Re: [PATCH] platform_driver_register: warn if probe is in .init.text

From: Dmitry Torokhov
Date: Mon Jan 25 2010 - 14:39:35 EST


On Mon, Jan 25, 2010 at 08:25:40PM +0100, Uwe Kleine-König wrote:
> Hello Dmitry,
>
> > > > > + if (drv->probe && kernel_init_text_address((unsigned long)drv->probe))
> > > > > + pr_warning("oops-warning: probe function of platform driver %s"
> > > > > + " lives in .init.text\n", drv->driver.name);
> > > > > +#else
> > > > > + /*
> > > > > + * without HOTPLUG probe functions can be discarded after the driver is
> > > > > + * loaded.
> > > > > + * There is a little chance for false positives, namely if the driver is
> > > > > + * registered after the .init sections are discarded.
> > > > > + */
> > > > > + if (drv->probe && !kernel_init_text_address((unsigned long)drv->probe))
> > > > > + pr_info("probably the probe function of platform driver %s can"
> > > > > + " be moved to .init.text\n", drv->driver.name);
> > > >
> > > > It really depends on the user's (or rather builder's) local
> > > > configuration so how can we make this suggestion?
> > > Can you point out a situation that makes the suggestion wrong? AFAIK
> > > there only the possibility that the driver is loaded after .init is
> > > discarded (as written in the comment).
> > >
> >
> > The presence of CONFIG_HOTPLUG depends on particular .config, so, for
> > example, you may not have it set while I have. So you will boot, get the
> > suggestion, submit a patch, then I will boot and will get a warning that
> > the probe function is in wrong section.
> >
> > So in general I wonder if it is possible to request that all probe
> > functions are marked as __devinit or not marked at all, regardless of
> > CONFIG_HOTPLUG and CONFIG_MODULE settings.
> Would you agree if the message would change to
>
> probably the probe function of platform driver %s can be moved
> to .devinit.text
>
> ?

How about "Consider marking the probe function as '__devinit'"?

--
Dmitry
--
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/