From patchwork Tue Jan 29 04:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156921 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226699jaa; Mon, 28 Jan 2019 20:59:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN6H1/TEqsQI2tD/R/HmFFL+So4q2Rnfrfd29EXaBGtbyMlRmaNtRxoJn3Ob6/KgVrnvwRfQ X-Received: by 2002:a63:d301:: with SMTP id b1mr21470650pgg.61.1548737951586; Mon, 28 Jan 2019 20:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737951; cv=none; d=google.com; s=arc-20160816; b=Gve+GUxCgvyiTP6s8feh4xA3cbJ6yWzhylIQLwn33dqLzAfwkB2z1K9cOjn+F0pBkW n8O464AgtZE64isP8MliH03AH4Kl5SzeT16PRxlEHcifLLuZp7Gh8P8053LSJXRip3Gs 1lKXlmlCsssQokaqk8RQCuWX4x4yvAiK1YrnPAL0e/bWMMQxWdkowA2jNo+EX31DWex0 arTKSoP0Rh62T6El/gE6O7xbIsZ7ITNtRykA108Id6YIy21ox8X6fKJKtUOWFeNHeyfY RnQoPz+jygH0hc3+G8Y+pnBQXMqdV0I87b9E/iRZGL27eaYaIzFYcRgHIU1COS0XYHOt Xe4Q== 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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=sWb4GffJDbw/ovawhfSPECB9moJsntDzps+fUVyUIyZus0ONWtcw2BOwlC4iDm8kBD njhjcQCs34ebE3rv4xzx4kFWUwbgTeicPEcTbD8l/baV341gFlS5q/5ha2dBykZESZja jSm59NvfSyHZvADzJRiAiQNIJb9ps1decvWCXoeZZEYlaSX2bTqqf6NtgqROqTAvX+jC /S2fAfqQuHStE+oHzZnbQxRaxpF0TLQMDfvxsoXaQnaeIr+f0B7G0Zdlll8Blbuw4KD0 Ya2hp7Gun0LrZDY2032bhiBTwDvYe/WCpmQcyAS8wNsA04++uNib8iOZl8Hhj8c8zoBg Vmiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIQOgBgI; 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.59.11; Mon, 28 Jan 2019 20:59:11 -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=OIQOgBgI; 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 S1727090AbfA2E7K (ORCPT + 11 others); Mon, 28 Jan 2019 23:59:10 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54616 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbfA2E7K (ORCPT ); Mon, 28 Jan 2019 23:59:10 -0500 Received: by mail-wm1-f68.google.com with SMTP id a62so16328738wmh.4 for ; Mon, 28 Jan 2019 20:59:08 -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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=OIQOgBgIYGQMD5MsHLsxxua0J6GIoPteH87r+Nqm3iXi33wmq5/SA3xu6C8XWZeUE8 5BEPB+ixLyvmyN1VSzTniLJcAQ+MjLrbckzu2gqa6qKrt5+DdT5GzOYGwqFuuE/b8D9+ 9tSK6SeE3Z0bHjhe2bBP4bRqYLweIzNozPMnM= 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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=F94Yf68Y9506mga6qhgUCe2UD+cbNyucrxIWhfX2oTZXHmtV6sQL1nf+sGIy2Qb4no FqK6hCbJ4AHI6eFHFPR9ibgJjU7eHUsw0TlituIhQ/YKkLAV2Um45CkyZ4c7DYlvcads Y4Han3VSe6G69I/h0RD4l6/a1TJAwYSzYagL4GG6wmMU+E+MmCMSxcrGoaCq+WbPoqrp zElMjUq5DFKxlis0Vfodw2Y8WMFGvqwHBlp1eoH4YLULg+VUF1DjuI/LX13ua8XrHmkO mz0N4gfpnqHJe5kZKlBeyJ13Vq+Ykrm1n6onfaG53mPhdmls6pU4QBJHfupteJ53XofA VSSg== X-Gm-Message-State: AJcUukci/amGx9rI+BVER7Gq678QioOGqO/TLmGL+UtOtWx+Ym+xq+Ls gshHQo+gHyGVgICTd7eQSXEEHQ== X-Received: by 2002:a1c:7dd6:: with SMTP id y205mr7116773wmc.121.1548737948077; Mon, 28 Jan 2019 20:59:08 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n127sm1733195wmd.20.2019.01.28.20.59.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:59:07 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v5 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:15 +0530 Message-Id: <082a9bae988061ea5465f7cdb4b0c61b4230cd59.1548737236.git.amit.kucheria@linaro.org> 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/scpi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 99449738faa4..1db2f6927e13 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ struct scpi_data { struct clk *clk; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static struct scpi_ops *scpi_ops; @@ -186,7 +184,6 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) { struct scpi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); clk_put(priv->clk); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); @@ -195,23 +192,16 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scpi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scpi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scpi_cpufreq_driver = { .name = "scpi-cpufreq", .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, .get = scpi_cpufreq_get_rate, .init = scpi_cpufreq_init, .exit = scpi_cpufreq_exit, - .ready = scpi_cpufreq_ready, .target_index = scpi_cpufreq_set_target, };