diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-04-22 13:45:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:50 -0400 |
commit | 8b3b90aca293418171297ae14efac5817ba02bd3 (patch) | |
tree | 2292a74407496e29b92d9520ac3c85f1876fe6fa /drivers/media | |
parent | a2a7f84b7908c6dba998b43a1ed343aff1d2fd98 (diff) |
V4L/DVB (7363): fix coding style violations in v4l1-compat.c
fix most coding style violations found by checkpatch
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/v4l1-compat.c | 184 |
1 files changed, 90 insertions, 94 deletions
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index ffd3f106dd4f..6455b2f43bed 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -41,13 +41,16 @@ | |||
41 | 41 | ||
42 | static unsigned int debug; | 42 | static unsigned int debug; |
43 | module_param(debug, int, 0644); | 43 | module_param(debug, int, 0644); |
44 | MODULE_PARM_DESC(debug,"enable debug messages"); | 44 | MODULE_PARM_DESC(debug, "enable debug messages"); |
45 | MODULE_AUTHOR("Bill Dirks"); | 45 | MODULE_AUTHOR("Bill Dirks"); |
46 | MODULE_DESCRIPTION("v4l(1) compatibility layer for v4l2 drivers."); | 46 | MODULE_DESCRIPTION("v4l(1) compatibility layer for v4l2 drivers."); |
47 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
48 | 48 | ||
49 | #define dprintk(fmt, arg...) if (debug) \ | 49 | #define dprintk(fmt, arg...) \ |
50 | printk(KERN_DEBUG "v4l1-compat: " fmt , ## arg) | 50 | do { \ |
51 | if (debug) \ | ||
52 | printk(KERN_DEBUG "v4l1-compat: " fmt , ## arg);\ | ||
53 | } while (0) | ||
51 | 54 | ||
52 | /* | 55 | /* |
53 | * I O C T L T R A N S L A T I O N | 56 | * I O C T L T R A N S L A T I O N |
@@ -69,14 +72,12 @@ get_v4l_control(struct inode *inode, | |||
69 | qctrl2.id = cid; | 72 | qctrl2.id = cid; |
70 | err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); | 73 | err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); |
71 | if (err < 0) | 74 | if (err < 0) |
72 | dprintk("VIDIOC_QUERYCTRL: %d\n",err); | 75 | dprintk("VIDIOC_QUERYCTRL: %d\n", err); |
73 | if (err == 0 && | 76 | if (err == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) { |
74 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) | ||
75 | { | ||
76 | ctrl2.id = qctrl2.id; | 77 | ctrl2.id = qctrl2.id; |
77 | err = drv(inode, file, VIDIOC_G_CTRL, &ctrl2); | 78 | err = drv(inode, file, VIDIOC_G_CTRL, &ctrl2); |
78 | if (err < 0) { | 79 | if (err < 0) { |
79 | dprintk("VIDIOC_G_CTRL: %d\n",err); | 80 | dprintk("VIDIOC_G_CTRL: %d\n", err); |
80 | return 0; | 81 | return 0; |
81 | } | 82 | } |
82 | return ((ctrl2.value - qctrl2.minimum) * 65535 | 83 | return ((ctrl2.value - qctrl2.minimum) * 65535 |
@@ -100,11 +101,10 @@ set_v4l_control(struct inode *inode, | |||
100 | qctrl2.id = cid; | 101 | qctrl2.id = cid; |
101 | err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); | 102 | err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); |
102 | if (err < 0) | 103 | if (err < 0) |
103 | dprintk("VIDIOC_QUERYCTRL: %d\n",err); | 104 | dprintk("VIDIOC_QUERYCTRL: %d\n", err); |
104 | if (err == 0 && | 105 | if (err == 0 && |
105 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED) && | 106 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED) && |
106 | !(qctrl2.flags & V4L2_CTRL_FLAG_GRABBED)) | 107 | !(qctrl2.flags & V4L2_CTRL_FLAG_GRABBED)) { |
107 | { | ||
108 | if (value < 0) | 108 | if (value < 0) |
109 | value = 0; | 109 | value = 0; |
110 | if (value > 65535) | 110 | if (value > 65535) |
@@ -119,7 +119,7 @@ set_v4l_control(struct inode *inode, | |||
119 | ctrl2.value += qctrl2.minimum; | 119 | ctrl2.value += qctrl2.minimum; |
120 | err = drv(inode, file, VIDIOC_S_CTRL, &ctrl2); | 120 | err = drv(inode, file, VIDIOC_S_CTRL, &ctrl2); |
121 | if (err < 0) | 121 | if (err < 0) |
122 | dprintk("VIDIOC_S_CTRL: %d\n",err); | 122 | dprintk("VIDIOC_S_CTRL: %d\n", err); |
123 | } | 123 | } |
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
@@ -157,8 +157,7 @@ static unsigned int __attribute_const__ | |||
157 | pixelformat_to_palette(unsigned int pixelformat) | 157 | pixelformat_to_palette(unsigned int pixelformat) |
158 | { | 158 | { |
159 | int palette = 0; | 159 | int palette = 0; |
160 | switch (pixelformat) | 160 | switch (pixelformat) { |
161 | { | ||
162 | case V4L2_PIX_FMT_GREY: | 161 | case V4L2_PIX_FMT_GREY: |
163 | palette = VIDEO_PALETTE_GREY; | 162 | palette = VIDEO_PALETTE_GREY; |
164 | break; | 163 | break; |
@@ -234,9 +233,9 @@ static int count_inputs(struct inode *inode, | |||
234 | int i; | 233 | int i; |
235 | 234 | ||
236 | for (i = 0;; i++) { | 235 | for (i = 0;; i++) { |
237 | memset(&input2,0,sizeof(input2)); | 236 | memset(&input2, 0, sizeof(input2)); |
238 | input2.index = i; | 237 | input2.index = i; |
239 | if (0 != drv(inode,file,VIDIOC_ENUMINPUT, &input2)) | 238 | if (0 != drv(inode, file, VIDIOC_ENUMINPUT, &input2)) |
240 | break; | 239 | break; |
241 | } | 240 | } |
242 | return i; | 241 | return i; |
@@ -250,18 +249,18 @@ static int check_size(struct inode *inode, | |||
250 | struct v4l2_fmtdesc desc2; | 249 | struct v4l2_fmtdesc desc2; |
251 | struct v4l2_format fmt2; | 250 | struct v4l2_format fmt2; |
252 | 251 | ||
253 | memset(&desc2,0,sizeof(desc2)); | 252 | memset(&desc2, 0, sizeof(desc2)); |
254 | memset(&fmt2,0,sizeof(fmt2)); | 253 | memset(&fmt2, 0, sizeof(fmt2)); |
255 | 254 | ||
256 | desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 255 | desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
257 | if (0 != drv(inode,file,VIDIOC_ENUM_FMT, &desc2)) | 256 | if (0 != drv(inode, file, VIDIOC_ENUM_FMT, &desc2)) |
258 | goto done; | 257 | goto done; |
259 | 258 | ||
260 | fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 259 | fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
261 | fmt2.fmt.pix.width = 10000; | 260 | fmt2.fmt.pix.width = 10000; |
262 | fmt2.fmt.pix.height = 10000; | 261 | fmt2.fmt.pix.height = 10000; |
263 | fmt2.fmt.pix.pixelformat = desc2.pixelformat; | 262 | fmt2.fmt.pix.pixelformat = desc2.pixelformat; |
264 | if (0 != drv(inode,file,VIDIOC_TRY_FMT, &fmt2)) | 263 | if (0 != drv(inode, file, VIDIOC_TRY_FMT, &fmt2)) |
265 | goto done; | 264 | goto done; |
266 | 265 | ||
267 | *maxw = fmt2.fmt.pix.width; | 266 | *maxw = fmt2.fmt.pix.width; |
@@ -313,13 +312,13 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
313 | 312 | ||
314 | err = drv(inode, file, VIDIOC_QUERYCAP, cap2); | 313 | err = drv(inode, file, VIDIOC_QUERYCAP, cap2); |
315 | if (err < 0) { | 314 | if (err < 0) { |
316 | dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n",err); | 315 | dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n", err); |
317 | break; | 316 | break; |
318 | } | 317 | } |
319 | if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { | 318 | if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { |
320 | err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); | 319 | err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); |
321 | if (err < 0) { | 320 | if (err < 0) { |
322 | dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n",err); | 321 | dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n", err); |
323 | memset(&fbuf2, 0, sizeof(fbuf2)); | 322 | memset(&fbuf2, 0, sizeof(fbuf2)); |
324 | } | 323 | } |
325 | err = 0; | 324 | err = 0; |
@@ -339,9 +338,9 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
339 | if (fbuf2.capability & V4L2_FBUF_CAP_LIST_CLIPPING) | 338 | if (fbuf2.capability & V4L2_FBUF_CAP_LIST_CLIPPING) |
340 | cap->type |= VID_TYPE_CLIPPING; | 339 | cap->type |= VID_TYPE_CLIPPING; |
341 | 340 | ||
342 | cap->channels = count_inputs(inode,file,drv); | 341 | cap->channels = count_inputs(inode, file, drv); |
343 | check_size(inode,file,drv, | 342 | check_size(inode, file, drv, |
344 | &cap->maxwidth,&cap->maxheight); | 343 | &cap->maxwidth, &cap->maxheight); |
345 | cap->audios = 0; /* FIXME */ | 344 | cap->audios = 0; /* FIXME */ |
346 | cap->minwidth = 48; /* FIXME */ | 345 | cap->minwidth = 48; /* FIXME */ |
347 | cap->minheight = 32; /* FIXME */ | 346 | cap->minheight = 32; /* FIXME */ |
@@ -356,7 +355,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
356 | 355 | ||
357 | err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); | 356 | err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); |
358 | if (err < 0) { | 357 | if (err < 0) { |
359 | dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); | 358 | dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n", err); |
360 | break; | 359 | break; |
361 | } | 360 | } |
362 | buffer->base = fbuf2.base; | 361 | buffer->base = fbuf2.base; |
@@ -386,8 +385,8 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
386 | buffer->bytesperline = fbuf2.fmt.bytesperline; | 385 | buffer->bytesperline = fbuf2.fmt.bytesperline; |
387 | if (!buffer->depth && buffer->width) | 386 | if (!buffer->depth && buffer->width) |
388 | buffer->depth = ((fbuf2.fmt.bytesperline<<3) | 387 | buffer->depth = ((fbuf2.fmt.bytesperline<<3) |
389 | + (buffer->width-1) ) | 388 | + (buffer->width-1)) |
390 | /buffer->width; | 389 | / buffer->width; |
391 | } else { | 390 | } else { |
392 | buffer->bytesperline = | 391 | buffer->bytesperline = |
393 | (buffer->width * buffer->depth + 7) & 7; | 392 | (buffer->width * buffer->depth + 7) & 7; |
@@ -423,7 +422,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
423 | fbuf2.fmt.bytesperline = buffer->bytesperline; | 422 | fbuf2.fmt.bytesperline = buffer->bytesperline; |
424 | err = drv(inode, file, VIDIOC_S_FBUF, &fbuf2); | 423 | err = drv(inode, file, VIDIOC_S_FBUF, &fbuf2); |
425 | if (err < 0) | 424 | if (err < 0) |
426 | dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %d\n",err); | 425 | dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %d\n", err); |
427 | break; | 426 | break; |
428 | } | 427 | } |
429 | case VIDIOCGWIN: /* get window or capture dimensions */ | 428 | case VIDIOCGWIN: /* get window or capture dimensions */ |
@@ -435,12 +434,12 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
435 | err = -ENOMEM; | 434 | err = -ENOMEM; |
436 | break; | 435 | break; |
437 | } | 436 | } |
438 | memset(win,0,sizeof(*win)); | 437 | memset(win, 0, sizeof(*win)); |
439 | 438 | ||
440 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | 439 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; |
441 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 440 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
442 | if (err < 0) | 441 | if (err < 0) |
443 | dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n",err); | 442 | dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n", err); |
444 | if (err == 0) { | 443 | if (err == 0) { |
445 | win->x = fmt2->fmt.win.w.left; | 444 | win->x = fmt2->fmt.win.w.left; |
446 | win->y = fmt2->fmt.win.w.top; | 445 | win->y = fmt2->fmt.win.w.top; |
@@ -455,7 +454,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
455 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 454 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
456 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 455 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
457 | if (err < 0) { | 456 | if (err < 0) { |
458 | dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n",err); | 457 | dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n", err); |
459 | break; | 458 | break; |
460 | } | 459 | } |
461 | win->x = 0; | 460 | win->x = 0; |
@@ -470,7 +469,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
470 | case VIDIOCSWIN: /* set window and/or capture dimensions */ | 469 | case VIDIOCSWIN: /* set window and/or capture dimensions */ |
471 | { | 470 | { |
472 | struct video_window *win = arg; | 471 | struct video_window *win = arg; |
473 | int err1,err2; | 472 | int err1, err2; |
474 | 473 | ||
475 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | 474 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
476 | if (!fmt2) { | 475 | if (!fmt2) { |
@@ -481,7 +480,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
481 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); | 480 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); |
482 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); | 481 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); |
483 | if (err1 < 0) | 482 | if (err1 < 0) |
484 | dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n",err); | 483 | dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n", err); |
485 | if (err1 == 0) { | 484 | if (err1 == 0) { |
486 | fmt2->fmt.pix.width = win->width; | 485 | fmt2->fmt.pix.width = win->width; |
487 | fmt2->fmt.pix.height = win->height; | 486 | fmt2->fmt.pix.height = win->height; |
@@ -495,7 +494,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
495 | win->height = fmt2->fmt.pix.height; | 494 | win->height = fmt2->fmt.pix.height; |
496 | } | 495 | } |
497 | 496 | ||
498 | memset(fmt2,0,sizeof(*fmt2)); | 497 | memset(fmt2, 0, sizeof(*fmt2)); |
499 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | 498 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; |
500 | fmt2->fmt.win.w.left = win->x; | 499 | fmt2->fmt.win.w.left = win->x; |
501 | fmt2->fmt.win.w.top = win->y; | 500 | fmt2->fmt.win.w.top = win->y; |
@@ -506,7 +505,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
506 | fmt2->fmt.win.clipcount = win->clipcount; | 505 | fmt2->fmt.win.clipcount = win->clipcount; |
507 | err2 = drv(inode, file, VIDIOC_S_FMT, fmt2); | 506 | err2 = drv(inode, file, VIDIOC_S_FMT, fmt2); |
508 | if (err2 < 0) | 507 | if (err2 < 0) |
509 | dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n",err); | 508 | dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n", err); |
510 | 509 | ||
511 | if (err1 != 0 && err2 != 0) | 510 | if (err1 != 0 && err2 != 0) |
512 | err = err1; | 511 | err = err1; |
@@ -524,19 +523,19 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
524 | } | 523 | } |
525 | err = drv(inode, file, VIDIOC_OVERLAY, arg); | 524 | err = drv(inode, file, VIDIOC_OVERLAY, arg); |
526 | if (err < 0) | 525 | if (err < 0) |
527 | dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %d\n",err); | 526 | dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %d\n", err); |
528 | break; | 527 | break; |
529 | } | 528 | } |
530 | case VIDIOCGCHAN: /* get input information */ | 529 | case VIDIOCGCHAN: /* get input information */ |
531 | { | 530 | { |
532 | struct video_channel *chan = arg; | 531 | struct video_channel *chan = arg; |
533 | 532 | ||
534 | memset(&input2,0,sizeof(input2)); | 533 | memset(&input2, 0, sizeof(input2)); |
535 | input2.index = chan->channel; | 534 | input2.index = chan->channel; |
536 | err = drv(inode, file, VIDIOC_ENUMINPUT, &input2); | 535 | err = drv(inode, file, VIDIOC_ENUMINPUT, &input2); |
537 | if (err < 0) { | 536 | if (err < 0) { |
538 | dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " | 537 | dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " |
539 | "channel=%d err=%d\n",chan->channel,err); | 538 | "channel=%d err=%d\n", chan->channel, err); |
540 | break; | 539 | break; |
541 | } | 540 | } |
542 | chan->channel = input2.index; | 541 | chan->channel = input2.index; |
@@ -557,7 +556,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
557 | chan->norm = 0; | 556 | chan->norm = 0; |
558 | err = drv(inode, file, VIDIOC_G_STD, &sid); | 557 | err = drv(inode, file, VIDIOC_G_STD, &sid); |
559 | if (err < 0) | 558 | if (err < 0) |
560 | dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %d\n",err); | 559 | dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %d\n", err); |
561 | if (err == 0) { | 560 | if (err == 0) { |
562 | if (sid & V4L2_STD_PAL) | 561 | if (sid & V4L2_STD_PAL) |
563 | chan->norm = VIDEO_MODE_PAL; | 562 | chan->norm = VIDEO_MODE_PAL; |
@@ -575,7 +574,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
575 | sid = 0; | 574 | sid = 0; |
576 | err = drv(inode, file, VIDIOC_S_INPUT, &chan->channel); | 575 | err = drv(inode, file, VIDIOC_S_INPUT, &chan->channel); |
577 | if (err < 0) | 576 | if (err < 0) |
578 | dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n",err); | 577 | dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n", err); |
579 | switch (chan->norm) { | 578 | switch (chan->norm) { |
580 | case VIDEO_MODE_PAL: | 579 | case VIDEO_MODE_PAL: |
581 | sid = V4L2_STD_PAL; | 580 | sid = V4L2_STD_PAL; |
@@ -590,7 +589,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
590 | if (0 != sid) { | 589 | if (0 != sid) { |
591 | err = drv(inode, file, VIDIOC_S_STD, &sid); | 590 | err = drv(inode, file, VIDIOC_S_STD, &sid); |
592 | if (err < 0) | 591 | if (err < 0) |
593 | dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n",err); | 592 | dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n", err); |
594 | } | 593 | } |
595 | break; | 594 | break; |
596 | } | 595 | } |
@@ -605,7 +604,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
605 | } | 604 | } |
606 | 605 | ||
607 | pict->brightness = get_v4l_control(inode, file, | 606 | pict->brightness = get_v4l_control(inode, file, |
608 | V4L2_CID_BRIGHTNESS,drv); | 607 | V4L2_CID_BRIGHTNESS, drv); |
609 | pict->hue = get_v4l_control(inode, file, | 608 | pict->hue = get_v4l_control(inode, file, |
610 | V4L2_CID_HUE, drv); | 609 | V4L2_CID_HUE, drv); |
611 | pict->contrast = get_v4l_control(inode, file, | 610 | pict->contrast = get_v4l_control(inode, file, |
@@ -618,13 +617,13 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
618 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 617 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
619 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 618 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
620 | if (err < 0) { | 619 | if (err < 0) { |
621 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err); | 620 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n", err); |
622 | break; | 621 | break; |
623 | } | 622 | } |
624 | 623 | ||
625 | pict->depth = ((fmt2->fmt.pix.bytesperline<<3) | 624 | pict->depth = ((fmt2->fmt.pix.bytesperline << 3) |
626 | + (fmt2->fmt.pix.width-1) ) | 625 | + (fmt2->fmt.pix.width - 1)) |
627 | /fmt2->fmt.pix.width; | 626 | / fmt2->fmt.pix.width; |
628 | pict->palette = pixelformat_to_palette( | 627 | pict->palette = pixelformat_to_palette( |
629 | fmt2->fmt.pix.pixelformat); | 628 | fmt2->fmt.pix.pixelformat); |
630 | break; | 629 | break; |
@@ -664,7 +663,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
664 | support memory capture. Trying to set the memory capture | 663 | support memory capture. Trying to set the memory capture |
665 | parameters would be pointless. */ | 664 | parameters would be pointless. */ |
666 | if (err < 0) { | 665 | if (err < 0) { |
667 | dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %d\n",err); | 666 | dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %d\n", err); |
668 | mem_err = -1000; /* didn't even try */ | 667 | mem_err = -1000; /* didn't even try */ |
669 | } else if (fmt2->fmt.pix.pixelformat != | 668 | } else if (fmt2->fmt.pix.pixelformat != |
670 | palette_to_pixelformat(pict->palette)) { | 669 | palette_to_pixelformat(pict->palette)) { |
@@ -681,7 +680,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
681 | support overlay. Trying to set the overlay parameters | 680 | support overlay. Trying to set the overlay parameters |
682 | would be quite pointless. */ | 681 | would be quite pointless. */ |
683 | if (err < 0) { | 682 | if (err < 0) { |
684 | dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %d\n",err); | 683 | dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %d\n", err); |
685 | ovl_err = -1000; /* didn't even try */ | 684 | ovl_err = -1000; /* didn't even try */ |
686 | } else if (fbuf2.fmt.pixelformat != | 685 | } else if (fbuf2.fmt.pixelformat != |
687 | palette_to_pixelformat(pict->palette)) { | 686 | palette_to_pixelformat(pict->palette)) { |
@@ -692,16 +691,15 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
692 | dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", | 691 | dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", |
693 | ovl_err); | 692 | ovl_err); |
694 | } | 693 | } |
695 | if (ovl_err < 0 && mem_err < 0) | 694 | if (ovl_err < 0 && mem_err < 0) { |
696 | /* ioctl failed, couldn't set either parameter */ | 695 | /* ioctl failed, couldn't set either parameter */ |
697 | if (mem_err != -1000) { | 696 | if (mem_err != -1000) |
698 | err = mem_err; | 697 | err = mem_err; |
699 | } else if (ovl_err == -EPERM) { | 698 | else if (ovl_err == -EPERM) |
700 | err = 0; | 699 | err = 0; |
701 | } else { | 700 | else |
702 | err = ovl_err; | 701 | err = ovl_err; |
703 | } | 702 | } else |
704 | else | ||
705 | err = 0; | 703 | err = 0; |
706 | break; | 704 | break; |
707 | } | 705 | } |
@@ -709,10 +707,10 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
709 | { | 707 | { |
710 | struct video_tuner *tun = arg; | 708 | struct video_tuner *tun = arg; |
711 | 709 | ||
712 | memset(&tun2,0,sizeof(tun2)); | 710 | memset(&tun2, 0, sizeof(tun2)); |
713 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); | 711 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); |
714 | if (err < 0) { | 712 | if (err < 0) { |
715 | dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n",err); | 713 | dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n", err); |
716 | break; | 714 | break; |
717 | } | 715 | } |
718 | memcpy(tun->name, tun2.name, | 716 | memcpy(tun->name, tun2.name, |
@@ -724,7 +722,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
724 | tun->mode = VIDEO_MODE_AUTO; | 722 | tun->mode = VIDEO_MODE_AUTO; |
725 | 723 | ||
726 | for (i = 0; i < 64; i++) { | 724 | for (i = 0; i < 64; i++) { |
727 | memset(&std2,0,sizeof(std2)); | 725 | memset(&std2, 0, sizeof(std2)); |
728 | std2.index = i; | 726 | std2.index = i; |
729 | if (0 != drv(inode, file, VIDIOC_ENUMSTD, &std2)) | 727 | if (0 != drv(inode, file, VIDIOC_ENUMSTD, &std2)) |
730 | break; | 728 | break; |
@@ -738,7 +736,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
738 | 736 | ||
739 | err = drv(inode, file, VIDIOC_G_STD, &sid); | 737 | err = drv(inode, file, VIDIOC_G_STD, &sid); |
740 | if (err < 0) | 738 | if (err < 0) |
741 | dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n",err); | 739 | dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n", err); |
742 | if (err == 0) { | 740 | if (err == 0) { |
743 | if (sid & V4L2_STD_PAL) | 741 | if (sid & V4L2_STD_PAL) |
744 | tun->mode = VIDEO_MODE_PAL; | 742 | tun->mode = VIDEO_MODE_PAL; |
@@ -759,25 +757,25 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
759 | { | 757 | { |
760 | struct video_tuner *tun = arg; | 758 | struct video_tuner *tun = arg; |
761 | struct v4l2_tuner t; | 759 | struct v4l2_tuner t; |
762 | memset(&t,0,sizeof(t)); | 760 | memset(&t, 0, sizeof(t)); |
763 | 761 | ||
764 | t.index=tun->tuner; | 762 | t.index = tun->tuner; |
765 | 763 | ||
766 | err = drv(inode, file, VIDIOC_S_INPUT, &t); | 764 | err = drv(inode, file, VIDIOC_S_INPUT, &t); |
767 | if (err < 0) | 765 | if (err < 0) |
768 | dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n",err); | 766 | dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n", err); |
769 | 767 | ||
770 | break; | 768 | break; |
771 | } | 769 | } |
772 | case VIDIOCGFREQ: /* get frequency */ | 770 | case VIDIOCGFREQ: /* get frequency */ |
773 | { | 771 | { |
774 | unsigned long *freq = arg; | 772 | unsigned long *freq = arg; |
775 | memset(&freq2,0,sizeof(freq2)); | 773 | memset(&freq2, 0, sizeof(freq2)); |
776 | 774 | ||
777 | freq2.tuner = 0; | 775 | freq2.tuner = 0; |
778 | err = drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); | 776 | err = drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); |
779 | if (err < 0) | 777 | if (err < 0) |
780 | dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %d\n",err); | 778 | dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %d\n", err); |
781 | if (0 == err) | 779 | if (0 == err) |
782 | *freq = freq2.frequency; | 780 | *freq = freq2.frequency; |
783 | break; | 781 | break; |
@@ -785,23 +783,23 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
785 | case VIDIOCSFREQ: /* set frequency */ | 783 | case VIDIOCSFREQ: /* set frequency */ |
786 | { | 784 | { |
787 | unsigned long *freq = arg; | 785 | unsigned long *freq = arg; |
788 | memset(&freq2,0,sizeof(freq2)); | 786 | memset(&freq2, 0, sizeof(freq2)); |
789 | 787 | ||
790 | drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); | 788 | drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); |
791 | freq2.frequency = *freq; | 789 | freq2.frequency = *freq; |
792 | err = drv(inode, file, VIDIOC_S_FREQUENCY, &freq2); | 790 | err = drv(inode, file, VIDIOC_S_FREQUENCY, &freq2); |
793 | if (err < 0) | 791 | if (err < 0) |
794 | dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %d\n",err); | 792 | dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %d\n", err); |
795 | break; | 793 | break; |
796 | } | 794 | } |
797 | case VIDIOCGAUDIO: /* get audio properties/controls */ | 795 | case VIDIOCGAUDIO: /* get audio properties/controls */ |
798 | { | 796 | { |
799 | struct video_audio *aud = arg; | 797 | struct video_audio *aud = arg; |
800 | memset(&aud2,0,sizeof(aud2)); | 798 | memset(&aud2, 0, sizeof(aud2)); |
801 | 799 | ||
802 | err = drv(inode, file, VIDIOC_G_AUDIO, &aud2); | 800 | err = drv(inode, file, VIDIOC_G_AUDIO, &aud2); |
803 | if (err < 0) { | 801 | if (err < 0) { |
804 | dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %d\n",err); | 802 | dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %d\n", err); |
805 | break; | 803 | break; |
806 | } | 804 | } |
807 | memcpy(aud->name, aud2.name, | 805 | memcpy(aud->name, aud2.name, |
@@ -842,10 +840,10 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
842 | aud->step = qctrl2.step; | 840 | aud->step = qctrl2.step; |
843 | aud->mode = 0; | 841 | aud->mode = 0; |
844 | 842 | ||
845 | memset(&tun2,0,sizeof(tun2)); | 843 | memset(&tun2, 0, sizeof(tun2)); |
846 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); | 844 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); |
847 | if (err < 0) { | 845 | if (err < 0) { |
848 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n",err); | 846 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n", err); |
849 | err = 0; | 847 | err = 0; |
850 | break; | 848 | break; |
851 | } | 849 | } |
@@ -862,13 +860,13 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
862 | { | 860 | { |
863 | struct video_audio *aud = arg; | 861 | struct video_audio *aud = arg; |
864 | 862 | ||
865 | memset(&aud2,0,sizeof(aud2)); | 863 | memset(&aud2, 0, sizeof(aud2)); |
866 | memset(&tun2,0,sizeof(tun2)); | 864 | memset(&tun2, 0, sizeof(tun2)); |
867 | 865 | ||
868 | aud2.index = aud->audio; | 866 | aud2.index = aud->audio; |
869 | err = drv(inode, file, VIDIOC_S_AUDIO, &aud2); | 867 | err = drv(inode, file, VIDIOC_S_AUDIO, &aud2); |
870 | if (err < 0) { | 868 | if (err < 0) { |
871 | dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %d\n",err); | 869 | dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %d\n", err); |
872 | break; | 870 | break; |
873 | } | 871 | } |
874 | 872 | ||
@@ -885,7 +883,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
885 | 883 | ||
886 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); | 884 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); |
887 | if (err < 0) | 885 | if (err < 0) |
888 | dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %d\n",err); | 886 | dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %d\n", err); |
889 | if (err == 0) { | 887 | if (err == 0) { |
890 | switch (aud->mode) { | 888 | switch (aud->mode) { |
891 | default: | 889 | default: |
@@ -902,7 +900,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
902 | } | 900 | } |
903 | err = drv(inode, file, VIDIOC_S_TUNER, &tun2); | 901 | err = drv(inode, file, VIDIOC_S_TUNER, &tun2); |
904 | if (err < 0) | 902 | if (err < 0) |
905 | dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %d\n",err); | 903 | dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %d\n", err); |
906 | } | 904 | } |
907 | err = 0; | 905 | err = 0; |
908 | break; | 906 | break; |
@@ -916,19 +914,19 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
916 | err = -ENOMEM; | 914 | err = -ENOMEM; |
917 | break; | 915 | break; |
918 | } | 916 | } |
919 | memset(&buf2,0,sizeof(buf2)); | 917 | memset(&buf2, 0, sizeof(buf2)); |
920 | 918 | ||
921 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 919 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
922 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 920 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
923 | if (err < 0) { | 921 | if (err < 0) { |
924 | dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n",err); | 922 | dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n", err); |
925 | break; | 923 | break; |
926 | } | 924 | } |
927 | if (mm->width != fmt2->fmt.pix.width || | 925 | if (mm->width != fmt2->fmt.pix.width || |
928 | mm->height != fmt2->fmt.pix.height || | 926 | mm->height != fmt2->fmt.pix.height || |
929 | palette_to_pixelformat(mm->format) != | 927 | palette_to_pixelformat(mm->format) != |
930 | fmt2->fmt.pix.pixelformat) | 928 | fmt2->fmt.pix.pixelformat) { |
931 | {/* New capture format... */ | 929 | /* New capture format... */ |
932 | fmt2->fmt.pix.width = mm->width; | 930 | fmt2->fmt.pix.width = mm->width; |
933 | fmt2->fmt.pix.height = mm->height; | 931 | fmt2->fmt.pix.height = mm->height; |
934 | fmt2->fmt.pix.pixelformat = | 932 | fmt2->fmt.pix.pixelformat = |
@@ -937,7 +935,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
937 | fmt2->fmt.pix.bytesperline = 0; | 935 | fmt2->fmt.pix.bytesperline = 0; |
938 | err = drv(inode, file, VIDIOC_S_FMT, fmt2); | 936 | err = drv(inode, file, VIDIOC_S_FMT, fmt2); |
939 | if (err < 0) { | 937 | if (err < 0) { |
940 | dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n",err); | 938 | dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n", err); |
941 | break; | 939 | break; |
942 | } | 940 | } |
943 | } | 941 | } |
@@ -945,30 +943,30 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
945 | buf2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 943 | buf2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
946 | err = drv(inode, file, VIDIOC_QUERYBUF, &buf2); | 944 | err = drv(inode, file, VIDIOC_QUERYBUF, &buf2); |
947 | if (err < 0) { | 945 | if (err < 0) { |
948 | dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %d\n",err); | 946 | dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %d\n", err); |
949 | break; | 947 | break; |
950 | } | 948 | } |
951 | err = drv(inode, file, VIDIOC_QBUF, &buf2); | 949 | err = drv(inode, file, VIDIOC_QBUF, &buf2); |
952 | if (err < 0) { | 950 | if (err < 0) { |
953 | dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %d\n",err); | 951 | dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %d\n", err); |
954 | break; | 952 | break; |
955 | } | 953 | } |
956 | err = drv(inode, file, VIDIOC_STREAMON, &captype); | 954 | err = drv(inode, file, VIDIOC_STREAMON, &captype); |
957 | if (err < 0) | 955 | if (err < 0) |
958 | dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %d\n",err); | 956 | dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %d\n", err); |
959 | break; | 957 | break; |
960 | } | 958 | } |
961 | case VIDIOCSYNC: /* wait for a frame */ | 959 | case VIDIOCSYNC: /* wait for a frame */ |
962 | { | 960 | { |
963 | int *i = arg; | 961 | int *i = arg; |
964 | 962 | ||
965 | memset(&buf2,0,sizeof(buf2)); | 963 | memset(&buf2, 0, sizeof(buf2)); |
966 | buf2.index = *i; | 964 | buf2.index = *i; |
967 | buf2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 965 | buf2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
968 | err = drv(inode, file, VIDIOC_QUERYBUF, &buf2); | 966 | err = drv(inode, file, VIDIOC_QUERYBUF, &buf2); |
969 | if (err < 0) { | 967 | if (err < 0) { |
970 | /* No such buffer */ | 968 | /* No such buffer */ |
971 | dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n",err); | 969 | dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); |
972 | break; | 970 | break; |
973 | } | 971 | } |
974 | if (!(buf2.flags & V4L2_BUF_FLAG_MAPPED)) { | 972 | if (!(buf2.flags & V4L2_BUF_FLAG_MAPPED)) { |
@@ -980,29 +978,28 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
980 | /* make sure capture actually runs so we don't block forever */ | 978 | /* make sure capture actually runs so we don't block forever */ |
981 | err = drv(inode, file, VIDIOC_STREAMON, &captype); | 979 | err = drv(inode, file, VIDIOC_STREAMON, &captype); |
982 | if (err < 0) { | 980 | if (err < 0) { |
983 | dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %d\n",err); | 981 | dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %d\n", err); |
984 | break; | 982 | break; |
985 | } | 983 | } |
986 | 984 | ||
987 | /* Loop as long as the buffer is queued, but not done */ | 985 | /* Loop as long as the buffer is queued, but not done */ |
988 | while ((buf2.flags & | 986 | while ((buf2.flags & |
989 | (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) | 987 | (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) |
990 | == V4L2_BUF_FLAG_QUEUED) | 988 | == V4L2_BUF_FLAG_QUEUED) { |
991 | { | ||
992 | err = poll_one(file); | 989 | err = poll_one(file); |
993 | if (err < 0 || /* error or sleep was interrupted */ | 990 | if (err < 0 || /* error or sleep was interrupted */ |
994 | err == 0) /* timeout? Shouldn't occur. */ | 991 | err == 0) /* timeout? Shouldn't occur. */ |
995 | break; | 992 | break; |
996 | err = drv(inode, file, VIDIOC_QUERYBUF, &buf2); | 993 | err = drv(inode, file, VIDIOC_QUERYBUF, &buf2); |
997 | if (err < 0) | 994 | if (err < 0) |
998 | dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n",err); | 995 | dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); |
999 | } | 996 | } |
1000 | if (!(buf2.flags & V4L2_BUF_FLAG_DONE)) /* not done */ | 997 | if (!(buf2.flags & V4L2_BUF_FLAG_DONE)) /* not done */ |
1001 | break; | 998 | break; |
1002 | do { | 999 | do { |
1003 | err = drv(inode, file, VIDIOC_DQBUF, &buf2); | 1000 | err = drv(inode, file, VIDIOC_DQBUF, &buf2); |
1004 | if (err < 0) | 1001 | if (err < 0) |
1005 | dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %d\n",err); | 1002 | dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %d\n", err); |
1006 | } while (err == 0 && buf2.index != *i); | 1003 | } while (err == 0 && buf2.index != *i); |
1007 | break; | 1004 | break; |
1008 | } | 1005 | } |
@@ -1093,7 +1090,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
1093 | kfree(fmt2); | 1090 | kfree(fmt2); |
1094 | return err; | 1091 | return err; |
1095 | } | 1092 | } |
1096 | |||
1097 | EXPORT_SYMBOL(v4l_compat_translate_ioctl); | 1093 | EXPORT_SYMBOL(v4l_compat_translate_ioctl); |
1098 | 1094 | ||
1099 | /* | 1095 | /* |