From patchwork Mon Jan 14 16:34:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10763137 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 0F990746 for ; Mon, 14 Jan 2019 16:42:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F04B629633 for ; Mon, 14 Jan 2019 16:42:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E401F29654; Mon, 14 Jan 2019 16:42:13 +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 9B54129633 for ; Mon, 14 Jan 2019 16:42:13 +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=mLNcvhucj5FFBhQez7uu26jdKu IgrO0m3/rM5AWmvgc5h83Uy8zCBm1Qm5csMWcdXFs9/MhrfO9BWGYR3GG5ZbYq/xufzJi/sSenhWH 7koYYJ0Rp1Qhuz4Gy87o46u2L9fSS7Fm/tQPOT19OvjI4jUz/GcDtEk6bx0noOzHdIaueRulOaYee CJfnqYnsFkDsCIzp7e9QinUkTPYdz5zUQ4O0N8/SIqmQ+0w1UN7hF3kOom0Dswdjo9alFTL4LVCLZ XVLe22gppZ+g3408pUT1MVK28dI6vQPMBpX0aLxnOp5e+LIONgk1ibqqHRdjBibw6vo6LEKYAh9Ei EP572hNA==; 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 1gj5JS-0006wd-JS; Mon, 14 Jan 2019 16:42:10 +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 1gj5JO-0006vE-HM for linux-arm-kernel@lists.infradead.org; Mon, 14 Jan 2019 16:42:08 +0000 Received: by mail-wm1-x344.google.com with SMTP id g67so229049wmd.2 for ; Mon, 14 Jan 2019 08:42:05 -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=Vn/oqcY/P63zY8ZUM+xRQ9jA/yok6Av41I0Nbd/XBcMYaybRLswoqC+bZ7zFthiL99 AD8roHRXIq4z/jltTQDQy+bZ3SYq2XsqBoRpBPDqUlr3MrNNQ8pHTqOE2xiKwhPFJy1I +jhPvzj5X/ykiwTALhSNyEO8GSfyjhARHv/Z8= 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=pFaseorXSUFR2YZ5OfGo2fRcBJVl/3mckAayQXapACca+XT+mF7vQZtzSBl2oz2rdr vJivPbdzezs5c8iDTC+k3AYFt6+u/ccadOoscB5KBmegkcEe/Xhl5wal2CXUQGlA2o6D 8Qb6JX2H97sSYQ/mGJkarGviOKuR57rPxTHRyCNbeYXfeydz3Ju5OsUs+ArQ+SX2UqLJ 7JHnLcIQYylqgNg8+TWYlEq/EwnvTmvy5JLZiCXMc5YlJxiCiQcLRSyf2W1o4la2B8l4 6rK4c28Sa/Gttw7IQ7JUtVHwIPu5KQs0fKS/xbhmmlOcIvt/p3qs4BoU/0cEJSlsAgbp x1kQ== X-Gm-Message-State: AJcUukffE+laQnZufGLTDqYcOEtUOp6X5cL6xn7nyK01qGWkr9CCqgNd ggDwK7iEOHp7WGc7j+YXpl2Q5g== X-Google-Smtp-Source: ALg8bN7mqoKQiOsb2WAqJ6DGUQ8jr6Te4CeoL5mDym674Xao19ig/KGBq4YHGSzRMedmhyjopdmoEQ== X-Received: by 2002:a1c:2007:: with SMTP id g7mr12266919wmg.79.1547484124495; Mon, 14 Jan 2019 08:42:04 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id k3sm110603159wrm.7.2019.01.14.08.42.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:42:03 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v1 07/10] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:04:59 +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-20190114_084206_573288_5B6DB0EA X-CRM114-Status: GOOD ( 13.45 ) 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 14 16:35:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10763151 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 6AA3C1390 for ; Mon, 14 Jan 2019 16:43:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59040295D7 for ; Mon, 14 Jan 2019 16:43:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D2E129630; Mon, 14 Jan 2019 16:43: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 02ABF295D7 for ; Mon, 14 Jan 2019 16:43:24 +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=ivmeJVlcaZHrN70vLZq4nM29MgtLaWj8Bl43vmW6U3s=; b=D8dZAx83OQziSqcfqXrwv/U8yk kGTgtDzfWtoFFdQ7zlcT/VdQEA/YofBLs+3aoPFtZp7Ih0MLkexyHVrxPU1TdjD/9WaZlvQZq3ZMB bA0Y4eIA/M5O7uh+pTipIu04lqMn5nTHDeT5+JtRFA2stAYzAziFmK8M9wWadG8SdFXYE4fuLJ+wi nxgQ5Im1V1RLXUnway2W6+M6iIfogaze0hs0FtPULIxfgUuel3K9cD4aL1GAQbhUQGkJm/8SssAc0 5ffzHmfyMwyWXSI4bNAvP2koBgCKEFQHboeDBrdtCWdapHyao0awPMIr2Awj97BLi4Btq333T6uPG US5CVWmA==; 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 1gj5Kd-0007zt-AJ; Mon, 14 Jan 2019 16:43:23 +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 1gj5KT-0007xu-RS for linux-arm-kernel@lists.infradead.org; Mon, 14 Jan 2019 16:43:21 +0000 Received: by mail-wr1-x444.google.com with SMTP id r10so23660798wrs.10 for ; Mon, 14 Jan 2019 08:43:13 -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=mDodrn+SCjmkCblcpvbM4z/vNhnHCT5BvbpgksmUkgc=; b=Fhy70gTL0OMX9xMLnahPm61C2gyyRa/Xm4VRechtSjnkGyMbcPSkmfRt3cnQNNqQQ7 8fc921xreoiDTRnUNG8vNvQGRtCba0fQmxktSO/vqXw2OhKGxHwXekV7VUmqX6pZRXgW A7SLloAtz9L09a9i5Yvv0XYBV2Ma17qDbQuVQ= 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=mDodrn+SCjmkCblcpvbM4z/vNhnHCT5BvbpgksmUkgc=; b=OUhXAZCKO36QNxo3h4ILgXaX97vCyQI6U3YemDjfMC8rlG0sMhWPwWF3Rv2ETQMITP pooOaNJ8rpRUGWY6UewHk3maNtAUEjmyJqk+sKJshMzoIcGP8LkfToHctUMDnugFRMIA PWbrwRn2/fWye/AQk4h+BiHRC5QonEbmqOzJP1J0yccaO7oe0CsYn2KmrwUwkysh8apX Oli2ET26tLcfYGaaxv/9PWuGHZxC65tMYqvD252QKILBTHweCSZcP1JVTawQbrl+cAyb Do/unDuyJ6ytEGl3dmmrNmiPEdoV1nEtfVKS2FfwRV9urAd6diKEZZ9pd1MJcwWW0+4I UlBA== X-Gm-Message-State: AJcUukcyQxnpUxEkBzsWlSqZZ1LOO3wFonNbiI9TJyRU3EYh2FL4hIvw wix51gT+QPJdfyZZsRImvXL3Bw== X-Google-Smtp-Source: ALg8bN6zHe/OsxMKKheKzh7ajANwFUVMRdZ/FaxbB5Jsbc3WBwdpnCitCEDI+OI3cXEFT2xKrPhDtw== X-Received: by 2002:a5d:45d0:: with SMTP id b16mr23989728wrs.86.1547484192218; Mon, 14 Jan 2019 08:43:12 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id s132sm12237023wmf.28.2019.01.14.08.43.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:43:11 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v1 09/10] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:05:01 +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-20190114_084313_985896_0C8B2636 X-CRM114-Status: GOOD ( 13.56 ) 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, 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 50b1551ba894..f062a84a1175 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_cpumask_remove_table(policy->related_cpus); @@ -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 14 16:35:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10763157 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 13D98746 for ; Mon, 14 Jan 2019 16:43:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 013F027DCD for ; Mon, 14 Jan 2019 16:43:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E90B927FAE; Mon, 14 Jan 2019 16:43:49 +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 9039627F88 for ; Mon, 14 Jan 2019 16:43:49 +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=smaPsntxjDGrSQXYrjdNaC2dwSWWCSFD58c1vVmmAiI=; b=BnJCDfsr/NvTXvLm8FbKKS7mZW Ejpf5Rs1gb/K52UNNmt5aHI/KZj8VAJTbERwsOu6DmTq0TbfaGHT5LOpi4CSh3CMC/XXDXB47CxdX K1gJXTt3xX5gdxRSa6otOTRa9JndvZ0rQFX1VWt1OpfGeDGKibmgXu7PDGSmn6cHhidnb3omAt7mj a+nbfuPHYYmb+MZRi9uNee8eMmgVNKwhoPHqaDk2m+3hDtyeJ9o8v+ApQy+4x3bRj/JEohy0ST5LB 2Bb+c1a7znLL3L8RXKL3QLBjR0hBWRxLZ7WOPQyD86If1iaXWppbmdH9ZyzrVynOgFKVCkK5oyS8C 17sZicLQ==; 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 1gj5L0-0008H2-L6; Mon, 14 Jan 2019 16:43:46 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gj5Kk-00085Y-GH for linux-arm-kernel@lists.infradead.org; Mon, 14 Jan 2019 16:43:44 +0000 Received: by mail-wr1-x443.google.com with SMTP id s12so23685728wrt.4 for ; Mon, 14 Jan 2019 08:43:30 -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=8jUWUXinqrIEk2wbCrHnyISvXX2O3vcX46RGBCRFza8=; b=CZRSEX9xhalKjgqG4U+P2MSdMyDo7y7Xr/ytxGZM78A+F/9DrRIo/KhQWHyj5c1d9U i7GpifF0VdNNm1c/Ky6ueBZzsUWSqv1swnoeLzzbJJIe6CwwmAHNO2t6g0/JRxI3QeEk 0VHkhylq59Tre+6qsnnEjgjbSOedrDEZjKMFM= 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=8jUWUXinqrIEk2wbCrHnyISvXX2O3vcX46RGBCRFza8=; b=EA0OBHLqEW41CUP7AmdcrseyownMdcWATskMREKOFXUabl6fyWsEWR7YhyCm2wtXIl 4CkoVfeDH/hVxzDjxW6K9Trg/Z96Qa8HkZMD9UKCPtcnvkR3XddF91QKRgR/OFnWRep8 k/e8J2YD6ddv6OI8DKegV+C748TEWQeIKfioFhkWIlTUsOq0lfl6hpbWWvLSBw+787rN 8HKEbdlpG0cizSEGkh5zqCbVxX99vFcmxgkJaUJGI6VElYZzqV58CaVxZPDjE5v4ZU6m RhLz6zWYs9q09EoHYbq8NAuPoUgtIXiorGQ32xBjyWw4tmeTZ+1q/Lwj4S5jwtNrmwV7 FzSA== X-Gm-Message-State: AJcUukePRPuvAqr0kAR801KV6mmJKTx9zxYp/k811H3YEEoU+CnWdK+8 mwecqG8peCrUaKlpFWavDIKdRA== X-Google-Smtp-Source: ALg8bN7gnnHsFpYDNmwBC+drqi83as5YoAeuieSwHayKGL0PkzLBbetQmfvTApWSP/zr++6WgEITyw== X-Received: by 2002:adf:80cf:: with SMTP id 73mr25037001wrl.57.1547484208974; Mon, 14 Jan 2019 08:43:28 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id f10sm7842762wmb.35.2019.01.14.08.43.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:43:28 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCH v1 10/10] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:05:02 +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-20190114_084331_147110_DB444D9B X-CRM114-Status: GOOD ( 13.15 ) 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, 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 --- 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 87a98ec77773..c01c63a342c9 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, };