aboutsummaryrefslogtreecommitdiffstats
path: root/applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch
diff options
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-06 05:54:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-06 05:54:31 +0800
commitbff1dff74d7d6d1bbe6aacc9b74d3c64d3443edd (patch)
tree3a37fed17bfca852475d416d709c0808e6d202f4 /applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch
parent348b7247cdbca9abadd5cb0bdddba7e2129235d9 (diff)
parent6866d52ad99a8c2c5301c7371fce365d25b2d0be (diff)
downloadpatches-bff1dff74d7d6d1bbe6aacc9b74d3c64d3443edd.tar.gz
Merge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/gregkh/patches
Diffstat (limited to 'applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch')
-rw-r--r--applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch125
1 files changed, 125 insertions, 0 deletions
diff --git a/applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch b/applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch
new file mode 100644
index 00000000000000..5677c3185c92f4
--- /dev/null
+++ b/applied/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch
@@ -0,0 +1,125 @@
+From foo@baz Wed Jun 26 16:22:38 PDT 2013
+Date: Wed, 26 Jun 2013 16:22:38 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+Cc: linux-usb@vger.kernel.org
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: 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>
+
+---
+ drivers/usb/misc/adutux.c | 50 ++++++++--------------------------------------
+ 1 file changed, 9 insertions(+), 41 deletions(-)
+
+--- a/drivers/usb/misc/adutux.c
++++ b/drivers/usb/misc/adutux.c
+@@ -27,30 +27,11 @@
+ #include <linux/mutex.h>
+ #include <linux/uaccess.h>
+
+-#ifdef CONFIG_USB_DEBUG
+-static int debug = 5;
+-#else
+-static int debug = 1;
+-#endif
+-
+-/* Use our own dbg macro */
+-#undef dbg
+-#define dbg(lvl, format, arg...) \
+-do { \
+- if (debug >= lvl) \
+- printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
+-} while (0)
+-
+-
+ /* Version Information */
+ #define DRIVER_VERSION "v0.0.13"
+ #define DRIVER_AUTHOR "John Homppi"
+ #define DRIVER_DESC "adutux (see www.ontrak.net)"
+
+-/* Module parameters */
+-module_param(debug, int, S_IRUGO | S_IWUSR);
+-MODULE_PARM_DESC(debug, "Debug enabled or not");
+-
+ /* Define these values to match your device */
+ #define ADU_VENDOR_ID 0x0a07
+ #define ADU_PRODUCT_ID 0x0064
+@@ -124,19 +105,11 @@ static DEFINE_MUTEX(adutux_mutex);
+
+ static struct usb_driver adu_driver;
+
+-static void adu_debug_data(int level, const char *function, int size,
+- const unsigned char *data)
++static inline void adu_debug_data(struct device *dev, const char *function,
++ int size, const unsigned char *data)
+ {
+- int i;
+-
+- if (debug < level)
+- return;
+-
+- printk(KERN_DEBUG "%s: %s - length = %d, data = ",
+- __FILE__, function, size);
+- for (i = 0; i < size; ++i)
+- printk("%.2x ", data[i]);
+- printk("\n");
++ dev_dbg(dev, "%s - length = %d, data = %*ph\n",
++ function, size, size, data);
+ }
+
+ /**
+@@ -185,8 +158,8 @@ static void adu_interrupt_in_callback(st
+ struct adu_device *dev = urb->context;
+ int status = urb->status;
+
+- adu_debug_data(5, __func__, urb->actual_length,
+- urb->transfer_buffer);
++ adu_debug_data(&dev->udev->dev, __func__,
++ urb->actual_length, urb->transfer_buffer);
+
+ spin_lock(&dev->buflock);
+
+@@ -222,8 +195,6 @@ exit:
+ spin_unlock(&dev->buflock);
+ /* always wake up so we recover from errors */
+ wake_up_interruptible(&dev->read_wait);
+- adu_debug_data(5, __func__, urb->actual_length,
+- urb->transfer_buffer);
+ }
+
+ static void adu_interrupt_out_callback(struct urb *urb)
+@@ -231,7 +202,8 @@ static void adu_interrupt_out_callback(s
+ struct adu_device *dev = urb->context;
+ int status = urb->status;
+
+- adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);
++ adu_debug_data(&dev->udev->dev, __func__,
++ urb->actual_length, urb->transfer_buffer);
+
+ if (status != 0) {
+ if ((status != -ENOENT) &&
+@@ -240,17 +212,13 @@ static void adu_interrupt_out_callback(s
+ "%s :nonzero status received: %d\n", __func__,
+ status);
+ }
+- goto exit;
++ return;
+ }
+
+ spin_lock(&dev->buflock);
+ dev->out_urb_finished = 1;
+ wake_up(&dev->write_wait);
+ spin_unlock(&dev->buflock);
+-exit:
+-
+- adu_debug_data(5, __func__, urb->actual_length,
+- urb->transfer_buffer);
+ }
+
+ static int adu_open(struct inode *inode, struct file *file)