diff options
Diffstat (limited to 'linux/drivers/media/video/msp3400-driver.c')
-rw-r--r-- | linux/drivers/media/video/msp3400-driver.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index e91267516..62b2d4a10 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -45,19 +45,24 @@ #include <linux/errno.h> #include <linux/slab.h> #include <linux/i2c.h> -#include "compat.h" -#include <linux/videodev.h> #include <linux/init.h> #include <linux/smp_lock.h> +#include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #include <linux/kthread.h> #include <linux/suspend.h> +#endif #include <asm/semaphore.h> #include <asm/pgtable.h> +#include <linux/videodev.h> #include <media/audiochip.h> #include <media/id.h> #include "msp3400.h" -#include "compat.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#include <media/i2c-compat.h> +#endif + #define OPMODE_AUTO -1 #define OPMODE_MANUAL 0 @@ -762,7 +767,7 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout) #endif } } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) if (current->flags & PF_FREEZE) { refrigerator (PF_FREEZE); } @@ -1459,25 +1464,31 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) static int msp_suspend(struct device * dev, pm_message_t state, u32 level); -#else +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) static int msp_suspend(struct device * dev, u32 state, u32 level); #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) static int msp_resume(struct device * dev, u32 level); +#endif static void msp_wake_thread(struct i2c_client *client); static struct i2c_driver driver = { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54) .owner = THIS_MODULE, +#endif .name = "i2c msp3400 driver", .id = I2C_DRIVERID_MSP3400, .flags = I2C_DF_NOTIFY, .attach_adapter = msp_probe, .detach_client = msp_detach, .command = msp_command, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54) .driver = { .suspend = msp_suspend, .resume = msp_resume, }, +#endif }; static struct i2c_client client_template = @@ -1618,9 +1629,13 @@ static int msp_detach(struct i2c_client *client) static int msp_probe(struct i2c_adapter *adap) { +#ifdef I2C_CLASS_TV_ANALOG if (adap->class & I2C_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, msp_attach); return 0; +#else + return i2c_probe(adap, &addr_data, msp_attach); +#endif } static void msp_wake_thread(struct i2c_client *client) @@ -1956,9 +1971,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) static int msp_suspend(struct device * dev, pm_message_t state, u32 level) -#else +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) static int msp_suspend(struct device * dev, u32 state, u32 level) #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) { struct i2c_client *c = container_of(dev, struct i2c_client, dev); @@ -1975,7 +1991,7 @@ static int msp_resume(struct device * dev, u32 level) msp_wake_thread(c); return 0; } - +#endif /* LINUX_VERSION_CODE */ /* ----------------------------------------------------------------------- */ static int __init msp3400_init_module(void) |