forked from makelinux/ldt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathldt_plat_dev.c
68 lines (60 loc) · 1.22 KB
/
ldt_plat_dev.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* LDT - Linux Driver Template
*
* Copyright (C) 2012 Constantine Shulyupin http://www.makelinux.net/
*
* Dual BSD/GPL License
*
* platform_device template driver
*
* uses
*
* platform_data
* resources
*
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include "tracing.h"
static struct resource ldt_resource[] = {
{
.flags = IORESOURCE_IO,
.start = 0x3f8,
.end = 0x3ff,
},
{
.flags = IORESOURCE_IRQ,
.start = 4,
.end = 4,
},
{
.flags = IORESOURCE_MEM,
.start = 0,
.end = 0,
},
};
void ldt_dev_release(struct device *dev)
{
_entry:;
}
static struct platform_device ldt_platform_device = {
.name = "ldt_device_name",
.id = 0,
.num_resources = ARRAY_SIZE(ldt_resource),
.resource = ldt_resource,
.dev.platform_data = "test data",
.dev.release = ldt_dev_release,
};
static int ldt_plat_dev_init(void)
{
return platform_device_register(&ldt_platform_device);
}
static void ldt_plat_dev_exit(void)
{
platform_device_unregister(&ldt_platform_device);
}
module_init(ldt_plat_dev_init);
module_exit(ldt_plat_dev_exit);
MODULE_DESCRIPTION("LDT - Linux Driver Template: platform_device");
MODULE_AUTHOR("Constantine Shulyupin <[email protected]>");
MODULE_LICENSE("Dual BSD/GPL");