Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp141405imu; Thu, 24 Jan 2019 23:05:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5eQlmAiP4TNgXFBtUBGmq2gn8CYPQFE2bO8LgrkRXi2lotXHgB7XSX3/Dht4BivaKFz2Ya X-Received: by 2002:a62:29c3:: with SMTP id p186mr9958056pfp.117.1548399918491; Thu, 24 Jan 2019 23:05:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399918; cv=none; d=google.com; s=arc-20160816; b=HuxpibydTnAb6a4iMsAGmJcYI6Gx2LQDbDrOdzCFNwJv0jarmO15dXnrrn4HxPW+/j 3oczyHUSwRCHDa8YK261PscQwuwE2iRzHhQ+HJnq+USsF6aRtJbmrbdIvL/CBgJ5KDrv UrGTJs0QQ3W0WDW7fICiOrRndSp3f8yGZwrPENE5btSPTmkmJ/FMvVOXN2JnAdeEbY5v PL0h29tRyUzfpY9hDwbZ9ZLEo29GNrVVTB2IlUwtwcS2ooHCzcKfRPkXasxc027Se8nW 3j/Vd7ADnCh1s5RhW8fbaOOZ+Vzoo6pXjQS320e2qNkgUA9/Nz8L7UFhXaBbpBboLIwQ 3o3g== 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=rG8NPEQ09PZjhYqUJchnN5/jGnhAFsQFqsJT0dtbpTD9CmpNt1+61XIWoX3xPT2M0B vP/Zw7Fi/uj9fxZTE2G3m4k/b+TpU+wcvI2zVc4znDfwExdFcd2qQXEg6rGn4Ke/IxBK nzrvDsq1kVwAKV4cVZGclYFPDgZodjwmTtBDa0cx2dSkK8hFyyGOuKujJUEZmvxuDMmQ HqNU7dvn7JLfUHsbvqpz3O1YaZ0maF9x3i0e8aZtQ36MXZ5iCvO+29ZgV5AonTU3hk3n 7V5JmgpADeTsWe6Hb7Vgcu3H8g+8f9k+O0zRQHB+xcszgMSpaJ1rYIZ7LmcS5+n9ZU31 +DXg== 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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 62si10392865pgb.298.2019.01.24.23.05.01; Thu, 24 Jan 2019 23:05:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1728331AbfAYHDR (ORCPT + 99 others); Fri, 25 Jan 2019 02:03:17 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:34511 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728288AbfAYHDP (ORCPT ); Fri, 25 Jan 2019 02:03:15 -0500 Received: by mail-yw1-f65.google.com with SMTP id g75so3536375ywb.1 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=LeAYR6/unktxFYYLTmIss5BSNovkp4Vd9gWEw9V7nO0QXl4Pc8klpKMqwLjyQRpXpJ kjtt9qsvQys+47HfdArbk/R+xTsV0S+WPTbP52KozZmq26hi+5M1+ShJ44A+9pp+e1cz wwrWTJXKCVh99OdFXOVBry1RxoSaeaheYxWToGHFo0h6P/wSwRut9XbiL66rfH3KaVsN aGuj0uwL/NELPN76rKgjUMI04D8PpmYx1nuv/HKurhniCeu6NaQRizz+DmAy5oJNMe0b ODWQzRfRz6GtVbZjur0HOnkePCGGGwxp7vtYMqSpyJwrmVaj/S/D1vmdeWh1n4u6Jejy tTSw== X-Gm-Message-State: AJcUukcjrRWIUnWZAhAI3hAUmbV1MQkhXUnHRQY2Kh/Ipz69RrZB3aGq Xq3hrhvEPSi9VRozIIYOr/rpfhLsXyA= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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, }; -- 2.17.1