From: "Németh Márton" <nm127@freemail.hu>
To: David Vrabel <david.vrabel@csr.com>
Cc: linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Julia Lawall <julia@diku.dk>,
cocci@diku.dk
Subject: [PATCH] uwb: make USB device id constant
Date: Tue, 12 Jan 2010 08:49:14 +0100 [thread overview]
Message-ID: <4B4C297A.5090405@freemail.hu> (raw)
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),
next reply other threads:[~2010-01-12 7:49 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 7:49 Németh Márton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4C297A.5090405@freemail.hu \
--to=nm127@freemail.hu \
--cc=cocci@diku.dk \
--cc=david.vrabel@csr.com \
--cc=julia@diku.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®