diff options
author | Jonathan Corbet | 2011-06-11 19:46:48 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab | 2011-07-27 22:53:01 +0200 |
commit | 595a93a47a3b7dc1be84160fbd73b1406074f411 (patch) | |
tree | a39b1ced0360d377fe7f4d167a2116e9b87cde88 /drivers/media/video/marvell-ccic/cafe-driver.c | |
parent | [media] marvell-cam: Right-shift i2c slave ID's in the cafe driver (diff) | |
download | kernel-qcow2-linux-595a93a47a3b7dc1be84160fbd73b1406074f411.tar.gz kernel-qcow2-linux-595a93a47a3b7dc1be84160fbd73b1406074f411.tar.xz kernel-qcow2-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/cafe-driver.c')
-rw-r--r-- | drivers/media/video/marvell-ccic/cafe-driver.c | 9 |
1 files changed, 7 insertions, 2 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); } |