From patchwork Tue Jan 29 04:55:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156916 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4225902jaa; Mon, 28 Jan 2019 20:57:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN6o9bwN2g1GcIFi9vwy3Yst5DUNfPwywnw6I+32wclzldrlzAbbyknAETc5jCn+IU0T1TUe X-Received: by 2002:a62:18ce:: with SMTP id 197mr25478776pfy.88.1548737874281; Mon, 28 Jan 2019 20:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737874; cv=none; d=google.com; s=arc-20160816; b=jjrjYC782rwhOhzl0hmyCxChtgTWZ9c0t3E6Ts8US4rGir+A3hepNztNZYgkfRQBOu TdRpXw+rpTXruBC6m+21GPO82VXCfAd1VkVJY+LNJf4DpA0y3GCn8JU2dmM2pDK1Gbvu AW/AcRtbRDgZKkSnztuVwD/7i9pMVmmAdTaAVCsEEg2ZtTtDuOCjhOuftEqygSceLWuC P4BZGIpOaym/uVIi6esFfYs4UHTokGG4olm5BhEUClecuphYxlgls9jOzRAOShk7xVj7 +tTFfkyrtIVKrRo4fwGkWPIWwXs+253msM0h/E+EOo7WbqFg4wrub5ROaB97+oqNplf7 gMHw== 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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=ospRw+9I52J3hBxoFsVxrRfPSxIV+9F7S6pu6F0fJYOJ3HPcqP276RmoK9Bf7Lfp2K MFMXkwYs7sJ3RVCdBl4IwWNVOgmAry+JmttKQ/OAywgrBNz7MwSvKjv45ULGrjDgM4Hv QJ94m6p+7F81CyVrx/zVd026jp4sDvDwmKsNj7KITdh7TIJhcWYXfpuulrv/bwGl4/hA hA9T1OfqDtkWrOoMxINdTVwtKtnxC/qXDEWkoxt85PXYjutZzBUR4KGnhOpBAYuUMFoC y09s0WIZYH/4CUrjAv/oIEF2aANvKue2ZBhBRwi3k5zE/So/w9FDfAZVuxdVtbwinOOx z3MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pi8oySiw; 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 w189si33117008pfb.151.2019.01.28.20.57.54; Mon, 28 Jan 2019 20:57:54 -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=Pi8oySiw; 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 S1727082AbfA2E5x (ORCPT + 11 others); Mon, 28 Jan 2019 23:57:53 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36888 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfA2E5x (ORCPT ); Mon, 28 Jan 2019 23:57:53 -0500 Received: by mail-wm1-f66.google.com with SMTP id g67so16220478wmd.2 for ; Mon, 28 Jan 2019 20:57:52 -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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=Pi8oySiwrxSw+U2E/uf7rNEBCB48Zun38AmHkp+cirwAt/dohdRzgc2BhyS+p8yyOb PoaOQrBBqTAzY7ZKxwJbxOKYk603CH4+hi3q3pWpX0qhltsPaQab3qt6VNF3jT2Y9g7J X9WDPQigzIF6bmN+2tdKdqf01L5K+Rou/RbqY= 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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=FRe9CQrtcL1/kg7y6Dg8eVp/mIA9QsK2blowRwdTxD038ruVFxnFiUP9SZZU7sFGjk mvL1CbBDVzzJJEcTVKQQfBasOJbn0oVqmPzi9FOWgbQ9N733cWtZDp2p4hOZoXcsEfgG cv1kQMtw3XmB1bGGGvankGOh2CLL+dYJdx8P7R/aq0VNIO+sF/uQUFt/8owvtQBZSr2B p+bHwi/FwU5KMTXIw6iT+6qPedRa93dQTR7PqwgDCB/RddCnNsvVJmAwgnjDg1EABaSE TNRgaVM6JtLUQ+OzLoUHB4V0o1lqTTtpZwIdJi78QoAVIjRYcg8NzFYB3TiPM1iOdJIy 3PRw== X-Gm-Message-State: AJcUukdQ9Pe02pFPfT9/q+kAnjVpqf7EAaWLW7DBBVtMP+YIj22H7C0P efI3Ww/uuyERwY3kQ+3Wy3dx3g== X-Received: by 2002:a1c:6657:: with SMTP id a84mr18288519wmc.23.1548737871433; Mon, 28 Jan 2019 20:57:51 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id p10sm3929437wmd.14.2019.01.28.20.57.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:50 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Anson Huang , Bastian Stender , Fabio Estevam , linux-pm@vger.kernel.org Subject: [PATCH v5 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:10 +0530 Message-Id: <37b9d8c8b580152246d988629ab52f58314f698c.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: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/imx6q-cpufreq.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..ca955713e070 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +51,6 @@ static struct clk_bulk_data clks[] = { }; static struct device *cpu_dev; -static struct thermal_cooling_device *cdev; static bool free_opp; static struct cpufreq_frequency_table *freq_table; static unsigned int max_freq; @@ -193,16 +191,6 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) return 0; } -static void imx6q_cpufreq_ready(struct cpufreq_policy *policy) -{ - cdev = of_cpufreq_cooling_register(policy); - - if (!cdev) - dev_err(cpu_dev, - "running cpufreq without cooling device: %ld\n", - PTR_ERR(cdev)); -} - static int imx6q_cpufreq_init(struct cpufreq_policy *policy) { int ret; @@ -214,22 +202,14 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) return ret; } -static int imx6q_cpufreq_exit(struct cpufreq_policy *policy) -{ - cpufreq_cooling_unregister(cdev); - - return 0; -} - static struct cpufreq_driver imx6q_cpufreq_driver = { - .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = imx6q_set_target, .get = cpufreq_generic_get, .init = imx6q_cpufreq_init, - .exit = imx6q_cpufreq_exit, .name = "imx6q-cpufreq", - .ready = imx6q_cpufreq_ready, .attr = cpufreq_generic_attr, .suspend = cpufreq_generic_suspend, };