Commit 13ac58da authored by Németh Márton's avatar Németh Márton Committed by Greg Kroah-Hartman

staging: make PCI device id constant

The id_table field of the struct pci_driver is constant in <linux/pci.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: default avatarNémeth Márton <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 75b16013
...@@ -69,7 +69,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -69,7 +69,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
return ret; return ret;
} }
static struct pci_device_id phison_pci_tbl[] = { static const struct pci_device_id phison_pci_tbl[] = {
{ PCI_VENDOR_ID_PHISON, PCI_DEVICE_ID_PS5000, PCI_ANY_ID, PCI_ANY_ID, { PCI_VENDOR_ID_PHISON, PCI_DEVICE_ID_PS5000, PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 0 }, PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 0 },
{ 0, }, { 0, },
......
...@@ -71,7 +71,7 @@ static void __exit rar_exit_handler(void); ...@@ -71,7 +71,7 @@ static void __exit rar_exit_handler(void);
static int __devinit rar_probe(struct pci_dev *pdev, static int __devinit rar_probe(struct pci_dev *pdev,
const struct pci_device_id *ent); const struct pci_device_id *ent);
static struct pci_device_id rar_pci_id_tbl[] = { static const struct pci_device_id rar_pci_id_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4110) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4110) },
{ 0 } { 0 }
}; };
......
...@@ -2587,7 +2587,7 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id ...@@ -2587,7 +2587,7 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
return error; return error;
} }
static struct pci_device_id sep_pci_id_tbl[] = { static const struct pci_device_id sep_pci_id_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080c)}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080c)},
{0} {0}
}; };
......
...@@ -1103,7 +1103,7 @@ static int __init smtcfb_pci_probe(struct pci_dev *pdev, ...@@ -1103,7 +1103,7 @@ static int __init smtcfb_pci_probe(struct pci_dev *pdev,
/* Jason (08/11/2009) PCI_DRV wrapper essential structs */ /* Jason (08/11/2009) PCI_DRV wrapper essential structs */
static struct pci_device_id smtcfb_pci_table[] = { static const struct pci_device_id smtcfb_pci_table[] = {
{0x126f, 0x710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x126f, 0x710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{0x126f, 0x712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x126f, 0x712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{0x126f, 0x720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x126f, 0x720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
......
...@@ -61,7 +61,7 @@ static struct mutex vme_int; /* ...@@ -61,7 +61,7 @@ static struct mutex vme_int; /*
static char driver_name[] = "vme_ca91cx42"; static char driver_name[] = "vme_ca91cx42";
static struct pci_device_id ca91cx42_ids[] = { static const struct pci_device_id ca91cx42_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) }, { PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) },
{ }, { },
}; };
......
...@@ -81,7 +81,7 @@ static struct mutex vme_int; /* ...@@ -81,7 +81,7 @@ static struct mutex vme_int; /*
static char driver_name[] = "vme_tsi148"; static char driver_name[] = "vme_tsi148";
static struct pci_device_id tsi148_ids[] = { static const struct pci_device_id tsi148_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_TSI148) }, { PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_TSI148) },
{ }, { },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment