public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] uwb: make USB device id constant
@ 2010-01-12  7:49 Németh Márton
  2010-01-12 16:10 ` David Vrabel
  0 siblings, 1 reply; 38+ messages in thread
From: Németh Márton @ 2010-01-12  7:49 UTC (permalink / raw)
  To: David Vrabel; +Cc: linux-usb, LKML, Julia Lawall, cocci

From: Márton Németh <nm127@freemail.hu>

The id_table field of the struct usb_device_id is constant in <linux/usb.h>
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/)

// <smpl>
@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[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
---
diff -u -p a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
--- a/drivers/uwb/hwa-rc.c 2009-12-03 04:51:21.000000000 +0100
+++ b/drivers/uwb/hwa-rc.c 2010-01-08 11:17:49.000000000 +0100
@@ -891,7 +891,7 @@ static int hwarc_post_reset(struct usb_i
 }

 /** USB device ID's that we handle */
-static struct usb_device_id hwarc_id_table[] = {
+static const struct usb_device_id hwarc_id_table[] = {
 	/* D-Link DUB-1210 */
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3d02, 0xe0, 0x01, 0x02),
 	  .driver_info = WUSB_QUIRK_WHCI_CMD_EVT },
diff -u -p a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
--- a/drivers/uwb/i1480/dfu/usb.c 2010-01-07 19:08:47.000000000 +0100
+++ b/drivers/uwb/i1480/dfu/usb.c 2010-01-08 11:18:26.000000000 +0100
@@ -430,7 +430,7 @@ error:


 /** USB device ID's that we handle */
-static struct usb_device_id i1480_usb_id_table[] = {
+static const struct usb_device_id i1480_usb_id_table[] = {
 	i1480_USB_DEV(0x8086, 0xdf3b),
 	i1480_USB_DEV(0x15a9, 0x0005),
 	i1480_USB_DEV(0x07d1, 0x3802),

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2010-01-18 11:23 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12  7:49 [PATCH] uwb: make USB device id constant Németh Márton
2010-01-12 16:10 ` David Vrabel
2010-01-12 16:57   ` Németh Márton
2010-01-13 14:59     ` Changelog quality (was Re: [PATCH] uwb: make USB device id constant) Stefan Richter
2010-01-13 15:38       ` Julia Lawall
2010-01-13 17:06         ` Changelog quality Stefan Richter
2010-01-13 17:29           ` Alan Stern
2010-01-13 17:44             ` Greg KH
2010-01-13 18:04               ` Alan Stern
2010-01-13 19:52                 ` Greg KH
2010-01-14  5:24                   ` Németh Márton
2010-01-14  6:05                     ` Julia Lawall
2010-01-14  8:07                       ` Stefan Richter
2010-01-14  8:26                     ` Dmitry Torokhov
2010-01-13 19:19               ` Geert Uytterhoeven
2010-01-13 17:49             ` Bartlomiej Zolnierkiewicz
2010-01-13 18:22               ` Stefan Richter
2010-01-15  1:03         ` Changelog quality (was Re: [PATCH] uwb: make USB device id constant) Andy Isaacson
2010-01-15  8:13           ` Stefan Richter
2010-01-15  8:24             ` Changelog quality David Miller
2010-01-15  8:50               ` Stefan Richter
2010-01-15  8:54                 ` David Miller
2010-01-15  9:17                   ` Stefan Richter
2010-01-15  9:22                     ` David Miller
2010-01-15  9:43                       ` Julia Lawall
2010-01-15  9:49                         ` Pekka Enberg
2010-01-15 10:05                           ` Julia Lawall
2010-01-15 11:08                             ` Mark Brown
2010-01-15 12:06                               ` Julia Lawall
2010-01-15 12:44                                 ` Pekka Enberg
2010-01-15 13:10                                   ` Julia Lawall
2010-01-15 12:45                                 ` Stefan Richter
2010-01-15 12:52                                   ` Pekka Enberg
2010-01-15 13:39                                 ` Mark Brown
2010-01-15 16:49                                   ` SmPL scripts into build environment? (was: Changelog quality) Németh Márton
2010-01-18 10:58                                     ` SmPL scripts into build environment? Michal Marek
2010-01-18 11:22                                       ` Julia Lawall
2010-01-15 13:28                       ` Changelog quality Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox