still works after split
This commit is contained in:
53
driver/init.c
Normal file
53
driver/init.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Wolfgang Hottgenroth");
|
||||
MODULE_DESCRIPTION("A simple LKM to parse the device tree for a specific device and its properties");
|
||||
|
||||
|
||||
extern struct platform_driver leds_driver;
|
||||
extern struct spi_driver ls7366r_driver;
|
||||
extern struct platform_driver interrupt_driver;
|
||||
|
||||
/* module loading and unloading */
|
||||
static int __init my_init(void) {
|
||||
printk("counter - Loading the leds driver...\n");
|
||||
if(platform_driver_register(&leds_driver)) {
|
||||
printk("dt_gpio - Error! Could not load leds driver\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printk("counter - Loading the ls7366r driver...\n");
|
||||
if (spi_register_driver(&ls7366r_driver)) {
|
||||
printk("counter - Error! Could not load spi driver\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printk("counter - Loading the interrupt driver...\n");
|
||||
if(platform_driver_register(&interrupt_driver)) {
|
||||
printk("dt_gpio - Error! Could not load interrupt driver\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit my_exit(void) {
|
||||
printk("counter - Unloading the leds driver...\n");
|
||||
platform_driver_unregister(&leds_driver);
|
||||
|
||||
printk("counter - Unloading the ls7366r driver...\n");
|
||||
spi_unregister_driver(&ls7366r_driver);
|
||||
|
||||
printk("counter - Unloading the interrupt driver...\n");
|
||||
platform_driver_unregister(&interrupt_driver);
|
||||
}
|
||||
|
||||
module_init(my_init);
|
||||
module_exit(my_exit);
|
||||
|
||||
|
Reference in New Issue
Block a user