Skip to content

Commit

Permalink
hwmon: Make PCI device ids constant
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Márton Németh authored and Jean Delvare committed Jan 10, 2010
1 parent 1fe63ab commit 3dd3a15
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/hwmon/k10temp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void __devexit k10temp_remove(struct pci_dev *pdev)
dev_set_drvdata(&pdev->dev, NULL);
}

static struct pci_device_id k10temp_id_table[] = {
static const struct pci_device_id k10temp_id_table[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
{}
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/k8temp.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 1, 0);
static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1);
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);

static struct pci_device_id k8temp_ids[] = {
static const struct pci_device_id k8temp_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
{ 0 },
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/sis5595.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev)
return data;
}

static struct pci_device_id sis5595_pci_ids[] = {
static const struct pci_device_id sis5595_pci_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) },
{ 0, }
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/via686a.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
return data;
}

static struct pci_device_id via686a_pci_ids[] = {
static const struct pci_device_id via686a_pci_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) },
{ 0, }
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/vt8231.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static struct platform_driver vt8231_driver = {
.remove = __devexit_p(vt8231_remove),
};

static struct pci_device_id vt8231_pci_ids[] = {
static const struct pci_device_id vt8231_pci_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) },
{ 0, }
};
Expand Down

0 comments on commit 3dd3a15

Please sign in to comment.