public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: make ops constant
@ 2010-11-11 15:27 Alan Cox
  2010-11-12  0:24 ` Zhang Rui
  2010-11-15  0:38 ` Zhang Rui
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Cox @ 2010-11-11 15:27 UTC (permalink / raw)
  To: linux-acpi, rui.zhang

From: Alan Cox <alan@linux.intel.com>

And while touching that function definition do something about the disaster
of formatting there.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/thermal/thermal_sys.c |   17 +++++------------
 include/linux/thermal.h       |   15 +++++----------
 2 files changed, 10 insertions(+), 22 deletions(-)


diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 13c72c6..bde3477 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -823,11 +823,8 @@ static struct class thermal_class = {
  * @devdata:	device private data.
  * @ops:		standard thermal cooling devices callbacks.
  */
-struct thermal_cooling_device *thermal_cooling_device_register(char *type,
-							       void *devdata,
-							       struct
-							       thermal_cooling_device_ops
-							       *ops)
+struct thermal_cooling_device *thermal_cooling_device_register(
+     char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
 {
 	struct thermal_cooling_device *cdev;
 	struct thermal_zone_device *pos;
@@ -1048,13 +1045,9 @@ EXPORT_SYMBOL(thermal_zone_device_update);
  * section 11.1.5.1 of the ACPI specification 3.0.
  */
 struct thermal_zone_device *thermal_zone_device_register(char *type,
-							 int trips,
-							 void *devdata, struct
-							 thermal_zone_device_ops
-							 *ops, int tc1, int
-							 tc2,
-							 int passive_delay,
-							 int polling_delay)
+	int trips, void *devdata,
+	const struct thermal_zone_device_ops *ops,
+	int tc1, int tc2, int passive_delay, int polling_delay)
 {
 	struct thermal_zone_device *tz;
 	struct thermal_cooling_device *pos;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 1de8b9e..0662690 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -77,7 +77,7 @@ struct thermal_cooling_device {
 	char type[THERMAL_NAME_LENGTH];
 	struct device device;
 	void *devdata;
-	struct thermal_cooling_device_ops *ops;
+	const struct thermal_cooling_device_ops *ops;
 	struct list_head node;
 };
 
@@ -114,7 +114,7 @@ struct thermal_zone_device {
 	int last_temperature;
 	bool passive;
 	unsigned int forced_passive;
-	struct thermal_zone_device_ops *ops;
+	const struct thermal_zone_device_ops *ops;
 	struct list_head cooling_devices;
 	struct idr idr;
 	struct mutex lock;	/* protect cooling devices list */
@@ -129,11 +129,8 @@ struct thermal_zone_device {
 };
 
 struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
-							 struct
-							 thermal_zone_device_ops
-							 *, int tc1, int tc2,
-							 int passive_freq,
-							 int polling_freq);
+		const struct thermal_zone_device_ops *, int tc1, int tc2,
+		int passive_freq, int polling_freq);
 void thermal_zone_device_unregister(struct thermal_zone_device *);
 
 int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
@@ -142,9 +139,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
 				       struct thermal_cooling_device *);
 void thermal_zone_device_update(struct thermal_zone_device *);
 struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
-							       struct
-							       thermal_cooling_device_ops
-							       *);
+		const struct thermal_cooling_device_ops *);
 void thermal_cooling_device_unregister(struct thermal_cooling_device *);
 
 #endif /* __THERMAL_H__ */


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

* Re: [PATCH] thermal: make ops constant
  2010-11-11 15:27 [PATCH] thermal: make ops constant Alan Cox
@ 2010-11-12  0:24 ` Zhang Rui
  2010-11-12 10:20   ` Alan Cox
  2010-11-15  0:38 ` Zhang Rui
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang Rui @ 2010-11-12  0:24 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-acpi@vger.kernel.org

On Thu, 2010-11-11 at 23:27 +0800, Alan Cox wrote:
> From: Alan Cox <alan@linux.intel.com>
> 
> And while

>  touching that function definition

agreed.

>  do something about the disaster of formatting there.
> 
well. this is what we got after running Lindent.
Your changes are reverted If I apply your patch and run Lindent again.
So maybe this is a problem that should be fixed in Lindent?

thanks,
rui

> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
> 
>  drivers/thermal/thermal_sys.c |   17 +++++------------
>  include/linux/thermal.h       |   15 +++++----------
>  2 files changed, 10 insertions(+), 22 deletions(-)
> 
> 
> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
> index 13c72c6..bde3477 100644
> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -823,11 +823,8 @@ static struct class thermal_class = {
>   * @devdata:	device private data.
>   * @ops:		standard thermal cooling devices callbacks.
>   */
> -struct thermal_cooling_device *thermal_cooling_device_register(char *type,
> -							       void *devdata,
> -							       struct
> -							       thermal_cooling_device_ops
> -							       *ops)
> +struct thermal_cooling_device *thermal_cooling_device_register(
> +     char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
>  {
>  	struct thermal_cooling_device *cdev;
>  	struct thermal_zone_device *pos;
> @@ -1048,13 +1045,9 @@ EXPORT_SYMBOL(thermal_zone_device_update);
>   * section 11.1.5.1 of the ACPI specification 3.0.
>   */
>  struct thermal_zone_device *thermal_zone_device_register(char *type,
> -							 int trips,
> -							 void *devdata, struct
> -							 thermal_zone_device_ops
> -							 *ops, int tc1, int
> -							 tc2,
> -							 int passive_delay,
> -							 int polling_delay)
> +	int trips, void *devdata,
> +	const struct thermal_zone_device_ops *ops,
> +	int tc1, int tc2, int passive_delay, int polling_delay)
>  {
>  	struct thermal_zone_device *tz;
>  	struct thermal_cooling_device *pos;
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 1de8b9e..0662690 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -77,7 +77,7 @@ struct thermal_cooling_device {
>  	char type[THERMAL_NAME_LENGTH];
>  	struct device device;
>  	void *devdata;
> -	struct thermal_cooling_device_ops *ops;
> +	const struct thermal_cooling_device_ops *ops;
>  	struct list_head node;
>  };
>  
> @@ -114,7 +114,7 @@ struct thermal_zone_device {
>  	int last_temperature;
>  	bool passive;
>  	unsigned int forced_passive;
> -	struct thermal_zone_device_ops *ops;
> +	const struct thermal_zone_device_ops *ops;
>  	struct list_head cooling_devices;
>  	struct idr idr;
>  	struct mutex lock;	/* protect cooling devices list */
> @@ -129,11 +129,8 @@ struct thermal_zone_device {
>  };
>  
>  struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
> -							 struct
> -							 thermal_zone_device_ops
> -							 *, int tc1, int tc2,
> -							 int passive_freq,
> -							 int polling_freq);
> +		const struct thermal_zone_device_ops *, int tc1, int tc2,
> +		int passive_freq, int polling_freq);
>  void thermal_zone_device_unregister(struct thermal_zone_device *);
>  
>  int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
> @@ -142,9 +139,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
>  				       struct thermal_cooling_device *);
>  void thermal_zone_device_update(struct thermal_zone_device *);
>  struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
> -							       struct
> -							       thermal_cooling_device_ops
> -							       *);
> +		const struct thermal_cooling_device_ops *);
>  void thermal_cooling_device_unregister(struct thermal_cooling_device *);
>  
>  #endif /* __THERMAL_H__ */
> 



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

* Re: [PATCH] thermal: make ops constant
  2010-11-12  0:24 ` Zhang Rui
@ 2010-11-12 10:20   ` Alan Cox
  2010-11-15  0:45     ` Zhang Rui
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2010-11-12 10:20 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi@vger.kernel.org

On Fri, 12 Nov 2010 08:24:57 +0800
Zhang Rui <rui.zhang@intel.com> wrote:

> On Thu, 2010-11-11 at 23:27 +0800, Alan Cox wrote:
> > From: Alan Cox <alan@linux.intel.com>
> > 
> > And while
> 
> >  touching that function definition
> 
> agreed.
> 
> >  do something about the disaster of formatting there.
> > 
> well. this is what we got after running Lindent.
> Your changes are reverted If I apply your patch and run Lindent again.
> So maybe this is a problem that should be fixed in Lindent?

Lindent is just a script for indent which is designed to help a human not
replace them. It's not something to run automatically over code as it
makes bad mistakes now and then.


Alan

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

* Re: [PATCH] thermal: make ops constant
  2010-11-11 15:27 [PATCH] thermal: make ops constant Alan Cox
  2010-11-12  0:24 ` Zhang Rui
@ 2010-11-15  0:38 ` Zhang Rui
  2010-11-20  2:41   ` Len Brown
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang Rui @ 2010-11-15  0:38 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-acpi@vger.kernel.org

On Thu, 2010-11-11 at 23:27 +0800, Alan Cox wrote:
> From: Alan Cox <alan@linux.intel.com>
> 
> And while touching that function definition do something about the disaster
> of formatting there.
> 
> Signed-off-by: Alan Cox <alan@linux.intel.com>

Acked-by: Zhang Rui <rui.zhang@intel.com>

> ---
> 
>  drivers/thermal/thermal_sys.c |   17 +++++------------
>  include/linux/thermal.h       |   15 +++++----------
>  2 files changed, 10 insertions(+), 22 deletions(-)
> 
> 
> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
> index 13c72c6..bde3477 100644
> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -823,11 +823,8 @@ static struct class thermal_class = {
>   * @devdata:	device private data.
>   * @ops:		standard thermal cooling devices callbacks.
>   */
> -struct thermal_cooling_device *thermal_cooling_device_register(char *type,
> -							       void *devdata,
> -							       struct
> -							       thermal_cooling_device_ops
> -							       *ops)
> +struct thermal_cooling_device *thermal_cooling_device_register(
> +     char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
>  {
>  	struct thermal_cooling_device *cdev;
>  	struct thermal_zone_device *pos;
> @@ -1048,13 +1045,9 @@ EXPORT_SYMBOL(thermal_zone_device_update);
>   * section 11.1.5.1 of the ACPI specification 3.0.
>   */
>  struct thermal_zone_device *thermal_zone_device_register(char *type,
> -							 int trips,
> -							 void *devdata, struct
> -							 thermal_zone_device_ops
> -							 *ops, int tc1, int
> -							 tc2,
> -							 int passive_delay,
> -							 int polling_delay)
> +	int trips, void *devdata,
> +	const struct thermal_zone_device_ops *ops,
> +	int tc1, int tc2, int passive_delay, int polling_delay)
>  {
>  	struct thermal_zone_device *tz;
>  	struct thermal_cooling_device *pos;
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 1de8b9e..0662690 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -77,7 +77,7 @@ struct thermal_cooling_device {
>  	char type[THERMAL_NAME_LENGTH];
>  	struct device device;
>  	void *devdata;
> -	struct thermal_cooling_device_ops *ops;
> +	const struct thermal_cooling_device_ops *ops;
>  	struct list_head node;
>  };
>  
> @@ -114,7 +114,7 @@ struct thermal_zone_device {
>  	int last_temperature;
>  	bool passive;
>  	unsigned int forced_passive;
> -	struct thermal_zone_device_ops *ops;
> +	const struct thermal_zone_device_ops *ops;
>  	struct list_head cooling_devices;
>  	struct idr idr;
>  	struct mutex lock;	/* protect cooling devices list */
> @@ -129,11 +129,8 @@ struct thermal_zone_device {
>  };
>  
>  struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
> -							 struct
> -							 thermal_zone_device_ops
> -							 *, int tc1, int tc2,
> -							 int passive_freq,
> -							 int polling_freq);
> +		const struct thermal_zone_device_ops *, int tc1, int tc2,
> +		int passive_freq, int polling_freq);
>  void thermal_zone_device_unregister(struct thermal_zone_device *);
>  
>  int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
> @@ -142,9 +139,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
>  				       struct thermal_cooling_device *);
>  void thermal_zone_device_update(struct thermal_zone_device *);
>  struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
> -							       struct
> -							       thermal_cooling_device_ops
> -							       *);
> +		const struct thermal_cooling_device_ops *);
>  void thermal_cooling_device_unregister(struct thermal_cooling_device *);
>  
>  #endif /* __THERMAL_H__ */
> 



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

* Re: [PATCH] thermal: make ops constant
  2010-11-12 10:20   ` Alan Cox
@ 2010-11-15  0:45     ` Zhang Rui
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang Rui @ 2010-11-15  0:45 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-acpi@vger.kernel.org

On Fri, 2010-11-12 at 18:20 +0800, Alan Cox wrote:
> On Fri, 12 Nov 2010 08:24:57 +0800
> Zhang Rui <rui.zhang@intel.com> wrote:
> 
> > On Thu, 2010-11-11 at 23:27 +0800, Alan Cox wrote:
> > > From: Alan Cox <alan@linux.intel.com>
> > > 
> > > And while
> > 
> > >  touching that function definition
> > 
> > agreed.
> > 
> > >  do something about the disaster of formatting there.
> > > 
> > well. this is what we got after running Lindent.
> > Your changes are reverted If I apply your patch and run Lindent again.
> > So maybe this is a problem that should be fixed in Lindent?
> 
> Lindent is just a script for indent which is designed to help a human not
> replace them. It's not something to run automatically over code as it
> makes bad mistakes now and then.
> 
Oh, I used to run it first when a new file is introduced, although the
result doesn't look quite good for me sometimes.
Thanks for the correction.

thanks,
rui



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

* Re: [PATCH] thermal: make ops constant
  2010-11-15  0:38 ` Zhang Rui
@ 2010-11-20  2:41   ` Len Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Len Brown @ 2010-11-20  2:41 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Alan Cox, linux-acpi@vger.kernel.org

applied

thanks,
Len Brown, Intel Open Source Technology Center


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

end of thread, other threads:[~2010-11-20  2:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 15:27 [PATCH] thermal: make ops constant Alan Cox
2010-11-12  0:24 ` Zhang Rui
2010-11-12 10:20   ` Alan Cox
2010-11-15  0:45     ` Zhang Rui
2010-11-15  0:38 ` Zhang Rui
2010-11-20  2:41   ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox