Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3142489imu; Sun, 27 Jan 2019 22:47:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN507ySxiEhsInJC+2+gqgcyuqLEpmok6S0vXVQ+dT8AGy67fvZolbZEExB4kZGMrZdV8ZoH X-Received: by 2002:a17:902:145:: with SMTP id 63mr20569454plb.256.1548658052926; Sun, 27 Jan 2019 22:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548658052; cv=none; d=google.com; s=arc-20160816; b=beNjrHA7QJh+0sLkOdixbmdAc7QtcspItKsATp1360V46GW4WR3OqkY5nbfFZglTJx aVUSu/Ht4gRcJNWviAvFdkf0uc/ahcbxzv+ijFJXRcvIvSeEPdyyd9t6+rPZh56GoBro mQpOF6zCPv9edxHceieBqLFRn17S7q7FhNVvVIywarEe3UcIafyP0fIYiwQOsqhLOn39 uJY1b1k1qMsfmwgDCEbj/0KKC//uellOqMbe0qIldPiArwQOWJniKTW61yJyPcZVWyPY hf5q7bSyvO1yRFbcUBj7nc6IVewM+9t89BgdqEyfLLzpkfkRF3HKvS+e6Inc+DuteiZ/ GO0w== 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=uj2NLqWGmYZ3WLGrQiq3dMQCU5LkDPrYEUAImuY2h1i9aIc+2QnTng2LsrtZEu7ki5 DJ5FEtZeHevdchjZfBZrrtgtbPQh0HR8e2a8kOsMvcI9akAuA3EwQP3ijYlW+W7RiTBx B68TO2j+VPLA503hU4F7KCpy/aIKv6GyMqe4bVlW6WoCHGglSuQxOnw2U2Ldz1A8DuAv fMda3PMpOGJOeDl2lVaUDLqN4apbj0PW8gGqIj+quDacsSymABsiFE2Sj4KqCZsnQiX9 XX03L8wGbei1LW48QmwrnomN6a/2Wc9OOGDDx1OwGqtP2JXk6d3Zlf1Id6fJKeVTNszl vCUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W4RfYAIz; 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 y189si32694043pfg.75.2019.01.27.22.47.17; Sun, 27 Jan 2019 22:47:32 -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=W4RfYAIz; 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 S1726880AbfA1Gpj (ORCPT + 99 others); Mon, 28 Jan 2019 01:45:39 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38524 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbfA1Gpj (ORCPT ); Mon, 28 Jan 2019 01:45:39 -0500 Received: by mail-wr1-f68.google.com with SMTP id v13so16671034wrw.5 for ; Sun, 27 Jan 2019 22:45:38 -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=W4RfYAIzJgkQJh5MIR4Gnjr5DkFNFNW1Bt6NGGz/WvBZMMfK0AudwJi6FlerejmBKc J9fVVMr3cbR7h6Iko7GMxSgIEJaah943A3l9Qy1SyFuzWRCiTSHf2Gz43+BRUokIyw/m S8THImJ1AIjte0KIUe9HHfxEvOnWpacdFWgYw= 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=fqo6NaZNUP+WHhJeaHbEl47sWJ2BeoCpw/6ZP1O/keyrzaMugknDQrD/6XY2TgNhWa OOFtDJFR79/Bh+eSCZ6jE0AxvMlwcBVIaVpVW4GQcbpFMzKii+Kts41bAddyP7jw9su1 SK9H81Q7hCnsW+bV1fxax7CIpbS1ncnv0uazEdufZ0TuILoCsSEW6O2d6gin0+IW1Cmk cD8R5CyEU6E1zifNhwz2JJDN/S7yARYgIEUTNEgVcAoOjIa5t4bRDsSilY/vF8IBy6Kr 11n6y55pgTna9DLl7haSPFs/s2lBI96cBG8jmQ0nqAWRIYmLRgo7w77O3npZdWCuG1tb dedg== X-Gm-Message-State: AJcUukfkXAn25ZKbyPEeIbSt7QvnYRkJByQrO+OMvjloBZMG8UW9q8ap 0CP+ahNGatdkGC2yhg1LBfRVdQ+x0C8= X-Received: by 2002:adf:f691:: with SMTP id v17mr19591125wrp.114.1548657937143; Sun, 27 Jan 2019 22:45:37 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id c10sm47955333wrr.69.2019.01.27.22.45.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:36 -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 v4 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:31 +0530 Message-Id: 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