From 13ac58dac0c6b1edeb060102049b07ebceea9a40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?N=C3=A9meth=20M=C3=A1rton?= Date: Sun, 10 Jan 2010 00:18:26 +0100 Subject: [PATCH] staging: make PCI device id constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The id_table field of the struct pci_driver is constant in 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/) // @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[] = ...; // Signed-off-by: Németh Márton Cc: Julia Lawall Cc: cocci@diku.dk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/phison/phison.c | 2 +- drivers/staging/rar/rar_driver.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/sm7xx/smtcfb.c | 2 +- drivers/staging/vme/bridges/vme_ca91cx42.c | 2 +- drivers/staging/vme/bridges/vme_tsi148.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c index 3817d7497049..ff30cb0321b9 100644 --- a/drivers/staging/phison/phison.c +++ b/drivers/staging/phison/phison.c @@ -69,7 +69,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 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_CLASS_STORAGE_IDE << 8, 0xffff00, 0 }, { 0, }, diff --git a/drivers/staging/rar/rar_driver.c b/drivers/staging/rar/rar_driver.c index b91a90f4ce9e..a85a7da6df40 100644 --- a/drivers/staging/rar/rar_driver.c +++ b/drivers/staging/rar/rar_driver.c @@ -71,7 +71,7 @@ static void __exit rar_exit_handler(void); static int __devinit rar_probe(struct pci_dev *pdev, 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) }, { 0 } }; diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index 92fa18655f87..09346c92e94d 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -2587,7 +2587,7 @@ end_function: 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)}, {0} }; diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c index 161dbc9c1397..080b51a6e553 100644 --- a/drivers/staging/sm7xx/smtcfb.c +++ b/drivers/staging/sm7xx/smtcfb.c @@ -1103,7 +1103,7 @@ static int __init smtcfb_pci_probe(struct pci_dev *pdev, /* 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, 0x712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0x126f, 0x720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index 470479856054..807278485bbf 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -61,7 +61,7 @@ static struct mutex vme_int; /* 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) }, { }, }; diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 4d19a914ec52..ed8297daf9ee 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c @@ -81,7 +81,7 @@ static struct mutex vme_int; /* 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) }, { }, }; -- 2.39.5