| Date | Sat, 28 Mar 2009 11:01:10 +0100 | Subject | Re: [PATCH 57/58] move w100fb's probe function to .devinit.text | From | pHilipp Zabel <> |
| |
2009/3/28 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>: > A pointer to w100fb_probe is passed to the core via > platform_driver_register and so the function must not disappear when the > .init sections are discarded. Otherwise (if also having HOTPLUG=y) > unbinding and binding a device to the driver via sysfs will result in an > oops as does a device being registered late. > > An alternative to this patch is using platform_driver_probe instead of > platform_driver_register plus removing the pointer to the probe function > from the struct platform_driver.
The ATI Imageon chips handled by this driver are not hotpluggable, I think the proposed alternative is the right way. Also, shouldn't w100fb_init be moved from __devinit to __init and w100fb_remove be put into __exit?
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > Cc: Philipp Zabel <philipp.zabel@gmail.com> > Cc: Ian Molton <spyro@f2s.com> > Cc: Richard Purdie <rpurdie@rpsys.net> > Cc: Antonino Daplas <adaplas@gmail.com> > Cc: Alberto Mardegan <mardy@users.sourceforge.net> > Cc: Andrew Morton <akpm@linux-foundation.org>
--- drivers/video/w100fb.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index d0674f1..157e7bd 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c @@ -781,7 +781,7 @@ out: }
-static int w100fb_remove(struct platform_device *pdev) +static int __exit w100fb_remove(struct platform_device *pdev) { struct fb_info *info = platform_get_drvdata(pdev); struct w100fb_par *par=info->par; @@ -1609,8 +1609,7 @@ static void w100_vsync(void) }
static struct platform_driver w100fb_driver = { - .probe = w100fb_probe, - .remove = w100fb_remove, + .remove = __exit_p(w100fb_remove), .suspend = w100fb_suspend, .resume = w100fb_resume, .driver = { @@ -1618,9 +1617,9 @@ static struct platform_driver w100fb_driver = { }, };
-int __devinit w100fb_init(void) +int __init w100fb_init(void) { - return platform_driver_register(&w100fb_driver); + return platform_driver_probe(&w100fb_driver, w100fb_probe); }
void __exit w100fb_cleanup(void) -- 1.6.2.1 -- 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/
|