diff mbox series

cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported()

Message ID 20190409022536.6164-1-zbestahu@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show
Series cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported() | expand

Commit Message

Yue Hu April 9, 2019, 2:25 a.m. UTC
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(-)

Comments

Viresh Kumar April 9, 2019, 4:17 a.m. UTC | #1
On 09-04-19, 10:25, Yue Hu wrote:
> 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)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Rafael J. Wysocki May 1, 2019, 10:18 a.m. UTC | #2
On Tuesday, April 9, 2019 6:17:59 AM CEST Viresh Kumar wrote:
> On 09-04-19, 10:25, Yue Hu wrote:
> > 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)
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Patch applied, thanks!
diff mbox series

Patch

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)