linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq cleanups related to pointless labels
@ 2016-02-25 23:01 Rafael J. Wysocki
  2016-02-25 23:03 ` [PATCH 1/2] cpufreq: Rearrange __cpufreq_driver_target() Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-02-25 23:01 UTC (permalink / raw)
  To: Linux PM list
  Cc: Linux Kernel Mailing List, Srinivas Pandruvada, Viresh Kumar

Hi,

Two cleanups removing pointless labels at return statements from the
core and the ACPI driver.

On opt of the current linux-next branch of linux-pm.git.

Thanks,
Rafael

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

* [PATCH 1/2] cpufreq: Rearrange __cpufreq_driver_target()
  2016-02-25 23:01 [PATCH 0/2] cpufreq cleanups related to pointless labels Rafael J. Wysocki
@ 2016-02-25 23:03 ` Rafael J. Wysocki
  2016-02-25 23:03 ` [PATCH 2/2] cpufreq: acpi-cpufreq: Drop pointless label from acpi_cpufreq_target() Rafael J. Wysocki
  2016-02-26  2:34 ` [PATCH 0/2] cpufreq cleanups related to pointless labels Viresh Kumar
  2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-02-25 23:03 UTC (permalink / raw)
  To: Linux PM list
  Cc: Linux Kernel Mailing List, Srinivas Pandruvada, Viresh Kumar

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Drop a pointless label at a return statement from
__cpufreq_driver_target() and rearrange that function
to reduce the indentation level.

No intentional functional changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/cpufreq.c |   47 ++++++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 26 deletions(-)

Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq.c
+++ linux-pm/drivers/cpufreq/cpufreq.c
@@ -1899,7 +1899,8 @@ int __cpufreq_driver_target(struct cpufr
 			    unsigned int relation)
 {
 	unsigned int old_target_freq = target_freq;
-	int retval = -EINVAL;
+	struct cpufreq_frequency_table *freq_table;
+	int index, retval;
 
 	if (cpufreq_disabled())
 		return -ENODEV;
@@ -1926,34 +1927,28 @@ int __cpufreq_driver_target(struct cpufr
 	policy->restore_freq = policy->cur;
 
 	if (cpufreq_driver->target)
-		retval = cpufreq_driver->target(policy, target_freq, relation);
-	else if (cpufreq_driver->target_index) {
-		struct cpufreq_frequency_table *freq_table;
-		int index;
-
-		freq_table = cpufreq_frequency_get_table(policy->cpu);
-		if (unlikely(!freq_table)) {
-			pr_err("%s: Unable to find freq_table\n", __func__);
-			goto out;
-		}
-
-		retval = cpufreq_frequency_table_target(policy, freq_table,
-				target_freq, relation, &index);
-		if (unlikely(retval)) {
-			pr_err("%s: Unable to find matching freq\n", __func__);
-			goto out;
-		}
-
-		if (freq_table[index].frequency == policy->cur) {
-			retval = 0;
-			goto out;
-		}
+		return cpufreq_driver->target(policy, target_freq, relation);
 
-		retval = __target_index(policy, freq_table, index);
+	if (!cpufreq_driver->target_index)
+		return -EINVAL;
+
+	freq_table = cpufreq_frequency_get_table(policy->cpu);
+	if (unlikely(!freq_table)) {
+		pr_err("%s: Unable to find freq_table\n", __func__);
+		return -EINVAL;
+	}
+
+	retval = cpufreq_frequency_table_target(policy, freq_table, target_freq,
+						relation, &index);
+	if (unlikely(retval)) {
+		pr_err("%s: Unable to find matching freq\n", __func__);
+		return retval;
 	}
 
-out:
-	return retval;
+	if (freq_table[index].frequency == policy->cur)
+		return 0;
+
+	return __target_index(policy, freq_table, index);
 }
 EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
 


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

* [PATCH 2/2] cpufreq: acpi-cpufreq: Drop pointless label from acpi_cpufreq_target()
  2016-02-25 23:01 [PATCH 0/2] cpufreq cleanups related to pointless labels Rafael J. Wysocki
  2016-02-25 23:03 ` [PATCH 1/2] cpufreq: Rearrange __cpufreq_driver_target() Rafael J. Wysocki
@ 2016-02-25 23:03 ` Rafael J. Wysocki
  2016-02-25 23:38   ` Srinivas Pandruvada
  2016-02-26  2:34 ` [PATCH 0/2] cpufreq cleanups related to pointless labels Viresh Kumar
  2 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-02-25 23:03 UTC (permalink / raw)
  To: Linux PM list
  Cc: Linux Kernel Mailing List, Srinivas Pandruvada, Viresh Kumar

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The "out" label at the final return statement in acpi_cpufreq_target()
is totally pointless, so drop them and modify the code to return the
right values immediately instead of jumping to it.

No functional changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/acpi-cpufreq.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux-pm/drivers/cpufreq/acpi-cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/acpi-cpufreq.c
+++ linux-pm/drivers/cpufreq/acpi-cpufreq.c
@@ -434,7 +434,7 @@ static int acpi_cpufreq_target(struct cp
 		} else {
 			pr_debug("Already at target state (P%d)\n",
 				next_perf_state);
-			goto out;
+			return 0;
 		}
 	}
 
@@ -456,8 +456,7 @@ static int acpi_cpufreq_target(struct cp
 		cmd.val = (u32) perf->states[next_perf_state].control;
 		break;
 	default:
-		result = -ENODEV;
-		goto out;
+		return -ENODEV;
 	}
 
 	/* cpufreq holds the hotplug lock, so we are safe from here on */
@@ -480,7 +479,6 @@ static int acpi_cpufreq_target(struct cp
 	if (!result)
 		perf->state = next_perf_state;
 
-out:
 	return result;
 }
 

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

* Re: [PATCH 2/2] cpufreq: acpi-cpufreq: Drop pointless label from acpi_cpufreq_target()
  2016-02-25 23:03 ` [PATCH 2/2] cpufreq: acpi-cpufreq: Drop pointless label from acpi_cpufreq_target() Rafael J. Wysocki
@ 2016-02-25 23:38   ` Srinivas Pandruvada
  0 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2016-02-25 23:38 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM list; +Cc: Linux Kernel Mailing List, Viresh Kumar

On Fri, 2016-02-26 at 00:03 +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The "out" label at the final return statement in
> acpi_cpufreq_target()
> is totally pointless, so drop them and modify the code to return the
> right values immediately instead of jumping to it.
> 
> No functional changes.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/cpufreq/acpi-cpufreq.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> Index: linux-pm/drivers/cpufreq/acpi-cpufreq.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/acpi-cpufreq.c
> +++ linux-pm/drivers/cpufreq/acpi-cpufreq.c
> @@ -434,7 +434,7 @@ static int acpi_cpufreq_target(struct cp
>  		} else {
>  			pr_debug("Already at target state (P%d)\n",
>  				next_perf_state);
> -			goto out;
> +			return 0;
>  		}
>  	}
>  
> @@ -456,8 +456,7 @@ static int acpi_cpufreq_target(struct cp
>  		cmd.val = (u32) perf-
> >states[next_perf_state].control;
>  		break;
>  	default:
> -		result = -ENODEV;
> -		goto out;
> +		return -ENODEV;
>  	}
>  
>  	/* cpufreq holds the hotplug lock, so we are safe from here
> on */
> @@ -480,7 +479,6 @@ static int acpi_cpufreq_target(struct cp
>  	if (!result)
>  		perf->state = next_perf_state;
>  
> -out:
>  	return result;
>  }
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/2] cpufreq cleanups related to pointless labels
  2016-02-25 23:01 [PATCH 0/2] cpufreq cleanups related to pointless labels Rafael J. Wysocki
  2016-02-25 23:03 ` [PATCH 1/2] cpufreq: Rearrange __cpufreq_driver_target() Rafael J. Wysocki
  2016-02-25 23:03 ` [PATCH 2/2] cpufreq: acpi-cpufreq: Drop pointless label from acpi_cpufreq_target() Rafael J. Wysocki
@ 2016-02-26  2:34 ` Viresh Kumar
  2 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2016-02-26  2:34 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM list, Linux Kernel Mailing List, Srinivas Pandruvada

On 26-02-16, 00:01, Rafael J. Wysocki wrote:
> Hi,
> 
> Two cleanups removing pointless labels at return statements from the
> core and the ACPI driver.
> 
> On opt of the current linux-next branch of linux-pm.git.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

end of thread, other threads:[~2016-02-26  2:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 23:01 [PATCH 0/2] cpufreq cleanups related to pointless labels Rafael J. Wysocki
2016-02-25 23:03 ` [PATCH 1/2] cpufreq: Rearrange __cpufreq_driver_target() Rafael J. Wysocki
2016-02-25 23:03 ` [PATCH 2/2] cpufreq: acpi-cpufreq: Drop pointless label from acpi_cpufreq_target() Rafael J. Wysocki
2016-02-25 23:38   ` Srinivas Pandruvada
2016-02-26  2:34 ` [PATCH 0/2] cpufreq cleanups related to pointless labels Viresh Kumar

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).