lkml.org 
[lkml]   [2000]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] initdata and bss
Hi,

A few bss changes (to remove zero initialization) in test9 were not
completly correct. Init data must be initialized if you want that it gets
into the init section (it's also mentioned in the gcc documentation).
The following patch fixes what I was able to find with grep and also adds
a note about in init.h.

bye, Roman

diff -ur linux-2.4.org/arch/arm/mm/init.c linux-2.4-initdata/arch/arm/mm/init.c
--- linux-2.4.org/arch/arm/mm/init.c Thu Oct 5 19:35:19 2000
+++ linux-2.4-initdata/arch/arm/mm/init.c Thu Oct 5 20:22:00 2000
@@ -56,7 +56,7 @@
* The sole use of this is to pass memory configuration
* data from paging_init to mem_init.
*/
-static struct meminfo __initdata meminfo;
+static struct meminfo meminfo __initdata = { 0, };

/*
* empty_bad_page is the page that is used for page faults when
diff -ur linux-2.4.org/arch/ia64/kernel/smp.c linux-2.4-initdata/arch/ia64/kernel/smp.c
--- linux-2.4.org/arch/ia64/kernel/smp.c Thu Aug 24 19:30:52 2000
+++ linux-2.4-initdata/arch/ia64/kernel/smp.c Thu Oct 5 20:23:31 2000
@@ -49,8 +49,8 @@

spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;

-struct smp_boot_data __initdata smp;
-char __initdata no_int_routing = 0;
+struct smp_boot_data smp __initdata = { 0, };
+char no_int_routing __initdata = 0;

unsigned char smp_int_redirect; /* are INT and IPI redirectable by the chipset? */
volatile int __cpu_number_map[NR_CPUS] = { -1, }; /* SAPIC ID -> Logical ID */
diff -ur linux-2.4.org/arch/m68k/kernel/setup.c linux-2.4-initdata/arch/m68k/kernel/setup.c
--- linux-2.4.org/arch/m68k/kernel/setup.c Wed Jul 5 01:04:12 2000
+++ linux-2.4-initdata/arch/m68k/kernel/setup.c Thu Oct 5 20:20:01 2000
@@ -68,13 +68,13 @@

char m68k_debug_device[6] = "";

-void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata;
+void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
/* machine dependent keyboard functions */
-int (*mach_keyb_init) (void) __initdata;
+int (*mach_keyb_init) (void) __initdata = NULL;
int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
void (*mach_kbd_leds) (unsigned int) = NULL;
/* machine dependent irq functions */
-void (*mach_init_IRQ) (void) __initdata;
+void (*mach_init_IRQ) (void) __initdata = NULL;
void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
void (*mach_get_model) (char *model) = NULL;
int (*mach_get_hardware_list) (char *buffer) = NULL;
diff -ur linux-2.4.org/arch/ppc/kernel/apus_setup.c linux-2.4-initdata/arch/ppc/kernel/apus_setup.c
--- linux-2.4.org/arch/ppc/kernel/apus_setup.c Thu Oct 5 19:35:21 2000
+++ linux-2.4-initdata/arch/ppc/kernel/apus_setup.c Thu Oct 5 20:19:41 2000
@@ -82,13 +82,13 @@

extern void amiga_init_IRQ(void);

-void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata;
+void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
/* machine dependent keyboard functions */
-int (*mach_keyb_init) (void) __initdata;
+int (*mach_keyb_init) (void) __initdata = NULL;
int (*mach_kbdrate) (struct kbd_repeat *) __apusdata = NULL;
void (*mach_kbd_leds) (unsigned int) __apusdata = NULL;
/* machine dependent irq functions */
-void (*mach_init_IRQ) (void) __initdata;
+void (*mach_init_IRQ) (void) __initdata = NULL;
void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) __apusdata = NULL;
void (*mach_get_model) (char *model) __apusdata = NULL;
int (*mach_get_hardware_list) (char *buffer) __apusdata = NULL;
diff -ur linux-2.4.org/arch/ppc/kernel/prep_setup.c linux-2.4-initdata/arch/ppc/kernel/prep_setup.c
--- linux-2.4.org/arch/ppc/kernel/prep_setup.c Thu Oct 5 19:35:22 2000
+++ linux-2.4-initdata/arch/ppc/kernel/prep_setup.c Thu Oct 5 20:18:55 2000
@@ -384,8 +384,8 @@
* 2 following ones measure the interval. The precision of the method
* is still doubtful due to the short interval sampled.
*/
-static __initdata volatile int calibrate_steps = 3;
-static __initdata unsigned tbstamp;
+static volatile int calibrate_steps __initdata = 3;
+static unsigned tbstamp __initdata = 0;

void __init
prep_calibrate_decr_handler(int irq,
diff -ur linux-2.4.org/drivers/block/xd.c linux-2.4-initdata/drivers/block/xd.c
--- linux-2.4.org/drivers/block/xd.c Thu Oct 5 19:35:27 2000
+++ linux-2.4-initdata/drivers/block/xd.c Thu Oct 5 20:14:58 2000
@@ -142,9 +142,9 @@
static DECLARE_WAIT_QUEUE_HEAD(xd_wait_open);
static u_char xd_valid[XD_MAXDRIVES] = { 0,0 };
static u_char xd_drives, xd_irq = 5, xd_dma = 3, xd_maxsectors;
-static u_char xd_override __initdata, xd_type __initdata;
+static u_char xd_override __initdata = 0, xd_type __initdata = 0;
static u_short xd_iobase = 0x320;
-static int xd_geo[XD_MAXDRIVES*3] __initdata;
+static int xd_geo[XD_MAXDRIVES*3] __initdata = { 0, };

static volatile int xdc_busy;
static DECLARE_WAIT_QUEUE_HEAD(xdc_wait);
diff -ur linux-2.4.org/drivers/md/md.c linux-2.4-initdata/drivers/md/md.c
--- linux-2.4.org/drivers/md/md.c Thu Oct 5 19:35:31 2000
+++ linux-2.4-initdata/drivers/md/md.c Thu Oct 5 20:18:13 2000
@@ -2032,7 +2032,7 @@
* at boot time.
*/
#ifdef CONFIG_AUTODETECT_RAID
-static int detected_devices[128] md__initdata;
+static int detected_devices[128] md__initdata = { 0, };
static int dev_cnt=0;
void md_autodetect_dev(kdev_t dev)
{
@@ -3640,7 +3640,7 @@
int pers[MAX_MD_BOOT_DEVS];
int chunk[MAX_MD_BOOT_DEVS];
kdev_t devices[MAX_MD_BOOT_DEVS][MAX_REAL];
-} md_setup_args md__initdata;
+} md_setup_args md__initdata = { 0, };

/*
* Parse the command-line parameters given our kernel, but do not
diff -ur linux-2.4.org/drivers/net/acenic.c linux-2.4-initdata/drivers/net/acenic.c
--- linux-2.4.org/drivers/net/acenic.c Thu Oct 5 19:35:31 2000
+++ linux-2.4-initdata/drivers/net/acenic.c Thu Oct 5 20:14:23 2000
@@ -408,7 +408,7 @@

static struct net_device *root_dev;

-static int probed __initdata;
+static int probed __initdata = 0;


#ifdef NEW_NETINIT
diff -ur linux-2.4.org/drivers/sound/msnd_pinnacle.c linux-2.4-initdata/drivers/sound/msnd_pinnacle.c
--- linux-2.4.org/drivers/sound/msnd_pinnacle.c Thu Oct 5 19:35:40 2000
+++ linux-2.4-initdata/drivers/sound/msnd_pinnacle.c Thu Oct 5 20:16:41 2000
@@ -1595,20 +1595,20 @@
static int cfg __initdata = -1;

/* Extra Peripheral Configuration */
-static int reset __initdata;
-static int mpu_io __initdata;
-static int mpu_irq __initdata;
-static int ide_io0 __initdata;
-static int ide_io1 __initdata;
-static int ide_irq __initdata;
-static int joystick_io __initdata;
+static int reset __initdata = 0;
+static int mpu_io __initdata = 0;
+static int mpu_irq __initdata = 0;
+static int ide_io0 __initdata = 0;
+static int ide_io1 __initdata = 0;
+static int ide_irq __initdata = 0;
+static int joystick_io __initdata = 0;

/* If we have the digital daugherboard... */
-static int digital __initdata;
+static int digital __initdata = 0;
#endif

static int fifosize __initdata = DEFFIFOSIZE;
-static int calibrate_signal __initdata;
+static int calibrate_signal __initdata = 0;

#else /* not a module */

diff -ur linux-2.4.org/drivers/sound/waveartist.c linux-2.4-initdata/drivers/sound/waveartist.c
--- linux-2.4.org/drivers/sound/waveartist.c Thu Oct 5 19:35:41 2000
+++ linux-2.4-initdata/drivers/sound/waveartist.c Thu Oct 5 20:15:45 2000
@@ -1762,10 +1762,10 @@

static int attached;

-static int __initdata io;
-static int __initdata irq;
-static int __initdata dma;
-static int __initdata dma2;
+static int __initdata io = 0;
+static int __initdata irq = 0;
+static int __initdata dma = 0;
+static int __initdata dma2 = 0;


MODULE_PARM(io, "i"); /* IO base */
diff -ur linux-2.4.org/include/linux/init.h linux-2.4-initdata/include/linux/init.h
--- linux-2.4.org/include/linux/init.h Tue Jul 18 19:51:23 2000
+++ linux-2.4-initdata/include/linux/init.h Thu Oct 5 20:50:36 2000
@@ -33,6 +33,8 @@
*
* For initialized data not at file scope, i.e. within a function,
* you should use __initlocaldata instead, due to a bug in GCC 2.7.
+ * Don't forget to initialize the data, as gcc otherwise puts the
+ * data into the bss section and not into the init section.
*/

#ifndef MODULE
-
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/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.056 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site