All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH v2] hwmon, fam15h_power: Tweak runavg_range on resume
Date: Thu, 20 Sep 2012 16:35:39 +0000	[thread overview]
Message-ID: <20120920163539.GA25657@roeck-us.net> (raw)
In-Reply-To: <20120920103408.GD4602@alberich>

On Thu, Sep 20, 2012 at 12:34:08PM +0200, Andreas Herrmann wrote:
> 
> The quirk introduced with commit
> 00250ec90963b7ef6678438888f3244985ecde14 (hwmon: fam15h_power: fix
> bogus values with current BIOSes) is not only required during driver
> load but also when system resumes from suspend. The BIOS might set the
> previously recommended (but unsuitable) initilization value for the
> running average range register during resume.
> 
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> ---
>  drivers/hwmon/fam15h_power.c |   15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> Hi Jean,
> 
> Thanks for spotting the issues.
> Here's a new patch version, esp. to fix the section mismatch.
> 
> Please apply.
> 
> 
> Thanks,
> 
> Andreas
> 
> diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
> index 2764b78a784b..af69073b3fe8 100644
> --- a/drivers/hwmon/fam15h_power.c
> +++ b/drivers/hwmon/fam15h_power.c
> @@ -129,12 +129,12 @@ 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) = {
> +static const struct pci_device_id affected_device[] = {

I would prefer if we could keep DEFINE_PCI_DEVICE_TABLE to avoid the
checkpatch warning. Should be easy to implement, by moving pci_match_id
into the probe function and only call tweak_runavg_range() if it returns true.
You could keep the response in fam15h_power_data, as a flag such as needs_tweak,
for use in fam15h_power_resume().

Just my $0.02, though. I'll leave it up to Jean to decide if the patch is ok
as-is. 

Guenter

>  	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
>  	{ 0 }
>  };
>  
> -static void __devinit tweak_runavg_range(struct pci_dev *pdev)
> +static void tweak_runavg_range(struct pci_dev *pdev)
>  {
>  	u32 val;
>  
> @@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev)
>  		REG_TDP_RUNNING_AVERAGE, val);
>  }
>  
> +#ifdef CONFIG_PM
> +static int fam15h_power_resume(struct pci_dev *pdev)
> +{
> +	tweak_runavg_range(pdev);
> +	return 0;
> +}
> +#else
> +#define fam15h_power_resume NULL
> +#endif
> +
>  static void __devinit fam15h_power_init_data(struct pci_dev *f4,
>  					     struct fam15h_power_data *data)
>  {
> @@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = {
>  	.id_table = fam15h_power_id_table,
>  	.probe = fam15h_power_probe,
>  	.remove = __devexit_p(fam15h_power_remove),
> +	.resume = fam15h_power_resume,
>  };
>  
>  module_pci_driver(fam15h_power_driver);
> -- 
> 1.7.10.4
> 
> 
> 

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

  parent reply	other threads:[~2012-09-20 16:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20 10:34 [lm-sensors] [PATCH v2] hwmon, fam15h_power: Tweak runavg_range on resume Andreas Herrmann
2012-09-20 16:26 ` Andreas Hartmann
2012-09-20 16:35 ` Guenter Roeck [this message]
2012-09-23 17:06 ` Jean Delvare
2013-07-18 14:47 ` Jean Delvare
2013-07-18 14:51 ` Satoshi Imamura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120920163539.GA25657@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.