From patchwork Mon Jan 28 06:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10783311 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 B10031390 for ; Mon, 28 Jan 2019 06:45:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DF972A395 for ; Mon, 28 Jan 2019 06:45:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 925702A3A1; Mon, 28 Jan 2019 06:45:25 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB 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 281C92A395 for ; Mon, 28 Jan 2019 06:45:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbfA1GpY (ORCPT ); Mon, 28 Jan 2019 01:45:24 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34799 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbfA1GpY (ORCPT ); Mon, 28 Jan 2019 01:45:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id f7so16760760wrp.1 for ; Sun, 27 Jan 2019 22:45:23 -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=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=ce0p9qg1PNF/g2Mzt+MI/kYGEL51eAZQwxB7uptGywv/lzmD2j+/Xk6ndBMpNS4KLb BgeMs0xQ+O4I+rcGxJFGp/XhLxsOMO8EMccGK+zR497LstD56+kGZnGFeW48qV5hawtT AldDvDhXXBySYabj4WViQD7SKKWHLBn7vR/GA= 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=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=K9lXI4S/LMbF7p0HT/fzvu5u9jkpHzh0HHHRtRBQrW/l+Psq7Pe5xyOnYO1b3aKUfd 50fyzhSYKc2/c4lZZOh5LmoauEoFN7/VCkBDZd8RfBQFvt6w4DeFoAHG5nOGBmES3ZOg Vae5JTfvd4TCZpZHKcyQL1MeY4Jnby2J8+Vxnk0gco/tAk6ABlReMpDYpWdJphi2fNIM N0JK2LSLCgoS0/72ORlYwzJRQXfdUxLjP+JmhiE+ZiKtaT9eVOK7L/Ph8PPNrwU5vUTa Cedm77ZpfzHdimqDZd6vIWcTYiNIO96Ax09EU6fAhSPxeYWQ0LOD7JquSqufEw1L5uIV rhGw== X-Gm-Message-State: AJcUukfaBGZlyI3nGDE7vAO5RCWSCHnAWbtmRTz+yOXELFyHjXLuP+vQ nInqVmgCbVA9Ppb2cOaUty89pQ== X-Google-Smtp-Source: ALg8bN4hRvGsVB7OwydVzAo5DowYVFPT39mqtlIt6zVrf4HWTF1biOHwA+6CIhPHaohhuXy1wvjOOw== X-Received: by 2002:a05:6000:1287:: with SMTP id f7mr21262511wrx.302.1548657922646; Sun, 27 Jan 2019 22:45:22 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id q12sm44198894wmf.2.2019.01.27.22.45.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:22 -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" , linux-pm@vger.kernel.org Subject: [PATCH v4 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:30 +0530 Message-Id: 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 X-Virus-Scanned: ClamAV using ClamSMTP 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 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..2a4c4ea7980b 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_AUTO_REGISTER_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,