#ifndef __OVCAM_COMPAT_H #define __OVCAM_COMPAT_H #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) # include #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 67) static inline void * i2c_get_clientdata(struct i2c_client *dev) { return dev->data; } static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) { dev->data = data; } static inline void * i2c_get_adapdata(struct i2c_adapter *dev) { return dev->data; } static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) { dev->data = data; } #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 67) #define I2C_DEVNAME(str) .name = str static inline char * i2c_clientname(struct i2c_client *c) { return c->name; } static inline char * i2c_adapname(struct i2c_adapter *a) { return a->name; } #else static inline char * i2c_adapname(struct i2c_adapter *a) { return a->name; } #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) static inline void * video_get_drvdata(struct video_device *vdev) { return vdev->priv; } static inline void video_set_drvdata(struct video_device *vdev, void *data) { vdev->priv = data; } static inline struct video_device *video_device_alloc(void) { struct video_device *vfd; vfd = kmalloc(sizeof(*vfd),GFP_KERNEL); if (NULL == vfd) return NULL; memset(vfd,0,sizeof(*vfd)); return vfd; } static inline void video_device_release(struct video_device *vfd) { kfree(vfd); } #endif #endif /* ! __OVCAM_COMPAT_H__ */