Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6370186imu; Mon, 21 Jan 2019 07:47:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN4hb+x/Q1Iw7nie67lypaK80yumMmTATpX4jJghIi/gF10uN5SM4NVefr6UH96HZeQP32Mn X-Received: by 2002:a63:c848:: with SMTP id l8mr28185169pgi.78.1548085635749; Mon, 21 Jan 2019 07:47:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085635; cv=none; d=google.com; s=arc-20160816; b=UkAXdWrelNdAf2nvtxPhxM4wkeWfZE64rtDu3m3vRdyVI/HdB4isW4FZ0umN4HLLl3 SRxeDB7BhFru1W8ZJOxRiLr4er+AsVPXS20xg4l/Rikz2MCO5myPkmQAOR1uoEB8wEDQ X0R6sRqnTesstTW4Fxxq2mCRZqaVJbXKttpr4g2ISS0/kCqq/FcRCNolKtv58LF+etWM fptnu0vh/Oz5F0WLrCwlbwTRiCagKRNyy3SVOeXDeGqmPmD+E2TaqBVHl1rNCsUp1YTb 43tJ1SVZXXphyHbd05vTb1hCHcvg7jZnzBe14jvUuzfkenEUAlYFaKNV9iiq6OkTwasM CqiA== 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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=YVM3rjlSTspnYne9FjPtR7m7zmect9aXj7Fbs3MTOZSk4DGdWM0jh8oIGGGnfGt/RE 5XdrzW8gjBDfC4xKyWeIrtzolfx9VsKaKjJEQT3ILveiDh5W3gkjsW/SwC/V6zzaxdL+ M8seGLvI9L1URfTy4oqxIU4kWdCJhp4IkB8AJiCgrRaV15lIvGGlCib2XJ7WQM5VQ+qk 1LOFSl3oatovhjSAEa+VtfWUToBXWKTd3kYPsqsTYTfKXQMDfOsu/5WfWNyt9e2z96wb vtGp4lAvcAo9zPI0n7map+210KZy2ogPEjzBeBrAiY29rmtBeL1J9KLLoCvS5yD5vSRr 3Lfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jo0rQgiA; 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 y189si12912791pfg.75.2019.01.21.07.47.00; Mon, 21 Jan 2019 07:47:15 -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=Jo0rQgiA; 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 S1730109AbfAUPop (ORCPT + 99 others); Mon, 21 Jan 2019 10:44:45 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41288 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728988AbfAUPop (ORCPT ); Mon, 21 Jan 2019 10:44:45 -0500 Received: by mail-wr1-f65.google.com with SMTP id x10so23877164wrs.8 for ; Mon, 21 Jan 2019 07:44:44 -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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=Jo0rQgiA6XZhFFylUgmrP6E6Xzgb15dXRRevqTQJAUItH22QqT2xFJqIko6H3r1KqM zue+H7wGt+G2EkE7X96HcEWFrB+xXcJwXI0vAFtpmmIJM+ZrM7yCAMY7ekTTHxJwXvXf 6puWowuqDKRpwPEsuadb/Ann553jVHZ6f8RtU= 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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=IAjXNT8+SU1Y7nCDYWP4R73ch9pvKdMErEYvCNg4lcH91cx5Hp5aMWCiAI+qOv2Mou n53X/NXvlNzUG153SlRcR9wguY0cfaNO/1iN/K+Aa7aA32uUaN8v0ZL3kaBzwxa9/izm VWt2/MFAFgdRdNc2xUKKS09GgfjXR6M5DSZ17PYKZISuR3wOhQJEaRrxQK2PswAjZ6zv Cu+NdfxVX5ZoN4CaReviBE01u+vvKITm580jK5w69cMiBqWbaJxJDjtzv3rztYWHXFPG GxMJFQt9E8dYa1ttY9jk3zCT4Ztv57WqXEf2eWSmvgPKcPC63lwfxtt9m5Yvc4kY5dnW 163g== X-Gm-Message-State: AJcUukfhIl2iHGnhpbUbRqErDegdq35zbGUFnH4rODC48gg/9IKGPQDn kkdB+LNhW/5qIksbB6PQ0NWEP8J5a5c= X-Received: by 2002:adf:a78a:: with SMTP id j10mr29041502wrc.191.1548085483480; Mon, 21 Jan 2019 07:44:43 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id v6sm76280857wro.57.2019.01.21.07.44.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:44:42 -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, "Rafael J. Wysocki" , Anson Huang , Bastian Stender , linux-pm@vger.kernel.org Subject: [PATCH v2 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:29 +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 --- drivers/cpufreq/imx6q-cpufreq.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..9935df234fa1 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_AUTO_REGISTER_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, }; -- 2.17.1