public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bluetooth: make USB device id constant
@ 2010-01-10 12:39 Németh Márton
  2010-01-10 15:09 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Németh Márton @ 2010-01-10 12:39 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Maxim Krasnyansky, 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 bcm203x_table 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/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
--- a/drivers/bluetooth/bcm203x.c 2009-12-03 04:51:21.000000000 +0100
+++ b/drivers/bluetooth/bcm203x.c 2010-01-08 11:29:05.000000000 +0100
@@ -39,7 +39,7 @@

 #define VERSION "1.2"

-static struct usb_device_id bcm203x_table[] = {
+static const struct usb_device_id bcm203x_table[] = {
 	/* Broadcom Blutonium (BCM2033) */
 	{ USB_DEVICE(0x0a5c, 0x2033) },


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

* Re: [PATCH] bluetooth: make USB device id constant
  2010-01-10 12:39 [PATCH] bluetooth: make USB device id constant Németh Márton
@ 2010-01-10 15:09 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2010-01-10 15:09 UTC (permalink / raw)
  To: Németh Márton; +Cc: Maxim Krasnyansky, LKML, Julia Lawall, cocci

Hi Marton,

> 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 bcm203x_table also constant.

patch has been applied to my tree. Thanks.

Regards

Marcel



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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-10 12:39 [PATCH] bluetooth: make USB device id constant Németh Márton
2010-01-10 15:09 ` Marcel Holtmann

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