From patchwork Fri Jan 25 07:02:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156549 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp19062jaa; Thu, 24 Jan 2019 23:04:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN69MjjK3rmdrFARD0aARTZ2F+u044YBZsXX1O9PQIvDA+Y4WcEqZQDrNjEIzk/Z/JENVV5q X-Received: by 2002:a62:109b:: with SMTP id 27mr9602284pfq.227.1548399854500; Thu, 24 Jan 2019 23:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399854; cv=none; d=google.com; s=arc-20160816; b=dUrizKoetXUPZiSCNn/kg18uhrR9Wj9l+HJJaxMotcTG+hnCEZ4CrBOk1No+8cDlz7 ohcD2u44pJdq9CtyBj27ZNQodkVSLHeRWpAyU5TkWURCcaKUYOOBMAyVLRetvkyUi+nv kFde8DAWCO9510a/+1zoAEg7RxsbX+339UgqfEv7ETFnBttbzfTFHW+DiGpsnBeoUnnj 37eTPL4rHdxzVGoOkIXSXaBj3AoeOLFO9RaIYnzURjlOuZKcC0tvdKRaKVeIh3kCVz2p XFzxUxDVOVELpknmrHRyyL/me01VosJUyFicDcT062cPa5dD1zxLnq+qIxXhGY6EU5mn 8v2A== 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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=bW2gwR+gQSrq7p6f0A/PhGE1snRdCrNWOjMkqbcJuo7zWVlu1xsVCrcV7kc+ZlsMQC SJawj7wlF1ovSoD0bYOjlu6msPLRLlC0eQMn696VtYKQItjYMsYUNnXkNTw+T8A6Dj/R tjk9ljEk0HEWethou/Wwo0qhgk4etQ8YIJvM6rLD8HZ9b2DTva6JUneOe0+aLXC/yKbO CY7+ZAW6GauEyxBrq10OHUJt5D4jBITXi/pc08onYfNMfujIMN029smKFkO57RkI0VXd 1nCthqonN/VjdCWuaAVelIgjpJ286YBsK3rwyvWQf0f2F4O5O6BCNtTpm7ofEMHXpYDe ZAqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cKCXamQs; 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 o19si20154240pfi.261.2019.01.24.23.04.14; Thu, 24 Jan 2019 23:04:14 -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=cKCXamQs; 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 S1728702AbfAYHEM (ORCPT + 31 others); Fri, 25 Jan 2019 02:04:12 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:40417 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728588AbfAYHEL (ORCPT ); Fri, 25 Jan 2019 02:04:11 -0500 Received: by mail-ed1-f66.google.com with SMTP id g22so6554806edr.7 for ; Thu, 24 Jan 2019 23:04:09 -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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=cKCXamQs27SFMCtXHsaEBtbiosOOItfG+tsJqXFmkDoPmAf2H+e73DJevygpbblnSt GFq4GplluPUoT3mbrGtJ1VHYGObCo8N/odzHXnGIQQ7Q5bx0BLnO7FMcKOk8Th/v5nbm 3jWu22wKm/ypacS7C8rwvGblxK9vpItxXi+Xs= 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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=fhRJesF8/rUqTT5z4PEy2gOAU9ngBKrcrFgFDryInko5Dl+QTOLV0w0MKlRULMN0md z3OyUXJo0p8EksM3IvS9siWOxyYI4+CqJOHEfQhlRnS1qj3zIRDfh1Q58MSvykRLJEEJ +dMfdiIiWZiK58g1/uHd9daahwdhVAENKecIAAkUQcr9q18JQd4TYx+aEkhNfh9KmdnH DzMA/+uRjbcu/n0dkIfbGlQB+OYC8dJSZS2SabNDDxr5IqrlMckHOsCW2qmgA4dWTqOR mjS80i9UQ1LqDWxSEdn/z5l7f36RjQVJHm2hAif5x+GOx8RgVzjzcy4ncgSyf6lrtfmJ xmmw== X-Gm-Message-State: AJcUukcza0xfGcnn/cgdO+wboxN9HA/Guxh5F57+1FIWdnrRUEMsNSg5 NNiLNnoPsrv8DaM0xXFil6zNOomS2pw= X-Received: by 2002:aa7:c55a:: with SMTP id s26mr9551675edr.132.1548399848614; Thu, 24 Jan 2019 23:04:08 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id w56sm11734113edb.72.2019.01.24.23.04.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:04:08 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:28 +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 Acked-by: Sudeep Holla --- 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..b19e9d129f8f 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_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)