aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videodev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/videodev.c')
-rw-r--r--drivers/media/video/videodev.c74
1 files changed, 45 insertions, 29 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 0d9b63762a48..31e8af0ba278 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -18,14 +18,14 @@
18 18
19#define dbgarg(cmd, fmt, arg...) \ 19#define dbgarg(cmd, fmt, arg...) \
20 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \ 20 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \
21 printk (KERN_DEBUG "%s: ", vfd->name); \ 21 printk(KERN_DEBUG "%s: ", vfd->name); \
22 v4l_printk_ioctl(cmd); \ 22 v4l_printk_ioctl(cmd); \
23 printk (KERN_DEBUG "%s: " fmt, vfd->name, ## arg); \ 23 printk(" " fmt, ## arg); \
24 } 24 }
25 25
26#define dbgarg2(fmt, arg...) \ 26#define dbgarg2(fmt, arg...) \
27 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \ 27 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \
28 printk (KERN_DEBUG "%s: " fmt, vfd->name, ## arg); 28 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);
29 29
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/types.h> 31#include <linux/types.h>
@@ -378,38 +378,45 @@ static const char *v4l2_int_ioctls[] = {
378 external ioctl messages as well as internal V4L ioctl */ 378 external ioctl messages as well as internal V4L ioctl */
379void v4l_printk_ioctl(unsigned int cmd) 379void v4l_printk_ioctl(unsigned int cmd)
380{ 380{
381 char *dir; 381 char *dir, *type;
382 382
383 switch (_IOC_DIR(cmd)) {
384 case _IOC_NONE: dir = "--"; break;
385 case _IOC_READ: dir = "r-"; break;
386 case _IOC_WRITE: dir = "-w"; break;
387 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
388 default: dir = "*ERR*"; break;
389 }
390 switch (_IOC_TYPE(cmd)) { 383 switch (_IOC_TYPE(cmd)) {
391 case 'd': 384 case 'd':
392 printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n", 385 if (_IOC_NR(cmd) >= V4L2_INT_IOCTLS) {
393 (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? 386 type = "v4l2_int";
394 v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); 387 break;
395 break; 388 }
389 printk("%s", v4l2_int_ioctls[_IOC_NR(cmd)]);
390 return;
396#ifdef CONFIG_VIDEO_V4L1_COMPAT 391#ifdef CONFIG_VIDEO_V4L1_COMPAT
397 case 'v': 392 case 'v':
398 printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", 393 if (_IOC_NR(cmd) >= V4L1_IOCTLS) {
399 (_IOC_NR(cmd) < V4L1_IOCTLS) ? 394 type = "v4l1";
400 v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); 395 break;
401 break; 396 }
397 printk("%s", v4l1_ioctls[_IOC_NR(cmd)]);
398 return;
402#endif 399#endif
403 case 'V': 400 case 'V':
404 printk("v4l2 ioctl %s, dir=%s (0x%08x)\n", 401 if (_IOC_NR(cmd) >= V4L2_IOCTLS) {
405 (_IOC_NR(cmd) < V4L2_IOCTLS) ? 402 type = "v4l2";
406 v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); 403 break;
407 break; 404 }
408 405 printk("%s", v4l2_ioctls[_IOC_NR(cmd)]);
406 return;
409 default: 407 default:
410 printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n", 408 type = "unknown";
411 _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd); 409 }
410
411 switch (_IOC_DIR(cmd)) {
412 case _IOC_NONE: dir = "--"; break;
413 case _IOC_READ: dir = "r-"; break;
414 case _IOC_WRITE: dir = "-w"; break;
415 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
416 default: dir = "*ERR*"; break;
412 } 417 }
418 printk("%s ioctl '%c', dir=%s, #%d (0x%08x)",
419 type, _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
413} 420}
414EXPORT_SYMBOL(v4l_printk_ioctl); 421EXPORT_SYMBOL(v4l_printk_ioctl);
415 422
@@ -774,6 +781,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
774 if ( (vfd->debug & V4L2_DEBUG_IOCTL) && 781 if ( (vfd->debug & V4L2_DEBUG_IOCTL) &&
775 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { 782 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) {
776 v4l_print_ioctl(vfd->name, cmd); 783 v4l_print_ioctl(vfd->name, cmd);
784 printk("\n");
777 } 785 }
778 786
779#ifdef CONFIG_VIDEO_V4L1_COMPAT 787#ifdef CONFIG_VIDEO_V4L1_COMPAT
@@ -1853,12 +1861,20 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1853 dbgarg (cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1861 dbgarg (cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1854 break; 1862 break;
1855 } 1863 }
1864 default:
1865 {
1866 if (!vfd->vidioc_default)
1867 break;
1868 ret = vfd->vidioc_default(file, fh, cmd, arg);
1869 break;
1870 }
1856 } /* switch */ 1871 } /* switch */
1857 1872
1858 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { 1873 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
1859 if (ret<0) { 1874 if (ret<0) {
1860 printk ("%s: err:\n", vfd->name); 1875 printk("%s: err: on ", vfd->name);
1861 v4l_print_ioctl(vfd->name, cmd); 1876 v4l_print_ioctl(vfd->name, cmd);
1877 printk("\n");
1862 } 1878 }
1863 } 1879 }
1864 1880
@@ -2019,7 +2035,7 @@ int video_register_device(struct video_device *vfd, int type, int nr)
2019 break; 2035 break;
2020 default: 2036 default:
2021 printk(KERN_ERR "%s called with unknown type: %d\n", 2037 printk(KERN_ERR "%s called with unknown type: %d\n",
2022 __FUNCTION__, type); 2038 __func__, type);
2023 return -1; 2039 return -1;
2024 } 2040 }
2025 2041
@@ -2057,7 +2073,7 @@ int video_register_device(struct video_device *vfd, int type, int nr)
2057 ret = device_register(&vfd->class_dev); 2073 ret = device_register(&vfd->class_dev);
2058 if (ret < 0) { 2074 if (ret < 0) {
2059 printk(KERN_ERR "%s: device_register failed\n", 2075 printk(KERN_ERR "%s: device_register failed\n",
2060 __FUNCTION__); 2076 __func__);
2061 goto fail_minor; 2077 goto fail_minor;
2062 } 2078 }
2063 2079