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;
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);
}
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;
* 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 */