* [patch] Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
@ 2013-04-17 7:18 Dan Carpenter
2013-04-17 15:45 ` Zhang Rui
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-04-17 7:18 UTC (permalink / raw)
To: Zhang Rui; +Cc: linux-pm, kernel-janitors
This code doesn't work on big endian systems because we're storing low
values in the high bits of the unsigned long. It makes it a very high
value instead.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 5f5c780..768b508 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -303,12 +303,12 @@ static int cpufreq_get_max_state(struct thermal_cooling_device *cdev,
struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
struct cpumask *mask = &cpufreq_device->allowed_cpus;
unsigned int cpu;
- unsigned long count = 0;
+ unsigned int count = 0;
int ret;
cpu = cpumask_any(mask);
- ret = get_property(cpu, 0, (unsigned int *)&count, GET_MAXL);
+ ret = get_property(cpu, 0, &count, GET_MAXL);
if (count > 0)
*state = count;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
2013-04-17 7:18 [patch] Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state() Dan Carpenter
@ 2013-04-17 15:45 ` Zhang Rui
2013-04-17 16:55 ` Eduardo Valentin
0 siblings, 1 reply; 3+ messages in thread
From: Zhang Rui @ 2013-04-17 15:45 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-pm, kernel-janitors
On Wed, 2013-04-17 at 10:18 +0300, Dan Carpenter wrote:
> This code doesn't work on big endian systems because we're storing low
> values in the high bits of the unsigned long. It makes it a very high
> value instead.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
applied to thermal -next.
thanks,
rui
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index 5f5c780..768b508 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -303,12 +303,12 @@ static int cpufreq_get_max_state(struct thermal_cooling_device *cdev,
> struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
> struct cpumask *mask = &cpufreq_device->allowed_cpus;
> unsigned int cpu;
> - unsigned long count = 0;
> + unsigned int count = 0;
> int ret;
>
> cpu = cpumask_any(mask);
>
> - ret = get_property(cpu, 0, (unsigned int *)&count, GET_MAXL);
> + ret = get_property(cpu, 0, &count, GET_MAXL);
>
> if (count > 0)
> *state = count;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
2013-04-17 15:45 ` Zhang Rui
@ 2013-04-17 16:55 ` Eduardo Valentin
0 siblings, 0 replies; 3+ messages in thread
From: Eduardo Valentin @ 2013-04-17 16:55 UTC (permalink / raw)
To: Zhang Rui; +Cc: Dan Carpenter, linux-pm, kernel-janitors, eduardo.valentin
On 17-04-2013 11:45, Zhang Rui wrote:
> On Wed, 2013-04-17 at 10:18 +0300, Dan Carpenter wrote:
>> This code doesn't work on big endian systems because we're storing low
>> values in the high bits of the unsigned long. It makes it a very high
>> value instead.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> applied to thermal -next.
Rui,
Can you please add also my:
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Tested-by: Eduardo Valentin <eduardo.valentin@ti.com>
Tested on TI OMAP4430.
>
> thanks,
> rui
>>
>> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
>> index 5f5c780..768b508 100644
>> --- a/drivers/thermal/cpu_cooling.c
>> +++ b/drivers/thermal/cpu_cooling.c
>> @@ -303,12 +303,12 @@ static int cpufreq_get_max_state(struct thermal_cooling_device *cdev,
>> struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
>> struct cpumask *mask = &cpufreq_device->allowed_cpus;
>> unsigned int cpu;
>> - unsigned long count = 0;
>> + unsigned int count = 0;
>> int ret;
>>
>> cpu = cpumask_any(mask);
>>
>> - ret = get_property(cpu, 0, (unsigned int *)&count, GET_MAXL);
>> + ret = get_property(cpu, 0, &count, GET_MAXL);
>>
>> if (count > 0)
>> *state = count;
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" 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
end of thread, other threads:[~2013-04-17 16:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-17 7:18 [patch] Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state() Dan Carpenter
2013-04-17 15:45 ` Zhang Rui
2013-04-17 16:55 ` Eduardo Valentin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).