Skip to contentSkip to conversation

sstfb.c: make some code static

PATCH In review Adrian Bunk 2 participants 4 messages Nov 21, 2004 – Nov 25, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sstfb.c: make some code static

The patch below makes some needlessly global code static.

diffstat output:

 drivers/video/sstfb.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/video/sstfb.c renamed from drivers/video/sstfb.c.old +7 -4
@@ -1338,8 +1338,8 @@
 /*
  * Interface to the world
  */
-
-int  __init sstfb_setup(char *options)
+#ifndef MODULE
+static int  __init sstfb_setup(char *options)
 {
 	char *this_opt;
 
@@ -1372,6 +1372,7 @@
 	}
 	return 0;
 }
+#endif
 
 static struct fb_ops sstfb_ops = {
 	.owner		= THIS_MODULE,
@@ -1565,7 +1566,7 @@
 };
 
 
-int __devinit sstfb_init(void)
+static int __devinit sstfb_init(void)
 {
 #ifndef MODULE
 	char *option = NULL;
@@ -1577,10 +1578,12 @@
 	return pci_module_init(&sstfb_driver);
 }
 
-void __devexit sstfb_exit(void)
+#ifdef MODULE
+static void __devexit sstfb_exit(void)
 {
 	pci_unregister_driver(&sstfb_driver);
 }
+#endif
 
 
 /*
#1 lore raw
Quoted 1 line · Adrian Bunk

The patch below makes some needlessly global code static.

No it doesn't. It makes some functions static (which is fine) and adds some nasty messy pointless #ifdefs. It touches no variable at all.

Please check your description texts and also don't fill the kernel with ifdef crap. Probably the __setup stuff should be a module param new style too.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#2 lore raw
Quoted 9 lines · Alan Cox
Quoted 1 line · Adrian Bunk

The patch below makes some needlessly global code static.

No it doesn't. It makes some functions static (which is fine) and adds some nasty messy pointless #ifdefs. It touches no variable at all.

Please check your description texts and also don't fill the kernel with ifdef crap. Probably the __setup stuff should be a module param new style too.

Yes, the description text could have been better.

The "ifdef crap" comes from the fact, that after making the functions static, gcc warns if they are unused.

cu
Adrian

Signature · 12 lines
       "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



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
#3 lore raw
Quoted 2 lines · Adrian Bunk

The "ifdef crap" comes from the fact, that after making the functions static, gcc warns if they are unused.

__attribute__ is your friend in that situation.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/