Re: [RFC, PATCH] watchdog on gpio

Mike Frysinger
2008-01-14T09:45:37Z

On Jan 14, 2008 4:29 AM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > > Saves memory - you can't make inlined strings __initdata without breaking
> > > some compilers. So it is correct.
> >
> > you could make the same argument about all strings used in all __init
> > functions. making a special case for this one string is just
> > confusing. this is also used from the *platfrom driver probe*
> > function, not the *module init* function, which means it should be
> > __devinitdata (see below) ... which quickly adds to the
> > confusion/craziness.
>
> Not neccessarily see below. For strings there is a tricky tradeoff
> between space on embedded boxes and simplicity. On a 2GB desktop PC the
> decision is fairly trivial, on a PDA it gets a bit more important.

i'm aware of this (i bang on embedded no-mmu systems). if his banner
string was crazy long, i'd more understand, but it isnt any longer
than any one of his error strings in the probe function. in fact, all
of the error strings combined are more than 3x the size of his banner.

wonder if we could design a printk designed for __init functions to
address this in a clean fashion.
#define init_printk(fmt, __VA_ARGS__) \
do { \
static const __init char __fmt[] = fmt; \
printk(__fmt , ## __VA_ARGS__); \
} while (0)

(yes, i know this isnt perfect as you'd need to pass back the return
value of printk(), but it's an idea)

> > > > > +static int __init gpio_wdt_probe(struct platform_device *pdev)
> > > >
> > > > shouldnt this be __devinit ?
> > >
> > > IFF the device can be found/removed dynamically.
> >
> > wont __init get freed once the module has finished loading ?
>
> If your platform creates the device statically (as a lot of embedded
> platforms do) then the __init is fine. The platform register in
> init_module will call back the driver probe method and attach the device
> before the init_module exits.

there is no hard requirement anywhere that says platform resources
must be in the board resources file. marking the functions as __init
instead of __devinit will basically cause a kernel crash if someone
tries to use dynamic platform resources. there is no option that i'm
aware of that prevents dynamic platform resources which means there is
no way for the driver to say "i wont work with standard dynamic
platform resources".
-mike