From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F34F0C83000 for ; Tue, 28 Apr 2020 15:31:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D91052075A for ; Tue, 28 Apr 2020 15:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbgD1Pbv (ORCPT ); Tue, 28 Apr 2020 11:31:51 -0400 Received: from foss.arm.com ([217.140.110.172]:54322 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727917AbgD1Pbu (ORCPT ); Tue, 28 Apr 2020 11:31:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0538B30E; Tue, 28 Apr 2020 08:31:50 -0700 (PDT) Received: from [10.37.12.125] (unknown [10.37.12.125]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0ACA3F305; Tue, 28 Apr 2020 08:31:44 -0700 (PDT) Subject: Re: [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device To: Daniel Lezcano , rui.zhang@intel.com Cc: amit.kucheria@verdurent.com, "Rafael J. Wysocki" , Lorenzo Pieralisi , Sudeep Holla , "open list:CPU IDLE TIME MANAGEMENT FRAMEWORK" , open list , "open list:CPUIDLE DRIVER - ARM PSCI" References: <20200414220837.9284-1-daniel.lezcano@linaro.org> <20200414220837.9284-4-daniel.lezcano@linaro.org> From: Lukasz Luba Message-ID: Date: Tue, 28 Apr 2020 16:31:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200414220837.9284-4-daniel.lezcano@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 4/14/20 11:08 PM, Daniel Lezcano wrote: > The cpuidle driver can be used as a cooling device by injecting idle > cycles. The DT binding for the idle state added an optional > > When the property is set, register the cpuidle driver with the idle > state node pointer as a cooling device. The thermal framework will do > the association automatically with the thermal zone via the > cooling-device defined in the device tree cooling-maps section. > > Signed-off-by: Daniel Lezcano > --- > drivers/cpuidle/cpuidle-arm.c | 5 +++++ > drivers/cpuidle/cpuidle-psci.c | 5 +++++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c > index 9e5156d39627..2406ac0ae134 100644 > --- a/drivers/cpuidle/cpuidle-arm.c > +++ b/drivers/cpuidle/cpuidle-arm.c > @@ -8,6 +8,7 @@ > > #define pr_fmt(fmt) "CPUidle arm: " fmt > > +#include > #include > #include > #include > @@ -124,6 +125,10 @@ static int __init arm_idle_init_cpu(int cpu) > if (ret) > goto out_kfree_drv; > > + ret = cpuidle_cooling_register(drv); > + if (ret) > + pr_err("Failed to register the idle cooling device: %d\n", ret); This and similar from cpuidle-psci.c might produce a lot of error log entries. The 'return 0' below does not take into account that we failed to register cpuidle cooling. Thus, I would rather ignore the return from cpuidle_cooling_register and move this print into cpuidle_cooling_register function, changing it also to debug level. > + > return 0; > > out_kfree_drv: > diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c > index edd7a54ef0d3..8e805bff646f 100644 > --- a/drivers/cpuidle/cpuidle-psci.c > +++ b/drivers/cpuidle/cpuidle-psci.c > @@ -9,6 +9,7 @@ > #define pr_fmt(fmt) "CPUidle PSCI: " fmt > > #include > +#include > #include > #include > #include > @@ -305,6 +306,10 @@ static int __init psci_idle_init_cpu(int cpu) > if (ret) > goto out_kfree_drv; > > + ret = cpuidle_cooling_register(drv); > + if (ret) > + pr_err("Failed to register the idle cooling device: %d\n", ret); > + The same here. I would change it into one line: + cpuidle_cooling_register(drv); > return 0; > > out_kfree_drv: > Regards, Lukasz