diff mbox

[1/2] ACPI / processor: Drop an unused argument of a cleanup routine

Message ID 15976638.8lfDjd5ol2@vostro.rjw.lan (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Rafael J. Wysocki July 18, 2015, 1:14 a.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

acpi_processor_unregister_performance() actually doesn't use its
first argument, so drop it and update the callers accordingly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/processor_perflib.c    |    4 +---
 drivers/cpufreq/acpi-cpufreq.c      |    5 ++---
 drivers/cpufreq/e_powersaver.c      |    2 +-
 drivers/cpufreq/ia64-acpi-cpufreq.c |    5 ++---
 drivers/cpufreq/powernow-k7.c       |    4 ++--
 drivers/cpufreq/powernow-k8.c       |    5 ++---
 drivers/xen/xen-acpi-processor.c    |    4 ++--
 include/acpi/processor.h            |    5 +----
 8 files changed, 13 insertions(+), 21 deletions(-)


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

Comments

xinhui.pan July 20, 2015, 1:45 a.m. UTC | #1
hi, Rafael
	thanks for your nice work :)
On 2015?07?18? 09:14, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> acpi_processor_unregister_performance() actually doesn't use its
> first argument, so drop it and update the callers accordingly.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/acpi/processor_perflib.c    |    4 +---
>  drivers/cpufreq/acpi-cpufreq.c      |    5 ++---
>  drivers/cpufreq/e_powersaver.c      |    2 +-
>  drivers/cpufreq/ia64-acpi-cpufreq.c |    5 ++---
>  drivers/cpufreq/powernow-k7.c       |    4 ++--
>  drivers/cpufreq/powernow-k8.c       |    5 ++---
>  drivers/xen/xen-acpi-processor.c    |    4 ++--
>  include/acpi/processor.h            |    5 +----
>  8 files changed, 13 insertions(+), 21 deletions(-)
> 

I wish I can test this patch. However I only have x86 hardware, not all codes can be tested on my side.

> Index: linux-pm/drivers/xen/xen-acpi-processor.c
> ===================================================================
> --- linux-pm.orig/drivers/xen/xen-acpi-processor.c
> +++ linux-pm/drivers/xen/xen-acpi-processor.c
> @@ -563,7 +563,7 @@ err_unregister:
>  	for_each_possible_cpu(i) {
>  		struct acpi_processor_performance *perf;
>  		perf = per_cpu_ptr(acpi_perf_data, i);
> -		acpi_processor_unregister_performance(perf, i);
> +		acpi_processor_unregister_performance(i);
>  	}
>  err_out:
>  	/* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
> @@ -582,7 +582,7 @@ static void __exit xen_acpi_processor_ex
>  	for_each_possible_cpu(i) {
>  		struct acpi_processor_performance *perf;
>  		perf = per_cpu_ptr(acpi_perf_data, i);
> -		acpi_processor_unregister_performance(perf, i);
> +		acpi_processor_unregister_performance(i);


>  	}
>  	free_acpi_perf_data();
>  }
> 

After a simple review, in functions above *perf* is not used anymore, can we just change the codes like below
	@@ -580,9 +580,7 @@ static void __exit xen_acpi_processor_exit(void)
        kfree(acpi_id_present);
        kfree(acpi_id_cst_present);
        for_each_possible_cpu(i) {
-               struct acpi_processor_performance *perf;
-               perf = per_cpu_ptr(acpi_perf_data, i);
-               acpi_processor_unregister_performance(perf, i);
+               acpi_processor_unregister_performance(i);
        }
        free_acpi_perf_data();

thanks
xinhui
--
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
Rafael J. Wysocki July 20, 2015, 9:49 p.m. UTC | #2
On Monday, July 20, 2015 09:45:30 AM Pan Xinhui wrote:
> hi, Rafael
> 	thanks for your nice work :)
> On 2015?07?18? 09:14, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > acpi_processor_unregister_performance() actually doesn't use its
> > first argument, so drop it and update the callers accordingly.
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >  drivers/acpi/processor_perflib.c    |    4 +---
> >  drivers/cpufreq/acpi-cpufreq.c      |    5 ++---
> >  drivers/cpufreq/e_powersaver.c      |    2 +-
> >  drivers/cpufreq/ia64-acpi-cpufreq.c |    5 ++---
> >  drivers/cpufreq/powernow-k7.c       |    4 ++--
> >  drivers/cpufreq/powernow-k8.c       |    5 ++---
> >  drivers/xen/xen-acpi-processor.c    |    4 ++--
> >  include/acpi/processor.h            |    5 +----
> >  8 files changed, 13 insertions(+), 21 deletions(-)
> > 
> 
> I wish I can test this patch. However I only have x86 hardware, not all
> codes can be tested on my side.

Possible build errors should be sorted out by the 0-day testing and the
functional part will be OK if the name of the remaining argument is not
changed in any spot.


> > Index: linux-pm/drivers/xen/xen-acpi-processor.c
> > ===================================================================
> > --- linux-pm.orig/drivers/xen/xen-acpi-processor.c
> > +++ linux-pm/drivers/xen/xen-acpi-processor.c
> > @@ -563,7 +563,7 @@ err_unregister:
> >  	for_each_possible_cpu(i) {
> >  		struct acpi_processor_performance *perf;
> >  		perf = per_cpu_ptr(acpi_perf_data, i);
> > -		acpi_processor_unregister_performance(perf, i);
> > +		acpi_processor_unregister_performance(i);
> >  	}
> >  err_out:
> >  	/* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
> > @@ -582,7 +582,7 @@ static void __exit xen_acpi_processor_ex
> >  	for_each_possible_cpu(i) {
> >  		struct acpi_processor_performance *perf;
> >  		perf = per_cpu_ptr(acpi_perf_data, i);
> > -		acpi_processor_unregister_performance(perf, i);
> > +		acpi_processor_unregister_performance(i);
> 
> 
> >  	}
> >  	free_acpi_perf_data();
> >  }
> > 
> 
> After a simple review, in functions above *perf* is not used anymore, can we just change the codes like below
> 	@@ -580,9 +580,7 @@ static void __exit xen_acpi_processor_exit(void)
>         kfree(acpi_id_present);
>         kfree(acpi_id_cst_present);
>         for_each_possible_cpu(i) {
> -               struct acpi_processor_performance *perf;
> -               perf = per_cpu_ptr(acpi_perf_data, i);
> -               acpi_processor_unregister_performance(perf, i);
> +               acpi_processor_unregister_performance(i);
>         }
>         free_acpi_perf_data();

You're right, thanks!

I'll send an update shortly.
diff mbox

Patch

Index: linux-pm/drivers/acpi/processor_perflib.c
===================================================================
--- linux-pm.orig/drivers/acpi/processor_perflib.c
+++ linux-pm/drivers/acpi/processor_perflib.c
@@ -780,9 +780,7 @@  acpi_processor_register_performance(stru
 
 EXPORT_SYMBOL(acpi_processor_register_performance);
 
-void
-acpi_processor_unregister_performance(struct acpi_processor_performance
-				      *performance, unsigned int cpu)
+void acpi_processor_unregister_performance(unsigned int cpu)
 {
 	struct acpi_processor *pr;
 
Index: linux-pm/include/acpi/processor.h
===================================================================
--- linux-pm.orig/include/acpi/processor.h
+++ linux-pm/include/acpi/processor.h
@@ -228,10 +228,7 @@  extern int acpi_processor_preregister_pe
 
 extern int acpi_processor_register_performance(struct acpi_processor_performance
 					       *performance, unsigned int cpu);
-extern void acpi_processor_unregister_performance(struct
-						  acpi_processor_performance
-						  *performance,
-						  unsigned int cpu);
+extern void acpi_processor_unregister_performance(unsigned int cpu);
 
 /* note: this locks both the calling module and the processor module
          if a _PPC object exists, rmmod is disallowed then */
Index: linux-pm/drivers/cpufreq/acpi-cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/acpi-cpufreq.c
+++ linux-pm/drivers/cpufreq/acpi-cpufreq.c
@@ -842,7 +842,7 @@  static int acpi_cpufreq_cpu_init(struct
 err_freqfree:
 	kfree(data->freq_table);
 err_unreg:
-	acpi_processor_unregister_performance(perf, cpu);
+	acpi_processor_unregister_performance(cpu);
 err_free_mask:
 	free_cpumask_var(data->freqdomain_cpus);
 err_free:
@@ -860,8 +860,7 @@  static int acpi_cpufreq_cpu_exit(struct
 
 	if (data) {
 		policy->driver_data = NULL;
-		acpi_processor_unregister_performance(data->acpi_data,
-						      data->acpi_perf_cpu);
+		acpi_processor_unregister_performance(data->acpi_perf_cpu);
 		free_cpumask_var(data->freqdomain_cpus);
 		kfree(data->freq_table);
 		kfree(data);
Index: linux-pm/drivers/cpufreq/e_powersaver.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/e_powersaver.c
+++ linux-pm/drivers/cpufreq/e_powersaver.c
@@ -78,7 +78,7 @@  static int eps_acpi_init(void)
 static int eps_acpi_exit(struct cpufreq_policy *policy)
 {
 	if (eps_acpi_cpu_perf) {
-		acpi_processor_unregister_performance(eps_acpi_cpu_perf, 0);
+		acpi_processor_unregister_performance(0);
 		free_cpumask_var(eps_acpi_cpu_perf->shared_cpu_map);
 		kfree(eps_acpi_cpu_perf);
 		eps_acpi_cpu_perf = NULL;
Index: linux-pm/drivers/cpufreq/ia64-acpi-cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/ia64-acpi-cpufreq.c
+++ linux-pm/drivers/cpufreq/ia64-acpi-cpufreq.c
@@ -313,7 +313,7 @@  acpi_cpufreq_cpu_init (
  err_freqfree:
 	kfree(data->freq_table);
  err_unreg:
-	acpi_processor_unregister_performance(&data->acpi_data, cpu);
+	acpi_processor_unregister_performance(cpu);
  err_free:
 	kfree(data);
 	acpi_io_data[cpu] = NULL;
@@ -332,8 +332,7 @@  acpi_cpufreq_cpu_exit (
 
 	if (data) {
 		acpi_io_data[policy->cpu] = NULL;
-		acpi_processor_unregister_performance(&data->acpi_data,
-		                                      policy->cpu);
+		acpi_processor_unregister_performance(policy->cpu);
 		kfree(data);
 	}
 
Index: linux-pm/drivers/cpufreq/powernow-k7.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/powernow-k7.c
+++ linux-pm/drivers/cpufreq/powernow-k7.c
@@ -421,7 +421,7 @@  static int powernow_acpi_init(void)
 	return 0;
 
 err2:
-	acpi_processor_unregister_performance(acpi_processor_perf, 0);
+	acpi_processor_unregister_performance(0);
 err1:
 	free_cpumask_var(acpi_processor_perf->shared_cpu_map);
 err05:
@@ -661,7 +661,7 @@  static int powernow_cpu_exit(struct cpuf
 {
 #ifdef CONFIG_X86_POWERNOW_K7_ACPI
 	if (acpi_processor_perf) {
-		acpi_processor_unregister_performance(acpi_processor_perf, 0);
+		acpi_processor_unregister_performance(0);
 		free_cpumask_var(acpi_processor_perf->shared_cpu_map);
 		kfree(acpi_processor_perf);
 	}
Index: linux-pm/drivers/cpufreq/powernow-k8.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/powernow-k8.c
+++ linux-pm/drivers/cpufreq/powernow-k8.c
@@ -795,7 +795,7 @@  err_out_mem:
 	kfree(powernow_table);
 
 err_out:
-	acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
+	acpi_processor_unregister_performance(data->cpu);
 
 	/* data->acpi_data.state_count informs us at ->exit()
 	 * whether ACPI was used */
@@ -863,8 +863,7 @@  static int fill_powernow_table_fidvid(st
 static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data)
 {
 	if (data->acpi_data.state_count)
-		acpi_processor_unregister_performance(&data->acpi_data,
-				data->cpu);
+		acpi_processor_unregister_performance(data->cpu);
 	free_cpumask_var(data->acpi_data.shared_cpu_map);
 }
 
Index: linux-pm/drivers/xen/xen-acpi-processor.c
===================================================================
--- linux-pm.orig/drivers/xen/xen-acpi-processor.c
+++ linux-pm/drivers/xen/xen-acpi-processor.c
@@ -563,7 +563,7 @@  err_unregister:
 	for_each_possible_cpu(i) {
 		struct acpi_processor_performance *perf;
 		perf = per_cpu_ptr(acpi_perf_data, i);
-		acpi_processor_unregister_performance(perf, i);
+		acpi_processor_unregister_performance(i);
 	}
 err_out:
 	/* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
@@ -582,7 +582,7 @@  static void __exit xen_acpi_processor_ex
 	for_each_possible_cpu(i) {
 		struct acpi_processor_performance *perf;
 		perf = per_cpu_ptr(acpi_perf_data, i);
-		acpi_processor_unregister_performance(perf, i);
+		acpi_processor_unregister_performance(i);
 	}
 	free_acpi_perf_data();
 }