diff options
Diffstat (limited to 'linux/include/media/v4l2-i2c-drv-legacy.h')
-rw-r--r-- | linux/include/media/v4l2-i2c-drv-legacy.h | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/linux/include/media/v4l2-i2c-drv-legacy.h b/linux/include/media/v4l2-i2c-drv-legacy.h index 7494bdcc3..738f87454 100644 --- a/linux/include/media/v4l2-i2c-drv-legacy.h +++ b/linux/include/media/v4l2-i2c-drv-legacy.h @@ -30,10 +30,9 @@ struct v4l2_i2c_driver_data { int (*suspend)(struct i2c_client *client, pm_message_t state); int (*resume)(struct i2c_client *client); int (*legacy_probe)(struct i2c_adapter *adapter); -#ifdef I2C_CLASS_TV_ANALOG int legacy_class; -#else - int legacy_id; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + const struct i2c_device_id *id_table; #endif }; @@ -46,12 +45,7 @@ static struct i2c_client_address_data addr_data; static struct i2c_driver v4l2_i2c_driver_legacy; static char v4l2_i2c_drv_name_legacy[32]; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind) -#else -static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -#endif { return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver_legacy, v4l2_i2c_drv_name_legacy, v4l2_i2c_data.probe); @@ -64,11 +58,7 @@ static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter) return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy); return 0; } -#ifdef I2C_CLASS_TV_ANALOG if (adapter->class & v4l2_i2c_data.legacy_class) -#else - if (adapter->id == v4l2_i2c_data.legacy_id) -#endif return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy); return 0; } @@ -84,14 +74,9 @@ static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client) if (err) return err; kfree(client); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - MOD_DEC_USE_COUNT; -#endif return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20) static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state) @@ -127,19 +112,17 @@ static int v4l2_i2c_drv_resume_helper(struct device * dev, u32 level) #endif return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0; } -#endif /* ----------------------------------------------------------------------- */ /* i2c implementation */ static struct i2c_driver v4l2_i2c_driver_legacy = { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)) +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) .owner = THIS_MODULE, #endif #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) .flags = I2C_DF_NOTIFY, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) .driver = { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) .owner = THIS_MODULE, @@ -149,7 +132,6 @@ static struct i2c_driver v4l2_i2c_driver_legacy = { .resume = v4l2_i2c_drv_resume_helper, #endif }, -#endif .attach_adapter = v4l2_i2c_drv_probe_legacy, .detach_client = v4l2_i2c_drv_detach_legacy, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20) @@ -167,9 +149,7 @@ static struct i2c_driver v4l2_i2c_driver = { .resume = v4l2_i2c_drv_resume_helper, }; #endif - - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static int compat_legacy_probe(struct i2c_client *client) { return v4l2_i2c_data.probe(client, NULL); @@ -183,13 +163,8 @@ static int __init v4l2_i2c_drv_init(void) strlcpy(v4l2_i2c_drv_name_legacy, v4l2_i2c_data.name, sizeof(v4l2_i2c_drv_name_legacy)); strlcat(v4l2_i2c_drv_name_legacy, "'", sizeof(v4l2_i2c_drv_name_legacy)); -#ifdef I2C_CLASS_TV_ANALOG if (v4l2_i2c_data.legacy_class == 0) v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG; -#else - if (v4l2_i2c_data.legacy_id == 0) - v4l2_i2c_data.legacy_id = I2C_HW_B_BT848; -#endif #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) strlcpy(v4l2_i2c_driver_legacy.name, v4l2_i2c_drv_name_legacy, sizeof(v4l2_i2c_driver_legacy.name)); @@ -212,6 +187,9 @@ static int __init v4l2_i2c_drv_init(void) v4l2_i2c_driver.probe = compat_legacy_probe; #endif v4l2_i2c_driver.remove = v4l2_i2c_data.remove; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table; +#endif err = i2c_add_driver(&v4l2_i2c_driver); if (err) i2c_del_driver(&v4l2_i2c_driver_legacy); |