V4L/DVB (13828): uvcvideo: Make the quirks module parameter override the built-in...
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 10 Dec 2009 13:00:39 +0000 (10:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:25 +0000 (15:10 -0300)
The quirks module parameter is or'ed with the built-in quirks for the
device being probed. This make it impossible to disable a built-in quirk
without recompiling the driver.

Replace the built-in quirks with the quirks module parameter instead of
or'ing the values.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_driver.c

index 05ac2774d3b9bc502a9fbd44b3754c4fa1d0302c..c0e4fbd8f894d6327e54bf55450b75517f27b1d7 100644 (file)
@@ -45,7 +45,7 @@
 
 unsigned int uvc_clock_param = CLOCK_MONOTONIC;
 unsigned int uvc_no_drop_param;
-static unsigned int uvc_quirks_param;
+static unsigned int uvc_quirks_param = -1;
 unsigned int uvc_trace_param;
 unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
 
@@ -1751,7 +1751,8 @@ static int uvc_probe(struct usb_interface *intf,
        dev->udev = usb_get_dev(udev);
        dev->intf = usb_get_intf(intf);
        dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
-       dev->quirks = id->driver_info | uvc_quirks_param;
+       dev->quirks = (uvc_quirks_param == -1)
+                   ? id->driver_info : uvc_quirks_param;
 
        if (udev->product != NULL)
                strlcpy(dev->name, udev->product, sizeof dev->name);
@@ -1774,9 +1775,9 @@ static int uvc_probe(struct usb_interface *intf,
                le16_to_cpu(udev->descriptor.idVendor),
                le16_to_cpu(udev->descriptor.idProduct));
 
-       if (uvc_quirks_param != 0) {
-               uvc_printk(KERN_INFO, "Forcing device quirks 0x%x by module "
-                       "parameter for testing purpose.\n", uvc_quirks_param);
+       if (dev->quirks != id->driver_info) {
+               uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module "
+                       "parameter for testing purpose.\n", dev->quirks);
                uvc_printk(KERN_INFO, "Please report required quirks to the "
                        "linux-uvc-devel mailing list.\n");
        }