diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-13 14:52:01 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-13 14:52:01 -0300 |
commit | 791ffeb7445afcd84028999dbf26c243d918bd77 (patch) | |
tree | 12573b5490254ef03616c13148e962a45356a475 /linux/drivers/media/video/et61x251/et61x251.h | |
parent | 86beca113bbe666cd0630a4ad8d45e6e49b5cc8b (diff) | |
download | mediapointer-dvb-s2-791ffeb7445afcd84028999dbf26c243d918bd77.tar.gz mediapointer-dvb-s2-791ffeb7445afcd84028999dbf26c243d918bd77.tar.bz2 |
ET61x251 driver updates
From: Luca Risolia <luca.risolia@studio.unibo.it>
- Make the driver depend on V4L2 only (KConfig)
- Better and safe locking mechanism of the device structure on open(),
close() and disconnect()
- Use kref for handling device deallocation
- Generic cleanups
Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/et61x251/et61x251.h')
-rw-r--r-- | linux/drivers/media/video/et61x251/et61x251.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/linux/drivers/media/video/et61x251/et61x251.h b/linux/drivers/media/video/et61x251/et61x251.h index 597f2aa76..d22fbd34a 100644 --- a/linux/drivers/media/video/et61x251/et61x251.h +++ b/linux/drivers/media/video/et61x251/et61x251.h @@ -39,6 +39,7 @@ #endif #include <linux/stddef.h> #include <linux/string.h> +#include <linux/kref.h> #include "et61x251_sensor.h" @@ -137,7 +138,7 @@ struct et61x251_module_param { }; static DEFINE_MUTEX(et61x251_sysfs_lock); -static DECLARE_RWSEM(et61x251_disconnect); +static DECLARE_RWSEM(et61x251_dev_lock); struct et61x251_device { struct video_device* v4ldev; @@ -161,16 +162,18 @@ struct et61x251_device { struct et61x251_sysfs_attr sysfs; struct et61x251_module_param module_param; + struct kref kref; enum et61x251_dev_state state; u8 users; + struct completion probe; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) - struct mutex dev_mutex, fileop_mutex; + struct mutex open_mutex, fileop_mutex; #else - struct semaphore dev_mutex, fileop_mutex; + struct semaphore open_mutex, fileop_mutex; #endif spinlock_t queue_lock; - wait_queue_head_t open, wait_frame, wait_stream; + wait_queue_head_t wait_open, wait_frame, wait_stream; }; /*****************************************************************************/ @@ -184,7 +187,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id) void et61x251_attach_sensor(struct et61x251_device* cam, - struct et61x251_sensor* sensor) + const struct et61x251_sensor* sensor) { memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); } @@ -202,8 +205,8 @@ do { \ else if ((level) == 2) \ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ else if ((level) >= 3) \ - dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ + dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", \ + __FILE__, __FUNCTION__, __LINE__ , ## args); \ } \ } while (0) # define KDBG(level, fmt, args...) \ @@ -212,8 +215,8 @@ do { \ if ((level) == 1 || (level) == 2) \ pr_info("et61x251: " fmt "\n", ## args); \ else if ((level) == 3) \ - pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ - __LINE__ , ## args); \ + pr_debug("sn9c102: [%s:%s:%d] " fmt "\n", __FILE__, \ + __FUNCTION__, __LINE__ , ## args); \ } \ } while (0) # define V4LDBG(level, name, cmd) \ @@ -229,8 +232,8 @@ do { \ #undef PDBG #define PDBG(fmt, args...) \ -dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args) +dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __FUNCTION__, \ + __LINE__ , ## args) #undef PDBGG #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |