Commit 1ef37c6047fef8b65d62aa908d9795101b5244d6

Authored by Greg Kroah-Hartman
1 parent 66d4bc30d1

USB: adutux: remove custom debug macro and module parameter

Now that we don't use the dbg() macro, remove it, and the module
parameter.  Also fix up the "dump_data" function to properly use the
dynamic debug core and the correct printk options, and don't call it
twice per function, as the data doesn't change from the beginning and
the end of the call.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 9 additions and 41 deletions Side-by-side Diff

drivers/usb/misc/adutux.c
... ... @@ -27,30 +27,11 @@
27 27 #include <linux/mutex.h>
28 28 #include <linux/uaccess.h>
29 29  
30   -#ifdef CONFIG_USB_DEBUG
31   -static int debug = 5;
32   -#else
33   -static int debug = 1;
34   -#endif
35   -
36   -/* Use our own dbg macro */
37   -#undef dbg
38   -#define dbg(lvl, format, arg...) \
39   -do { \
40   - if (debug >= lvl) \
41   - printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
42   -} while (0)
43   -
44   -
45 30 /* Version Information */
46 31 #define DRIVER_VERSION "v0.0.13"
47 32 #define DRIVER_AUTHOR "John Homppi"
48 33 #define DRIVER_DESC "adutux (see www.ontrak.net)"
49 34  
50   -/* Module parameters */
51   -module_param(debug, int, S_IRUGO | S_IWUSR);
52   -MODULE_PARM_DESC(debug, "Debug enabled or not");
53   -
54 35 /* Define these values to match your device */
55 36 #define ADU_VENDOR_ID 0x0a07
56 37 #define ADU_PRODUCT_ID 0x0064
57 38  
... ... @@ -124,19 +105,11 @@
124 105  
125 106 static struct usb_driver adu_driver;
126 107  
127   -static void adu_debug_data(int level, const char *function, int size,
128   - const unsigned char *data)
  108 +static inline void adu_debug_data(struct device *dev, const char *function,
  109 + int size, const unsigned char *data)
129 110 {
130   - int i;
131   -
132   - if (debug < level)
133   - return;
134   -
135   - printk(KERN_DEBUG "%s: %s - length = %d, data = ",
136   - __FILE__, function, size);
137   - for (i = 0; i < size; ++i)
138   - printk("%.2x ", data[i]);
139   - printk("\n");
  111 + dev_dbg(dev, "%s - length = %d, data = %*ph\n",
  112 + function, size, size, data);
140 113 }
141 114  
142 115 /**
... ... @@ -185,8 +158,8 @@
185 158 struct adu_device *dev = urb->context;
186 159 int status = urb->status;
187 160  
188   - adu_debug_data(5, __func__, urb->actual_length,
189   - urb->transfer_buffer);
  161 + adu_debug_data(&dev->udev->dev, __func__,
  162 + urb->actual_length, urb->transfer_buffer);
190 163  
191 164 spin_lock(&dev->buflock);
192 165  
... ... @@ -222,8 +195,6 @@
222 195 spin_unlock(&dev->buflock);
223 196 /* always wake up so we recover from errors */
224 197 wake_up_interruptible(&dev->read_wait);
225   - adu_debug_data(5, __func__, urb->actual_length,
226   - urb->transfer_buffer);
227 198 }
228 199  
229 200 static void adu_interrupt_out_callback(struct urb *urb)
... ... @@ -231,7 +202,8 @@
231 202 struct adu_device *dev = urb->context;
232 203 int status = urb->status;
233 204  
234   - adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);
  205 + adu_debug_data(&dev->udev->dev, __func__,
  206 + urb->actual_length, urb->transfer_buffer);
235 207  
236 208 if (status != 0) {
237 209 if ((status != -ENOENT) &&
238 210  
... ... @@ -240,17 +212,13 @@
240 212 "%s :nonzero status received: %d\n", __func__,
241 213 status);
242 214 }
243   - goto exit;
  215 + return;
244 216 }
245 217  
246 218 spin_lock(&dev->buflock);
247 219 dev->out_urb_finished = 1;
248 220 wake_up(&dev->write_wait);
249 221 spin_unlock(&dev->buflock);
250   -exit:
251   -
252   - adu_debug_data(5, __func__, urb->actual_length,
253   - urb->transfer_buffer);
254 222 }
255 223  
256 224 static int adu_open(struct inode *inode, struct file *file)