From patchwork Mon Jan 21 15:40:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156219 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6518835jaa; Mon, 21 Jan 2019 07:47:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN4fV6kBVDKEwUrMufJm4xw55tA/U+lRX+A4VkIJ60zzFJyHMdMe/Y6od4XN2Cc4WaMgczIq X-Received: by 2002:a17:902:e18d:: with SMTP id cd13mr30686395plb.262.1548085628766; Mon, 21 Jan 2019 07:47:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085628; cv=none; d=google.com; s=arc-20160816; b=dCZrOx40gAaWEOpyKE1jtCJNndqBowpACCnHNlDc0Qv10Ll1jFR+8DjzvyQRwMTYHl zbY29/MARGNhfugj7cfsJ0ZIvOhyjrMQqhoMe5aYJTbut3EhK7eGf46R7QNmwfgx4W5L SnLv48NszNrpUwxBnkiicXcUNaDa2RyIOnQXOqP2+zY4on7Hac0NAMLRAbdnKDsWuL4I Q7Ip2iF4xtmLW8mzDNuFtP3pTD3eDtQTWqoNjL/Kd61MUFYiGO18gr3LDdxg3BQm8ABR p0EH1cKWg9UN8gwGu2hLstaVhg1QFRL6Oy9ie9wdCt2mRgQh7eFZMgJEyiWUg9cdP/E0 D5wg== 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=bF8jPb84NNZ8prPAwAZk/Ys6D9P98N9D6fNBwIkc+bZ+XEBQC9YZyuQMeMsWv3ofB/ be7djT7bhKuGEmg4hvzeJV5sTg8pGXOpIoaUeHYwXhNF9JonxMG1Id2DO6ZoBAXNfTWP g8uLIZ/hNfubnuumJEG36oDuRrTNBsm2BX+1iILpK3k18eBSQ4GttMJn4CetMgjI0a54 FOuRQzcjK90psLOt8o1l4ewPepT2rj6rQ+W413VMUMfil0cjZZs4M7ltSZDg+dedxjs4 T/CEA83pVs1IUALfQWkQiNVU9sX/PU9O/4qkz7IjkyWu7aIQvzO90OZPTV1inI18inyE nuOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=coDADYUv; 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 135si12925418pge.572.2019.01.21.07.47.08; Mon, 21 Jan 2019 07:47:08 -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=coDADYUv; 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 S1730843AbfAUPrG (ORCPT + 22 others); Mon, 21 Jan 2019 10:47:06 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:53360 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730640AbfAUPqS (ORCPT ); Mon, 21 Jan 2019 10:46:18 -0500 Received: by mail-wm1-f68.google.com with SMTP id d15so11247483wmb.3 for ; Mon, 21 Jan 2019 07:46:16 -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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=coDADYUvLFZRTbz5rB1pf5MJLNgJCkEzFO1jTwKFqWh1GA28dam5wmRCxancPw/Dp5 GBdQkQrAkjKtJD2n5CdsmDgUylwyEBdk1BLAYCT9osd1UtM1DuYR0OzrrXAN9OAwQKBw MKy9m0aUUc1OTPR9tPiYejvzgnMQUEydRVX1Q= 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=dVKMrAMN6HzY+h5pHf49JIJAPIxEe8HoLkn0IzfuSSSitgqROq3pSJa+h8sfOjLugn KWKHiEKNoUtJJN6RTykYB0PBBdEC7ZF2hKARR3Lv5sj87Rt4Dro9MWVH/CgU8MDHY/SB jKtqiz/uS7DAHOTa94APy4IzPx7KdIJaHksXP6qok4xskZkSP3Ll6h7igF3syTvkG0mL vBu9oRx2i/MKDxpcGMemmEZG8A7+PlljHhOCr+VLOkcGJt06H4sRooTDcgb/excZj31J SAkO3ZsTlvpoUzcwiqkoPh6hgJulp7K+/zsFTAI9dyxO1k6i38MJIe/bs7KUlD6zompF T9NQ== X-Gm-Message-State: AJcUukc0rm4ljLe/LBUDE3aN9sCvoefeIQ9uptzetHvIb+2x3lyEXYal +gcu+kerDVwBPlKU0H+z6+H+JrnWu1g= X-Received: by 2002:a1c:2e43:: with SMTP id u64mr25885532wmu.52.1548085575943; Mon, 21 Jan 2019 07:46:15 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id a18sm115239503wrp.13.2019.01.21.07.46.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:46:15 -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" , Wei Yongjun , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v2 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:34 +0530 Message-Id: <95506c9919bee528838016dd2c857ebb28e19152.1548084260.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 Acked-by: Sudeep Holla --- 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..82420e8e5f0d 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_AUTO_REGISTER_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, };