Re: [RFC][Patch] IBM Real-Time "SMI Free" mode driver -v4

From: Arnd Bergmann
Date: Fri Sep 24 2010 - 10:24:28 EST


On Friday 24 September 2010, Vernon Mauery wrote:
> >> +static DEFINE_MUTEX(rtl_lock);
> >> +static struct ibm_rtl_table __iomem *rtl_table = NULL;
> >> +static void __iomem *ebda_map;
> >> +static void __iomem *rtl_cmd_iomem_addr = NULL;
> >> +static u32 rtl_cmd_port_addr;
> >> +static enum rtl_addr_type rtl_cmd_type;
> >> +static u8 rtl_cmd_width;
> >
> > This is somewhat inconsistent, some of these are implicitly initialized,
> > others have an explicit "= NULL". I would recommend leaving out the
> > initialization, which is the historic way to do this in the kernel.
>
> The variables that have an explicit initialization are the variables
> that I read before I write. It just looks funny to me to read a
> variable that hasn't been initialized. But I can axe the
> initializations for the sake of consistency.

Ok. Global variables are by definition initialized to zero.
Old gcc versions used to allocate space in the .data section
if you had explicit = NULL statements while they would end
up in .bss otherwise, resulting in a smaller binary image.

With newer gcc versions, it doesn't make a difference, but
many people have the "don't initialize globals to zero" meme
hardcoded to their brains now ;-)

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