diff options
Diffstat (limited to 'linux/drivers/media/common/saa7146_i2c.c')
-rw-r--r-- | linux/drivers/media/common/saa7146_i2c.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/linux/drivers/media/common/saa7146_i2c.c b/linux/drivers/media/common/saa7146_i2c.c index 33f750799..a1dedcae8 100644 --- a/linux/drivers/media/common/saa7146_i2c.c +++ b/linux/drivers/media/common/saa7146_i2c.c @@ -1,9 +1,5 @@ #include <media/saa7146_vv.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) - #define KBUILD_MODNAME saa7146 -#endif - /* helper function */ static void my_wait(struct saa7146_dev *dev, long ms) @@ -380,9 +376,11 @@ out: static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg msg[], int num) { - struct saa7146_dev* dev = (struct saa7146_dev*)adapter->data; - + struct saa7146_dev* dev = i2c_get_adapdata(adapter); + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) DEB_I2C(("adapter: '%s'.\n", adapter->name)); +#endif /* use helper function to transfer data */ return saa7146_i2c_transfer(dev, msg, num, adapter->retries); @@ -412,8 +410,13 @@ int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c if( NULL != i2c_adapter ) { memset(i2c_adapter,0,sizeof(struct i2c_adapter)); strcpy(i2c_adapter->name, dev->name); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) i2c_adapter->data = dev; i2c_adapter->algo = &saa7146_algo; +#else + strcpy(i2c_adapter->dev.name, dev->name); + i2c_set_adapdata(i2c_adapter,dev); +#endif i2c_adapter->algo_data = NULL; i2c_adapter->id = I2C_ALGO_SAA7146; i2c_adapter->timeout = SAA7146_I2C_TIMEOUT; |