aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/et61x251/et61x251.h
diff options
context:
space:
mode:
authorLuca Risolia <luca.risolia@studio.unibo.it>2007-06-13 13:52:01 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:24:08 -0400
commit3b2ae0be9e246974db65a5bf4ccd2de328f3dede (patch)
tree214b1f770ef032dd371d4fa1791c808c021d4104 /drivers/media/video/et61x251/et61x251.h
parent3770be34199ace8c497ce454cebd7d63347dc4c3 (diff)
V4L/DVB (5766): ET61x251 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/et61x251/et61x251.h')
-rw-r--r--drivers/media/video/et61x251/et61x251.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/media/video/et61x251/et61x251.h b/drivers/media/video/et61x251/et61x251.h
index 262f98e12409..02c741d8f85a 100644
--- a/drivers/media/video/et61x251/et61x251.h
+++ b/drivers/media/video/et61x251/et61x251.h
@@ -36,6 +36,7 @@
36#include <linux/mutex.h> 36#include <linux/mutex.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 "et61x251_sensor.h" 41#include "et61x251_sensor.h"
41 42
@@ -134,7 +135,7 @@ struct et61x251_module_param {
134}; 135};
135 136
136static DEFINE_MUTEX(et61x251_sysfs_lock); 137static DEFINE_MUTEX(et61x251_sysfs_lock);
137static DECLARE_RWSEM(et61x251_disconnect); 138static DECLARE_RWSEM(et61x251_dev_lock);
138 139
139struct et61x251_device { 140struct et61x251_device {
140 struct video_device* v4ldev; 141 struct video_device* v4ldev;
@@ -158,12 +159,14 @@ struct et61x251_device {
158 struct et61x251_sysfs_attr sysfs; 159 struct et61x251_sysfs_attr sysfs;
159 struct et61x251_module_param module_param; 160 struct et61x251_module_param module_param;
160 161
162 struct kref kref;
161 enum et61x251_dev_state state; 163 enum et61x251_dev_state state;
162 u8 users; 164 u8 users;
163 165
164 struct mutex dev_mutex, fileop_mutex; 166 struct completion probe;
167 struct mutex open_mutex, fileop_mutex;
165 spinlock_t queue_lock; 168 spinlock_t queue_lock;
166 wait_queue_head_t open, wait_frame, wait_stream; 169 wait_queue_head_t wait_open, wait_frame, wait_stream;
167}; 170};
168 171
169/*****************************************************************************/ 172/*****************************************************************************/
@@ -177,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id)
177 180
178void 181void
179et61x251_attach_sensor(struct et61x251_device* cam, 182et61x251_attach_sensor(struct et61x251_device* cam,
180 struct et61x251_sensor* sensor) 183 const struct et61x251_sensor* sensor)
181{ 184{
182 memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); 185 memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor));
183} 186}
@@ -195,8 +198,8 @@ do { \
195 else if ((level) == 2) \ 198 else if ((level) == 2) \
196 dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ 199 dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
197 else if ((level) >= 3) \ 200 else if ((level) >= 3) \
198 dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ 201 dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", \
199 __FUNCTION__, __LINE__ , ## args); \ 202 __FILE__, __FUNCTION__, __LINE__ , ## args); \
200 } \ 203 } \
201} while (0) 204} while (0)
202# define KDBG(level, fmt, args...) \ 205# define KDBG(level, fmt, args...) \
@@ -205,8 +208,8 @@ do { \
205 if ((level) == 1 || (level) == 2) \ 208 if ((level) == 1 || (level) == 2) \
206 pr_info("et61x251: " fmt "\n", ## args); \ 209 pr_info("et61x251: " fmt "\n", ## args); \
207 else if ((level) == 3) \ 210 else if ((level) == 3) \
208 pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ 211 pr_debug("sn9c102: [%s:%s:%d] " fmt "\n", __FILE__, \
209 __LINE__ , ## args); \ 212 __FUNCTION__, __LINE__ , ## args); \
210 } \ 213 } \
211} while (0) 214} while (0)
212# define V4LDBG(level, name, cmd) \ 215# define V4LDBG(level, name, cmd) \
@@ -222,8 +225,8 @@ do { \
222 225
223#undef PDBG 226#undef PDBG
224#define PDBG(fmt, args...) \ 227#define PDBG(fmt, args...) \
225dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ 228dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __FUNCTION__, \
226 __FUNCTION__, __LINE__ , ## args) 229 __LINE__ , ## args)
227 230
228#undef PDBGG 231#undef PDBGG
229#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ 232#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */