diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-13 15:11:15 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-13 15:11:15 -0300 |
commit | 35133745a136eb4cdf08bd6095e5ab2c0d7d6c07 (patch) | |
tree | 38f7dfcc17baa1e2f8faffe693e025d54034973b /linux/drivers/media/video/zc0301/zc0301.h | |
parent | 791ffeb7445afcd84028999dbf26c243d918bd77 (diff) | |
download | mediapointer-dvb-s2-35133745a136eb4cdf08bd6095e5ab2c0d7d6c07.tar.gz mediapointer-dvb-s2-35133745a136eb4cdf08bd6095e5ab2c0d7d6c07.tar.bz2 |
ZC0301 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/zc0301/zc0301.h')
-rw-r--r-- | linux/drivers/media/video/zc0301/zc0301.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/linux/drivers/media/video/zc0301/zc0301.h b/linux/drivers/media/video/zc0301/zc0301.h index c720ace98..6a944c658 100644 --- a/linux/drivers/media/video/zc0301/zc0301.h +++ b/linux/drivers/media/video/zc0301/zc0301.h @@ -39,6 +39,7 @@ #include <linux/rwsem.h> #include <linux/stddef.h> #include <linux/string.h> +#include <linux/kref.h> #include "zc0301_sensor.h" @@ -101,7 +102,7 @@ struct zc0301_module_param { u16 frame_timeout; }; -static DECLARE_RWSEM(zc0301_disconnect); +static DECLARE_RWSEM(zc0301_dev_lock); struct zc0301_device { struct video_device* v4ldev; @@ -124,16 +125,18 @@ struct zc0301_device { struct zc0301_module_param module_param; + struct kref kref; enum zc0301_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; }; /*****************************************************************************/ @@ -163,8 +166,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...) \ @@ -173,8 +176,8 @@ do { \ if ((level) == 1 || (level) == 2) \ pr_info("zc0301: " fmt "\n", ## args); \ else if ((level) == 3) \ - pr_debug("zc0301: [%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) \ @@ -190,8 +193,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 */ |