public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static
       [not found] <20070425225716.8e9b28ca.akpm@linux-foundation.org>
@ 2007-04-28 19:19 ` Adrian Bunk
  2007-04-28 19:58   ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2007-04-28 19:19 UTC (permalink / raw)
  To: Andrew Morton, Henrique de Moraes Holschuh, lenb; +Cc: linux-kernel, linux-acpi

On Wed, Apr 25, 2007 at 10:57:16PM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.21-rc7-mm1:
>...
>  git-acpi.patch
>...
>  git trees
>...


This patch makes the needlessly global fan_mutex static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

BTW: Prototypes for static versions and static variables in a header
     file are really wrong, but the mess is bigger than what I'm
     willing to clean up...

--- linux-2.6.21-rc7-mm2/drivers/misc/thinkpad_acpi.h.old	2007-04-27 00:55:58.000000000 +0200
+++ linux-2.6.21-rc7-mm2/drivers/misc/thinkpad_acpi.h	2007-04-28 01:32:54.000000000 +0200
@@ -382,7 +382,7 @@
 static u8 fan_control_desired_level;
 static int fan_watchdog_maxinterval;
 
-struct mutex fan_mutex;
+static struct mutex fan_mutex;
 
 static acpi_handle fans_handle, gfan_handle, sfan_handle;
 

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

* Re: [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static
  2007-04-28 19:19 ` [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static Adrian Bunk
@ 2007-04-28 19:58   ` Henrique de Moraes Holschuh
  2007-04-29  1:53     ` Len Brown
  2007-04-29  2:50     ` Adrian Bunk
  0 siblings, 2 replies; 5+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-04-28 19:58 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Andrew Morton, lenb, linux-kernel, linux-acpi

On Sat, 28 Apr 2007, Adrian Bunk wrote:
> On Wed, Apr 25, 2007 at 10:57:16PM -0700, Andrew Morton wrote:
> >...
> > Changes since 2.6.21-rc7-mm1:
> >...
> >  git-acpi.patch
> >...
> >  git trees
> >...
> 
> 
> This patch makes the needlessly global fan_mutex static.
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

Sorry about the oversight.

> ---
> 
> BTW: Prototypes for static versions and static variables in a header
>      file are really wrong, but the mess is bigger than what I'm
>      willing to clean up...

It is a private header file, only one file uses it and it is not supposed to
be used by any other file ever, either.  I can certainly do a cleaning up
and a lot can be removed (at least 70% of it), but the driver is not linear
(it is some infrastructure and various subdrivers) and there is a bunch of
stuff that will need forward declarations regardless.

Maybe I should just break the driver into multiple files in a subdirectory?
That would certainly make it *much* cleaner...

> --- linux-2.6.21-rc7-mm2/drivers/misc/thinkpad_acpi.h.old	2007-04-27 00:55:58.000000000 +0200
> +++ linux-2.6.21-rc7-mm2/drivers/misc/thinkpad_acpi.h	2007-04-28 01:32:54.000000000 +0200
> @@ -382,7 +382,7 @@
>  static u8 fan_control_desired_level;
>  static int fan_watchdog_maxinterval;
>  
> -struct mutex fan_mutex;
> +static struct mutex fan_mutex;
>  
>  static acpi_handle fans_handle, gfan_handle, sfan_handle;
>  

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static
  2007-04-28 19:58   ` Henrique de Moraes Holschuh
@ 2007-04-29  1:53     ` Len Brown
  2007-04-29  2:50     ` Adrian Bunk
  1 sibling, 0 replies; 5+ messages in thread
From: Len Brown @ 2007-04-29  1:53 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Adrian Bunk, Andrew Morton, linux-kernel, linux-acpi


> > This patch makes the needlessly global fan_mutex static.

applied.
thanks,
-Len

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

* Re: [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static
  2007-04-28 19:58   ` Henrique de Moraes Holschuh
  2007-04-29  1:53     ` Len Brown
@ 2007-04-29  2:50     ` Adrian Bunk
  2007-04-29  4:09       ` Henrique de Moraes Holschuh
  1 sibling, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2007-04-29  2:50 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: Andrew Morton, lenb, linux-kernel, linux-acpi

On Sat, Apr 28, 2007 at 04:58:21PM -0300, Henrique de Moraes Holschuh wrote:
> On Sat, 28 Apr 2007, Adrian Bunk wrote:
>...
> > BTW: Prototypes for static versions and static variables in a header
> >      file are really wrong, but the mess is bigger than what I'm
> >      willing to clean up...
> 
> It is a private header file, only one file uses it and it is not supposed to
> be used by any other file ever, either.  I can certainly do a cleaning up
> and a lot can be removed (at least 70% of it), but the driver is not linear
> (it is some infrastructure and various subdrivers) and there is a bunch of
> stuff that will need forward declarations regardless.

Forward declarations of static functions (if required) and actual 
variables (like fan_mutex) belong into the C file, not the header.

> Maybe I should just break the driver into multiple files in a subdirectory?
> That would certainly make it *much* cleaner...

But even more in this case, you will not want to have actual variables 
or prototypes of static functions in the header file.

> > --- linux-2.6.21-rc7-mm2/drivers/misc/thinkpad_acpi.h.old	2007-04-27 00:55:58.000000000 +0200
> > +++ linux-2.6.21-rc7-mm2/drivers/misc/thinkpad_acpi.h	2007-04-28 01:32:54.000000000 +0200
> > @@ -382,7 +382,7 @@
> >  static u8 fan_control_desired_level;
> >  static int fan_watchdog_maxinterval;
> >  
> > -struct mutex fan_mutex;
> > +static struct mutex fan_mutex;
> >  
> >  static acpi_handle fans_handle, gfan_handle, sfan_handle;
> >  
>   Henrique Holschuh

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static
  2007-04-29  2:50     ` Adrian Bunk
@ 2007-04-29  4:09       ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 5+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-04-29  4:09 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Andrew Morton, lenb, linux-kernel, linux-acpi

On Sun, 29 Apr 2007, Adrian Bunk wrote:
> Forward declarations of static functions (if required) and actual 
> variables (like fan_mutex) belong into the C file, not the header.

Very well.  I will fix the mess for 2.6.23, or, time permitting, 2.6.22.

> > Maybe I should just break the driver into multiple files in a subdirectory?
> > That would certainly make it *much* cleaner...
> 
> But even more in this case, you will not want to have actual variables 
> or prototypes of static functions in the header file.

I would not have to, in that case.  The driver would be much easier to
write, and I will need to break it in two for an alsa module anyway, might
as well break it in one subdriver per file.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

end of thread, other threads:[~2007-04-29  4:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20070425225716.8e9b28ca.akpm@linux-foundation.org>
2007-04-28 19:19 ` [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static Adrian Bunk
2007-04-28 19:58   ` Henrique de Moraes Holschuh
2007-04-29  1:53     ` Len Brown
2007-04-29  2:50     ` Adrian Bunk
2007-04-29  4:09       ` Henrique de Moraes Holschuh

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