aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/et61x251.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 12:25:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 12:25:47 -0500
commit2bf2154c6bb5599e3ec3f73c34861a0b12aa839e (patch)
tree62691bd915e2e3c2e6648306d3fb893f7a1dc57e /drivers/usb/media/et61x251.h
parent08a4ecee986dd98e86090ff5faac4782b6765aed (diff)
parent71a8924bee63d891f6256d560e32416a458440b3 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (81 commits) [PATCH] USB: omninet: fix up debugging comments [PATCH] USB serial: add navman driver [PATCH] USB: Fix irda-usb use after use [PATCH] USB: rtl8150 small fix [PATCH] USB: ftdi_sio: add Icom ID1 USB product and vendor ids [PATCH] USB: cp2101: add new device IDs [PATCH] USB: fix check_ctrlrecip to allow control transfers in state ADDRESS [PATCH] USB: vicam.c: fix a NULL pointer dereference [PATCH] USB: ZC0301 driver bugfix [PATCH] USB: add support for Creativelabs Silvercrest USB keyboard [PATCH] USB: storage: new unusual_devs.h entry: Mitsumi 7in1 Card Reader [PATCH] USB: storage: unusual_devs.h entry 0420:0001 [PATCH] USB: storage: another unusual_devs.h entry [PATCH] USB: storage: sandisk unusual_devices entry [PATCH] USB: fix initdata issue in isp116x-hcd [PATCH] USB: usbcore: usb_set_configuration oops (NULL ptr dereference) [PATCH] USB: usbcore: Don't assume a USB configuration includes any interfaces [PATCH] USB: ub 03 drop stall clearing [PATCH] USB: ub 02 remove diag [PATCH] USB: ub 01 remove first_open ...
Diffstat (limited to 'drivers/usb/media/et61x251.h')
-rw-r--r--drivers/usb/media/et61x251.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/usb/media/et61x251.h b/drivers/usb/media/et61x251.h
index 652238f329f3..eee8afc9be72 100644
--- a/drivers/usb/media/et61x251.h
+++ b/drivers/usb/media/et61x251.h
@@ -33,7 +33,9 @@
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/param.h> 34#include <linux/param.h>
35#include <linux/rwsem.h> 35#include <linux/rwsem.h>
36#include <asm/semaphore.h> 36#include <linux/mutex.h>
37#include <linux/stddef.h>
38#include <linux/string.h>
37 39
38#include "et61x251_sensor.h" 40#include "et61x251_sensor.h"
39 41
@@ -51,6 +53,7 @@
51#define ET61X251_ALTERNATE_SETTING 13 53#define ET61X251_ALTERNATE_SETTING 13
52#define ET61X251_URB_TIMEOUT msecs_to_jiffies(2 * ET61X251_ISO_PACKETS) 54#define ET61X251_URB_TIMEOUT msecs_to_jiffies(2 * ET61X251_ISO_PACKETS)
53#define ET61X251_CTRL_TIMEOUT 100 55#define ET61X251_CTRL_TIMEOUT 100
56#define ET61X251_FRAME_TIMEOUT 2
54 57
55/*****************************************************************************/ 58/*****************************************************************************/
56 59
@@ -127,15 +130,16 @@ struct et61x251_sysfs_attr {
127 130
128struct et61x251_module_param { 131struct et61x251_module_param {
129 u8 force_munmap; 132 u8 force_munmap;
133 u16 frame_timeout;
130}; 134};
131 135
132static DECLARE_MUTEX(et61x251_sysfs_lock); 136static DEFINE_MUTEX(et61x251_sysfs_lock);
133static DECLARE_RWSEM(et61x251_disconnect); 137static DECLARE_RWSEM(et61x251_disconnect);
134 138
135struct et61x251_device { 139struct et61x251_device {
136 struct video_device* v4ldev; 140 struct video_device* v4ldev;
137 141
138 struct et61x251_sensor* sensor; 142 struct et61x251_sensor sensor;
139 143
140 struct usb_device* usbdev; 144 struct usb_device* usbdev;
141 struct urb* urb[ET61X251_URBS]; 145 struct urb* urb[ET61X251_URBS];
@@ -157,19 +161,28 @@ struct et61x251_device {
157 enum et61x251_dev_state state; 161 enum et61x251_dev_state state;
158 u8 users; 162 u8 users;
159 163
160 struct semaphore dev_sem, fileop_sem; 164 struct mutex dev_mutex, fileop_mutex;
161 spinlock_t queue_lock; 165 spinlock_t queue_lock;
162 wait_queue_head_t open, wait_frame, wait_stream; 166 wait_queue_head_t open, wait_frame, wait_stream;
163}; 167};
164 168
165/*****************************************************************************/ 169/*****************************************************************************/
166 170
171struct et61x251_device*
172et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id)
173{
174 if (usb_match_id(usb_ifnum_to_if(cam->usbdev, 0), id))
175 return cam;
176
177 return NULL;
178}
179
180
167void 181void
168et61x251_attach_sensor(struct et61x251_device* cam, 182et61x251_attach_sensor(struct et61x251_device* cam,
169 struct et61x251_sensor* sensor) 183 struct et61x251_sensor* sensor)
170{ 184{
171 cam->sensor = sensor; 185 memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor));
172 cam->sensor->usbdev = cam->usbdev;
173} 186}
174 187
175/*****************************************************************************/ 188/*****************************************************************************/
@@ -212,7 +225,8 @@ do { \
212 225
213#undef PDBG 226#undef PDBG
214#define PDBG(fmt, args...) \ 227#define PDBG(fmt, args...) \
215dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) 228dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
229 __FUNCTION__, __LINE__ , ## args)
216 230
217#undef PDBGG 231#undef PDBGG
218#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ 232#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */