Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: corgi_ts - mark probe function as __devinit

A pointer to corgits_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.

[dtor@mail.ru: fixed some more section markups]
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

authored by

Uwe Kleine-König and committed by
Dmitry Torokhov
840207ed f2d8dc75

+5 -4
+5 -4
drivers/input/touchscreen/corgi_ts.c
··· 268 268 #define corgits_resume NULL 269 269 #endif 270 270 271 - static int __init corgits_probe(struct platform_device *pdev) 271 + static int __devinit corgits_probe(struct platform_device *pdev) 272 272 { 273 273 struct corgi_ts *corgi_ts; 274 274 struct input_dev *input_dev; ··· 343 343 return err; 344 344 } 345 345 346 - static int corgits_remove(struct platform_device *pdev) 346 + static int __devexit corgits_remove(struct platform_device *pdev) 347 347 { 348 348 struct corgi_ts *corgi_ts = platform_get_drvdata(pdev); 349 349 ··· 352 352 corgi_ts->machinfo->put_hsync(); 353 353 input_unregister_device(corgi_ts->input); 354 354 kfree(corgi_ts); 355 + 355 356 return 0; 356 357 } 357 358 358 359 static struct platform_driver corgits_driver = { 359 360 .probe = corgits_probe, 360 - .remove = corgits_remove, 361 + .remove = __devexit_p(corgits_remove), 361 362 .suspend = corgits_suspend, 362 363 .resume = corgits_resume, 363 364 .driver = { ··· 367 366 }, 368 367 }; 369 368 370 - static int __devinit corgits_init(void) 369 + static int __init corgits_init(void) 371 370 { 372 371 return platform_driver_register(&corgits_driver); 373 372 }