summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-04-01 03:57:53 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 21:44:24 -0300
commite6574f2fbecdb8af807169d345c10131ae060a88 (patch)
tree9923d1065397b9796a476cac238bacbdf1d820d1 /drivers/media/video/v4l2-common.c
parent868f985c2fb85b5f32785bb55a349d180a30f3d3 (diff)
downloadkernel-crypto-e6574f2fbecdb8af807169d345c10131ae060a88.tar.gz
kernel-crypto-e6574f2fbecdb8af807169d345c10131ae060a88.tar.xz
kernel-crypto-e6574f2fbecdb8af807169d345c10131ae060a88.zip
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.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 270833b1b38..f576ef66b80 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);
-/* Load an i2c sub-device. It assumes that i2c_get_adapdata(adapter)
- returns the v4l2_device and that i2c_get_clientdata(client)
- returns the v4l2_subdev. */
-struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter,
+/* Load an i2c sub-device. */
+struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
+ struct i2c_adapter *adapter,
const char *module_name, const char *client_type, u8 addr)
{
- struct v4l2_device *dev = i2c_get_adapdata(adapter);
struct v4l2_subdev *sd = NULL;
struct i2c_client *client;
struct i2c_board_info info;
- BUG_ON(!dev);
+ BUG_ON(!v4l2_dev);
if (module_name)
request_module(module_name);
@@ -798,7 +796,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter,
/* Register with the v4l2_device which increases the module's
use count as well. */
- if (v4l2_device_register_subdev(dev, sd))
+ if (v4l2_device_register_subdev(v4l2_dev, sd))
sd = NULL;
/* Decrease the module use count to match the first try_module_get. */
module_put(client->driver->driver.owner);
@@ -812,19 +810,17 @@ error:
}
EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev);
-/* Probe and load an i2c sub-device. It assumes that i2c_get_adapdata(adapter)
- returns the v4l2_device and that i2c_get_clientdata(client)
- returns the v4l2_subdev. */
-struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter,
+/* Probe and load an i2c sub-device. */
+struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev,
+ struct i2c_adapter *adapter,
const char *module_name, const char *client_type,
const unsigned short *addrs)
{
- struct v4l2_device *dev = i2c_get_adapdata(adapter);
struct v4l2_subdev *sd = NULL;
struct i2c_client *client = NULL;
struct i2c_board_info info;
- BUG_ON(!dev);
+ BUG_ON(!v4l2_dev);
if (module_name)
request_module(module_name);
@@ -850,7 +846,7 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter,
/* Register with the v4l2_device which increases the module's
use count as well. */
- if (v4l2_device_register_subdev(dev, sd))
+ if (v4l2_device_register_subdev(v4l2_dev, sd))
sd = NULL;
/* Decrease the module use count to match the first try_module_get. */
module_put(client->driver->driver.owner);