Staging: comedi: usbduxfast: add comedi debug to Kconfig
authorMariusz Kozlowski <m.kozlowski@tuxland.pl>
Mon, 16 Feb 2009 20:31:27 +0000 (21:31 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Apr 2009 21:53:46 +0000 (14:53 -0700)
This patch moves CONFIG_COMEDI_DEBUG to Kconfig and cleans up the code
as it didn't actually compile with debug enabled.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc: Bernd Porr <BerndPorr@f2s.com>
Cc: David Schleef <ds@schleef.org>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/Kconfig
drivers/staging/comedi/drivers/usbduxfast.c

index b47ca1e7e383325ef24adbc8d408e116180704af..ab9439fa1983dedc964544b0212e7f30ca7e473c 100644 (file)
@@ -6,6 +6,13 @@ config COMEDI
          Enable support a wide range of data acquision devices
          for Linux.
 
+config COMEDI_DEBUG
+       bool "Comedi debugging"
+       depends on COMEDI != n
+       help
+         This is an option for use by developers; most people should
+         say N here. This enables comedi core and driver debugging.
+
 config COMEDI_RT
        tristate "Comedi Real-time support"
        depends on COMEDI && RT
index 8e5efaad76a9a916e89773d54ab392e7b6378426..3439a0591e920b9dd221496f19f65bdf247a4e29 100644 (file)
@@ -59,10 +59,6 @@ Status: testing
 #include "comedi_fc.h"
 #include "../comedidev.h"
 
-// (un)comment this if you want to have debug info.
-//#define CONFIG_COMEDI_DEBUG
-#undef  CONFIG_COMEDI_DEBUG
-
 #define BOARDNAME "usbduxfast"
 
 // timeout for the USB-transfer
@@ -189,26 +185,29 @@ static DECLARE_MUTEX(start_stop_sem);
 
 static int send_dux_commands(usbduxfastsub_t * this_usbduxfastsub, int cmd_type)
 {
-       int result, nsent;
+       int tmp, nsent;
+
        this_usbduxfastsub->dux_commands[0] = cmd_type;
+
 #ifdef CONFIG_COMEDI_DEBUG
-       int i;
-       printk("comedi%d: usbduxfast: dux_commands: ",
+       printk(KERN_DEBUG "comedi%d: usbduxfast: dux_commands: ",
                this_usbduxfastsub->comedidev->minor);
-       for (i = 0; i < SIZEOFDUXBUFFER; i++) {
-               printk(" %02x", this_usbduxfastsub->dux_commands[i]);
-       }
+       for (tmp = 0; tmp < SIZEOFDUXBUFFER; tmp++)
+               printk(" %02x", this_usbduxfastsub->dux_commands[tmp]);
        printk("\n");
 #endif
-       result = usb_bulk_msg(this_usbduxfastsub->usbdev,
+
+       tmp = usb_bulk_msg(this_usbduxfastsub->usbdev,
                              usb_sndbulkpipe(this_usbduxfastsub->usbdev,
                                              CHANNELLISTEP),
                              this_usbduxfastsub->dux_commands, SIZEOFDUXBUFFER,
                              &nsent, 10000);
-       if (result < 0) {
-               printk("comedi%d: could not transmit dux_commands to the usb-device, err=%d\n", this_usbduxfastsub->comedidev->minor, result);
-       }
-       return result;
+       if (tmp < 0)
+               printk(KERN_ERR "comedi%d: could not transmit dux_commands to"
+                      "the usb-device, err=%d\n",
+                      this_usbduxfastsub->comedidev->minor, tmp);
+
+       return tmp;
 }
 
 // Stops the data acquision
@@ -548,10 +547,10 @@ int usbduxfastsub_submit_InURBs(usbduxfastsub_t * usbduxfastsub)
                SIZEINBUF, usbduxfastsub_ai_Irq, usbduxfastsub->comedidev);
 
 #ifdef CONFIG_COMEDI_DEBUG
-       printk("comedi%d: usbduxfast: submitting in-urb: %x,%x\n",
+       printk("comedi%d: usbduxfast: submitting in-urb: 0x%p,0x%p\n",
                usbduxfastsub->comedidev->minor,
-               (int)(usbduxfastsub->urbIn->context),
-               (int)(usbduxfastsub->urbIn->dev));
+               usbduxfastsub->urbIn->context,
+               usbduxfastsub->urbIn->dev);
 #endif
        errFlag = usb_submit_urb(usbduxfastsub->urbIn, GFP_ATOMIC);
        if (errFlag) {
@@ -826,9 +825,8 @@ static int usbduxfast_ai_cmd(comedi_device * dev, comedi_subdevice * s)
                return -EINVAL;
        }
 #ifdef CONFIG_COMEDI_DEBUG
-       printk("comedi%d: usbduxfast: steps=%ld, convert_arg=%u, ai_timer=%u\n",
-               dev->minor,
-               steps, cmd->convert_arg, this_usbduxfastsub->ai_timer);
+       printk("comedi%d: usbduxfast: steps=%ld, convert_arg=%u\n",
+               dev->minor, steps, cmd->convert_arg);
 #endif
 
        switch (cmd->chanlist_len) {
@@ -1211,10 +1209,10 @@ static int usbduxfast_ai_insn_read(comedi_device * dev,
                return err;
        }
 #ifdef CONFIG_COMEDI_DEBUG
-       printk("comedi%d: usbduxfast: submitting in-urb: %x,%x\n",
+       printk("comedi%d: usbduxfast: submitting in-urb: 0x%p,0x%p\n",
                usbduxfastsub->comedidev->minor,
-               (int)(usbduxfastsub->urbIn->context),
-               (int)(usbduxfastsub->urbIn->dev));
+               usbduxfastsub->urbIn->context,
+               usbduxfastsub->urbIn->dev);
 #endif
        for (i = 0; i < PACKETS_TO_IGNORE; i++) {
                err = usb_bulk_msg(usbduxfastsub->usbdev,