cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: cpufreq: pcc-cpufreq: don't load driver if get_freq fails during init.
@ 2011-03-09 14:02 Naga Chumbalkar
  2011-03-09 16:09 ` Thomas Renninger
  0 siblings, 1 reply; 3+ messages in thread
From: Naga Chumbalkar @ 2011-03-09 14:02 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-acpi, Naga Chumbalkar, cpufreq


Return 0 on failure. This will cause the initialization of the driver
to fail and prevent the driver from loading if the BIOS cannot handle
the PCC interface command to "get frequency". Otherwise, the driver
will load and display a very high value like "4294967274" (which is
actually -EINVAL) for frequency:

# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
4294967274

Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
---

diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
index 4f6f679..4a5a42b 100644
--- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
@@ -195,7 +195,7 @@ static unsigned int pcc_get_freq(unsigned int cpu)
 cmd_incomplete:
 	iowrite16(0, &pcch_hdr->status);
 	spin_unlock(&pcc_lock);
-	return -EINVAL;
+	return 0;
 }
 
 static int pcc_cpufreq_target(struct cpufreq_policy *policy,

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

* Re: [PATCH]: cpufreq: pcc-cpufreq: don't load driver if get_freq fails during init.
  2011-03-09 14:02 [PATCH]: cpufreq: pcc-cpufreq: don't load driver if get_freq fails during init Naga Chumbalkar
@ 2011-03-09 16:09 ` Thomas Renninger
  2011-03-09 16:27   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Renninger @ 2011-03-09 16:09 UTC (permalink / raw)
  To: Naga Chumbalkar; +Cc: Dave Jones, linux-acpi, cpufreq, Greg Kroah-Hartman

Good catch.

On Wednesday, March 09, 2011 03:02:49 PM Naga Chumbalkar wrote:
> 
> Return 0 on failure. This will cause the initialization of the driver
> to fail and prevent the driver from loading if the BIOS cannot handle
> the PCC interface command to "get frequency". Otherwise, the driver
> will load and display a very high value like "4294967274" (which is
> actually -EINVAL) for frequency:
> 
> # cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
> 4294967274
> 
> Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>

While this is not a regression, it's an easy fix.
It should make sense to add:
CC: stable@kernel.org
?

   Thomas
> ---
> 
> diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c 
b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
> index 4f6f679..4a5a42b 100644
> --- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
> +++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
> @@ -195,7 +195,7 @@ static unsigned int pcc_get_freq(unsigned int cpu)
>  cmd_incomplete:
>  	iowrite16(0, &pcch_hdr->status);
>  	spin_unlock(&pcc_lock);
> -	return -EINVAL;
> +	return 0;
>  }
>  
>  static int pcc_cpufreq_target(struct cpufreq_policy *policy,
> --
> To unsubscribe from this list: send the line "unsubscribe cpufreq" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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

* Re: [PATCH]: cpufreq: pcc-cpufreq: don't load driver if get_freq fails during init.
  2011-03-09 16:09 ` Thomas Renninger
@ 2011-03-09 16:27   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-03-09 16:27 UTC (permalink / raw)
  To: Thomas Renninger; +Cc: Naga Chumbalkar, Dave Jones, linux-acpi, cpufreq

On Wed, Mar 09, 2011 at 05:09:40PM +0100, Thomas Renninger wrote:
> Good catch.
> 
> On Wednesday, March 09, 2011 03:02:49 PM Naga Chumbalkar wrote:
> > 
> > Return 0 on failure. This will cause the initialization of the driver
> > to fail and prevent the driver from loading if the BIOS cannot handle
> > the PCC interface command to "get frequency". Otherwise, the driver
> > will load and display a very high value like "4294967274" (which is
> > actually -EINVAL) for frequency:
> > 
> > # cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
> > 4294967274
> > 
> > Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
> Reviewed-by: Thomas Renninger <trenn@suse.de>
> 
> While this is not a regression, it's an easy fix.
> It should make sense to add:
> CC: stable@kernel.org
> ?

Yes you should :)

thanks,

greg k-h

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

end of thread, other threads:[~2011-03-09 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-09 14:02 [PATCH]: cpufreq: pcc-cpufreq: don't load driver if get_freq fails during init Naga Chumbalkar
2011-03-09 16:09 ` Thomas Renninger
2011-03-09 16:27   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox