October 2017
Intermediate to advanced
586 pages
14h 8m
English
For devices sitting on a bus, whether it is a physical one or the pseudo platform bus, most of the time, everything is done in the probe function. The init and exit functions are just used to register/unregister the driver with the bus core:
static int __init foo_init(void)
{
[...] /*My init code */
return spi_register_driver(&foo_driver);
}
module_init(foo_init);
static void __exit foo_cleanup(void)
{
[...] /* My clean up code */
spi_unregister_driver(&foo_driver);
}
module_exit(foo_cleanup);
If you do not do anything else but register/unregister the driver, the kernel offers a macro:
module_spi_driver(foo_driver);
This will internally call spi_register_driver and spi_unregister_driver. It is exactly ...
Read now
Unlock full access