-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.c
47 lines (34 loc) · 1.02 KB
/
module.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
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/module.h>
MODULE_AUTHOR("akozlins");
MODULE_LICENSE("GPL");
#include "dmabuf_platform_device.h"
#include "dmabuf_platform_driver.h"
static struct platform_device* dmabuf_platform_device = NULL;
static
int __init dmabuf_module_init(void) {
int error;
M_INFO("\n");
error = platform_driver_register(&dmabuf_platform_driver);
if(error) {
M_ERR("platform_driver_register: error = %d\n", error);
goto err_out;
}
dmabuf_platform_device = dmabuf_platform_device_register(THIS_MODULE->name);
if(IS_ERR_OR_NULL(dmabuf_platform_device)) {
error = PTR_ERR(dmabuf_platform_device);
dmabuf_platform_device = NULL;
goto err_out;
}
return 0;
err_out:
return error;
}
static
void __exit dmabuf_module_exit(void) {
M_INFO("\n");
platform_device_unregister(dmabuf_platform_device);
platform_driver_unregister(&dmabuf_platform_driver);
}
module_init(dmabuf_module_init);
module_exit(dmabuf_module_exit);