-
Notifications
You must be signed in to change notification settings - Fork 1
/
pic18_lifecycle.c
50 lines (39 loc) · 987 Bytes
/
pic18_lifecycle.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright (c) 2012-2013, Stuart Wheater, Newcastle upon Tyne, England. All rights reserved.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include "pic18_io.h"
#include "pic18_worker.h"
#include "pic18_sysfs.h"
MODULE_AUTHOR("Stuart Wheater");
MODULE_DESCRIPTION("Exposes a PIC microcontroller's Flash memory as a file.");
MODULE_LICENSE("GPL");
static int __init pic18_lifecycle_init(void)
{
printk(KERN_INFO "pic18_lifecycle_init\n");
if (pic18_sysfs_init())
return 1;
if (pic18_io_init())
{
pic18_sysfs_exit();
return 2;
}
if (pic18_worker_init())
{
pic18_io_exit();
pic18_sysfs_exit();
return 2;
}
return 0;
}
static void __exit pic18_lifecycle_exit(void)
{
printk(KERN_INFO "pic18_lifecycle_exit\n");
pic18_worker_exit();
pic18_io_exit();
pic18_sysfs_exit();
}
module_init(pic18_lifecycle_init);
module_exit(pic18_lifecycle_exit);