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: 10785417 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE6BF1874 for ; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFAAF2B37B for ; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B37562B39A; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59A872B37B for ; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbfA2E5x (ORCPT ); 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-Google-Smtp-Source: ALg8bN5UEBiiXSXtpHp8EndQm+0o8Ed6sp27vUhbZ75S3341/Gr23r5AiU/HoCcNVVnjmH4Z3xXhXA== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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, };