From patchwork Mon Jan 21 15:40:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10774073 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 A537D6C2 for ; Mon, 21 Jan 2019 15:45:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93DA62A564 for ; Mon, 21 Jan 2019 15:45:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87B992A5C4; Mon, 21 Jan 2019 15:45:25 +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 3E9F329B3D for ; Mon, 21 Jan 2019 15:45:25 +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=Yhx6Ry4LKReMxVAcDiOUkbPdfSiEwXCOP46x3YvFAlM=; b=eAp8MBm3li8RXpOwiDh0vkNPb0 lE98+8Re84YyrjZBnIdECur6RdGi60USWOdlqOwP8YZS1+rKtgUrsVaFJ45Fb9UyKKAZyoDqLIKY0 SvqgyaoiPA6XtxpLj/oALcseJVaJG4GtDpSs+d6Y8fCe/wS4VN+KeTH7BjkchGQWA0l4pw9lfa3Io amyBTCzmIFjaFgqRPSUqh9n8ZyRM84IWZlDRPuB4UYCpSo9iK8wnnwRZhiv892IsOpxQEhF4ZCEBo gXz9C5G8FmwuPXHa0jENYaMHR7m7tyVPTkxoYCrWJ+TZgjUb13naWXfTrB6eFZO0w1zUnFVTDCBTh Ypv9rJrg==; 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 1glblL-00016H-Ub; Mon, 21 Jan 2019 15:45:23 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glblE-0000Wz-Jj for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 15:45:20 +0000 Received: by mail-wr1-x442.google.com with SMTP id x10so23879364wrs.8 for ; Mon, 21 Jan 2019 07:45: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=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=WZrUCGY19DdCA1w3IHmK8oICHtgLdphKhOGUd5vevBnrBwrSzPdnkuBmbMvPX8lyUJ gl2gYp4z2QWp6fpzF4xTqXXp1aWdW4A1icNf4057BL7T6Y0JC6fajhO44w6GvSJzq9kh mo+iF/5MENrCUeILCAUvYs9e1ty9iNJS79FpA= 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=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=Dwh6aT3V6Od0HCTfGHypQT8l/oWxz4L0IN8RLhK9NQ791sRJhXCw6rQXxJ9y8gOt48 e8PL/zBr1kOgjuMa44DL9AXrj1B8rfK+2mkae5Nxpmz2iadNJOr6DGw6rKRl9FowU7HO 9j8bRMeon3Dw9oxSQLDjedwEu05k8Z83gUbRGwxKs8Xxbzj1noEGjT7u4VNQl9YxhHqR j5J7J1/m9VB4d3hNHIUZ983VN2C5WNocV41XDx5HjjIDSSiG70JKlnZOag2nzh8aAzlV tsMDhzEShTBDEukvWw4c6MfPVA/AtNoidyNovn84KpeLBIfMp9igByQk1N/TiPYVbJXV Hbjw== X-Gm-Message-State: AJcUukc2QZ3Sq3UDV5R6+mqKgDETMgkvu9pcjmRCN5p7uvYJtl/qZDxZ R5pn1MB6QtFSB9E2p5X4GdANOw== X-Google-Smtp-Source: ALg8bN6vWF75HLhXc63FN75VVMGq8sjmo7J7dYzSKP/6RsvGbhhuiONu2VRLaImfOVzYYKxTUis/LQ== X-Received: by 2002:adf:f785:: with SMTP id q5mr28138392wrp.9.1548085514799; Mon, 21 Jan 2019 07:45:14 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id r12sm105023879wrq.3.2019.01.21.07.45.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:45:14 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v2 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:31 +0530 Message-Id: <4253d7a24e9c85ca24cceef599ab8da8682e0bee.1548084260.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-20190121_074516_786391_A07F5533 X-CRM114-Status: GOOD ( 13.63 ) 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, linux-arm-msm@vger.kernel.org, Sean Wang , "Rafael J. Wysocki" , dianders@chromium.org, swboyd@chromium.org, edubezval@gmail.com, mka@chromium.org, linux-mediatek@lists.infradead.org, viresh.kumar@linaro.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_AUTO_REGISTER_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 --- 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..9a937f4c63e7 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_AUTO_REGISTER_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 Mon Jan 21 15:40:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10774083 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 F26766C2 for ; Mon, 21 Jan 2019 15:46:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E15E529B3D for ; Mon, 21 Jan 2019 15:46:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D57162A59A; Mon, 21 Jan 2019 15:46:10 +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 89AFC29B3D for ; Mon, 21 Jan 2019 15:46:10 +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=2HWbvJtAzdVZOLifB6p1pkGyt5UaBH2hYf5GvLAqmQ0=; b=r4wtXfemI6qBhDugNx4XBjX1dY +jqErXiG6zLLlswC4k29Wtn2ZF2ovyHLyGSrdRMK2+wiA8G4QqJ++MpYJ/3eDQJNI4OndBPRLt2R+ NnHhdgb4iPRIRh8baQixGscFeIJ7vJnuzGgBEXNG5r8OZ/efToOWvK5kYIeo9Ztf2fFSL83RAcSZC XYroQZ1D+o/pue24ci70eyNkJyRRe8LgwddNjMEO5LF6LvpodAnxjgl89DQ23VkYzHybfaGmP2kJu +v2dpSbEf+hZ9sAqSLu/1XncXvpZO5q+RsT1NBSq4fGxdOQApdzYyv2Lry1rzjevace/ukfV43TZB 7XXyONJg==; 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 1glbm5-0001gl-0a; Mon, 21 Jan 2019 15:46:09 +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 1glblu-0001bk-9O for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 15:46:06 +0000 Received: by mail-wr1-x444.google.com with SMTP id t6so23864786wrr.12 for ; Mon, 21 Jan 2019 07:45:58 -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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=UYm41OgYi5vribcT/yRgVmTyOKfonDp1gCSdYoN5JVhxHQmtv7NPmG0xORTgY7t3pS T/H16ms5FnaubeVeQ/LqMlVCQyiGAXxiRrCooF7w9UuIa95pNlZAADkVBU6OMzCwfbPW Q82riebXP2V8q6m/jnTlG9XdykRzGvtKsBwIg= 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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=tyHiIY00KjJ4uTAa15ZKy6WOJZeYAq+6vzzAPKbsuZML5w1CfxPNrg8hUu7hmiePfH LEvHpqDTUZQM3UaOJdhwoJ+f4mjh5lzr6W9qO6xHYnWIweEb5lMEPCvLhosp2rrQlduZ drLuDHvPzdfAQT/cTV4TCr5cDS/cvkOkZqqSKP4ZWFPA2keRFNnX0LudkOgkflz4WhFC TFFQ72RdxeYefqMtoo5g3aeWe2v29FOnbQMvYRm76ES2LNOEnhCXpIwMp/InJUznkfh0 S7Nss7qVwHoGkPx31p128jlV4tpZcdxDZ+UIK2Swxtk/m+DRp8cQfq7xDeEA9tIV5hGK hOBA== X-Gm-Message-State: AJcUukeGZN+4C9lGybQruN7I+4aKlqYZo+L0l2H/h6sBtdVX9DTVm6aH 5+eDtD0o2H6cDyBWRb/gAZAh6A== X-Google-Smtp-Source: ALg8bN7MwcR6dMXp8pvIynQ+OvdW4EYi9UpwG+nEBgNT19XS6j5Na+F5FzRqF+C8LxR9uydo7yALXg== X-Received: by 2002:adf:d243:: with SMTP id o3mr29691751wri.66.1548085556785; Mon, 21 Jan 2019 07:45:56 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id g188sm64972795wmf.32.2019.01.21.07.45.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:45:56 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v2 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:33 +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-20190121_074558_748967_D4C09DB4 X-CRM114-Status: GOOD ( 13.63 ) 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, linux-arm-msm@vger.kernel.org, Sudeep Holla , "Rafael J. Wysocki" , dianders@chromium.org, swboyd@chromium.org, edubezval@gmail.com, mka@chromium.org, Wei Yongjun , viresh.kumar@linaro.org, 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_AUTO_REGISTER_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 --- 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..b19e9d129f8f 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_AUTO_REGISTER_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 Mon Jan 21 15:40:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10774137 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 209906C2 for ; Mon, 21 Jan 2019 15:48:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BEB729B3D for ; Mon, 21 Jan 2019 15:48:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF2212A59A; Mon, 21 Jan 2019 15:48:01 +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=ham 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 85D2829B3D for ; Mon, 21 Jan 2019 15:48:01 +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=LXcCpims0cde4H/eoR07WI4whLbVVqKRJ2V+Ti8tqa0=; b=CVhWK6deHouKyULmgbhPfGW8NO ERh40fdVJPZHJSf3hoHX3gTiJuA/4bCbGBr4BR6IcquZ0UclDh+54Sgn6SU2P9jA3OZb5wXYQ9mj6 zVm+t3IbOWvtpZCIoFI/biCpFrZJa0wGDMS96xHoshhrR2PgfNkXAFqLmkTQy8WWUS6VxZzcaGpMg 1+pEs7KUqOBJkxeIxoJqnsuK9K5A24MlAhrpjfERWx2oP/3ByAevYEKd7ps64I4Cbqkk7Ak+a+Goa 4FT2LjPDmWBdeBYcrODEOnAc/OI31T+xVvqX3DTHojJo+FQxe1I/8t/O8abNDhQx7gI6V5/A13jZz 1rIhw9YQ==; 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 1glbnr-0003LU-5x; Mon, 21 Jan 2019 15:47:59 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1glbmD-0001mq-Pb for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2019 15:46:34 +0000 Received: by mail-wm1-x344.google.com with SMTP id p6so11244468wmc.1 for ; Mon, 21 Jan 2019 07:46:17 -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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=coDADYUvLFZRTbz5rB1pf5MJLNgJCkEzFO1jTwKFqWh1GA28dam5wmRCxancPw/Dp5 GBdQkQrAkjKtJD2n5CdsmDgUylwyEBdk1BLAYCT9osd1UtM1DuYR0OzrrXAN9OAwQKBw MKy9m0aUUc1OTPR9tPiYejvzgnMQUEydRVX1Q= 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=SYmTutyluToL3cZRblSiyKMGdtJrDbJkCDhsvbmgtLQJQGO831Tzoepfg4YY5vkObC wArK9ItRNy9u91eCyoQ4BeZjTP16DkGsLFXh+Dg/21J5OyaaRrpKN4f7k18B26bXfS+Y 996nTOzWXazdwwrarQa6aimf+Sb7IgPEDj23Ac0vkAMOKnhoqQRN+z9F0wbjHWj/03D5 jb3cok7oYpwWwykNO2dbPvgg3i7v8J7s+SbB3hNFsVv1wXNgIQsKZtHMT3ULtuVqVKPe 1Aw/RCIv5DwKuLcxOKa8nNwhl/nP3f0a5K6lS9aihmJi5hi9DaFEh4ceqPMvfiZ8N7ou /+Yg== X-Gm-Message-State: AJcUuke/nobdP1FAH6+tIzq2F7O5bMvhoVqeTOhi0IL6vdtK+qc5Erka cCsLL/KC7Ja0fvoFx+Q+VUpA6A== X-Google-Smtp-Source: ALg8bN6KrMDLiPVFWulMBQxmdUdOwj5FwgY6rBQBghows4GKT0uTTyxiEruIFbnYJGQhzQfvpFkoKg== X-Received: by 2002:a1c:2e43:: with SMTP id u64mr25885532wmu.52.1548085575943; Mon, 21 Jan 2019 07:46:15 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id a18sm115239503wrp.13.2019.01.21.07.46.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:46:15 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v2 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:34 +0530 Message-Id: <95506c9919bee528838016dd2c857ebb28e19152.1548084260.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-20190121_074618_321555_FFBA44B7 X-CRM114-Status: GOOD ( 13.22 ) 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, linux-arm-msm@vger.kernel.org, Sudeep Holla , "Rafael J. Wysocki" , dianders@chromium.org, swboyd@chromium.org, edubezval@gmail.com, mka@chromium.org, Wei Yongjun , viresh.kumar@linaro.org, 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_AUTO_REGISTER_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 --- 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..82420e8e5f0d 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_AUTO_REGISTER_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, };