diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-04-01 02:57:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:24 -0400 |
commit | e6574f2fbecdb8af807169d345c10131ae060a88 (patch) | |
tree | 9923d1065397b9796a476cac238bacbdf1d820d1 /drivers/media/video/v4l2-common.c | |
parent | 868f985c2fb85b5f32785bb55a349d180a30f3d3 (diff) |
V4L/DVB (11373): v4l2-common: add explicit v4l2_device pointer as first arg to new_(probed)_subdev
The functions v4l2_i2c_new_subdev and v4l2_i2c_new_probed_subdev relied on
i2c_get_adapdata to return the v4l2_device. However, this is not always
possible on embedded platforms. So modify the API to pass the v4l2_device
pointer explicitly.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r-- | drivers/media/video/v4l2-common.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 270833b1b38f..f576ef66b807 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -760,18 +760,16 @@ EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); | |||
760 | 760 | ||
761 | 761 | ||
762 | 762 | ||
763 | /* Load an i2c sub-device. It assumes that i2c_get_adapdata(adapter) | 763 | /* Load an i2c sub-device. */ |
764 | returns the v4l2_device and that i2c_get_clientdata(client) | 764 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, |
765 | returns the v4l2_subdev. */ | 765 | struct i2c_adapter *adapter, |
766 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, | ||
767 | const char *module_name, const char *client_type, u8 addr) | 766 | const char *module_name, const char *client_type, u8 addr) |
768 | { | 767 | { |
769 | struct v4l2_device *dev = i2c_get_adapdata(adapter); | ||
770 | struct v4l2_subdev *sd = NULL; | 768 | struct v4l2_subdev *sd = NULL; |
771 | struct i2c_client *client; | 769 | struct i2c_client *client; |
772 | struct i2c_board_info info; | 770 | struct i2c_board_info info; |
773 | 771 | ||
774 | BUG_ON(!dev); | 772 | BUG_ON(!v4l2_dev); |
775 | 773 | ||
776 | if (module_name) | 774 | if (module_name) |
777 | request_module(module_name); | 775 | request_module(module_name); |
@@ -798,7 +796,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, | |||
798 | 796 | ||
799 | /* Register with the v4l2_device which increases the module's | 797 | /* Register with the v4l2_device which increases the module's |
800 | use count as well. */ | 798 | use count as well. */ |
801 | if (v4l2_device_register_subdev(dev, sd)) | 799 | if (v4l2_device_register_subdev(v4l2_dev, sd)) |
802 | sd = NULL; | 800 | sd = NULL; |
803 | /* Decrease the module use count to match the first try_module_get. */ | 801 | /* Decrease the module use count to match the first try_module_get. */ |
804 | module_put(client->driver->driver.owner); | 802 | module_put(client->driver->driver.owner); |
@@ -812,19 +810,17 @@ error: | |||
812 | } | 810 | } |
813 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); | 811 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); |
814 | 812 | ||
815 | /* Probe and load an i2c sub-device. It assumes that i2c_get_adapdata(adapter) | 813 | /* Probe and load an i2c sub-device. */ |
816 | returns the v4l2_device and that i2c_get_clientdata(client) | 814 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev, |
817 | returns the v4l2_subdev. */ | 815 | struct i2c_adapter *adapter, |
818 | struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, | ||
819 | const char *module_name, const char *client_type, | 816 | const char *module_name, const char *client_type, |
820 | const unsigned short *addrs) | 817 | const unsigned short *addrs) |
821 | { | 818 | { |
822 | struct v4l2_device *dev = i2c_get_adapdata(adapter); | ||
823 | struct v4l2_subdev *sd = NULL; | 819 | struct v4l2_subdev *sd = NULL; |
824 | struct i2c_client *client = NULL; | 820 | struct i2c_client *client = NULL; |
825 | struct i2c_board_info info; | 821 | struct i2c_board_info info; |
826 | 822 | ||
827 | BUG_ON(!dev); | 823 | BUG_ON(!v4l2_dev); |
828 | 824 | ||
829 | if (module_name) | 825 | if (module_name) |
830 | request_module(module_name); | 826 | request_module(module_name); |
@@ -850,7 +846,7 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, | |||
850 | 846 | ||
851 | /* Register with the v4l2_device which increases the module's | 847 | /* Register with the v4l2_device which increases the module's |
852 | use count as well. */ | 848 | use count as well. */ |
853 | if (v4l2_device_register_subdev(dev, sd)) | 849 | if (v4l2_device_register_subdev(v4l2_dev, sd)) |
854 | sd = NULL; | 850 | sd = NULL; |
855 | /* Decrease the module use count to match the first try_module_get. */ | 851 | /* Decrease the module use count to match the first try_module_get. */ |
856 | module_put(client->driver->driver.owner); | 852 | module_put(client->driver->driver.owner); |