From patchwork Mon Jan 14 16:34:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155556 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3863099jaa; Mon, 14 Jan 2019 08:41:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN4CBF/paP+oyt1sgD/ihe3vyr7imtto2xMIuxI39NJq2buuaRVlMjrpfeZPGxMg9FiwjgpG X-Received: by 2002:a17:902:108a:: with SMTP id c10mr26595587pla.131.1547484096143; Mon, 14 Jan 2019 08:41:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484096; cv=none; d=google.com; s=arc-20160816; b=dTNtCfyoj+L5NlYjyIk6Nq0BR2ekQUFWlm58/SwklGjkY5OIC4MezoOOA4mtPt3ncx URcsVlXFOWCoLS9oB8Z/XwciJGrLt61ubHfhS2iKqjwY/SrkSI4PL8Dpyfwsc6E8h8A0 N3P0Z56OMb1T8KUMxba33bQ2IbR86mEkVQ6aNL/dISvlWU/yUNG0AnLA7uo4wpsi/rim 15+1usxtg6+bVvBGRhaz7cMK/mNehPLGBFKpW42JN4kBM7VY7sofI45tpX1fSecbYHdf zrXiwL9j1aK+zZwFcLQmEKS6pADi65WNh7unr24bTPM8KZ+SN5msW+D8gH7ljIoZIn/q nBSg== 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=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=eg30GQoBNKGznj9zcPKVwwsVyTx3PYpgKyQrV7Bu6i1gdp8wLdex8q9iSaAuKcPObh 3NtbJIq1v+VgZJTwKithvfItA2/JEAAeqa8V056vkb6xbaXgrjaXnsbm87jIhiqOa/xY xw6oPw/Jq3Up1Ggdf0uVCnx3ldh4jayxz5WuO3U0WzunvlPCOW0sW+pyglzJ9Gvxj55R SOcAbsL0bL0x0adhIEZUnrIXIXaG+SGFl/16ankWV31la/GBL4N5bIIi8CWy9MxXvoGK cqpJVqvJXlSm/NND4oUHZgiMc/OaXMjqXFpaOWUq+MwL9BrJsjlw70NroS7kdcHHUnXW bKkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GhCgDGmo; 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 o8si684715plk.28.2019.01.14.08.41.35; Mon, 14 Jan 2019 08:41:36 -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=GhCgDGmo; 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 S1726913AbfANQlf (ORCPT + 31 others); Mon, 14 Jan 2019 11:41:35 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40344 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfANQld (ORCPT ); Mon, 14 Jan 2019 11:41:33 -0500 Received: by mail-wr1-f68.google.com with SMTP id p4so23664097wrt.7 for ; Mon, 14 Jan 2019 08:41:32 -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=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=GhCgDGmoxDg7HLCQuCUtdj6BGUGMiGm5sk3l9jWvy+y8Mc2yxEL+d+M3bBXCNa78zO luP05FxIo8xnoRlQJS+BkC2BXYKe2AA9O009LfOeUL7Is7DXlTqHb4WdG6v5KVeF2BZ8 m/+hefIMzreCIs8TcyXF96EszozO+1m1yRRow= 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=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=dGE9Jbkrz+NBvooKYlmn0JmaddVqv53Bq+a7ECdtiPfAxe/A52u6lJ/Vzg12POGiLu bHebSbs2YAQX2884urIcS9DCcezIHiLafk6zVzbEuP+IDRBE9OVMkvzfdCqiK6WledYm L0o2XmkNv84fT90n3FE2pvjK+/wPFjvMPMGv9+XXEYRRHNYrCRBnpk3xubd3bdJvGJHQ XTLLzjGaTmsj4sGWicTmAlO55KkUnHtEyLh5BiIU4HhvGenwo0EcEmi53Mzy9ZAmyrkR 1NOT8gj7z6v/rLj/dCC2DKiOmguu2hw9JTH1EB9ebWwoYSwevZboIFxVJWP+4dJW4XlV G8gA== X-Gm-Message-State: AJcUukeaoMR2nAnyRSVhycso/VIDztL1Tmi/NoMwnqE3RCRbXdgJh11b 2tSzWiCF7WjhdBoJOjw9/ylJVIWqTcOuJg== X-Received: by 2002:adf:e5c4:: with SMTP id a4mr24073413wrn.157.1547484091561; Mon, 14 Jan 2019 08:41:31 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id 143sm56483488wml.14.2019.01.14.08.41.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:41:30 -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" , Shawn Guo , linux-pm@vger.kernel.org Subject: [PATCH v1 06/10] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:04:58 +0530 Message-Id: <9ff853ce75cc1f64f106a239891f55be96a28db4.1547481320.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/cpufreq-dt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e58bfcb1169e..2a4c4ea7980b 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,6 @@ struct private_data { struct opp_table *opp_table; struct device *cpu_dev; - struct thermal_cooling_device *cdev; const char *reg_name; bool have_static_opps; }; @@ -301,7 +299,6 @@ static int cpufreq_exit(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); @@ -314,21 +311,14 @@ static int cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void cpufreq_ready(struct cpufreq_policy *policy) -{ - struct private_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver dt_cpufreq_driver = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = set_target, .get = cpufreq_generic_get, .init = cpufreq_init, .exit = cpufreq_exit, - .ready = cpufreq_ready, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, .suspend = cpufreq_generic_suspend,