From patchwork Tue Jan 29 04:55:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785419 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 E56501874 for ; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4EE52B216 for ; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C86662B38C; Tue, 29 Jan 2019 04:58:05 +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 6CED32B216 for ; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfA2E6E (ORCPT ); Mon, 28 Jan 2019 23:58:04 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34296 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbfA2E6E (ORCPT ); Mon, 28 Jan 2019 23:58:04 -0500 Received: by mail-wr1-f65.google.com with SMTP id f7so20598394wrp.1 for ; Mon, 28 Jan 2019 20:58:03 -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=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=Z4HVrEsAJLZwLCWLjwhKeac6DiTO3NK15Ix6mCv8oaCWUMqLMOPX2ZXQSk/3MDXU/u d8EWT5UF9OUqAhBjgE6W91S+07pVgTlOWUd+OWeTF70aEEw1vdPTSVlLj/xdV1KOGPCm T+irIqzFGTBp4Rrz4A/n7Ko2BZDE0cvfWCLQo= 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=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=Awox0JMTGzdjsUb4fMirNXPTTdIKRLv22/yZqtRAQ6zhqIa+vv52f1AcOWxjz7wRsO HMsQcQmpxhGVAOlXf1yP9aCseroLHBonfaS1JBYaK3f7WyMKDlTf1MvLX3R/8qbdWQWi Lc/8BPXSg/uBy2QRqXeKB0h2Y4vv3jF0SXO6EP1Gqc4KeK6W+lRbdcsSwcZ02uerzAr3 KEB/7ll1GjjwN1y+FvmB2FuVbbinGQ4H/nLPnppqFAX+a2PrILjYZNhxH2okkcoYNVuO dYkraOWFF8ChTYaifoSFluhkdKCs0wFVKGhFkEftdHY2Bkuwd2i5oLQAYkMmn9whXjgp 4iig== X-Gm-Message-State: AJcUukffBs2DZqAJ1Pl5iEc0LyzGXxt+twBGxcGca6m+QehXhiQoEPcl uT52sR0fNLQ0ns1NJ8CX3IlomQ== X-Google-Smtp-Source: ALg8bN5+sCJyDD3U5tSJwjFysiND9QVXhp504ClglfbKlhPREFJkXVAAOR5EubBKMwk3msYX8rMBzg== X-Received: by 2002:a5d:50c5:: with SMTP id f5mr23276547wrt.37.1548737882650; Mon, 28 Jan 2019 20:58:02 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n6sm1320957wmk.9.2019.01.28.20.58.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:02 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v5 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:11 +0530 Message-Id: <4e19a2d9c5d929cdd87a984953c880c1e5a2e057.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/cpufreq-dt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e58bfcb1169e..7ba392911cd0 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,6 @@ struct private_data { struct opp_table *opp_table; struct device *cpu_dev; - struct thermal_cooling_device *cdev; const char *reg_name; bool have_static_opps; }; @@ -301,7 +299,6 @@ static int cpufreq_exit(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); @@ -314,21 +311,14 @@ static int cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void cpufreq_ready(struct cpufreq_policy *policy) -{ - struct private_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver dt_cpufreq_driver = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = set_target, .get = cpufreq_generic_get, .init = cpufreq_init, .exit = cpufreq_exit, - .ready = cpufreq_ready, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, .suspend = cpufreq_generic_suspend,