From patchwork Fri Jan 25 07:02:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10780659 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 F040D13B5 for ; Fri, 25 Jan 2019 07:03:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D894E2F843 for ; Fri, 25 Jan 2019 07:03:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C86672F862; Fri, 25 Jan 2019 07:03:31 +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 6C0642F843 for ; Fri, 25 Jan 2019 07:03:31 +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=XuBnndUL0min1f03EQ/Uw3W+g+ vmmloXJV6c0RWB1G/lTf7Tnu4/k+opYdAaGUjF84TjowT7zLaKxarECkhGU2KaxOaDI6yDUSO47wT rWvLg91ZLw20ak72mfjeaUFNPIPgL2omKzd7qRUxMAMK4p6QtczSMDElr4xqWvZQqNMJcksaqObbM ZQCnbfdZ/AIRMoqDLfJ5KdSZQrO5eGIKAaAApsz09sFAujW6usmaCoajHlECS/aqvo/l9BV0P0QwA 4gRDasVssTUebzNH9NhZ+FANLdgtwsSIVmNDlDjvfFZUYWd/lxXR8goN3goeGhyf66K2YXOuUlpkf ojNgzkYw==; 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 1gmvWT-0004ty-EJ; Fri, 25 Jan 2019 07:03:29 +0000 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmvWR-0004ss-40 for linux-arm-kernel@lists.infradead.org; Fri, 25 Jan 2019 07:03:28 +0000 Received: by mail-yb1-xb43.google.com with SMTP id x9so3446981ybj.5 for ; Thu, 24 Jan 2019 23:03:26 -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=Sbigyd7JmgLIlZ+I8Oa1biLl04Yqaku8qwP4GxQjehESlXzS4ZDj06HZsdDus/h5jp 6pchh/E0nJernzSmSS/DQOTeRvMl0jDrvFSc6TyL3twTCmUGu1Nc01rRiSKUv5Oj0qBY ouKw3DMoqh48jdgClJF2nCqK3oD35XsPX3Y10= 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=a2Bd2BvhIqr9YukCTrfSiXa9rioPBTY2bIEDBNkkyW+3rMCoqyuNpiNn3HiyY9oo3n Vgr4v3DGyQUdQ12HKwJ94CAygQ2+xR0wKh4CtWuRxslnYekUMBasqJ1cH9ILH/D3xwWf O2qtgQpECoA2M/dnsVG/lvwSfQoYC12ryCdgXVTkNycJHcd3T9wFlN19G1zt+IWv4LQE AKU0hPSFhwnfbIZhEh64rfN4sbwrduyrWgTeOfYc8vQFf5rAAMG9Zbz8tmDDQ1bWE97P vzBRswu1z4pLIMrI9UfBU/ugzSM8QW3T/wqPAf6GEX091hgkbwusjXvUe5i7JZNtT1wq mA/Q== X-Gm-Message-State: AJcUukcHpsovsv156F6ANCE05zNmX1zGTwK+Ml+Xjvjas+BDX4HpkNIf 7aSK+F9FFJnBsxAw3EvXXQs/gg== X-Google-Smtp-Source: ALg8bN58EbqqRRNEU3mB7QLSSmV6TAP0kmLn1/+IwmGM/Dg7drlFTgOUGrtSJLqTJKTTjCRc3wyIog== X-Received: by 2002:a5b:412:: with SMTP id m18mr9106264ybp.243.1548399805154; Thu, 24 Jan 2019 23:03:25 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id f62sm10310024ywd.68.2019.01.24.23.03.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:24 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCHv3 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:26 +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-20190124_230327_165472_CA8FF1C3 X-CRM114-Status: GOOD ( 12.85 ) 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: "open list:CPU FREQUENCY SCALING FRAMEWORK" , linux-arm-msm@vger.kernel.org, "Rafael J. Wysocki" , dianders@chromium.org, swboyd@chromium.org, edubezval@gmail.com, mka@chromium.org, "moderated list:ARM/Mediatek SoC support" , viresh.kumar@linaro.org, Matthias Brugger , "moderated list:ARM/Mediatek SoC support" 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 Fri Jan 25 07:02:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10780681 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 6B59413B5 for ; Fri, 25 Jan 2019 07:04:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 571F72F703 for ; Fri, 25 Jan 2019 07:04:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A6132F843; Fri, 25 Jan 2019 07:04:30 +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 E74152F703 for ; Fri, 25 Jan 2019 07:04:29 +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=gVe3i0YRuX+x9i+j97Fuk4COaH UgaPy/2pBJdPmznK/tPMTiSRAjKUnvIqQru3cnGjZHzRqkUGwbjY7i5A3iEJUbykF6BnXLkmm9kSO xOnAL13fctMIvUky4rM9eRy/wTC8WI6ISd0BoPpmj3/9Rnm3EbEtcuClRYCszhAS/WppeUnNSQk7T 2L0QXgOThInBnnTJJP6+Esd6vkizxEaJbv/X4VWJH+k9E78cZJezhE7Ds0ktfEiugXTp3el8ChYVb HrUruMsxUEdhpvPAN9q4+5mhDqTo5SpcXcPtGNx1hMPoEG8uNOtq+U8ltHF5/YWQEdWDcb6/xxfTC Y94/7o1A==; 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 1gmvXR-0005Rg-2w; Fri, 25 Jan 2019 07:04:29 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmvX8-0005Dl-9m for linux-arm-kernel@lists.infradead.org; Fri, 25 Jan 2019 07:04:11 +0000 Received: by mail-ed1-x544.google.com with SMTP id p6so6600792eds.0 for ; Thu, 24 Jan 2019 23:04: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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=cKCXamQs27SFMCtXHsaEBtbiosOOItfG+tsJqXFmkDoPmAf2H+e73DJevygpbblnSt GFq4GplluPUoT3mbrGtJ1VHYGObCo8N/odzHXnGIQQ7Q5bx0BLnO7FMcKOk8Th/v5nbm 3jWu22wKm/ypacS7C8rwvGblxK9vpItxXi+Xs= 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=F+ItMWk5kVU2jHDn7OJU55qGu0ErA9CZiCuROLbr9+DHEgWYzk/stAa3Wy4w4qbv6V NoSNjID2jD4PElYW+ZHx4mX7wXPDwA9U9jILUgV9F2su2z2TqJ4cGHkiFuy40Gq8wbUd sgaoHSeZouTauikO1r7R9tX7ulHLKgOOugmX94g5p7J1EglqRhanw+GqKBbk9JSDIs0g uHnGF9SmDcSmGmQqcrbmHUF/yb0iHb6w4vsqZ4MRPkjTijbXxIbUcEQ0AQA2I9Fi+KXP gcLOCJRv6kNZZKqjHFaS+/3tEb1etI3H+rbTXd5GF659H5eO6nIQ28PayRClUwZSnbbb 1LwQ== X-Gm-Message-State: AJcUukeepwOX/eBcCDv2CtNRNa6G/s8IGfdwSoAP8b3iN0/KauaiWrkf MazjJ5OnW53iC4NSyIjkLjJ6JA== X-Google-Smtp-Source: ALg8bN5ZtDmNkfTzzOMEjmFZrYiQoSLYPamIAqopCNrzFwl4kUeNo57OfKlGU10wQqiNeVegNL6NEg== X-Received: by 2002:aa7:c55a:: with SMTP id s26mr9551675edr.132.1548399848614; Thu, 24 Jan 2019 23:04:08 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id w56sm11734113edb.72.2019.01.24.23.04.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:04:08 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCHv3 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:28 +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-20190124_230410_334290_6E19AA34 X-CRM114-Status: GOOD ( 12.84 ) 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: "open list:CPU FREQUENCY SCALING FRAMEWORK" , 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 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 Fri Jan 25 07:02:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10780685 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 D7ABC13B5 for ; Fri, 25 Jan 2019 07:04:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3AC02F703 for ; Fri, 25 Jan 2019 07:04:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7A3F2F843; Fri, 25 Jan 2019 07:04:59 +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 4EF8C2F703 for ; Fri, 25 Jan 2019 07:04:59 +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=AbvtoEEhUWIrm6sBlKmPS0Dulf YjnfB69tEZDElo6fja5+2sSQXZPnfoqhS3q104p8cvy+X1QeBOx9Kdq5lQKq0NROr4lhwxLrypv3u lTki1HUtJqXRXtznD4HyIo24xfLeSIRArDpwxWWB4dPchePuVmba+duVWoxit5rUpa9WTK4Z8bi7W ASXPfwrKgxBUc5BWbh6N82zO3aoiAOm52mFsKLJAi1UXW8OmhmnDclGqLvqab/zqr8QiG7PH8QJBG Kt5PWvxMOwFGTGhrXDGJfMofnR/99Lh0sz5cJOHJlFKsQvQ67e8T73FZ0DZBhClVtSv9W5JZL7prP +UfxQTkA==; 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 1gmvXt-0005lb-Ac; Fri, 25 Jan 2019 07:04:57 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmvXJ-0005Lp-5e for linux-arm-kernel@lists.infradead.org; Fri, 25 Jan 2019 07:04:25 +0000 Received: by mail-ed1-x544.google.com with SMTP id b3so6596029ede.1 for ; Thu, 24 Jan 2019 23:04:20 -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=c9XfQHXKTJjH9D8+A9yWRU0POrNIBML8yy4f3PPCCfnJpwyfoCXm+jquPMXGhj78uP v3QMXI6KhuZb5C1BK6jeNEPlGnHiYGwAZUc/Oet7u0C3OjNstLEQ0B6NnDxAPvN9TzNh bVB81EaHQT+ngBa2Tn9F3YVPUF3LOVVXKHEvY= 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=GBRG9KmZxqUfijIyKuIU8rok7ZPWESkimOLwJHTtH+5w4iX1FsJHFDgXvim6sI1/bk bcUKZcElUtdeBnKFA2KH2VuwPFG7H4BRPVqYSthEE6wu0VIZPrbiWEQJKOYgi6Mkpxhv 5Ej1A9cSW5CEre/Uhe6U8DqFgKKMmTEVdJ805cxhzs7zWJyXKNfql2cX2qP52uEDglbU IvbM6NqvjtFotq8YUGuPrW63gEC45qQw3CpveVHZKC9KpKU5Q60RGzpMj+Zd+ii8J8bS Wg7ezXWHl8Vux2GlI3P//+CbagHumPVStdzRLFcwbNWG4ixvW422LR0YfGZMIo/a/CZH FUjw== X-Gm-Message-State: AJcUukdz81Kwp/Ub8y1ZW+WIfk46SRS6EWAXynxiZ52bA9+tuCH5HF4Z D7WYvtRVrXglHi24H0q3lijKIw== X-Google-Smtp-Source: ALg8bN7iPl88pvKHtZoqcZiLt/406TypDrvj6REJZ/Hbw2n5j69b2EFHMQr7yQhhLfGYchfwNWc8zQ== X-Received: by 2002:a50:b667:: with SMTP id c36mr9996768ede.190.1548399859489; Thu, 24 Jan 2019 23:04:19 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id 49sm11802931edz.59.2019.01.24.23.04.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:04:18 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Subject: [PATCHv3 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:29 +0530 Message-Id: <94d264be0f980396cf4d2b94ba31e55ef1bc304b.1548398851.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-20190124_230421_264706_902B3C59 X-CRM114-Status: GOOD ( 12.54 ) 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: "open list:CPU FREQUENCY SCALING FRAMEWORK" , 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/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, };