summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/marvell-ccic
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2011-06-11 14:46:48 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 17:53:01 -0300
commit595a93a47a3b7dc1be84160fbd73b1406074f411 (patch)
treea39b1ced0360d377fe7f4d167a2116e9b87cde88 /drivers/media/video/marvell-ccic
parent1c68f889c3287bd9beedd23164804e7e09c6566b (diff)
downloadtalos-obmc-linux-595a93a47a3b7dc1be84160fbd73b1406074f411.tar.gz
talos-obmc-linux-595a93a47a3b7dc1be84160fbd73b1406074f411.zip
[media] marvell-cam: Allocate the i2c adapter in the platform driver
The upcoming mmp-camera driver will need an i2c_adapter structure allocated externally, so change the core adapter to a pointer and require the platform code to fill it in. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/marvell-ccic')
-rw-r--r--drivers/media/video/marvell-ccic/cafe-driver.c9
-rw-r--r--drivers/media/video/marvell-ccic/mcam-core.c2
-rw-r--r--drivers/media/video/marvell-ccic/mcam-core.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c
index 3dbc7e55499d..6a29cc1c45a5 100644
--- a/drivers/media/video/marvell-ccic/cafe-driver.c
+++ b/drivers/media/video/marvell-ccic/cafe-driver.c
@@ -334,9 +334,13 @@ static struct i2c_algorithm cafe_smbus_algo = {
static int cafe_smbus_setup(struct cafe_camera *cam)
{
- struct i2c_adapter *adap = &cam->mcam.i2c_adapter;
+ struct i2c_adapter *adap;
int ret;
+ adap = kzalloc(sizeof(*adap), GFP_KERNEL);
+ if (adap == NULL)
+ return -ENOMEM;
+ cam->mcam.i2c_adapter = adap;
cafe_smbus_enable_irq(cam);
adap->owner = THIS_MODULE;
adap->algo = &cafe_smbus_algo;
@@ -351,7 +355,8 @@ static int cafe_smbus_setup(struct cafe_camera *cam)
static void cafe_smbus_shutdown(struct cafe_camera *cam)
{
- i2c_del_adapter(&cam->mcam.i2c_adapter);
+ i2c_del_adapter(cam->mcam.i2c_adapter);
+ kfree(cam->mcam.i2c_adapter);
}
diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c
index d5f18a300094..014b70b5a9b8 100644
--- a/drivers/media/video/marvell-ccic/mcam-core.c
+++ b/drivers/media/video/marvell-ccic/mcam-core.c
@@ -1581,7 +1581,7 @@ int mccic_register(struct mcam_camera *cam)
sensor_cfg.use_smbus = cam->use_smbus;
cam->sensor_addr = ov7670_info.addr;
cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev,
- &cam->i2c_adapter, &ov7670_info, NULL);
+ cam->i2c_adapter, &ov7670_info, NULL);
if (cam->sensor == NULL) {
ret = -ENODEV;
goto out_unregister;
diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h
index e8a7de05100b..5effa8203412 100644
--- a/drivers/media/video/marvell-ccic/mcam-core.h
+++ b/drivers/media/video/marvell-ccic/mcam-core.h
@@ -37,7 +37,7 @@ struct mcam_camera {
* These fields should be set by the platform code prior to
* calling mcam_register().
*/
- struct i2c_adapter i2c_adapter;
+ struct i2c_adapter *i2c_adapter;
unsigned char __iomem *regs;
spinlock_t dev_lock;
struct device *dev; /* For messages, dma alloc */
OpenPOWER on IntegriCloud