aboutsummaryrefslogtreecommitdiffstats
path: root/applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch
diff options
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 14:45:58 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 14:45:58 -0700
commit6866d52ad99a8c2c5301c7371fce365d25b2d0be (patch)
treef39adaa4087fd91ed21e7fd81c09ace7b2d9228d /applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch
parente275d064f56be8b9dec6fc2e33d6b075dcc2ac62 (diff)
downloadpatches-6866d52ad99a8c2c5301c7371fce365d25b2d0be.tar.gz
move applied patches to applied/ and add a pwm patch
Diffstat (limited to 'applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch')
-rw-r--r--applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch b/applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch
new file mode 100644
index 00000000000000..b2ac3a9adb1445
--- /dev/null
+++ b/applied/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch
@@ -0,0 +1,114 @@
+From foo@baz Wed Jun 26 16:17:57 PDT 2013
+Date: Wed, 26 Jun 2013 16:17:57 -0700
+To: Greg KH <gregkh@linuxfoundation.org>, Juergen Stuber <starblue@users.sourceforge.net>
+Cc: linux-usb@vger.kernel.org
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: USB: legotower: 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.
+
+Cc: Juergen Stuber <starblue@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/usb/misc/legousbtower.c | 43 ++++++++--------------------------------
+ 1 file changed, 9 insertions(+), 34 deletions(-)
+
+--- a/drivers/usb/misc/legousbtower.c
++++ b/drivers/usb/misc/legousbtower.c
+@@ -87,28 +87,11 @@
+ #include <linux/poll.h>
+
+
+-#ifdef CONFIG_USB_DEBUG
+- static int debug = 4;
+-#else
+- static int debug = 0;
+-#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.96"
+ #define DRIVER_AUTHOR "Juergen Stuber <starblue@sourceforge.net>"
+ #define DRIVER_DESC "LEGO USB Tower Driver"
+
+-/* Module parameters */
+-module_param(debug, int, S_IRUGO | S_IWUSR);
+-MODULE_PARM_DESC(debug, "Debug enabled or not");
+
+ /* The defaults are chosen to work with the latest versions of leJOS and NQC.
+ */
+@@ -298,18 +281,12 @@ static struct usb_driver tower_driver =
+ /**
+ * lego_usb_tower_debug_data
+ */
+-static inline void lego_usb_tower_debug_data (int level, const char *function, int size, const unsigned char *data)
++static inline void lego_usb_tower_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);
+ }
+
+
+@@ -744,7 +721,8 @@ static void tower_interrupt_in_callback
+ int status = urb->status;
+ int retval;
+
+- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);
++ lego_usb_tower_debug_data(&dev->udev->dev, __func__,
++ urb->actual_length, urb->transfer_buffer);
+
+ if (status) {
+ if (status == -ENOENT ||
+@@ -788,8 +766,6 @@ resubmit:
+ exit:
+ dev->interrupt_in_done = 1;
+ wake_up_interruptible (&dev->read_wait);
+-
+- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);
+ }
+
+
+@@ -801,7 +777,8 @@ static void tower_interrupt_out_callback
+ struct lego_usb_tower *dev = urb->context;
+ int status = urb->status;
+
+- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);
++ lego_usb_tower_debug_data(&dev->udev->dev, __func__,
++ urb->actual_length, urb->transfer_buffer);
+
+ /* sync/async unlink faults aren't errors */
+ if (status && !(status == -ENOENT ||
+@@ -814,8 +791,6 @@ static void tower_interrupt_out_callback
+
+ dev->interrupt_out_busy = 0;
+ wake_up_interruptible(&dev->write_wait);
+-
+- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);
+ }
+
+