Skip to content

Commit 13ac58d

Browse files
nmarci1gregkh
authored andcommitted
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: Németh Márton <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Cc: cocci@diku.dk Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 75b1601 commit 13ac58d

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎drivers/staging/phison/phison.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
6969
return ret;
7070
}
7171

72-
static struct pci_device_id phison_pci_tbl[] = {
72+
static const struct pci_device_id phison_pci_tbl[] = {
7373
{ PCI_VENDOR_ID_PHISON, PCI_DEVICE_ID_PS5000, PCI_ANY_ID, PCI_ANY_ID,
7474
PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 0 },
7575
{ 0, },

‎drivers/staging/rar/rar_driver.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void __exit rar_exit_handler(void);
7171
static int __devinit rar_probe(struct pci_dev *pdev,
7272
const struct pci_device_id *ent);
7373

74-
static struct pci_device_id rar_pci_id_tbl[] = {
74+
static const struct pci_device_id rar_pci_id_tbl[] = {
7575
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4110) },
7676
{ 0 }
7777
};

‎drivers/staging/sep/sep_driver.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,7 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
25872587
return error;
25882588
}
25892589

2590-
static struct pci_device_id sep_pci_id_tbl[] = {
2590+
static const struct pci_device_id sep_pci_id_tbl[] = {
25912591
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080c)},
25922592
{0}
25932593
};

‎drivers/staging/sm7xx/smtcfb.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ static int __init smtcfb_pci_probe(struct pci_dev *pdev,
11031103

11041104

11051105
/* Jason (08/11/2009) PCI_DRV wrapper essential structs */
1106-
static struct pci_device_id smtcfb_pci_table[] = {
1106+
static const struct pci_device_id smtcfb_pci_table[] = {
11071107
{0x126f, 0x710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
11081108
{0x126f, 0x712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
11091109
{0x126f, 0x720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},

‎drivers/staging/vme/bridges/vme_ca91cx42.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static struct mutex vme_int; /*
6161

6262
static char driver_name[] = "vme_ca91cx42";
6363

64-
static struct pci_device_id ca91cx42_ids[] = {
64+
static const struct pci_device_id ca91cx42_ids[] = {
6565
{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) },
6666
{ },
6767
};

‎drivers/staging/vme/bridges/vme_tsi148.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static struct mutex vme_int; /*
8181

8282
static char driver_name[] = "vme_tsi148";
8383

84-
static struct pci_device_id tsi148_ids[] = {
84+
static const struct pci_device_id tsi148_ids[] = {
8585
{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_TSI148) },
8686
{ },
8787
};

0 commit comments

Comments
 (0)