From patchwork Tue Jan 14 18:45:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 3487491 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D4FCC02DC for ; Tue, 14 Jan 2014 18:45:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38C002023F for ; Tue, 14 Jan 2014 18:45:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B65720222 for ; Tue, 14 Jan 2014 18:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751548AbaANSpy (ORCPT ); Tue, 14 Jan 2014 13:45:54 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:46924 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472AbaANSpy (ORCPT ); Tue, 14 Jan 2014 13:45:54 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s0EIjq1k002763; Tue, 14 Jan 2014 12:45:52 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s0EIjqfV023801; Tue, 14 Jan 2014 12:45:52 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 14 Jan 2014 12:45:52 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s0EIjpdT014161; Tue, 14 Jan 2014 12:45:51 -0600 Received: from localhost (j-172-22-130-193.vpn.ti.com [172.22.130.193]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s0EIjlt04929; Tue, 14 Jan 2014 12:45:47 -0600 (CST) From: Eduardo Valentin To: Zhang Rui CC: Wei Ni , Eduardo Valentin , , Subject: [PATCH 1/1] thermal: fix default governor assignment Date: Tue, 14 Jan 2014 14:45:37 -0400 Message-ID: <1389725137-16147-1-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.8.2.1.342.gfa7285d MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reported-by: Wei Ni Signed-off-by: Eduardo Valentin --- 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);