Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: Make PCI device ids constant

The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make pci_device_id also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
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>
Signed-off-by: Jean Delvare <khali@linux-fr.org>

authored by

Márton Németh and committed by
Jean Delvare
3dd3a156 1fe63ab4

+5 -5
+1 -1
drivers/hwmon/k10temp.c
··· 195 195 dev_set_drvdata(&pdev->dev, NULL); 196 196 } 197 197 198 - static struct pci_device_id k10temp_id_table[] = { 198 + static const struct pci_device_id k10temp_id_table[] = { 199 199 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, 200 200 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, 201 201 {}
+1 -1
drivers/hwmon/k8temp.c
··· 136 136 static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); 137 137 static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 138 138 139 - static struct pci_device_id k8temp_ids[] = { 139 + static const struct pci_device_id k8temp_ids[] = { 140 140 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, 141 141 { 0 }, 142 142 };
+1 -1
drivers/hwmon/sis5595.c
··· 697 697 return data; 698 698 } 699 699 700 - static struct pci_device_id sis5595_pci_ids[] = { 700 + static const struct pci_device_id sis5595_pci_ids[] = { 701 701 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, 702 702 { 0, } 703 703 };
+1 -1
drivers/hwmon/via686a.c
··· 767 767 return data; 768 768 } 769 769 770 - static struct pci_device_id via686a_pci_ids[] = { 770 + static const struct pci_device_id via686a_pci_ids[] = { 771 771 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) }, 772 772 { 0, } 773 773 };
+1 -1
drivers/hwmon/vt8231.c
··· 697 697 .remove = __devexit_p(vt8231_remove), 698 698 }; 699 699 700 - static struct pci_device_id vt8231_pci_ids[] = { 700 + static const struct pci_device_id vt8231_pci_ids[] = { 701 701 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, 702 702 { 0, } 703 703 };