From patchwork Tue Jan 29 04:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09EA313B5 for ; Tue, 29 Jan 2019 04:58:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE1782B216 for ; Tue, 29 Jan 2019 04:58:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E20E92B38C; Tue, 29 Jan 2019 04:58:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9379F2B216 for ; Tue, 29 Jan 2019 04:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=DEeqAtBqBndf4UkmxF36E30eca38LXPMqphRS7YwOUc=; b=dWAkzAsAiXAB/Y4TL53G+UAQ4Q pTwu6q8qNpLeQHduMJZviHHhfrq0Oec6EY8bnrtDv8oj98pdOMKKPZFJCJLMAYdrX+kU+IgD1S2PM xblFPl+gxkbEoasjFcmwbsJQgkYP8rOHIVFNsiVXCVj+8EagdNXhZhQTfeUmQBoXqwoTGlyvQoZq/ cDL/JW5uUiuzogKqPFvU0RwAo8VJJpJymXndUoikewUTpsopJDkLNeF8lAMZzbQguPJmBZwHAtWL7 XEEZllWfxE4sLX/MBmDWkFSL4qlL7ybV2Vn0qQs7Jtp/ZNJTrjzWff3ZyYcqtNvjoHoOcBR5yI1y5 8CKEtCWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1goLTX-0003SD-71; Tue, 29 Jan 2019 04:58:19 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1goLTU-0003RW-QI for linux-arm-kernel@lists.infradead.org; Tue, 29 Jan 2019 04:58:18 +0000 Received: by mail-wr1-x444.google.com with SMTP id l9so20452767wrt.13 for ; Mon, 28 Jan 2019 20:58:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=anE2vDQFGsF1XAH9CF3uxaknWOljYGMhl2CzciW+AY/hDoFhzqbpIBHB4a7QW3S8bl LzXlRKbR2mul+a6Puig7aadA8sQiu9FpEqXSzZhq+1XVpFjjltMi6bf+tkeo1p+ipT3C cQp2f1YPstwlKD2T7RT2Mdhqp+4aAANaszQ+g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=aW17KDgvccn3Wj79poY0KbBIeKdrfu9TXxCCWgiLpLu8D71fllc5cXBPIoP1hxRJo2 cLVSY6C+36pzaR5QpQCAqpwL/fr8LCe5aL4YXIeN2xI11SOYEjHxWM5m0o/ZrLOzW4KV rToDYfQoesbobVXzlM2kOhLhTJYIBoIayfFs7XFuUNIhK/rK0ONQpYVkLJCAcHD9ogAz Gsfsd3kS267EsmAc4p1i0UlYuxZhXcgAzXHqHcdfyvCRkEvdV+1FkW+kJuKeQHlExaoz e/kk27+QPgf1+5hH/KC3FK2rGmJOVJM1tZeoXEcYJXiz30pxuZSubA3BsVNYCcIYEvld aj0w== X-Gm-Message-State: AJcUukeTUjfuvOqascuTP9bIgvFmDeGlnr4bn3/cDQ/Cfwke8PI4IA3C pjleaMK4sKE/6frmQDxNSaMmxA== X-Google-Smtp-Source: ALg8bN5iW0BV+F0TjrVK5FWW51JWwOc6PxD2qUoFZ3RJ9thGLu66KEy7/JexxnljuVPUMsceXISG3A== X-Received: by 2002:adf:f449:: with SMTP id f9mr24838998wrp.40.1548737895053; Mon, 28 Jan 2019 20:58:15 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id a8sm2977581wme.23.2019.01.28.20.58.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:14 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v5 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:12 +0530 Message-Id: <36eb429112e84263bdbd26d8ea3027f71eeb862e.1548737236.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190128_205816_847111_3EB86D08 X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Wang , linux-pm@vger.kernel.org, Viresh Kumar , Daniel Lezcano , "Rafael J. Wysocki" , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the CPUFREQ_IS_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano Reviewed-by: Matthias Brugger --- drivers/cpufreq/mediatek-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index eb8920d39818..4229fcc31310 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -48,7 +47,6 @@ struct mtk_cpu_dvfs_info { struct regulator *sram_reg; struct clk *cpu_clk; struct clk *inter_clk; - struct thermal_cooling_device *cdev; struct list_head list_head; int intermediate_voltage; bool need_voltage_tracking; @@ -307,13 +305,6 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy, #define DYNAMIC_POWER "dynamic-power-coefficient" -static void mtk_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct mtk_cpu_dvfs_info *info = policy->driver_data; - - info->cdev = of_cpufreq_cooling_register(policy); -} - static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) { struct device *cpu_dev; @@ -472,7 +463,6 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy) { struct mtk_cpu_dvfs_info *info = policy->driver_data; - cpufreq_cooling_unregister(info->cdev); dev_pm_opp_free_cpufreq_table(info->cpu_dev, &policy->freq_table); return 0; @@ -480,13 +470,13 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy) static struct cpufreq_driver mtk_cpufreq_driver = { .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | - CPUFREQ_HAVE_GOVERNOR_PER_POLICY, + CPUFREQ_HAVE_GOVERNOR_PER_POLICY | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = mtk_cpufreq_set_target, .get = cpufreq_generic_get, .init = mtk_cpufreq_init, .exit = mtk_cpufreq_exit, - .ready = mtk_cpufreq_ready, .name = "mtk-cpufreq", .attr = cpufreq_generic_attr, }; From patchwork Tue Jan 29 04:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A5EE1390 for ; Tue, 29 Jan 2019 04:58:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC80C2B2FE for ; Tue, 29 Jan 2019 04:58:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE0D82B301; Tue, 29 Jan 2019 04:58:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 86C422B2FE for ; Tue, 29 Jan 2019 04:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2StlJ/HsXeW8GrUqQOvrkm6fRLSlRwFJlkCx3pSg/a0=; b=RHkUPWlm3gVcjA3bwVeyhuddTq oQC5lz81+9B5nM8UjuRCed5heTUqa2CL9YRZbcVlhmCmK67QH8Re/l7IgFw7FCiSt2D7r1/6MN8u1 8E1LbqmAihxdlEZkYqp78HaS3WHC051LbJtIj0qxHZhPOPITHMQ0JvPkWNILhs4GkaoTe8HUDjNc/ oERPimAFS4juLWMc364z3FtidZ+W2Lv7F6ZzUc5cuwb5o28OQdgK8dmX+jyJoDFzQTGH8Jp818eFY dG5AHz+A3m+ZCJvrW+r6t5QCWV5cffIWmjjh29crjqTOrxyA+Bf+Umen6O4/QSt6QT9Z+LU/b/ZES 5LM32X5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1goLU3-0003lG-Hg; Tue, 29 Jan 2019 04:58:51 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1goLU0-0003kp-3s for linux-arm-kernel@lists.infradead.org; Tue, 29 Jan 2019 04:58:49 +0000 Received: by mail-wm1-x341.google.com with SMTP id n190so16342250wmd.0 for ; Mon, 28 Jan 2019 20:58:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=SKkw+bx9M7a1C7KFz6NtETyB1HBgVDEedtQCAyZlJS20Esw+cYWkadE9BRpxg7FN9v fSTti4bcAemIotQ72wCEHy/4Ibs01qFlFne/uFQ0/dWsQ3O4hVXI40wKT9tQNZu7s0Q9 KZKZeWQZxlWlQ/LA/VRqGQ5c2PSEfdY4+SLDQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=hm4Qa+30li8WwfiZCGHliq8+c9Q+I8DPzj6HbXsdyM1lnuhLQkax1GheGW4l/OzLWY WCEm1g61NsX/1mPuVNaG/n/TaJOZgg1HhoioEUbOEIPE/MxfcA1boJZ5rYBuXRS7SOJ+ O06i0i76yzSpkoradudzoKqutpRkKcrc0TXibQTp0N19FQdS5CN6LwbtgLzhzLeZvYfO Ydx8JtrcA16ezr8H5nWplif/4zXM772I2GdHosdnsfkksvxs7C8YJf1hrciYLzjsj+mz 6NewO+tUKu/+CKu1cH8/Y/A+LXXDqcLiVevjXpFk2EoU/SuoGU5Vpoiq+Jq2Tq8G9/ju +moQ== X-Gm-Message-State: AJcUukcGqhMemUyA2IqJO1xCJcxzIEgRbEB/wWLKv+tc0aMrQN0zc7Lo D6y01tFI4iL4TsOLpnmM5Ij4ZQ== X-Google-Smtp-Source: ALg8bN7lQ4NZxXpPYYyKI5DUU25o6+aZkafyPjktEveuyTl9Mfybi/gfZyuPTCpUrUcuUKYg9snh3w== X-Received: by 2002:a1c:2314:: with SMTP id j20mr19221835wmj.142.1548737926560; Mon, 28 Jan 2019 20:58:46 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id 125sm1908131wmm.26.2019.01.28.20.58.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:46 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v5 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:14 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190128_205848_151092_7C24A596 X-CRM114-Status: GOOD ( 13.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , linux-pm@vger.kernel.org, "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, Sudeep Holla MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the CPUFREQ_IS_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria Acked-by: Sudeep Holla Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/scmi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 242c3370544e..66b633b48eb1 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -22,7 +21,6 @@ struct scmi_data { int domain_id; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static const struct scmi_handle *handle; @@ -185,7 +183,6 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) { struct scmi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); dev_pm_opp_remove_all_dynamic(priv->cpu_dev); @@ -193,17 +190,11 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scmi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scmi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scmi_cpufreq_driver = { .name = "scmi", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .target_index = scmi_cpufreq_set_target, @@ -211,7 +202,6 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .get = scmi_cpufreq_get_rate, .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit, - .ready = scmi_cpufreq_ready, }; static int scmi_cpufreq_probe(struct scmi_device *sdev) From patchwork Tue Jan 29 04:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED25413B5 for ; Tue, 29 Jan 2019 04:59:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD6EA2B2FE for ; Tue, 29 Jan 2019 04:59:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D14372B301; Tue, 29 Jan 2019 04:59:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 854222B2FE for ; Tue, 29 Jan 2019 04:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=E02L41O5HKiYNl6wtJdMjL61bIERhcerSes4jtTDOzI=; b=Xg4FRblZpCDPz8ySch13I0B5yc MnqOx7T8XKxX0eBWrwwoUoOq5kCCiS5Ai7zSoEl/acYfnIcI6+7sGpJVP633+5J8YgFC25IoZNfXx HPZjhMqRa/EsH7j679HKNoffHE8hc/DjXw7paJ5+ERXOwR71beoTbzrNVkT66IMCetSUsfz18LHAK F0eTQwC4Uual3AutZBzCFQhGE8KCRG29tzdCWmblxo/jZBhzyb4U3t4xSEDhpJfFoH1+8zGCPGwCm CK+AwNlR2gCa9hWDa0wKAIcunEZy/nz/McFPlbcIlsndqtJWJ44jI7UrZs4HRl0PniVXDN9Q9TqKq lB9LRs6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1goLUO-00041L-ET; Tue, 29 Jan 2019 04:59:12 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1goLUL-00040d-Gn for linux-arm-kernel@lists.infradead.org; Tue, 29 Jan 2019 04:59:10 +0000 Received: by mail-wm1-x341.google.com with SMTP id y139so16188138wmc.5 for ; Mon, 28 Jan 2019 20:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=OIQOgBgIYGQMD5MsHLsxxua0J6GIoPteH87r+Nqm3iXi33wmq5/SA3xu6C8XWZeUE8 5BEPB+ixLyvmyN1VSzTniLJcAQ+MjLrbckzu2gqa6qKrt5+DdT5GzOYGwqFuuE/b8D9+ 9tSK6SeE3Z0bHjhe2bBP4bRqYLweIzNozPMnM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=UGNo0yJMlLVTs1clH+iRFfwwevBVPvIYuilR/T5uOwAPRH8bFNBxYHPzzErYnkL8pC 8V75YMbejMFzpkIDM7bKEqI6+RYDNbKD0wTjTl9v2aGFv5ZPTIGkMbnhMjdJDQqG50Gy eBOlXXcX+7yoMQmh2sRi01YgLjJc3lIgjvGBpcQPDC/natTllTVwmgtmOndC+gUBuXt5 I/Kv8DmZn+kLx/zvgKzxIeewOIDQBt1JY3Moeq2cDqydfxYGD3Lp3z7OyMw5PfBjvyXC mrNSFT0/tvJ2CBHHtl51Npp1zK8Sc31Ivs79ir098yFTjROJlZnBsanTElgiUQTezSSi 75Zg== X-Gm-Message-State: AJcUukdHeSWR9byw4irzZ45J0FKSDPm1U2u2KNhdVSDIAjVQryN2hfW/ yIAC680kxVELYxCwDD3+XLoU3SRaKOY= X-Google-Smtp-Source: ALg8bN6bI6kCxC4BqxUEiUgTYI6W6CiLIOnshiFU+e/0Ybp+o8c7bUzIrCsxiftfkgC9xU9EH8URjQ== X-Received: by 2002:a1c:7dd6:: with SMTP id y205mr7116773wmc.121.1548737948077; Mon, 28 Jan 2019 20:59:08 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n127sm1733195wmd.20.2019.01.28.20.59.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:59:07 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v5 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:15 +0530 Message-Id: <082a9bae988061ea5465f7cdb4b0c61b4230cd59.1548737236.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190128_205909_577831_CAFA8978 X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, Viresh Kumar , Daniel Lezcano , "Rafael J. Wysocki" , Sudeep Holla , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the CPUFREQ_IS_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria Acked-by: Sudeep Holla Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/scpi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 99449738faa4..1db2f6927e13 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ struct scpi_data { struct clk *clk; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static struct scpi_ops *scpi_ops; @@ -186,7 +184,6 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) { struct scpi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); clk_put(priv->clk); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); @@ -195,23 +192,16 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scpi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scpi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scpi_cpufreq_driver = { .name = "scpi-cpufreq", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .get = scpi_cpufreq_get_rate, .init = scpi_cpufreq_init, .exit = scpi_cpufreq_exit, - .ready = scpi_cpufreq_ready, .target_index = scpi_cpufreq_set_target, };