diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-27 12:14:48 -0500 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-01-27 12:14:48 -0500 |
commit | e48d33193d94175f012c3ed606a1d1e574ed726a (patch) | |
tree | 6bc9c255dbb1dc34b23197bc2d501fc30c9606c1 /drivers | |
parent | bdc511f438f6ca40307e06edda00331e6ac0f813 (diff) |
i2c: Change prototypes of refcounting functions
Use more standard prototypes for i2c_use_client() and
i2c_release_client(). The former now returns a pointer to the client,
and the latter no longer returns anything. This matches what all other
subsystems do.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-core.c | 24 | ||||
-rw-r--r-- | drivers/media/video/vino.c | 22 |
2 files changed, 24 insertions, 22 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 9b9d808578b9..f75344ac4663 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -764,17 +764,33 @@ int i2c_detach_client(struct i2c_client *client) | |||
764 | } | 764 | } |
765 | EXPORT_SYMBOL(i2c_detach_client); | 765 | EXPORT_SYMBOL(i2c_detach_client); |
766 | 766 | ||
767 | int i2c_use_client(struct i2c_client *client) | 767 | /** |
768 | * i2c_use_client - increments the reference count of the i2c client structure | ||
769 | * @client: the client being referenced | ||
770 | * | ||
771 | * Each live reference to a client should be refcounted. The driver model does | ||
772 | * that automatically as part of driver binding, so that most drivers don't | ||
773 | * need to do this explicitly: they hold a reference until they're unbound | ||
774 | * from the device. | ||
775 | * | ||
776 | * A pointer to the client with the incremented reference counter is returned. | ||
777 | */ | ||
778 | struct i2c_client *i2c_use_client(struct i2c_client *client) | ||
768 | { | 779 | { |
769 | get_device(&client->dev); | 780 | get_device(&client->dev); |
770 | return 0; | 781 | return client; |
771 | } | 782 | } |
772 | EXPORT_SYMBOL(i2c_use_client); | 783 | EXPORT_SYMBOL(i2c_use_client); |
773 | 784 | ||
774 | int i2c_release_client(struct i2c_client *client) | 785 | /** |
786 | * i2c_release_client - release a use of the i2c client structure | ||
787 | * @client: the client being no longer referenced | ||
788 | * | ||
789 | * Must be called when a user of a client is finished with it. | ||
790 | */ | ||
791 | void i2c_release_client(struct i2c_client *client) | ||
775 | { | 792 | { |
776 | put_device(&client->dev); | 793 | put_device(&client->dev); |
777 | return 0; | ||
778 | } | 794 | } |
779 | EXPORT_SYMBOL(i2c_release_client); | 795 | EXPORT_SYMBOL(i2c_release_client); |
780 | 796 | ||
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 9a03dc82c6ca..5bb75294b5aa 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -2589,11 +2589,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
2589 | /* First try D1 and then SAA7191 */ | 2589 | /* First try D1 and then SAA7191 */ |
2590 | if (vino_drvdata->camera.driver | 2590 | if (vino_drvdata->camera.driver |
2591 | && (vino_drvdata->camera.owner == VINO_NO_CHANNEL)) { | 2591 | && (vino_drvdata->camera.owner == VINO_NO_CHANNEL)) { |
2592 | if (i2c_use_client(vino_drvdata->camera.driver)) { | 2592 | i2c_use_client(vino_drvdata->camera.driver); |
2593 | ret = -ENODEV; | ||
2594 | goto out; | ||
2595 | } | ||
2596 | |||
2597 | vino_drvdata->camera.owner = vcs->channel; | 2593 | vino_drvdata->camera.owner = vcs->channel; |
2598 | vcs->input = VINO_INPUT_D1; | 2594 | vcs->input = VINO_INPUT_D1; |
2599 | vcs->data_norm = VINO_DATA_NORM_D1; | 2595 | vcs->data_norm = VINO_DATA_NORM_D1; |
@@ -2602,11 +2598,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
2602 | int input, data_norm; | 2598 | int input, data_norm; |
2603 | int saa7191_input; | 2599 | int saa7191_input; |
2604 | 2600 | ||
2605 | if (i2c_use_client(vino_drvdata->decoder.driver)) { | 2601 | i2c_use_client(vino_drvdata->decoder.driver); |
2606 | ret = -ENODEV; | ||
2607 | goto out; | ||
2608 | } | ||
2609 | |||
2610 | input = VINO_INPUT_COMPOSITE; | 2602 | input = VINO_INPUT_COMPOSITE; |
2611 | 2603 | ||
2612 | saa7191_input = vino_get_saa7191_input(input); | 2604 | saa7191_input = vino_get_saa7191_input(input); |
@@ -2688,10 +2680,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
2688 | } | 2680 | } |
2689 | 2681 | ||
2690 | if (vino_drvdata->decoder.owner == VINO_NO_CHANNEL) { | 2682 | if (vino_drvdata->decoder.owner == VINO_NO_CHANNEL) { |
2691 | if (i2c_use_client(vino_drvdata->decoder.driver)) { | 2683 | i2c_use_client(vino_drvdata->decoder.driver); |
2692 | ret = -ENODEV; | ||
2693 | goto out; | ||
2694 | } | ||
2695 | vino_drvdata->decoder.owner = vcs->channel; | 2684 | vino_drvdata->decoder.owner = vcs->channel; |
2696 | } | 2685 | } |
2697 | 2686 | ||
@@ -2759,10 +2748,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
2759 | } | 2748 | } |
2760 | 2749 | ||
2761 | if (vino_drvdata->camera.owner == VINO_NO_CHANNEL) { | 2750 | if (vino_drvdata->camera.owner == VINO_NO_CHANNEL) { |
2762 | if (i2c_use_client(vino_drvdata->camera.driver)) { | 2751 | i2c_use_client(vino_drvdata->camera.driver); |
2763 | ret = -ENODEV; | ||
2764 | goto out; | ||
2765 | } | ||
2766 | vino_drvdata->camera.owner = vcs->channel; | 2752 | vino_drvdata->camera.owner = vcs->channel; |
2767 | } | 2753 | } |
2768 | 2754 | ||