Skip to contentSkip to conversation

hwmon: (fam15h_power) Fix pci_device_id array

PATCH In review Guenter Roeck 2 participants 3 messages Apr 25, 2012 – Apr 26, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (fam15h_power) Fix pci_device_id array

pci_match_id() takes an *array* of IDs which must be properly zero- terminated.

---
 drivers/hwmon/fam15h_power.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/hwmon/fam15h_power.c +6 -3
index 37a8fc9..e8e18ca 100644
@@ -128,17 +128,20 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
  * counter saturations resulting in bogus power readings.
  * We correct this value ourselves to cope with older BIOSes.
  */
+static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
+	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
+	{ 0 }
+};
+
 static void __devinit tweak_runavg_range(struct pci_dev *pdev)
 {
 	u32 val;
-	const struct pci_device_id affected_device = {
-		PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) };
 
 	/*
 	 * let this quirk apply only to the current version of the
 	 * northbridge, since future versions may change the behavior
 	 */
-	if (!pci_match_id(&affected_device, pdev))
+	if (!pci_match_id(affected_device, pdev))
 		return;
 
 	pci_bus_read_config_dword(pdev->bus,
Signature · 7 lines
1.7.9.48.g85da4d


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Guenter Roeck

pci_match_id() takes an *array* of IDs which must be properly zero- terminated.

Good catch, sorry for not seeing it.

Quoted 11 lines
---
 drivers/hwmon/fam15h_power.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/hwmon/fam15h_power.c +0 -0
index 37a8fc9..e8e18ca 100644

drivers/hwmon/fam15h_power.c static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) · line 135

Quoted 8 lines
drivers/hwmon/fam15h_power.c +5 -0
@@ -128,17 +128,20 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
  * counter saturations resulting in bogus power readings.
  * We correct this value ourselves to cope with older BIOSes.
  */
+static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
+	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
+	{ 0 }
+};
+

Not sure why you move it here, you didn't have to, did you?

Other than this:

Quoted 15 lines
drivers/hwmon/fam15h_power.c +1 -3
 static void __devinit tweak_runavg_range(struct pci_dev *pdev)
 {
 	u32 val;
-	const struct pci_device_id affected_device = {
-		PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) };
 
 	/*
 	 * let this quirk apply only to the current version of the
 	 * northbridge, since future versions may change the behavior
 	 */
-	if (!pci_match_id(&affected_device, pdev))
+	if (!pci_match_id(affected_device, pdev))
 		return;
 
 	pci_bus_read_config_dword(pdev->bus,
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Guenter Roeck
Quoted 12 lines · Jean Delvare
Quoted 2 lines · Guenter Roeck

pci_match_id() takes an *array* of IDs which must be properly zero- terminated.

Good catch, sorry for not seeing it.

Quoted 6 lines
---
 drivers/hwmon/fam15h_power.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
Quoted 16 lines

drivers/hwmon/fam15h_power.c static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) · line 135

Quoted 13 lines
drivers/hwmon/fam15h_power.c +5 -0
index 37a8fc9..e8e18ca 100644
@@ -128,17 +128,20 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
  * counter saturations resulting in bogus power readings.
  * We correct this value ourselves to cope with older BIOSes.
  */
+static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
+	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
+	{ 0 }
+};
+

Not sure why you move it here, you didn't have to, did you?

checkpatch complains if I don't use DEFINE_PCI_DEVICE_TABLE, I was not sure what impact the __devinitconst in DEFINE_PCI_DEVICE_TABLE has to a local variable, and I did not want to be the first one trying. Mostly it was to play safe.

Quoted 4 lines

Other than this:

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors