diff options
author | Luca Risolia <luca.risolia@studio.unibo.it> | 2007-06-13 14:11:15 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:24:09 -0400 |
commit | 4052fcc7ba32ebd54cc907991cb855d909ce9d1c (patch) | |
tree | 2f1049c2f26d1067fa4e15d74392013c2c091505 /drivers/media/video/zc0301/zc0301.h | |
parent | 3b2ae0be9e246974db65a5bf4ccd2de328f3dede (diff) |
V4L/DVB (5767): ZC0301 driver updates
- 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 'drivers/media/video/zc0301/zc0301.h')
-rw-r--r-- | drivers/media/video/zc0301/zc0301.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/media/video/zc0301/zc0301.h b/drivers/media/video/zc0301/zc0301.h index 710f12eb9126..a2de50efa31a 100644 --- a/drivers/media/video/zc0301/zc0301.h +++ b/drivers/media/video/zc0301/zc0301.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/rwsem.h> | 36 | #include <linux/rwsem.h> |
37 | #include <linux/stddef.h> | 37 | #include <linux/stddef.h> |
38 | #include <linux/string.h> | 38 | #include <linux/string.h> |
39 | #include <linux/kref.h> | ||
39 | 40 | ||
40 | #include "zc0301_sensor.h" | 41 | #include "zc0301_sensor.h" |
41 | 42 | ||
@@ -98,7 +99,7 @@ struct zc0301_module_param { | |||
98 | u16 frame_timeout; | 99 | u16 frame_timeout; |
99 | }; | 100 | }; |
100 | 101 | ||
101 | static DECLARE_RWSEM(zc0301_disconnect); | 102 | static DECLARE_RWSEM(zc0301_dev_lock); |
102 | 103 | ||
103 | struct zc0301_device { | 104 | struct zc0301_device { |
104 | struct video_device* v4ldev; | 105 | struct video_device* v4ldev; |
@@ -121,12 +122,14 @@ struct zc0301_device { | |||
121 | 122 | ||
122 | struct zc0301_module_param module_param; | 123 | struct zc0301_module_param module_param; |
123 | 124 | ||
125 | struct kref kref; | ||
124 | enum zc0301_dev_state state; | 126 | enum zc0301_dev_state state; |
125 | u8 users; | 127 | u8 users; |
126 | 128 | ||
127 | struct mutex dev_mutex, fileop_mutex; | 129 | struct completion probe; |
130 | struct mutex open_mutex, fileop_mutex; | ||
128 | spinlock_t queue_lock; | 131 | spinlock_t queue_lock; |
129 | wait_queue_head_t open, wait_frame, wait_stream; | 132 | wait_queue_head_t wait_open, wait_frame, wait_stream; |
130 | }; | 133 | }; |
131 | 134 | ||
132 | /*****************************************************************************/ | 135 | /*****************************************************************************/ |
@@ -156,8 +159,8 @@ do { \ | |||
156 | else if ((level) == 2) \ | 159 | else if ((level) == 2) \ |
157 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 160 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
158 | else if ((level) >= 3) \ | 161 | else if ((level) >= 3) \ |
159 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 162 | dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", \ |
160 | __FUNCTION__, __LINE__ , ## args); \ | 163 | __FILE__, __FUNCTION__, __LINE__ , ## args); \ |
161 | } \ | 164 | } \ |
162 | } while (0) | 165 | } while (0) |
163 | # define KDBG(level, fmt, args...) \ | 166 | # define KDBG(level, fmt, args...) \ |
@@ -166,8 +169,8 @@ do { \ | |||
166 | if ((level) == 1 || (level) == 2) \ | 169 | if ((level) == 1 || (level) == 2) \ |
167 | pr_info("zc0301: " fmt "\n", ## args); \ | 170 | pr_info("zc0301: " fmt "\n", ## args); \ |
168 | else if ((level) == 3) \ | 171 | else if ((level) == 3) \ |
169 | pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ | 172 | pr_debug("sn9c102: [%s:%s:%d] " fmt "\n", __FILE__, \ |
170 | __LINE__ , ## args); \ | 173 | __FUNCTION__, __LINE__ , ## args); \ |
171 | } \ | 174 | } \ |
172 | } while (0) | 175 | } while (0) |
173 | # define V4LDBG(level, name, cmd) \ | 176 | # define V4LDBG(level, name, cmd) \ |
@@ -183,8 +186,8 @@ do { \ | |||
183 | 186 | ||
184 | #undef PDBG | 187 | #undef PDBG |
185 | #define PDBG(fmt, args...) \ | 188 | #define PDBG(fmt, args...) \ |
186 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 189 | dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __FUNCTION__, \ |
187 | __FUNCTION__, __LINE__ , ## args) | 190 | __LINE__ , ## args) |
188 | 191 | ||
189 | #undef PDBGG | 192 | #undef PDBGG |
190 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 193 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |