Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 74 lines (65 sloc) 1.291 kb
e9983bb @makelinux +platform_device and small updates
authored
1 /*
2 * LDT - Linux Driver Template
9bef4eb @makelinux +checkpatch
authored
3 *
e9983bb @makelinux +platform_device and small updates
authored
4 * Copyright (C) 2012 Constantine Shulyupin http://www.makelinux.net/
5 *
6 * Dual BSD/GPL License
7 *
8 * platform_device template driver
9 *
10 * uses
11 *
12 * platform_data
13 * resources
14 *
15 */
16
17 #include <linux/module.h>
18 #include <linux/platform_device.h>
19
20 static struct resource ldt_resource[] = {
21 {
9fc0000 @makelinux using ldt_resource
authored
22 .flags = IORESOURCE_IO,
23 .start = 0x3f8,
24 .end = 0x3ff,
25 },
26 {
e9983bb @makelinux +platform_device and small updates
authored
27 .flags = IORESOURCE_IRQ,
9fc0000 @makelinux using ldt_resource
authored
28 .start = 4,
29 .end = 4,
e9983bb @makelinux +platform_device and small updates
authored
30 },
31 {
32 .flags = IORESOURCE_MEM,
33 .start = 0,
34 .end = 0,
35 },
36 };
37
38 void ldt_dev_release(struct device *dev)
39 {
40 _entry:;
41 }
42
43 static struct platform_device ldt_platform_device = {
44 .name = "ldt_device_name",
45 .id = 0,
46 .num_resources = ARRAY_SIZE(ldt_resource),
47 .resource = ldt_resource,
48 .dev.platform_data = "test data",
49 .dev.release = ldt_dev_release,
50 };
51
52 static int ldt_plat_dev_init(void)
53 {
54 int ret = 0;
55 _entry:
56 ret = platform_device_register(&ldt_platform_device);
57 trl_();
58 trvd(ret);
59 return ret;
60 }
61
62 static void ldt_plat_dev_exit(void)
63 {
64 _entry:
65 platform_device_unregister(&ldt_platform_device);
66 }
67
68 module_init(ldt_plat_dev_init);
69 module_exit(ldt_plat_dev_exit);
70
71 MODULE_DESCRIPTION("LDT - Linux Driver Template: platform_device");
72 MODULE_AUTHOR("Constantine Shulyupin <const@makelinux.net>");
73 MODULE_LICENSE("Dual BSD/GPL");
Something went wrong with that request. Please try again.