Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3141521imu; Sun, 27 Jan 2019 22:45:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rwio3qv9bSHPIEWlRSm+mRkfcXSHRx6BoFE54En0jBCNJjcsfM8XzUHwwJn1vt9V3oIaj X-Received: by 2002:a62:7c47:: with SMTP id x68mr20940734pfc.209.1548657958927; Sun, 27 Jan 2019 22:45:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657958; cv=none; d=google.com; s=arc-20160816; b=nFxpD/is3T/7EeTr/350cX27VqM0xo1ydxW6d9EIsW8z059IHkZMTj2GPGdXsTynsb rsg85iouFE6qltnOKsI3tQx0OTrG0y5I5hQjINW9lFjTUbzXk/2MC284nDLjA9pTX/aG WFG06UN8bRQG77HQRes2/4n8HA8sP/9fsyXsAb12bZ+agxxTrVnIxmK8IGHKU9/04oq2 /vdndaW67oyvaFDp8AU8AKYcZUebkl6ZcQ+ufBNtRAWz7asV+A2g0YFp5z7Qbgl7pwMr Kjl5DPV4+q/cUNhR0lp4Irb00l2t6Z3TtJ5urnfHB8U88SSb2eGYIvyXJETpbQrG03zI HshQ== 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=UqU9mADalelWIPJsYeM3ochOvcH6EOCwZuxnfSBnhLrtAN3RZpTmwg/2qIX7dhL/eP hAWkwuY/wgHYigFTAAgiONhQJQ9IYOXs+obk7SVsG56tZdSXoooQ8LX3ur8X7ZrFzFCM iVXPWYrvWg9eLsMMFBTeOfkkFwJe7NnDO30+1QxC41ZIwQ6gGajp3QOZCIgLOyU5XcyN YV9MJ7RVdFM4Tscro92S2uJH0aeFwGFLP8bdZzX9WV/HcaMZ1QSrVGOZgpNtPa7+tMCG 6X1PDZSrEfiOMca1QghwYZpojVTqFbotV0wv/uBktpZmboXVg2tncbJW2RcrnKHs1//3 gBqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O7dXm3ea; 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 a8si30954617pgi.359.2019.01.27.22.45.44; Sun, 27 Jan 2019 22:45:58 -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=O7dXm3ea; 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 S1726839AbfA1GpP (ORCPT + 99 others); Mon, 28 Jan 2019 01:45:15 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33153 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726694AbfA1GpO (ORCPT ); Mon, 28 Jan 2019 01:45:14 -0500 Received: by mail-wm1-f65.google.com with SMTP id r24so9626144wmh.0 for ; Sun, 27 Jan 2019 22:45:13 -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=O7dXm3eaXx+urbyXs+leF9FdeXesCvpiSRQYtQssVK5y81eDev8ECLB6fEhz3TVkpO 1dLIFdEmDcMPqHZ7NWGdvSV/c4dqHkysgoHIbfpafxi9Wse6czBAMQ1AA6v5s/uCpG5F L5izdCEmQBNXGUIDzg5EmQR74IvSLLdxnWUBY= 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=lROh0w6noeEuvB6jXhPo3ipF9iF8exhGo5KvtQ79ENMR1mirvJ3NS9c6IeX+0NRq1m NBs3AwKaQjB7cav2lkCzTz1jQGuvBrvskzgO60X2uL/Fa8tI6BpPLgYteC87cwoW7tRq TbCOv/+AQHbzHqhvfs1XYz7DvqPcBbmYEBU41W8YwMWytY++7cYL8TvnNZ0evoYACz05 Y62VThpYZEqkczARSycDOkKy5Js2lxXL0C3n/4jeXgHwStPm+ftaSsiVi/dlj3cDlhsD vN9HZpfvCa+Rzn5jkpCCEVakNrXimUo+QnMYZZGm5n+M43WFs16t4dtE9V9ufET/BCbN M3uw== X-Gm-Message-State: AJcUukefTfpNFAgYDwyKOh6abXoNOJ6r2p4IwuaXWNKKHWyx2ElN+6wl +piyP2w8VJqdyHV9xuylZWx2GoRX7sc= X-Received: by 2002:a1c:2e43:: with SMTP id u64mr16048252wmu.52.1548657912682; Sun, 27 Jan 2019 22:45:12 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id c15sm52708620wml.27.2019.01.27.22.45.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:12 -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 , Shawn Guo , Bastian Stender , linux-pm@vger.kernel.org Subject: [PATCH v4 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:29 +0530 Message-Id: <6e8ab1213d82b6de5294c0f579a24150aafaf558.1548654899.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 --- 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