Linux Power Management development
 help / color / mirror / Atom feed
From: Yue Hu <zbestahu@gmail.com>
To: rjw@rjwysocki.net, rafael.j.wysocki@intel.com, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, huyue2@yulong.com
Subject: [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported()
Date: Tue,  9 Apr 2019 10:25:36 +0800	[thread overview]
Message-ID: <20190409022536.6164-1-zbestahu@gmail.com> (raw)

From: Yue Hu <huyue2@yulong.com>

Currently there are three calling paths for cpufreq_boost_supported() in
all as below, we can see the cpufreq_driver null check is needless since
it is already checked before.

<path1>
  cpufreq_enable_boost_support()
    |-> if (!cpufreq_driver)
    |-> cpufreq_boost_supported()

<path2>
  cpufreq_register_driver()
    |-> if (!driver_data ...
    |-> cpufreq_driver = driver_data
    |-> cpufreq_boost_supported()
    |-> remove_boost_sysfs_file()
          |-> cpufreq_boost_supported()

<path3>
  cpufreq_unregister_driver()
    |-> if (!cpufreq_driver ...
    |-> remove_boost_sysfs_file()
          |-> cpufreq_boost_supported()

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 drivers/cpufreq/cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e109227..d9123de 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2426,7 +2426,7 @@ int cpufreq_boost_trigger_state(int state)
 
 static bool cpufreq_boost_supported(void)
 {
-	return likely(cpufreq_driver) && cpufreq_driver->set_boost;
+	return cpufreq_driver->set_boost;
 }
 
 static int create_boost_sysfs_file(void)
-- 
1.9.1


             reply	other threads:[~2019-04-09  2:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  2:25 Yue Hu [this message]
2019-04-09  4:17 ` [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported() Viresh Kumar
2019-05-01 10:18   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190409022536.6164-1-zbestahu@gmail.com \
    --to=zbestahu@gmail.com \
    --cc=huyue2@yulong.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox