linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] cpufreq: acpi: Remove some redundant code
  2018-08-20 10:15 [PATCH] cpufreq: acpi: Remove some redundant code Ding Xiang
@ 2018-08-20  9:10 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2018-08-20  9:10 UTC (permalink / raw)
  To: Ding Xiang; +Cc: viresh.kumar, linux-pm, linux-kernel

On Monday, August 20, 2018 12:15:11 PM CEST Ding Xiang wrote:
> For single statement blocks,braces are not necessary.
> And "else" is not useful after return. So,remove these code.
> 
> Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
> ---
>  drivers/cpufreq/acpi-cpufreq.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index b61f4ec..0751a0a 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -423,9 +423,8 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
>  	unsigned int next_perf_state = 0; /* Index into perf table */
>  	int result = 0;
>  
> -	if (unlikely(!data)) {
> +	if (unlikely(!data))
>  		return -ENODEV;
> -	}
>  
>  	perf = to_perf_data(data);
>  	next_perf_state = policy->freq_table[index].driver_data;
> @@ -521,11 +520,10 @@ static unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
>  		}
>  		perf->state = perf->state_count-1;
>  		return freqn;
> -	} else {
> -		/* assume CPU is at P0... */
> -		perf->state = 0;
> -		return perf->states[0].core_frequency * 1000;
>  	}
> +	/* assume CPU is at P0... */
> +	perf->state = 0;
> +	return perf->states[0].core_frequency * 1000;
>  }
>  
>  static void free_acpi_perf_data(void)
> 

So what exactly is the value of this patch?



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

* [PATCH] cpufreq: acpi: Remove some redundant code
@ 2018-08-20 10:15 Ding Xiang
  2018-08-20  9:10 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Ding Xiang @ 2018-08-20 10:15 UTC (permalink / raw)
  To: rjw, viresh.kumar, linux-pm, linux-kernel

For single statement blocks,braces are not necessary.
And "else" is not useful after return. So,remove these code.

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 drivers/cpufreq/acpi-cpufreq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index b61f4ec..0751a0a 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -423,9 +423,8 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
 	unsigned int next_perf_state = 0; /* Index into perf table */
 	int result = 0;
 
-	if (unlikely(!data)) {
+	if (unlikely(!data))
 		return -ENODEV;
-	}
 
 	perf = to_perf_data(data);
 	next_perf_state = policy->freq_table[index].driver_data;
@@ -521,11 +520,10 @@ static unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
 		}
 		perf->state = perf->state_count-1;
 		return freqn;
-	} else {
-		/* assume CPU is at P0... */
-		perf->state = 0;
-		return perf->states[0].core_frequency * 1000;
 	}
+	/* assume CPU is at P0... */
+	perf->state = 0;
+	return perf->states[0].core_frequency * 1000;
 }
 
 static void free_acpi_perf_data(void)
-- 
1.8.3.1




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

end of thread, other threads:[~2018-08-20  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 10:15 [PATCH] cpufreq: acpi: Remove some redundant code Ding Xiang
2018-08-20  9:10 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).