From 33b9e16243fd69493be3ddda7be73226c8be586a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9meth=20M=C3=A1rton?= Date: Sun, 10 Jan 2010 15:34:45 +0100 Subject: USB misc: make USB device id constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The id_table field of the struct usb_device_id is constant in so it is worth to make the initialization data also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // @r@ disable decl_init,const_decl_init; identifier I1, I2, x; @@ struct I1 { ... const struct I2 *x; ... }; @s@ identifier r.I1, y; identifier r.x, E; @@ struct I1 y = { .x = E, }; @c@ identifier r.I2; identifier s.E; @@ const struct I2 E[] = ... ; @depends on !c@ identifier r.I2; identifier s.E; @@ + const struct I2 E[] = ...; // Signed-off-by: Németh Márton Cc: Julia Lawall Cc: cocci@diku.dk Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/adutux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/usb/misc/adutux.c') diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 203526542013..306e97825b36 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Debug enabled or not"); #define ADU_PRODUCT_ID 0x0064 /* table of devices that work with this driver */ -static struct usb_device_id device_table [] = { +static const struct usb_device_id device_table[] = { { USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID) }, /* ADU100 */ { USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+20) }, /* ADU120 */ { USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+30) }, /* ADU130 */ -- cgit v1.2.3 From 86266452f80545285c14e20a8024f79c4fb88a86 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Wed, 13 Jan 2010 15:33:15 +0100 Subject: USB: Push BKL on open down into the drivers Straightforward push into the drivers to allow auditing individual drivers separately Signed-off-by: Oliver Neukum Acked-by: Mauro Carvalho Chehab Cc: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/adutux.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/usb/misc/adutux.c') diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 306e97825b36..ac8ad91c2dac 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #ifdef CONFIG_USB_DEBUG @@ -274,6 +275,7 @@ static int adu_open(struct inode *inode, struct file *file) dbg(2,"%s : enter", __func__); + lock_kernel(); subminor = iminor(inode); if ((retval = mutex_lock_interruptible(&adutux_mutex))) { @@ -332,6 +334,7 @@ static int adu_open(struct inode *inode, struct file *file) exit_no_device: mutex_unlock(&adutux_mutex); exit_no_lock: + unlock_kernel(); dbg(2,"%s : leave, return value %d ", __func__, retval); return retval; } -- cgit v1.2.3 From 937f7131d7ea7762851c89a410c83e1c4b393234 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 14 Jan 2010 16:11:32 +0100 Subject: USB: BKL removal: adutux BKL was not needed at all. Removed without replacement. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/adutux.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/usb/misc/adutux.c') diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index ac8ad91c2dac..306e97825b36 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #ifdef CONFIG_USB_DEBUG @@ -275,7 +274,6 @@ static int adu_open(struct inode *inode, struct file *file) dbg(2,"%s : enter", __func__); - lock_kernel(); subminor = iminor(inode); if ((retval = mutex_lock_interruptible(&adutux_mutex))) { @@ -334,7 +332,6 @@ static int adu_open(struct inode *inode, struct file *file) exit_no_device: mutex_unlock(&adutux_mutex); exit_no_lock: - unlock_kernel(); dbg(2,"%s : leave, return value %d ", __func__, retval); return retval; } -- cgit v1.2.3 From f45ba776da4fe6c9a9eddd42b0fd5d1f15c260f3 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 5 Feb 2010 17:51:13 -0800 Subject: USB: Convert concatenated __FILE__ to %s, __FILE__ Reduces string space a bit Neaten a macro redefine of dbg Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/adutux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/usb/misc/adutux.c') diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 306e97825b36..d240de097c62 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -38,7 +38,7 @@ static int debug = 1; #define dbg(lvl, format, arg...) \ do { \ if (debug >= lvl) \ - printk(KERN_DEBUG __FILE__ " : " format " \n", ## arg); \ + printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ } while (0) @@ -132,8 +132,8 @@ static void adu_debug_data(int level, const char *function, int size, if (debug < level) return; - printk(KERN_DEBUG __FILE__": %s - length = %d, data = ", - function, size); + printk(KERN_DEBUG "%s: %s - length = %d, data = ", + __FILE__, function, size); for (i = 0; i < size; ++i) printk("%.2x ", data[i]); printk("\n"); -- cgit v1.2.3