From patchwork Tue Jan 29 04:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156920 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226474jaa; Mon, 28 Jan 2019 20:58:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN41DtGfdQhxM2ggY8om9/JSxmHsUKBXOfWP1x9nJzTSIxQcstBrZ0W1XDHOXpH3StuMUqTN X-Received: by 2002:a17:902:4601:: with SMTP id o1mr24568369pld.243.1548737929431; Mon, 28 Jan 2019 20:58:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737929; cv=none; d=google.com; s=arc-20160816; b=E5luchb5Xrh2kcx7uE/Am/thKMd2qD4f+PE8QS/3Pb2eWIT0/5HOHS+GnvLPblTvvE HnBgXq7ZeDaVwV8za7h0Nav+uUGcqYLr6Rw0pkxr/CZTeGps9uwULeWFsoZeyzF+Zz5Z 5scQKi5wCGak5d47E52VnyeN2PR+E0JfyZzTCyPRkeSUtwJGT6VWMcixegCvojQgHvAw mTDzyrTzABZDCd5euI3pd4uymIm7rYz+BjA8oGKVMLgNC7l78YzsgS4syGN+WySnEjsJ pWEcNPlfvs/bUs/pe0vCIyuGq4G9oCJQwMTxo57297H4bnlvVi5bBSKp97nOp83a8w3S +BAg== 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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=ujhuTb6WB3eVATLBcOJwTzokYmCtJSH4xLTMtJ/8/72dHKFKsgJVdw7PeNEJ03Kkl5 /90jiY5izZj7ncuPrTYPmkELj0lQ9UA3s5L7UihRmKSLb+tg1G2CDQHJ2NCwJQTqQGwu 2Zz7V3SbFAzjz+HE3md9h1M+WGNzTsXooGLaimwDX5KfHZCP0g5SCROttDR20iofYR4v 9TCfpp+ofeAW5kDgaeV9foAFgSr4erBwa8MLHrrK7LhFu6zrLXzpgb86FPtAXDPTJDYM /zkaQ6S7ARgeQdoOKC0+9bCrDI6LpwIXwioOU2CoMvqltP5PkC5dYPilT7IaHbqVuFqu DwFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SKkw+bx9; 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 h191si28452992pgc.302.2019.01.28.20.58.49; Mon, 28 Jan 2019 20:58:49 -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=SKkw+bx9; 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 S1727283AbfA2E6s (ORCPT + 11 others); Mon, 28 Jan 2019 23:58:48 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33944 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbfA2E6s (ORCPT ); Mon, 28 Jan 2019 23:58:48 -0500 Received: by mail-wm1-f65.google.com with SMTP id y185so12023290wmd.1 for ; Mon, 28 Jan 2019 20:58:47 -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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=SKkw+bx9M7a1C7KFz6NtETyB1HBgVDEedtQCAyZlJS20Esw+cYWkadE9BRpxg7FN9v fSTti4bcAemIotQ72wCEHy/4Ibs01qFlFne/uFQ0/dWsQ3O4hVXI40wKT9tQNZu7s0Q9 KZKZeWQZxlWlQ/LA/VRqGQ5c2PSEfdY4+SLDQ= 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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=HX3leC7GfNkFR/AkFN2+t1EyfA4VMEJ3pryfCDPyfpdEDSlLPvFg354VRQgmTVmFKc R5AP0EL3WBinqURMoopJHV1qbwc8hKdzBtKAqenhcxjytublbEgHiotx4tz8EoteZMmY Rjc60yNYVmKtMJt7UJm9HaeG1D4CKPFL/6n229PKPxX1qS4LgtcBnYOvVFmBjwJ+W0mU wfqfkttfy2AOJvHBajK4XHWT0wAQDsy+j08BLvrSqKWTin8QFCqIVgRi5+F/mzX9aCy1 mNNwU2vFCfYYsj2ipR75Ik4ce/SYbHsq0BHaeBuP1CoDf1FAfpy2Lk3wfgNX1BjuBIlw I2cA== X-Gm-Message-State: AJcUukdvXrpLQJzkIA4lt3h/x8pFtGKWquV3XeUgXTmtmw5vm+r3cqSm meSNotoTK6mJB1pCp36JiX+7SxtQSTE= X-Received: by 2002:a1c:2314:: with SMTP id j20mr19221835wmj.142.1548737926560; Mon, 28 Jan 2019 20:58:46 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id 125sm1908131wmm.26.2019.01.28.20.58.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:46 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v5 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:14 +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_IS_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 Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- 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 242c3370544e..66b633b48eb1 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_IS_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)