From patchwork Mon Jan 14 16:34:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155555 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3860436jaa; Mon, 14 Jan 2019 08:38:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5wdgMHh7kL4Wnaw2PTsuIEuEPEuxnXVzV4WTq4ae2far42ocNLF4psNlQnTRLtMs1R5UDu X-Received: by 2002:a62:7e13:: with SMTP id z19mr26052959pfc.94.1547483931894; Mon, 14 Jan 2019 08:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483931; cv=none; d=google.com; s=arc-20160816; b=aGIxjcANJCZiRHJMlEux9cxHaiMTE8EaoZYAE2QkqPZ0jHwacmu6GMgdU7eRodrNuJ qmuyQpF2UfNvFZoeQ+l2NFsMD8M8OW00nxXP3wafYc9vJGzokA9G7p55X+ad4XHbmdv8 rQlSK0DSIVImRwewTawWtQaZLgTRvaz83WLi7lTiPVwECwZZ+Egw0RhqLNN3/H6B6sHs tcGBjD9dqwVkwKsmVBBvNIHsa2YGVzbw0pz6pJ8pBI+SyYHIP4DqkvrqFItyrYmsf0eu o20chtXcgtNsfjkSmyPdVbii5VBkHNZd+jUpiFz1mQRWCTiV8g9LA80OArdgYdcn8Qk4 lRxg== 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=UIVW5Jk3h063m2TjLZyvAJQQxY5HQB8LVsVnZkvA3R0=; b=QdPCfz6OSmiOgbsxTEtOUAs88aAqk07ad+DUi/UxXnOuOTHzUUJS3DUEzEOhhxkyd6 ZhKi9NJG7mbqnF0VUEZSoUjtaqKS5B+pOlcKFuGQu1oBeOjRVKy43UQHAdg2mluz1zhC umeiJsVe0dAbyUFB8uQnxPLKLnHQMSl3qQ6Zra2eycnkN/3tI7QPACoXycg+FdWiRGLk rc195cBGIGrd8ympfkkrakuXlWQqxwsg7ncoaTIH2asHvqKrwsS4hW2K/YsQaSHz0v2A pHx6eGEsJPvGpNrreI4D6/EUzxXq3cbE3keLqqMoKtIjDUeF31IZZ+uo1CIIoyzlHN/b RpDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oe5N8JYA; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 bc7si665347plb.120.2019.01.14.08.38.51; Mon, 14 Jan 2019 08:38:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=Oe5N8JYA; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726736AbfANQiv (ORCPT + 15 others); Mon, 14 Jan 2019 11:38:51 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38806 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbfANQiu (ORCPT ); Mon, 14 Jan 2019 11:38:50 -0500 Received: by mail-wr1-f66.google.com with SMTP id v13so23654339wrw.5 for ; Mon, 14 Jan 2019 08:38:49 -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=UIVW5Jk3h063m2TjLZyvAJQQxY5HQB8LVsVnZkvA3R0=; b=Oe5N8JYAdaTMIzIXzxENuBPAAkXsaAkTXY1hQM2DXCEDtSRB8YPdZc1Z6ShWxktov2 ZR5kbfQP/Z5P2bFF+aECvR2FeAwTLxJfYGTN/b23rj/w3DzC6/CfVhH0RYRf86/RHvla 9LLdaJmiWToZ9s6mCd3GqK4FUZa4FppMCTyPQ= 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=UIVW5Jk3h063m2TjLZyvAJQQxY5HQB8LVsVnZkvA3R0=; b=OuBiIgzm/5iroFfqEoh/t+K7ZkEugAgj/J6xnOg3Y6l9P7kgkIDlr09QA40CC57FB4 P7KfFTyca+OyYSWmYzScs0IwnT6F1Bsq6EfLfsBNmfYBOV65yN8OC69uIgfR+v+iTr/V Wb6VSxDgew09/eFQVIb5th6yN7A3Tnl+X52YBIWgwZn2EDJKQgdEfENIXxV3cckaWgmg rzMHhzr9A2uA2KYP4kB/mmlePO3IPaC15xGnQkBfdnPZbTTwx2S1ZJFbLpKO5hqPbp0P fd9rmawbjHEOp9XkB69rKS9c95Akp7igytYWGStjjFeOvyaKlRJLetIBdj2uMb/KkDqs Nwsg== X-Gm-Message-State: AJcUukcQJNOBqxDzEG59/dN6RzkPqRUeKMpTQZIzf+kv7iYhB1ofF7jh 3PBmlJ+673qPfPQBrtGwsmJT5A== X-Received: by 2002:adf:cc91:: with SMTP id p17mr25446735wrj.118.1547483928892; Mon, 14 Jan 2019 08:38:48 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id e9sm60948525wro.16.2019.01.14.08.38.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:38:48 -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 , linux-pm@vger.kernel.org Subject: [PATCH v1 05/10] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:04:57 +0530 Message-Id: <49e531e140f299127ae6c0bc905b993b97c269e2.1547481320.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..ffb00291f48e 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; @@ -216,20 +204,18 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) 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, };