All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported()
@ 2019-04-09  2:25 Yue Hu
  2019-04-09  4:17 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Yue Hu @ 2019-04-09  2:25 UTC (permalink / raw)
  To: rjw, rafael.j.wysocki, viresh.kumar; +Cc: linux-pm, huyue2

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported()
  2019-04-09  2:25 [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported() Yue Hu
@ 2019-04-09  4:17 ` Viresh Kumar
  2019-05-01 10:18   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2019-04-09  4:17 UTC (permalink / raw)
  To: Yue Hu; +Cc: rjw, rafael.j.wysocki, linux-pm, huyue2

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>

-- 
viresh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported()
  2019-04-09  4:17 ` Viresh Kumar
@ 2019-05-01 10:18   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01 10:18 UTC (permalink / raw)
  To: Viresh Kumar, Yue Hu; +Cc: rafael.j.wysocki, linux-pm, huyue2

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!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-01 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09  2:25 [PATCH] cpufreq: Remove cpufreq_driver check in cpufreq_boost_supported() Yue Hu
2019-04-09  4:17 ` Viresh Kumar
2019-05-01 10:18   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.