staging/easycap: replace NOREADBACK with moduel parameter
authorTomas Winkler <tomas.winkler@intel.com>
Tue, 8 Feb 2011 23:12:51 +0000 (01:12 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 9 Feb 2011 19:59:07 +0000 (11:59 -0800)
NOREADBACK doesn't justify Kconfig option so we use module
paramter for it.

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/easycap/easycap.h
drivers/staging/easycap/easycap_low.c
drivers/staging/easycap/easycap_main.c

index 0ee60af6ccd90da58159b3ef6c49e9f9e5854919..55b1a14fa51852648033a883859554b8d60acdc9 100644 (file)
@@ -657,6 +657,7 @@ extern int easycap_debug;
  */
 /*---------------------------------------------------------------------------*/
 
+extern bool easycap_readback;
 extern const struct easycap_standard easycap_standard[];
 extern struct easycap_format easycap_format[];
 extern struct v4l2_queryctrl easycap_control[];
index b44c3841ee8662edb530ca1d23ba873edccaf1df..a345a1bc69d03ede29522e6dd51553cb17d43a0e 100644 (file)
@@ -275,54 +275,53 @@ static int regget(struct usb_device *pusb_device,
 
 static int regset(struct usb_device *pusb_device, u16 index, u16 value)
 {
-       int rc0, rc1;
-       u16 igot;
+       int rc;
 
        if (!pusb_device)
                return -ENODEV;
 
-       rc1 = 0;  igot = 0;
-       rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
+       rc = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
                        0x01,
                        (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
                        value, index, NULL, 0, 500);
 
-#ifdef NOREADBACK
-#
-#else
-       rc1 = regget(pusb_device, index, &igot, sizeof(igot));
-       igot = 0xFF & igot;
-       switch (index) {
-       case 0x000:
-       case 0x500:
-       case 0x502:
-       case 0x503:
-       case 0x504:
-       case 0x506:
-       case 0x507:
-               break;
+       if (rc < 0)
+               return rc;
+
+       if (easycap_readback) {
+               u16 igot = 0;
+               rc = regget(pusb_device, index, &igot, sizeof(igot));
+               igot = 0xFF & igot;
+               switch (index) {
+               case 0x000:
+               case 0x500:
+               case 0x502:
+               case 0x503:
+               case 0x504:
+               case 0x506:
+               case 0x507:
+                       break;
 
-       case 0x204:
-       case 0x205:
-       case 0x350:
-       case 0x351:
-               if (0 != (0xFF & igot)) {
-                       JOT(8, "unexpected 0x%02X for STK register 0x%03X\n",
-                                                               igot, index);
-               }
-               break;
+               case 0x204:
+               case 0x205:
+               case 0x350:
+               case 0x351:
+                       if (igot)
+                               JOT(8, "unexpected 0x%02X "
+                                       "for STK register 0x%03X\n",
+                                       igot, index);
+                       break;
 
-       default:
-               if ((0xFF & value) != (0xFF & igot)) {
-                       JOT(8, "unexpected 0x%02X != 0x%02X "
-                                               "for STK register 0x%03X\n",
+               default:
+                       if ((0xFF & value) != igot)
+                               JOT(8, "unexpected 0x%02X != 0x%02X "
+                                       "for STK register 0x%03X\n",
                                                igot, value, index);
+                       break;
                }
-               break;
        }
-#endif /* ! NOREADBACK*/
 
-       return (0 > rc0) ? rc0 : rc1;
+       return rc;
 }
 /*****************************************************************************/
 
index 997e75574f5f2ce86d191268b2d12f2c517ab8ce..340d4cff7f8ef57bcb8b7b6f89a01095520cea7a 100644 (file)
@@ -42,6 +42,10 @@ module_param_named(debug, easycap_debug, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug level: 0(default),1,2,...,9");
 #endif /* CONFIG_EASYCAP_DEBUG */
 
+bool easycap_readback;
+module_param_named(readback, easycap_readback, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(readback, "read back written registers: (default false)");
+
 static int easycap_bars = 1;
 module_param_named(bars, easycap_bars, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(bars,