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: 155559 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3864695jaa; Mon, 14 Jan 2019 08:43:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN5/eVBQXbIu+nx4si/IaIktckhCsm4uUPPqma7ZMV6f70eTonavRIUUGJ3hTN7lX1X/hDc3 X-Received: by 2002:a63:160d:: with SMTP id w13mr24177003pgl.43.1547484194807; Mon, 14 Jan 2019 08:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484194; cv=none; d=google.com; s=arc-20160816; b=JEiaz4aG/b3YbIeTc/C0Wbu8NfHOFEpGaxu/BOHUmVC3q82VwLpfDSREyMnh12gsfZ zX6God9RGtT644MJ7nGZ1v1W93il2gVJC/v7WAgCBOdLhlFAz+PqHrci1P9cZGsAyVM2 ykCTgN3Qze9UVATVfaKjUECpe0PxlxxQay0YfuZBKUTDPN7AUWEX3zspQOtJWwBv3zsb G7jwoj48WhIRQi1FaDH62/EcFA+F9N37bYVEcec+jRgd90C9VPyFwZOfcCS+sQYW0R0N KpNc0QVw9EAv68lA6nubd9Othc1AXpq6Vvza47Ih8cZOwZZVlL/YfLHAfxfNSUaNFASm MArQ== 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=mDodrn+SCjmkCblcpvbM4z/vNhnHCT5BvbpgksmUkgc=; b=XBQ4rsApJgYu1nGJN18mQH0yWCyiAC9U/31u4xTYTny3AXtDPjlzApWsyJ1pnSmx9W anZ2Mo1qlXnikGgfnT9CfiaV5+Ea9MxR4R4qHFSNMtidjHMS4swISHDmo2W2+MhS3Jtv kxoRfOO52iu+cmDXXcG8bOtmk+MuWx3XFzprOlysLbiBiDSNLEX/uph2+IEDrxY9dwRm pabRf6JgNOzfWXuHXoYlKYjjxJSmYbY54CMnI/oAn4NAXD30h3hsEe1EWTaWHq82mtpF Qq1sHxWq/jq4pCejtXS6D0TBZ6kiJKMYomvcqwn8GnDRlHioWZmySMq9puPzMEgNoOYK RAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fhy70gTL; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 f90si677898plb.362.2019.01.14.08.43.14; Mon, 14 Jan 2019 08:43:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=Fhy70gTL; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1726779AbfANQnO (ORCPT + 11 others); Mon, 14 Jan 2019 11:43:14 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33005 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726724AbfANQnN (ORCPT ); Mon, 14 Jan 2019 11:43:13 -0500 Received: by mail-wr1-f66.google.com with SMTP id c14so23769209wrr.0 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=sbzAoe9SCY3VyCb72z2C/GnX/pe9GVG83KTdFQyffP80zzEzFvFmHCcpz12bOCrKKe qEor3KzkzkxSzmSmbgwJAPU+UaiXFO9aj0//id2Ub3RQCwULAZzSM35HvglyrJngUrxn UZKF9h48pWetvZU166fmLClxWYjMXIgvN17LHIWp0SlQqEWiod7nD+55+4wbRl15EkA0 eYIVPb3KVW9oqTGwJqbopP7AkXI44ILcN1egKU3Fvqf8oeRFJTW2X2SIVP5q384vvX5C JCEjwzpjU2u58OsBnprPKz5QGpu87QFbZOnoSBMD4yjVcrOZXCLZbngFKXBpqBndmPbD YZBQ== X-Gm-Message-State: AJcUukcYpd5/nkjAmLEonbKaNEqQzBM/c1QzAQ2VmHmxlZiTAfqoVntI QoZrO6nnOuW2EHDQYZ80WJz63XqXkUU3sQ== 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 Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, Sudeep Holla , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, linux-pm@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: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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/scmi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 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)