linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduardo.valentin@ti.com>
To: Zhang Rui <rui.zhang@intel.com>
Cc: Wei Ni <wni@nvidia.com>,
	Eduardo Valentin <eduardo.valentin@ti.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] thermal: fix default governor assignment
Date: Tue, 14 Jan 2014 14:45:37 -0400	[thread overview]
Message-ID: <1389725137-16147-1-git-send-email-eduardo.valentin@ti.com> (raw)

When registering a thermal zone, passing an invalid
.governor_name via struct thermal_zone_params may
create a thermal zone without a governor, when it
is supposed to be the default governor.

This patch fixes this issue by assigning the
default governor, whenever the zone has a governor
set to NULL.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
 drivers/thermal/thermal_core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index a621e90..967d980 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -89,7 +89,7 @@ int thermal_register_governor(struct thermal_governor *governor)
 	list_for_each_entry(pos, &thermal_tz_list, node) {
 		if (pos->governor)
 			continue;
-		if (pos->tzp)
+		if (pos->tzp && pos->tzp->governor_name)
 			name = pos->tzp->governor_name;
 		else
 			name = DEFAULT_THERMAL_GOVERNOR;
@@ -1527,9 +1527,10 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
 	/* Update 'this' zone's governor information */
 	mutex_lock(&thermal_governor_lock);
 
-	if (tz->tzp)
+	if (tz->tzp && tz->tzp->governor_name)
 		tz->governor = __find_governor(tz->tzp->governor_name);
-	else
+
+	if (!tz->governor)
 		tz->governor = __find_governor(DEFAULT_THERMAL_GOVERNOR);
 
 	mutex_unlock(&thermal_governor_lock);
-- 
1.8.2.1.342.gfa7285d


             reply	other threads:[~2014-01-14 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 18:45 Eduardo Valentin [this message]
2014-02-27  6:44 ` [PATCH 1/1] thermal: fix default governor assignment Zhang Rui

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=1389725137-16147-1-git-send-email-eduardo.valentin@ti.com \
    --to=eduardo.valentin@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=wni@nvidia.com \
    /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 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).