aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/et61x251
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-03-25 07:19:53 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-03-25 07:29:23 -0500
commitd56410e0a594150c5ca06319da7bc8901c4d455e (patch)
treef1462651ac1bcc5cec48219dbb422ac615231423 /drivers/media/video/et61x251
parent9f6933be665ce3b049c274c99810ac754edabf19 (diff)
V4L/DVB (3599b): Whitespace cleanups under drivers/media
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/et61x251')
-rw-r--r--drivers/media/video/et61x251/et61x251.h8
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c210
-rw-r--r--drivers/media/video/et61x251/et61x251_sensor.h20
-rw-r--r--drivers/media/video/et61x251/et61x251_tas5130d1b.c10
4 files changed, 124 insertions, 124 deletions
diff --git a/drivers/media/video/et61x251/et61x251.h b/drivers/media/video/et61x251/et61x251.h
index eee8afc9be72..2e5ca4032489 100644
--- a/drivers/media/video/et61x251/et61x251.h
+++ b/drivers/media/video/et61x251/et61x251.h
@@ -180,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id)
180 180
181void 181void
182et61x251_attach_sensor(struct et61x251_device* cam, 182et61x251_attach_sensor(struct et61x251_device* cam,
183 struct et61x251_sensor* sensor) 183 struct et61x251_sensor* sensor)
184{ 184{
185 memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); 185 memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor));
186} 186}
@@ -199,7 +199,7 @@ do { \
199 dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ 199 dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
200 else if ((level) >= 3) \ 200 else if ((level) >= 3) \
201 dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ 201 dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
202 __FUNCTION__, __LINE__ , ## args); \ 202 __FUNCTION__, __LINE__ , ## args); \
203 } \ 203 } \
204} while (0) 204} while (0)
205# define KDBG(level, fmt, args...) \ 205# define KDBG(level, fmt, args...) \
@@ -209,7 +209,7 @@ do { \
209 pr_info("et61x251: " fmt "\n", ## args); \ 209 pr_info("et61x251: " fmt "\n", ## args); \
210 else if ((level) == 3) \ 210 else if ((level) == 3) \
211 pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ 211 pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \
212 __LINE__ , ## args); \ 212 __LINE__ , ## args); \
213 } \ 213 } \
214} while (0) 214} while (0)
215# define V4LDBG(level, name, cmd) \ 215# define V4LDBG(level, name, cmd) \
@@ -226,7 +226,7 @@ do { \
226#undef PDBG 226#undef PDBG
227#define PDBG(fmt, args...) \ 227#define PDBG(fmt, args...) \
228dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ 228dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
229 __FUNCTION__, __LINE__ , ## args) 229 __FUNCTION__, __LINE__ , ## args)
230 230
231#undef PDBGG 231#undef PDBGG
232#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ 232#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 7cc01b828b3d..dfc9dd732c9d 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -44,7 +44,7 @@
44/*****************************************************************************/ 44/*****************************************************************************/
45 45
46#define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ 46#define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \
47 "PC Camera Controllers" 47 "PC Camera Controllers"
48#define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" 48#define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia"
49#define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" 49#define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
50#define ET61X251_MODULE_LICENSE "GPL" 50#define ET61X251_MODULE_LICENSE "GPL"
@@ -63,68 +63,68 @@ MODULE_LICENSE(ET61X251_MODULE_LICENSE);
63static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; 63static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1};
64module_param_array(video_nr, short, NULL, 0444); 64module_param_array(video_nr, short, NULL, 0444);
65MODULE_PARM_DESC(video_nr, 65MODULE_PARM_DESC(video_nr,
66 "\n<-1|n[,...]> Specify V4L2 minor mode number." 66 "\n<-1|n[,...]> Specify V4L2 minor mode number."
67 "\n -1 = use next available (default)" 67 "\n -1 = use next available (default)"
68 "\n n = use minor number n (integer >= 0)" 68 "\n n = use minor number n (integer >= 0)"
69 "\nYou can specify up to " 69 "\nYou can specify up to "
70 __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." 70 __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way."
71 "\nFor example:" 71 "\nFor example:"
72 "\nvideo_nr=-1,2,-1 would assign minor number 2 to" 72 "\nvideo_nr=-1,2,-1 would assign minor number 2 to"
73 "\nthe second registered camera and use auto for the first" 73 "\nthe second registered camera and use auto for the first"
74 "\none and for every other camera." 74 "\none and for every other camera."
75 "\n"); 75 "\n");
76 76
77static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = 77static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] =
78 ET61X251_FORCE_MUNMAP}; 78 ET61X251_FORCE_MUNMAP};
79module_param_array(force_munmap, bool, NULL, 0444); 79module_param_array(force_munmap, bool, NULL, 0444);
80MODULE_PARM_DESC(force_munmap, 80MODULE_PARM_DESC(force_munmap,
81 "\n<0|1[,...]> Force the application to unmap previously" 81 "\n<0|1[,...]> Force the application to unmap previously"
82 "\nmapped buffer memory before calling any VIDIOC_S_CROP or" 82 "\nmapped buffer memory before calling any VIDIOC_S_CROP or"
83 "\nVIDIOC_S_FMT ioctl's. Not all the applications support" 83 "\nVIDIOC_S_FMT ioctl's. Not all the applications support"
84 "\nthis feature. This parameter is specific for each" 84 "\nthis feature. This parameter is specific for each"
85 "\ndetected camera." 85 "\ndetected camera."
86 "\n 0 = do not force memory unmapping" 86 "\n 0 = do not force memory unmapping"
87 "\n 1 = force memory unmapping (save memory)" 87 "\n 1 = force memory unmapping (save memory)"
88 "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." 88 "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"."
89 "\n"); 89 "\n");
90 90
91static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] = 91static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] =
92 ET61X251_FRAME_TIMEOUT}; 92 ET61X251_FRAME_TIMEOUT};
93module_param_array(frame_timeout, uint, NULL, 0644); 93module_param_array(frame_timeout, uint, NULL, 0644);
94MODULE_PARM_DESC(frame_timeout, 94MODULE_PARM_DESC(frame_timeout,
95 "\n<n[,...]> Timeout for a video frame in seconds." 95 "\n<n[,...]> Timeout for a video frame in seconds."
96 "\nThis parameter is specific for each detected camera." 96 "\nThis parameter is specific for each detected camera."
97 "\nDefault value is " 97 "\nDefault value is "
98 __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." 98 __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"."
99 "\n"); 99 "\n");
100 100
101#ifdef ET61X251_DEBUG 101#ifdef ET61X251_DEBUG
102static unsigned short debug = ET61X251_DEBUG_LEVEL; 102static unsigned short debug = ET61X251_DEBUG_LEVEL;
103module_param(debug, ushort, 0644); 103module_param(debug, ushort, 0644);
104MODULE_PARM_DESC(debug, 104MODULE_PARM_DESC(debug,
105 "\n<n> Debugging information level, from 0 to 3:" 105 "\n<n> Debugging information level, from 0 to 3:"
106 "\n0 = none (use carefully)" 106 "\n0 = none (use carefully)"
107 "\n1 = critical errors" 107 "\n1 = critical errors"
108 "\n2 = significant informations" 108 "\n2 = significant informations"
109 "\n3 = more verbose messages" 109 "\n3 = more verbose messages"
110 "\nLevel 3 is useful for testing only, when only " 110 "\nLevel 3 is useful for testing only, when only "
111 "one device is used." 111 "one device is used."
112 "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." 112 "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"."
113 "\n"); 113 "\n");
114#endif 114#endif
115 115
116/*****************************************************************************/ 116/*****************************************************************************/
117 117
118static u32 118static u32
119et61x251_request_buffers(struct et61x251_device* cam, u32 count, 119et61x251_request_buffers(struct et61x251_device* cam, u32 count,
120 enum et61x251_io_method io) 120 enum et61x251_io_method io)
121{ 121{
122 struct v4l2_pix_format* p = &(cam->sensor.pix_format); 122 struct v4l2_pix_format* p = &(cam->sensor.pix_format);
123 struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); 123 struct v4l2_rect* r = &(cam->sensor.cropcap.bounds);
124 const size_t imagesize = cam->module_param.force_munmap || 124 const size_t imagesize = cam->module_param.force_munmap ||
125 io == IO_READ ? 125 io == IO_READ ?
126 (p->width * p->height * p->priv) / 8 : 126 (p->width * p->height * p->priv) / 8 :
127 (r->width * r->height * p->priv) / 8; 127 (r->width * r->height * p->priv) / 8;
128 void* buff = NULL; 128 void* buff = NULL;
129 u32 i; 129 u32 i;
130 130
@@ -216,7 +216,7 @@ int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index)
216 *buff = value; 216 *buff = value;
217 217
218 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 218 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
219 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); 219 0, index, buff, 1, ET61X251_CTRL_TIMEOUT);
220 if (res < 0) { 220 if (res < 0) {
221 DBG(3, "Failed to write a register (value 0x%02X, index " 221 DBG(3, "Failed to write a register (value 0x%02X, index "
222 "0x%02X, error %d)", value, index, res); 222 "0x%02X, error %d)", value, index, res);
@@ -234,7 +234,7 @@ int et61x251_read_reg(struct et61x251_device* cam, u16 index)
234 int res; 234 int res;
235 235
236 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, 236 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
237 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); 237 0, index, buff, 1, ET61X251_CTRL_TIMEOUT);
238 if (res < 0) 238 if (res < 0)
239 DBG(3, "Failed to read a register (index 0x%02X, error %d)", 239 DBG(3, "Failed to read a register (index 0x%02X, error %d)",
240 index, res); 240 index, res);
@@ -269,7 +269,7 @@ et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor)
269 269
270int 270int
271et61x251_i2c_try_read(struct et61x251_device* cam, 271et61x251_i2c_try_read(struct et61x251_device* cam,
272 struct et61x251_sensor* sensor, u8 address) 272 struct et61x251_sensor* sensor, u8 address)
273{ 273{
274 struct usb_device* udev = cam->usbdev; 274 struct usb_device* udev = cam->usbdev;
275 u8* data = cam->control_buffer; 275 u8* data = cam->control_buffer;
@@ -280,14 +280,14 @@ et61x251_i2c_try_read(struct et61x251_device* cam,
280 data[2] = cam->sensor.rsta | 0x10; 280 data[2] = cam->sensor.rsta | 0x10;
281 data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); 281 data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02);
282 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 282 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
283 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); 283 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT);
284 if (res < 0) 284 if (res < 0)
285 err += res; 285 err += res;
286 286
287 err += et61x251_i2c_wait(cam, sensor); 287 err += et61x251_i2c_wait(cam, sensor);
288 288
289 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, 289 res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1,
290 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); 290 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT);
291 if (res < 0) 291 if (res < 0)
292 err += res; 292 err += res;
293 293
@@ -302,7 +302,7 @@ et61x251_i2c_try_read(struct et61x251_device* cam,
302 302
303int 303int
304et61x251_i2c_try_write(struct et61x251_device* cam, 304et61x251_i2c_try_write(struct et61x251_device* cam,
305 struct et61x251_sensor* sensor, u8 address, u8 value) 305 struct et61x251_sensor* sensor, u8 address, u8 value)
306{ 306{
307 struct usb_device* udev = cam->usbdev; 307 struct usb_device* udev = cam->usbdev;
308 u8* data = cam->control_buffer; 308 u8* data = cam->control_buffer;
@@ -312,13 +312,13 @@ et61x251_i2c_try_write(struct et61x251_device* cam,
312 data[1] = cam->sensor.i2c_slave_id; 312 data[1] = cam->sensor.i2c_slave_id;
313 data[2] = cam->sensor.rsta | 0x12; 313 data[2] = cam->sensor.rsta | 0x12;
314 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 314 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
315 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); 315 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
316 if (res < 0) 316 if (res < 0)
317 err += res; 317 err += res;
318 318
319 data[0] = value; 319 data[0] = value;
320 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 320 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
321 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); 321 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
322 if (res < 0) 322 if (res < 0)
323 err += res; 323 err += res;
324 324
@@ -335,8 +335,8 @@ et61x251_i2c_try_write(struct et61x251_device* cam,
335 335
336int 336int
337et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, 337et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
338 u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, 338 u8 data3, u8 data4, u8 data5, u8 data6, u8 data7,
339 u8 data8, u8 address) 339 u8 data8, u8 address)
340{ 340{
341 struct usb_device* udev = cam->usbdev; 341 struct usb_device* udev = cam->usbdev;
342 u8* data = cam->control_buffer; 342 u8* data = cam->control_buffer;
@@ -350,7 +350,7 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
350 data[5] = data7; 350 data[5] = data7;
351 data[6] = data8; 351 data[6] = data8;
352 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 352 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
353 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); 353 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT);
354 if (res < 0) 354 if (res < 0)
355 err += res; 355 err += res;
356 356
@@ -358,14 +358,14 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2,
358 data[1] = cam->sensor.i2c_slave_id; 358 data[1] = cam->sensor.i2c_slave_id;
359 data[2] = cam->sensor.rsta | 0x02 | (n << 4); 359 data[2] = cam->sensor.rsta | 0x02 | (n << 4);
360 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 360 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
361 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); 361 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT);
362 if (res < 0) 362 if (res < 0)
363 err += res; 363 err += res;
364 364
365 /* Start writing through the serial interface */ 365 /* Start writing through the serial interface */
366 data[0] = data1; 366 data[0] = data1;
367 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, 367 res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41,
368 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); 368 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT);
369 if (res < 0) 369 if (res < 0)
370 err += res; 370 err += res;
371 371
@@ -432,11 +432,11 @@ static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs)
432 432
433 if (!(*f)) 433 if (!(*f))
434 (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, 434 (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t,
435 frame); 435 frame);
436 436
437 imagesize = (cam->sensor.pix_format.width * 437 imagesize = (cam->sensor.pix_format.width *
438 cam->sensor.pix_format.height * 438 cam->sensor.pix_format.height *
439 cam->sensor.pix_format.priv) / 8; 439 cam->sensor.pix_format.priv) / 8;
440 440
441 for (i = 0; i < urb->number_of_packets; i++) { 441 for (i = 0; i < urb->number_of_packets; i++) {
442 unsigned int len, status; 442 unsigned int len, status;
@@ -476,7 +476,7 @@ start_of_frame:
476 if ((*f)->state == F_GRABBING) { 476 if ((*f)->state == F_GRABBING) {
477 if (sof && (*f)->buf.bytesused) { 477 if (sof && (*f)->buf.bytesused) {
478 if (cam->sensor.pix_format.pixelformat == 478 if (cam->sensor.pix_format.pixelformat ==
479 V4L2_PIX_FMT_ET61X251) 479 V4L2_PIX_FMT_ET61X251)
480 goto end_of_frame; 480 goto end_of_frame;
481 else { 481 else {
482 DBG(3, "Not expected SOF detected " 482 DBG(3, "Not expected SOF detected "
@@ -508,8 +508,8 @@ end_of_frame:
508 list_move_tail(&(*f)->frame, &cam->outqueue); 508 list_move_tail(&(*f)->frame, &cam->outqueue);
509 if (!list_empty(&cam->inqueue)) 509 if (!list_empty(&cam->inqueue))
510 (*f) = list_entry(cam->inqueue.next, 510 (*f) = list_entry(cam->inqueue.next,
511 struct et61x251_frame_t, 511 struct et61x251_frame_t,
512 frame); 512 frame);
513 else 513 else
514 (*f) = NULL; 514 (*f) = NULL;
515 spin_unlock(&cam->queue_lock); 515 spin_unlock(&cam->queue_lock);
@@ -521,7 +521,7 @@ end_of_frame:
521 521
522 if (sof && 522 if (sof &&
523 cam->sensor.pix_format.pixelformat == 523 cam->sensor.pix_format.pixelformat ==
524 V4L2_PIX_FMT_ET61X251) 524 V4L2_PIX_FMT_ET61X251)
525 goto start_of_frame; 525 goto start_of_frame;
526 } 526 }
527 } 527 }
@@ -544,15 +544,15 @@ static int et61x251_start_transfer(struct et61x251_device* cam)
544 struct usb_device *udev = cam->usbdev; 544 struct usb_device *udev = cam->usbdev;
545 struct urb* urb; 545 struct urb* urb;
546 const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, 546 const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832,
547 864, 896, 920, 956, 980, 1000, 547 864, 896, 920, 956, 980, 1000,
548 1022}; 548 1022};
549 const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; 549 const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING];
550 s8 i, j; 550 s8 i, j;
551 int err = 0; 551 int err = 0;
552 552
553 for (i = 0; i < ET61X251_URBS; i++) { 553 for (i = 0; i < ET61X251_URBS; i++) {
554 cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, 554 cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz,
555 GFP_KERNEL); 555 GFP_KERNEL);
556 if (!cam->transfer_buffer[i]) { 556 if (!cam->transfer_buffer[i]) {
557 err = -ENOMEM; 557 err = -ENOMEM;
558 DBG(1, "Not enough memory"); 558 DBG(1, "Not enough memory");
@@ -653,9 +653,9 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam)
653 653
654 cam->stream = STREAM_INTERRUPT; 654 cam->stream = STREAM_INTERRUPT;
655 timeout = wait_event_timeout(cam->wait_stream, 655 timeout = wait_event_timeout(cam->wait_stream,
656 (cam->stream == STREAM_OFF) || 656 (cam->stream == STREAM_OFF) ||
657 (cam->state & DEV_DISCONNECTED), 657 (cam->state & DEV_DISCONNECTED),
658 ET61X251_URB_TIMEOUT); 658 ET61X251_URB_TIMEOUT);
659 if (cam->state & DEV_DISCONNECTED) 659 if (cam->state & DEV_DISCONNECTED)
660 return -ENODEV; 660 return -ENODEV;
661 else if (cam->stream != STREAM_OFF) { 661 else if (cam->stream != STREAM_OFF) {
@@ -699,7 +699,7 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count)
699 699
700/* 700/*
701 NOTE 1: being inside one of the following methods implies that the v4l 701 NOTE 1: being inside one of the following methods implies that the v4l
702 device exists for sure (see kobjects and reference counters) 702 device exists for sure (see kobjects and reference counters)
703 NOTE 2: buffers are PAGE_SIZE long 703 NOTE 2: buffers are PAGE_SIZE long
704*/ 704*/
705 705
@@ -964,13 +964,13 @@ et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len)
964 964
965 965
966static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, 966static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR,
967 et61x251_show_reg, et61x251_store_reg); 967 et61x251_show_reg, et61x251_store_reg);
968static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, 968static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR,
969 et61x251_show_val, et61x251_store_val); 969 et61x251_show_val, et61x251_store_val);
970static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, 970static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
971 et61x251_show_i2c_reg, et61x251_store_i2c_reg); 971 et61x251_show_i2c_reg, et61x251_store_i2c_reg);
972static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, 972static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
973 et61x251_show_i2c_val, et61x251_store_i2c_val); 973 et61x251_show_i2c_val, et61x251_store_i2c_val);
974 974
975 975
976static void et61x251_create_sysfs(struct et61x251_device* cam) 976static void et61x251_create_sysfs(struct et61x251_device* cam)
@@ -990,7 +990,7 @@ static void et61x251_create_sysfs(struct et61x251_device* cam)
990 990
991static int 991static int
992et61x251_set_pix_format(struct et61x251_device* cam, 992et61x251_set_pix_format(struct et61x251_device* cam,
993 struct v4l2_pix_format* pix) 993 struct v4l2_pix_format* pix)
994{ 994{
995 int r, err = 0; 995 int r, err = 0;
996 996
@@ -1007,7 +1007,7 @@ et61x251_set_pix_format(struct et61x251_device* cam,
1007 1007
1008static int 1008static int
1009et61x251_set_compression(struct et61x251_device* cam, 1009et61x251_set_compression(struct et61x251_device* cam,
1010 struct v4l2_jpegcompression* compression) 1010 struct v4l2_jpegcompression* compression)
1011{ 1011{
1012 int r, err = 0; 1012 int r, err = 0;
1013 1013
@@ -1049,9 +1049,9 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect)
1049{ 1049{
1050 struct et61x251_sensor* s = &cam->sensor; 1050 struct et61x251_sensor* s = &cam->sensor;
1051 u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + 1051 u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left +
1052 s->active_pixel.left), 1052 s->active_pixel.left),
1053 fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + 1053 fmw_sy = (u16)(rect->top - s->cropcap.bounds.top +
1054 s->active_pixel.top), 1054 s->active_pixel.top),
1055 fmw_length = (u16)(rect->width), 1055 fmw_length = (u16)(rect->width),
1056 fmw_height = (u16)(rect->height); 1056 fmw_height = (u16)(rect->height);
1057 int err = 0; 1057 int err = 0;
@@ -1061,8 +1061,8 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect)
1061 err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); 1061 err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b);
1062 err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); 1062 err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c);
1063 err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) 1063 err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6)
1064 | ((fmw_length & 0x300) >> 4) 1064 | ((fmw_length & 0x300) >> 4)
1065 | ((fmw_height & 0x300) >> 2), 0x6d); 1065 | ((fmw_height & 0x300) >> 2), 0x6d);
1066 if (err) 1066 if (err)
1067 return -EIO; 1067 return -EIO;
1068 1068
@@ -1203,8 +1203,8 @@ static int et61x251_open(struct inode* inode, struct file* filp)
1203 } 1203 }
1204 mutex_unlock(&cam->dev_mutex); 1204 mutex_unlock(&cam->dev_mutex);
1205 err = wait_event_interruptible_exclusive(cam->open, 1205 err = wait_event_interruptible_exclusive(cam->open,
1206 cam->state & DEV_DISCONNECTED 1206 cam->state & DEV_DISCONNECTED
1207 || !cam->users); 1207 || !cam->users);
1208 if (err) { 1208 if (err) {
1209 up_read(&et61x251_disconnect); 1209 up_read(&et61x251_disconnect);
1210 return err; 1210 return err;
@@ -1277,7 +1277,7 @@ static int et61x251_release(struct inode* inode, struct file* filp)
1277 1277
1278static ssize_t 1278static ssize_t
1279et61x251_read(struct file* filp, char __user * buf, 1279et61x251_read(struct file* filp, char __user * buf,
1280 size_t count, loff_t* f_pos) 1280 size_t count, loff_t* f_pos)
1281{ 1281{
1282 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); 1282 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
1283 struct et61x251_frame_t* f, * i; 1283 struct et61x251_frame_t* f, * i;
@@ -1310,7 +1310,7 @@ et61x251_read(struct file* filp, char __user * buf,
1310 1310
1311 if (cam->io == IO_NONE) { 1311 if (cam->io == IO_NONE) {
1312 if (!et61x251_request_buffers(cam, cam->nreadbuffers, 1312 if (!et61x251_request_buffers(cam, cam->nreadbuffers,
1313 IO_READ)) { 1313 IO_READ)) {
1314 DBG(1, "read() failed, not enough memory"); 1314 DBG(1, "read() failed, not enough memory");
1315 mutex_unlock(&cam->fileop_mutex); 1315 mutex_unlock(&cam->fileop_mutex);
1316 return -ENOMEM; 1316 return -ENOMEM;
@@ -1336,12 +1336,12 @@ et61x251_read(struct file* filp, char __user * buf,
1336 return -EAGAIN; 1336 return -EAGAIN;
1337 } 1337 }
1338 timeout = wait_event_interruptible_timeout 1338 timeout = wait_event_interruptible_timeout
1339 ( cam->wait_frame, 1339 ( cam->wait_frame,
1340 (!list_empty(&cam->outqueue)) || 1340 (!list_empty(&cam->outqueue)) ||
1341 (cam->state & DEV_DISCONNECTED) || 1341 (cam->state & DEV_DISCONNECTED) ||
1342 (cam->state & DEV_MISCONFIGURED), 1342 (cam->state & DEV_MISCONFIGURED),
1343 cam->module_param.frame_timeout * 1343 cam->module_param.frame_timeout *
1344 1000 * msecs_to_jiffies(1) ); 1344 1000 * msecs_to_jiffies(1) );
1345 if (timeout < 0) { 1345 if (timeout < 0) {
1346 mutex_unlock(&cam->fileop_mutex); 1346 mutex_unlock(&cam->fileop_mutex);
1347 return timeout; 1347 return timeout;
@@ -1408,7 +1408,7 @@ static unsigned int et61x251_poll(struct file *filp, poll_table *wait)
1408 1408
1409 if (cam->io == IO_NONE) { 1409 if (cam->io == IO_NONE) {
1410 if (!et61x251_request_buffers(cam, cam->nreadbuffers, 1410 if (!et61x251_request_buffers(cam, cam->nreadbuffers,
1411 IO_READ)) { 1411 IO_READ)) {
1412 DBG(1, "poll() failed, not enough memory"); 1412 DBG(1, "poll() failed, not enough memory");
1413 goto error; 1413 goto error;
1414 } 1414 }
@@ -1465,7 +1465,7 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma)
1465{ 1465{
1466 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); 1466 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
1467 unsigned long size = vma->vm_end - vma->vm_start, 1467 unsigned long size = vma->vm_end - vma->vm_start,
1468 start = vma->vm_start; 1468 start = vma->vm_start;
1469 void *pos; 1469 void *pos;
1470 u32 i; 1470 u32 i;
1471 1471
@@ -1533,13 +1533,13 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg)
1533 .driver = "et61x251", 1533 .driver = "et61x251",
1534 .version = ET61X251_MODULE_VERSION_CODE, 1534 .version = ET61X251_MODULE_VERSION_CODE,
1535 .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | 1535 .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
1536 V4L2_CAP_STREAMING, 1536 V4L2_CAP_STREAMING,
1537 }; 1537 };
1538 1538
1539 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); 1539 strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
1540 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) 1540 if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
1541 strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, 1541 strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
1542 sizeof(cap.bus_info)); 1542 sizeof(cap.bus_info));
1543 1543
1544 if (copy_to_user(arg, &cap, sizeof(cap))) 1544 if (copy_to_user(arg, &cap, sizeof(cap)))
1545 return -EFAULT; 1545 return -EFAULT;
@@ -1871,7 +1871,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg)
1871 return -EINVAL; 1871 return -EINVAL;
1872 1872
1873 pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) 1873 pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251)
1874 ? 0 : (pfmt->width * pfmt->priv) / 8; 1874 ? 0 : (pfmt->width * pfmt->priv) / 8;
1875 pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); 1875 pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8);
1876 pfmt->field = V4L2_FIELD_NONE; 1876 pfmt->field = V4L2_FIELD_NONE;
1877 memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); 1877 memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt));
@@ -1885,7 +1885,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg)
1885 1885
1886static int 1886static int
1887et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, 1887et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd,
1888 void __user * arg) 1888 void __user * arg)
1889{ 1889{
1890 struct et61x251_sensor* s = &cam->sensor; 1890 struct et61x251_sensor* s = &cam->sensor;
1891 struct v4l2_format format; 1891 struct v4l2_format format;
@@ -1947,7 +1947,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd,
1947 pix->priv = pfmt->priv; /* bpp */ 1947 pix->priv = pfmt->priv; /* bpp */
1948 pix->colorspace = pfmt->colorspace; 1948 pix->colorspace = pfmt->colorspace;
1949 pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) 1949 pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251)
1950 ? 0 : (pix->width * pix->priv) / 8; 1950 ? 0 : (pix->width * pix->priv) / 8;
1951 pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); 1951 pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8);
1952 pix->field = V4L2_FIELD_NONE; 1952 pix->field = V4L2_FIELD_NONE;
1953 1953
@@ -2020,7 +2020,7 @@ static int
2020et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) 2020et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg)
2021{ 2021{
2022 if (copy_to_user(arg, &cam->compression, 2022 if (copy_to_user(arg, &cam->compression,
2023 sizeof(cam->compression))) 2023 sizeof(cam->compression)))
2024 return -EFAULT; 2024 return -EFAULT;
2025 2025
2026 return 0; 2026 return 0;
@@ -2169,7 +2169,7 @@ et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg)
2169 2169
2170static int 2170static int
2171et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, 2171et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp,
2172 void __user * arg) 2172 void __user * arg)
2173{ 2173{
2174 struct v4l2_buffer b; 2174 struct v4l2_buffer b;
2175 struct et61x251_frame_t *f; 2175 struct et61x251_frame_t *f;
@@ -2188,12 +2188,12 @@ et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp,
2188 if (filp->f_flags & O_NONBLOCK) 2188 if (filp->f_flags & O_NONBLOCK)
2189 return -EAGAIN; 2189 return -EAGAIN;
2190 timeout = wait_event_interruptible_timeout 2190 timeout = wait_event_interruptible_timeout
2191 ( cam->wait_frame, 2191 ( cam->wait_frame,
2192 (!list_empty(&cam->outqueue)) || 2192 (!list_empty(&cam->outqueue)) ||
2193 (cam->state & DEV_DISCONNECTED) || 2193 (cam->state & DEV_DISCONNECTED) ||
2194 (cam->state & DEV_MISCONFIGURED), 2194 (cam->state & DEV_MISCONFIGURED),
2195 cam->module_param.frame_timeout * 2195 cam->module_param.frame_timeout *
2196 1000 * msecs_to_jiffies(1) ); 2196 1000 * msecs_to_jiffies(1) );
2197 if (timeout < 0) 2197 if (timeout < 0)
2198 return timeout; 2198 return timeout;
2199 if (cam->state & DEV_DISCONNECTED) 2199 if (cam->state & DEV_DISCONNECTED)
@@ -2317,7 +2317,7 @@ et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg)
2317 2317
2318 2318
2319static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, 2319static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
2320 unsigned int cmd, void __user * arg) 2320 unsigned int cmd, void __user * arg)
2321{ 2321{
2322 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); 2322 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
2323 2323
@@ -2411,7 +2411,7 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
2411 2411
2412 2412
2413static int et61x251_ioctl(struct inode* inode, struct file* filp, 2413static int et61x251_ioctl(struct inode* inode, struct file* filp,
2414 unsigned int cmd, unsigned long arg) 2414 unsigned int cmd, unsigned long arg)
2415{ 2415{
2416 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); 2416 struct et61x251_device* cam = video_get_drvdata(video_devdata(filp));
2417 int err = 0; 2417 int err = 0;
@@ -2518,7 +2518,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
2518 mutex_lock(&cam->dev_mutex); 2518 mutex_lock(&cam->dev_mutex);
2519 2519
2520 err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, 2520 err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
2521 video_nr[dev_nr]); 2521 video_nr[dev_nr]);
2522 if (err) { 2522 if (err) {
2523 DBG(1, "V4L2 device registration failed"); 2523 DBG(1, "V4L2 device registration failed");
2524 if (err == -ENFILE && video_nr[dev_nr] == -1) 2524 if (err == -ENFILE && video_nr[dev_nr] == -1)
diff --git a/drivers/media/video/et61x251/et61x251_sensor.h b/drivers/media/video/et61x251/et61x251_sensor.h
index 56841ae8a207..65edd08dc386 100644
--- a/drivers/media/video/et61x251/et61x251_sensor.h
+++ b/drivers/media/video/et61x251/et61x251_sensor.h
@@ -47,7 +47,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id);
47 47
48extern void 48extern void
49et61x251_attach_sensor(struct et61x251_device* cam, 49et61x251_attach_sensor(struct et61x251_device* cam,
50 struct et61x251_sensor* sensor); 50 struct et61x251_sensor* sensor);
51 51
52/*****************************************************************************/ 52/*****************************************************************************/
53 53
@@ -56,13 +56,13 @@ extern int et61x251_read_reg(struct et61x251_device*, u16 index);
56extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); 56extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value);
57extern int et61x251_i2c_read(struct et61x251_device*, u8 address); 57extern int et61x251_i2c_read(struct et61x251_device*, u8 address);
58extern int et61x251_i2c_try_write(struct et61x251_device*, 58extern int et61x251_i2c_try_write(struct et61x251_device*,
59 struct et61x251_sensor*, u8 address, 59 struct et61x251_sensor*, u8 address,
60 u8 value); 60 u8 value);
61extern int et61x251_i2c_try_read(struct et61x251_device*, 61extern int et61x251_i2c_try_read(struct et61x251_device*,
62 struct et61x251_sensor*, u8 address); 62 struct et61x251_sensor*, u8 address);
63extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, 63extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1,
64 u8 data2, u8 data3, u8 data4, u8 data5, 64 u8 data2, u8 data3, u8 data4, u8 data5,
65 u8 data6, u8 data7, u8 data8, u8 address); 65 u8 data6, u8 data7, u8 data8, u8 address);
66 66
67/*****************************************************************************/ 67/*****************************************************************************/
68 68
@@ -100,13 +100,13 @@ struct et61x251_sensor {
100 100
101 int (*init)(struct et61x251_device* cam); 101 int (*init)(struct et61x251_device* cam);
102 int (*get_ctrl)(struct et61x251_device* cam, 102 int (*get_ctrl)(struct et61x251_device* cam,
103 struct v4l2_control* ctrl); 103 struct v4l2_control* ctrl);
104 int (*set_ctrl)(struct et61x251_device* cam, 104 int (*set_ctrl)(struct et61x251_device* cam,
105 const struct v4l2_control* ctrl); 105 const struct v4l2_control* ctrl);
106 int (*set_crop)(struct et61x251_device* cam, 106 int (*set_crop)(struct et61x251_device* cam,
107 const struct v4l2_rect* rect); 107 const struct v4l2_rect* rect);
108 int (*set_pix_format)(struct et61x251_device* cam, 108 int (*set_pix_format)(struct et61x251_device* cam,
109 const struct v4l2_pix_format* pix); 109 const struct v4l2_pix_format* pix);
110 110
111 /* Private */ 111 /* Private */
112 struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; 112 struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS];
diff --git a/drivers/media/video/et61x251/et61x251_tas5130d1b.c b/drivers/media/video/et61x251/et61x251_tas5130d1b.c
index 3998d76a307a..a7d65b82b2fb 100644
--- a/drivers/media/video/et61x251/et61x251_tas5130d1b.c
+++ b/drivers/media/video/et61x251/et61x251_tas5130d1b.c
@@ -46,20 +46,20 @@ static int tas5130d1b_init(struct et61x251_device* cam)
46 46
47 47
48static int tas5130d1b_set_ctrl(struct et61x251_device* cam, 48static int tas5130d1b_set_ctrl(struct et61x251_device* cam,
49 const struct v4l2_control* ctrl) 49 const struct v4l2_control* ctrl)
50{ 50{
51 int err = 0; 51 int err = 0;
52 52
53 switch (ctrl->id) { 53 switch (ctrl->id) {
54 case V4L2_CID_GAIN: 54 case V4L2_CID_GAIN:
55 err += et61x251_i2c_raw_write(cam, 2, 0x20, 55 err += et61x251_i2c_raw_write(cam, 2, 0x20,
56 0xf6-ctrl->value, 0, 0, 0, 56 0xf6-ctrl->value, 0, 0, 0,
57 0, 0, 0, 0); 57 0, 0, 0, 0);
58 break; 58 break;
59 case V4L2_CID_EXPOSURE: 59 case V4L2_CID_EXPOSURE:
60 err += et61x251_i2c_raw_write(cam, 2, 0x40, 60 err += et61x251_i2c_raw_write(cam, 2, 0x40,
61 0x47-ctrl->value, 0, 0, 0, 61 0x47-ctrl->value, 0, 0, 0,
62 0, 0, 0, 0); 62 0, 0, 0, 0);
63 break; 63 break;
64 default: 64 default:
65 return -EINVAL; 65 return -EINVAL;