Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6370744imu; Mon, 21 Jan 2019 07:47:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN74PO9AWClzkiTzAzR/8jhVvDP3crdupGpfvwZjz+qml7MYCTewkGe/ZK4wu/8Yt4mtEfOM X-Received: by 2002:a65:514c:: with SMTP id g12mr28450233pgq.169.1548085676062; Mon, 21 Jan 2019 07:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085676; cv=none; d=google.com; s=arc-20160816; b=Sz6mz+QvdRvAVCHfHSZk4kbkYBggk3EguR+AvWxbsLHS1jTUfMQkXRKvisrG8ZmYlQ 8ZLj8EelgQsKhrCRtVvImE4lDzNaeTzej9WyZowYPp38HjnWgpVOedQGfAvIPmIG1f6S ZfOyPBHbo7yKIrDX9B7L++USnyUmqRLYFUzZzDQdBSOiYzpqhj5J9v/rsoB0OnJnCT+V wpsOmaRQ/2KYBaUZ3467YmqavN3OboBHj+TRzfmXRBXHoiPrYhLWtSxmRGguWm3sGLTz +XqVoOiC/xbrlEa0jZ5PsRHcDBH4y3xdw3wECZhwHyx1L8z0C6SwpAR56K5BatWjLe1U xUAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=QJtp3wkB0X7UBVrufrLjCDfJVQPn195Q7k0H/70d2S/9e61KGM8vkhNEmrJRhPbya3 qJdzyZJbb/L8x+RiGcLtsSmuywO70J29ZM72jsP26t9ZV2vRDDHfzkuqrvSVhoXEktfP 0hVTrHkEbvz4DEuMVQiXSC0nOW8q1hCpXWTzfr/w9hH/sMFd+0f1lw4MlbbFJ+rh4z2w xFn8amwWaLQxAO/woHlps5oGolP/9irKh4GITxXmtE3bZ+v/xcryv9F/q8nAjQhRSYqm aZWYBWY4IwmA06TAJQwpCSOp2onsrgROTlsvMR0itNFvx/kvdaHKQ3EEWcu4PQY5SgXT tkhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WZrUCGY1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si12489190pgb.584.2019.01.21.07.47.40; Mon, 21 Jan 2019 07:47:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WZrUCGY1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730426AbfAUPpR (ORCPT + 99 others); Mon, 21 Jan 2019 10:45:17 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45578 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730116AbfAUPpR (ORCPT ); Mon, 21 Jan 2019 10:45:17 -0500 Received: by mail-wr1-f66.google.com with SMTP id t6so23861799wrr.12 for ; Mon, 21 Jan 2019 07:45:15 -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=X03XW0IGgZQI55AkvFkrxdM5tk9KI8drBxuzFTTKXbA4qrbbO8263nqe3V6Rf6Ztcw WxuP08Pceqh7NGMUS4RvBdK8qw/LC54qzmGTgAxCFUFns6qrN2T30Ivgf1TAWl9d8Cqx inRb87BZHdlvpJo2XXN0YZRSkpioe7FPN6S2yeNlxTN86sxbC951UJNUZKfsx6Ac2zR1 gsHPbBs2ORQmrvZJG4VXAUuNWej7aLk3eGDx/TiMux/Uc9vKVPhYk506zOV4xWr2fJwc b4EfWLzqFt1wjiqB4NHHVg3wYjCsQMOVJG0JiIiYj7CaNrWtKxxJFehF9jW0KTLCnCz6 UHOA== X-Gm-Message-State: AJcUukeU8AMx1St5a76I/EK51qwi6xyU81WU78od2EGra89mzjtLkQku t6sfnZSMU+JzZAlZr76qr0zCHauzyUc= 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 Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , Matthias Brugger , Sean Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, }; -- 2.17.1