All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon: (fam15h_power) Fix pci_device_id array
@ 2012-04-25 20:50 Guenter Roeck
  2012-04-26  6:21 ` Jean Delvare
  2012-04-26 12:46 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-04-25 20:50 UTC (permalink / raw)
  To: lm-sensors

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

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
---
 drivers/hwmon/fam15h_power.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index 37a8fc9..e8e18ca 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -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,
-- 
1.7.9.48.g85da4d


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [lm-sensors] [PATCH] hwmon: (fam15h_power) Fix pci_device_id array
  2012-04-25 20:50 [lm-sensors] [PATCH] hwmon: (fam15h_power) Fix pci_device_id array Guenter Roeck
@ 2012-04-26  6:21 ` Jean Delvare
  2012-04-26 12:46 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2012-04-26  6:21 UTC (permalink / raw)
  To: lm-sensors

On Wed, 25 Apr 2012 13:50:09 -0700, Guenter Roeck wrote:
> pci_match_id() takes an *array* of IDs which must be properly zero-
> terminated.

Good catch, sorry for not seeing it.

> Reported-by: Ben Hutchings <ben@decadent.org.uk>
> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
> ---
>  drivers/hwmon/fam15h_power.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
> index 37a8fc9..e8e18ca 100644
> --- a/drivers/hwmon/fam15h_power.c
> +++ b/drivers/hwmon/fam15h_power.c
> @@ -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:

Acked-by: Jean Delvare <khali@linux-fr.org>

>  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,

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [lm-sensors] [PATCH] hwmon: (fam15h_power) Fix pci_device_id array
  2012-04-25 20:50 [lm-sensors] [PATCH] hwmon: (fam15h_power) Fix pci_device_id array Guenter Roeck
  2012-04-26  6:21 ` Jean Delvare
@ 2012-04-26 12:46 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-04-26 12:46 UTC (permalink / raw)
  To: lm-sensors

On Thu, Apr 26, 2012 at 02:21:56AM -0400, Jean Delvare wrote:
> On Wed, 25 Apr 2012 13:50:09 -0700, Guenter Roeck wrote:
> > pci_match_id() takes an *array* of IDs which must be properly zero-
> > terminated.
> 
> Good catch, sorry for not seeing it.
> 
> > Reported-by: Ben Hutchings <ben@decadent.org.uk>
> > Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
> > ---
> >  drivers/hwmon/fam15h_power.c |    9 ++++++---
> >  1 files changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
> > index 37a8fc9..e8e18ca 100644
> > --- a/drivers/hwmon/fam15h_power.c
> > +++ b/drivers/hwmon/fam15h_power.c
> > @@ -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.

> Other than this:
> 
> Acked-by: Jean Delvare <khali@linux-fr.org>
> 
Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-26 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 20:50 [lm-sensors] [PATCH] hwmon: (fam15h_power) Fix pci_device_id array Guenter Roeck
2012-04-26  6:21 ` Jean Delvare
2012-04-26 12:46 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.