lkml.org 
[lkml]   [2010]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] platform_driver_register: warn if probe is in .init.text
    Date
    Uwe Kleine-König <u.kleine-koenig@pengutronix.de> writes:

    > +int platform_driver_register(struct platform_driver *drv)
    > +{
    > + int ret = __platform_driver_register(drv);
    > +
    > +#if defined(CONFIG_HOTPLUG)
    > + /*
    > + * drivers that are registered by platform_driver_register
    > + * should not have their probe function in .init.text. The
    > + * reason is that a probe can happen after .init.text is
    > + * discarded which then results in an oops. The alternatives
    > + * are using .devinit.text for the probe function or "register"
    > + * with platform_driver_probe.
    > + */
    > + 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);
    > +#endif
    > + return ret;
    > +}

    Um..., can't we extend modpost or such one for this? I think the static
    analysis is better (assume the changing ->probe dynamically is really
    rare).

    Thanks.
    --
    OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2010-01-24 22:11    [W:0.023 / U:1.232 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site