RE: [PATCH] Thermal: thermal zone governor fix

Zhang, Rui
2014-02-27T14:21:51Z

[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]

> -----Original Message-----
> From: Javi Merino [mailto:javi.merino@arm.com]
> Sent: Thursday, February 27, 2014 9:41 PM
> To: Zhang, Rui
> Cc: Linux PM list; eduardo; wni@nvidia.com
> Subject: Re: [PATCH] Thermal: thermal zone governor fix
> Importance: High
>
> Hi Rui,
>
> On Thu, Feb 27, 2014 at 06:47:48AM +0000, Zhang Rui wrote:
> > On Thu, 2014-02-27 at 14:41 +0800, Zhang Rui wrote:
> > > From cd587add3043ed7bf3347e5d956f65ec8adf04cf Mon Sep 17 00:00:00
> > > 2001
> > > From: Zhang Rui <rui.zhang@intel.com>
> > > Date: Fri, 24 Jan 2014 10:23:19 +0800
> > > Subject: [PATCH] Thermal: thermal zone governor fix
> >
> > oops. forgot to attach the updated version.
> >
> > thanks,
> > rui
> >
> > From dff1b207825609e73c7722bc79dda0ea29974931 Mon Sep 17 00:00:00 2001
> > From: Zhang Rui <rui.zhang@intel.com>
> > Date: Fri, 24 Jan 2014 10:23:19 +0800
> > Subject: [PATCH] Thermal: thermal zone governor fix
> >
> > This patch does a cleanup about the thermal zone govenor, setting and
> > make the following rule.
> > 1. For thermal zone devices that are registered w/o tz->tzp,
> > they can use the default thermal governor only.
> > 2. For thermal zone devices w/ governor name specified in
> > tz->tzp->governor_name, we will use the default govenor
> > if the governor specified is not available at the moment,
> > and update tz->governor when the matched governor is registered.
>
> Right, but this doesn't solve my problem. What I was trying to say was
> that we should get the default governor if tz->tzp->governor_name is not
> initialized. of_parse_thermal_zones() calls
> thermal_zone_device_register() with a tzp that has an empty governor_name
> and ends up with no governor.
>
I know, I tried to fix this by checking the input parameter in __find_governor, and apparently I did it wrong.
Refreshed patch attached. (My Linux machine is broken at the moment, thus I will resend the refreshed patch to the list later, if you think it fixes the problem for you this time.)

Thanks,
rui

[-- Attachment #2: 0001-Thermal-thermal-zone-governor-fix.patch --]
[-- Type: application/octet-stream, Size: 3068 bytes --]

From 635a1f41a8f95a35d1bf24c9cc018ffb018a93e6 Mon Sep 17 00:00:00 2001
From: Zhang Rui <rui.zhang@intel.com>
Date: Fri, 24 Jan 2014 10:23:19 +0800
Subject: [PATCH] Thermal: thermal zone governor fix

This patch does a cleanup about the thermal zone govenor,
setting and make the following rule.
1. For thermal zone devices that are registered w/o tz->tzp,
they can use the default thermal governor only.
2. For thermal zone devices w/ governor name specified in
tz->tzp->governor_name, we will use the default govenor
if the governor specified is not available at the moment,
and update tz->governor when the matched governor is registered.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/thermal/thermal_core.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 338a88b..1346205 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -56,10 +56,15 @@ static LIST_HEAD(thermal_governor_list);
static DEFINE_MUTEX(thermal_list_lock);
static DEFINE_MUTEX(thermal_governor_lock);

+static struct thermal_governor *def_governor;
+
static struct thermal_governor *__find_governor(const char *name)
{
struct thermal_governor *pos;

+ if (!name || !name[0])