public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] removal of "static foo = 0" from drivers/ide (test11)
@ 2000-11-21 21:25 Bartlomiej Zolnierkiewicz
  2000-11-21 22:55 ` J . A . Magallon
  0 siblings, 1 reply; 25+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2000-11-21 21:25 UTC (permalink / raw)
  To: torvalds; +Cc: andre, linux-kernel


Hi

Quick removal of unnecessary initialization to 0.

--
Bartlomiej Zolnierkiewicz
<bkz@linux-ide.org>


diff -uNr linux-240t11/drivers/ide/ali14xx.c linux/drivers/ide/ali14xx.c
--- linux-240t11/drivers/ide/ali14xx.c	Tue Jun 13 20:32:00 2000
+++ linux/drivers/ide/ali14xx.c	Tue Nov 21 14:35:59 2000
@@ -81,9 +81,9 @@
 	{0x2d, 0x32, 0x2e, 0x33},     /* drive 3 */
 };
 
-static int basePort = 0;	/* base port address */
-static int regPort = 0;		/* port for register number */
-static int dataPort = 0;	/* port for register data */
+static int basePort;	/* base port address */
+static int regPort;	/* port for register number */
+static int dataPort;	/* port for register data */
 static byte regOn;	/* output to base port to access registers */
 static byte regOff;	/* output to base port to close registers */
 
diff -uNr linux-240t11/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
--- linux-240t11/drivers/ide/alim15x3.c	Wed Nov 15 22:02:55 2000
+++ linux/drivers/ide/alim15x3.c	Tue Nov 21 14:35:59 2000
@@ -233,8 +233,8 @@
 }
 #endif  /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS) */
 
-static byte m5229_revision	= 0;
-static byte chip_is_1543c_e	= 0;
+static byte m5229_revision;
+static byte chip_is_1543c_e;
 
 byte ali_proc = 0;
 static struct pci_dev *isa_dev;
diff -uNr linux-240t11/drivers/ide/buddha.c linux/drivers/ide/buddha.c
--- linux-240t11/drivers/ide/buddha.c	Wed Nov 15 22:02:11 2000
+++ linux/drivers/ide/buddha.c	Tue Nov 21 14:35:59 2000
@@ -87,7 +87,7 @@
      *  Board information
      */
 
-static u_long buddha_board = 0;
+static u_long buddha_board;
 static int buddha_num_hwifs = -1;
 
 
diff -uNr linux-240t11/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-240t11/drivers/ide/hpt366.c	Wed Nov 15 22:02:55 2000
+++ linux/drivers/ide/hpt366.c	Tue Nov 21 14:36:27 2000
@@ -214,8 +214,8 @@
 byte hpt366_proc = 0;
 
 extern char *ide_xfer_verbose (byte xfer_rate);
-byte hpt363_shared_irq = 0;
-byte hpt363_shared_pin = 0;
+byte hpt363_shared_irq;
+byte hpt363_shared_pin;
 
 static unsigned int pci_rev_check_hpt3xx (struct pci_dev *dev)
 {
diff -uNr linux-240t11/drivers/ide/ide-pci.c linux/drivers/ide/ide-pci.c
--- linux-240t11/drivers/ide/ide-pci.c	Wed Nov 15 22:02:55 2000
+++ linux/drivers/ide/ide-pci.c	Tue Nov 21 14:35:59 2000
@@ -185,8 +185,8 @@
 #define INIT_HPT366	&ide_init_hpt366
 #define DMA_HPT366	&ide_dmacapable_hpt366
 #else
-static byte hpt363_shared_irq = 0;
-static byte hpt363_shared_pin = 0;
+static byte hpt363_shared_irq;
+static byte hpt363_shared_pin;
 #define PCI_HPT366	NULL
 #define ATA66_HPT366	NULL
 #define INIT_HPT366	NULL
diff -uNr linux-240t11/drivers/ide/osb4.c linux/drivers/ide/osb4.c
--- linux-240t11/drivers/ide/osb4.c	Wed Nov 15 22:02:12 2000
+++ linux/drivers/ide/osb4.c	Tue Nov 21 14:35:59 2000
@@ -60,7 +60,7 @@
 #include <linux/stat.h>
 #include <linux/proc_fs.h>
 
-static byte osb4_revision = 0;
+static byte osb4_revision;
 static struct pci_dev *bmide_dev;
 
 static int osb4_get_info(char *, char **, off_t, int, int);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [PATCH] removal of "static foo = 0" from drivers/ide (test11)
@ 2000-11-28 20:58 David Hinds
  2000-11-28 21:08 ` Tigran Aivazian
  0 siblings, 1 reply; 25+ messages in thread
From: David Hinds @ 2000-11-28 20:58 UTC (permalink / raw)
  To: linux-kernel

> What information is lost? Unless you're working on a really strange
> machine which does not zero bss, the following means the same from the
> codes point of view:
>
> static int foo = 0;
> static int foo; 

I think the argument is that "static int foo;" implies you don't
actually care how "foo" is initialized, but adding the "= 0" is
revealing that the code actually relies on the default value.  The
code is obviously equivalent.  It is a readability issue, not an issue
of what the code does.

I would contend that it is a compiler bug in gcc if it treats the two
statements differently, since they are trivially equivalent.  I guess
that it has been decided that linux kernel coding style dictates no
zero initializers, so that's that.  Personally, I prefer symmetry: if
I have a list of static variables initialized to various things, I
don't have to use a different form for ones that are zero initialized.

Did the savings really work out to be measured in kb's of space?  I
would have expected compression to eliminate most of the savings.

-- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [PATCH] removal of "static foo = 0" from drivers/ide (test11)
@ 2000-11-29 16:16 Darryl Miles
  2000-11-29 23:54 ` Russell King
  0 siblings, 1 reply; 25+ messages in thread
From: Darryl Miles @ 2000-11-29 16:16 UTC (permalink / raw)
  To: linux-kernel


Russell King <rmk@arm.linux.org.uk> writes:
>The only difference is the size on disk; if we go around setting every
>bss variable to zero, the kernel/module data size will unnecessarily
>huge.

Hmm, what about common symbol generation?  i.e. the linker looses the
ability
to throw out "multiply defined symbol" errors where you fail to
initialise it
to a value.

Okay extern global variables in the kernel need to be controlled and it
is not
like many get added, however it is possible that one developer may never
know
it is already in use by another part of the kernel, when their oh-no-new
driver
is added.  Since the linkers assistance in this issue has just been
disabled.

Is 'gas' able to be configured to never emit common symbols, but emit
BBS
symbols instead, or is 'ld' able to be configured to never merge common
symbols but throw up "multiply defined symbol" errors.  Then everyone is
safe.


>We already argue about the extra couple of bytes that xx change to the
>kernel/a module would cost.  With these change, we save kilo-bytes in
>disk space (which is important on some systems).
 
PDAs!!! :)  Excellent work Russell.

-- 
Darryl Miles
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2000-11-30  0:56 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-21 21:25 [PATCH] removal of "static foo = 0" from drivers/ide (test11) Bartlomiej Zolnierkiewicz
2000-11-21 22:55 ` J . A . Magallon
2000-11-21 23:04   ` Tigran Aivazian
2000-11-21 23:18     ` J . A . Magallon
2000-11-21 23:26       ` Tigran Aivazian
2000-11-21 23:30         ` J . A . Magallon
2000-11-23 11:01     ` Rusty Russell
2000-11-24 21:40       ` Vojtech Pavlik
     [not found]         ` <20001128031933.52DB981F5@halfway.linuxcare.com.au>
2000-11-28  8:59           ` Vojtech Pavlik
2000-11-24 23:13       ` J . A . Magallon
2000-11-25 12:01         ` Russell King
2000-11-25 11:50       ` Russell King
2000-11-25 23:56       ` Bartlomiej Zolnierkiewicz
2000-11-22  0:09   ` Jeff Garzik
2000-11-22 11:40   ` Russell King
  -- strict thread matches above, loose matches on Subject: below --
2000-11-28 20:58 David Hinds
2000-11-28 21:08 ` Tigran Aivazian
2000-11-28 23:53   ` Peter Samuelson
2000-11-29  3:23     ` Keith Owens
2000-11-29  3:35       ` Peter Samuelson
2000-11-29  7:48     ` Tigran Aivazian
2000-11-29 14:00       ` Peter Samuelson
2000-11-29 14:08         ` Tigran Aivazian
2000-11-29 16:16 Darryl Miles
2000-11-29 23:54 ` Russell King

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