From patchwork Fri Jan 25 07:02:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156545 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18214jaa; Thu, 24 Jan 2019 23:03:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN4OK1JRVYve4IMHAxjtpvfpHA4oBdB0U5MldJgf8ksc4oaeLRmV/ht1oU/ISGl8z6dmi3uo X-Received: by 2002:a17:902:690c:: with SMTP id j12mr9704457plk.206.1548399797526; Thu, 24 Jan 2019 23:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399797; cv=none; d=google.com; s=arc-20160816; b=u+KEL1MZM+KULrnF+dgExAV3AhtQMlqntEIb4QK69ZkWZqFmSo4CMUqXdTaJMK4AF8 7FHQwjHWDcgPuGNNS8CERW4nXIp//kAeC3UXjkAX0u6Iead+7I07qBDn3jEESEmcSgsa S7OnhKR/Amd51veMwZnwQQ/+J1sje2BmxneulYewsdJBo22rZ58YJhkhSZl5mpPQtXAJ nM3WRGpCVtqWjK1laGA/9KzGtz2IsBadmBUhtN25hYN1llTAyK8bW0LG7WhVCI0w8LqX ClNoX9vjdxzmaBpY8/HXa3+Gdb0YPR2icDo0ypjsYVUdfRVGdA3EQ1HgjnOWCd7jiR6C TR5g== 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=uZy1LkljIDN6lDojv26e7q4kDvBk8xRbiGVWhpc8AJtnvpROkoAi97nptcDw2ApmhW vDM91GQJQrT0U6tGdn5g+po8/iWBpzm/O1nV+AKEjoy/a2cSmq+a4C9Hj9uqkc9sgt37 YRLk+cpGvVl7E+u1OQMPhjTdgChs3fYD//gQ+9rqT68+x0douHrUboWjyCaLYkQay+s6 QgT/80iMHZGBwX4/+dzIW3HAffAXselRjpedzSqiC8QYjPzGgASD9o6y32w6vfT5Xhuf KXWUZOVikH8Cf/E/UkaBItmvFqYyP7n6mBKayjjN5my1YLQ8ILSkKCz4Bt8l3Do0qFNZ eB3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NEk3eDfd; 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 o10si24044000pls.76.2019.01.24.23.03.17; Thu, 24 Jan 2019 23:03:17 -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=NEk3eDfd; 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 S1728292AbfAYHDQ (ORCPT + 15 others); Fri, 25 Jan 2019 02:03:16 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:33048 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728283AbfAYHDP (ORCPT ); Fri, 25 Jan 2019 02:03:15 -0500 Received: by mail-yw1-f66.google.com with SMTP id p65so3533952ywe.0 for ; Thu, 24 Jan 2019 23:03:15 -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=NEk3eDfdH6RfX9hchExtslZ+BOkSbowcM9TqUZKf4LXiHXO2GBftEUFiMmgVxLfEX/ B53QG/F66Ki43J/CZy0q6Xy/7ZT9UuuCZIFF3G0BowFvb43DtZgFu42ENX11ThPZSR/8 YQ4wpc9xVwYCgAfaB02CgPrlW4/5xJsB1cLAc= 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=pC4jtwMSD1ak0v7dmg0/oYa8rVf4fVJ8MGJ08kbSUyb1P3nE0Cr2Umvd1uWMEnZoIp qpnukMslfu1q4qbu/4iqKxNO3uWnfdIRfEOPVWa+/lo4agvkcnWLMLz6wjOCE4ty1dU/ G/rnwJPtp08Bq1tPYvK/HjdprMryal2xefj06M2onquFBYpu1iBY+pd4JxOnQ4leXSUq jZY7dnbyNfKVpD3S6BlzokcvKQhp3gM+ywDL3AwSqc09FZulj9xz+NXJlf48p7y27OO4 JTaursS9GRfAD0Yu4HCYOt36PLP+KsPf7HWoyBEG/9fwKt77heAXwLwnAqj38HrlQqNW MUnA== X-Gm-Message-State: AJcUukeOfAUHvdGNtGwW/X2J1pt8syp9Q3ysgxF2SDn/ksO0O5q2g0Kw 7W/yVNyVOFO6BbyVkB3qceBaiw== X-Received: by 2002:a0d:f7c1:: with SMTP id h184mr9695278ywf.473.1548399794630; Thu, 24 Jan 2019 23:03:14 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id i128sm10340153ywb.82.2019.01.24.23.03.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:14 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:24 +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 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(-) -- 2.17.1 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, };