All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 1/2] fam15h_power: Correct sign extension of running_avg_capture
@ 2012-01-20 18:00 Andreas Herrmann
  2012-01-23 17:33 ` Guenter Roeck
  2012-01-31  7:29 ` Jean Delvare
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Herrmann @ 2012-01-20 18:00 UTC (permalink / raw)
  To: lm-sensors

fam15h_power: Correct sign extension of running_avg_capture

Wrong bit was used for sign extension which caused wrong end results.
Thanks to Andre for spotting this bug.

Reported-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---

Hi Jean,

Here are two patches for the fam15h power driver.

Please apply.


Thanks,
Andreas


 drivers/hwmon/fam15h_power.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index 523f8fb..930370d 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -60,7 +60,7 @@ static ssize_t show_power(struct device *dev,
 	pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),
 				  REG_TDP_RUNNING_AVERAGE, &val);
 	running_avg_capture = (val >> 4) & 0x3fffff;
-	running_avg_capture = sign_extend32(running_avg_capture, 22);
+	running_avg_capture = sign_extend32(running_avg_capture, 21);
 	running_avg_range = val & 0xf;
 
 	pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),
-- 
1.7.8.rc3




_______________________________________________
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 1/2] fam15h_power: Correct sign extension of running_avg_capture
  2012-01-20 18:00 [lm-sensors] [PATCH 1/2] fam15h_power: Correct sign extension of running_avg_capture Andreas Herrmann
@ 2012-01-23 17:33 ` Guenter Roeck
  2012-01-31  7:29 ` Jean Delvare
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2012-01-23 17:33 UTC (permalink / raw)
  To: lm-sensors

On Fri, 2012-01-20 at 13:00 -0500, Andreas Herrmann wrote:
> fam15h_power: Correct sign extension of running_avg_capture
> 
> Wrong bit was used for sign extension which caused wrong end results.
> Thanks to Andre for spotting this bug.
> 
> Reported-by: Andre Przywara <andre.przywara@amd.com>
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> ---

Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>

Candidate for stable ?

Jean, let me know if you want to pick up the two patches. I don't have
anything pending for this driver.

Thanks,
Guenter

> 
> Hi Jean,
> 
> Here are two patches for the fam15h power driver.
> 
> Please apply.
> 
> 
> Thanks,
> Andreas
> 
> 
>  drivers/hwmon/fam15h_power.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
> index 523f8fb..930370d 100644
> --- a/drivers/hwmon/fam15h_power.c
> +++ b/drivers/hwmon/fam15h_power.c
> @@ -60,7 +60,7 @@ static ssize_t show_power(struct device *dev,
>  	pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),
>  				  REG_TDP_RUNNING_AVERAGE, &val);
>  	running_avg_capture = (val >> 4) & 0x3fffff;
> -	running_avg_capture = sign_extend32(running_avg_capture, 22);
> +	running_avg_capture = sign_extend32(running_avg_capture, 21);
>  	running_avg_range = val & 0xf;
>  
>  	pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),



_______________________________________________
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 1/2] fam15h_power: Correct sign extension of running_avg_capture
  2012-01-20 18:00 [lm-sensors] [PATCH 1/2] fam15h_power: Correct sign extension of running_avg_capture Andreas Herrmann
  2012-01-23 17:33 ` Guenter Roeck
@ 2012-01-31  7:29 ` Jean Delvare
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2012-01-31  7:29 UTC (permalink / raw)
  To: lm-sensors

Sorry for the late reply.

On Mon, 23 Jan 2012 09:33:20 -0800, Guenter Roeck wrote:
> On Fri, 2012-01-20 at 13:00 -0500, Andreas Herrmann wrote:
> > fam15h_power: Correct sign extension of running_avg_capture
> > 
> > Wrong bit was used for sign extension which caused wrong end results.
> > Thanks to Andre for spotting this bug.
> > 
> > Reported-by: Andre Przywara <andre.przywara@amd.com>
> > Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> > ---
> 
> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
> 
> Candidate for stable ?

Yes, definitely.

> Jean, let me know if you want to pick up the two patches. I don't have
> anything pending for this driver.

I'll pick them.

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

end of thread, other threads:[~2012-01-31  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 18:00 [lm-sensors] [PATCH 1/2] fam15h_power: Correct sign extension of running_avg_capture Andreas Herrmann
2012-01-23 17:33 ` Guenter Roeck
2012-01-31  7:29 ` Jean Delvare

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.