diff options
Diffstat (limited to 'arch/avr32/boards/merisc/merisc_sysfs.c')
-rw-r--r-- | arch/avr32/boards/merisc/merisc_sysfs.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/avr32/boards/merisc/merisc_sysfs.c b/arch/avr32/boards/merisc/merisc_sysfs.c new file mode 100644 index 000000000000..df431fdba9ad --- /dev/null +++ b/arch/avr32/boards/merisc/merisc_sysfs.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Merisc sysfs exports | ||
3 | * | ||
4 | * Copyright (C) 2008 Martinsson Elektronik AB | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/list.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/sysdev.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/ctype.h> | ||
20 | #include "merisc.h" | ||
21 | |||
22 | static ssize_t merisc_model_show(struct class *class, char *buf) | ||
23 | { | ||
24 | ssize_t ret = 0; | ||
25 | |||
26 | sprintf(buf, "%s\n", merisc_model()); | ||
27 | ret = strlen(buf) + 1; | ||
28 | |||
29 | return ret; | ||
30 | } | ||
31 | |||
32 | static ssize_t merisc_revision_show(struct class *class, char *buf) | ||
33 | { | ||
34 | ssize_t ret = 0; | ||
35 | |||
36 | sprintf(buf, "%s\n", merisc_revision()); | ||
37 | ret = strlen(buf) + 1; | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | static struct class_attribute merisc_class_attrs[] = { | ||
43 | __ATTR(model, S_IRUGO, merisc_model_show, NULL), | ||
44 | __ATTR(revision, S_IRUGO, merisc_revision_show, NULL), | ||
45 | __ATTR_NULL, | ||
46 | }; | ||
47 | |||
48 | struct class merisc_class = { | ||
49 | .name = "merisc", | ||
50 | .owner = THIS_MODULE, | ||
51 | .class_attrs = merisc_class_attrs, | ||
52 | }; | ||
53 | |||
54 | static int __init merisc_sysfs_init(void) | ||
55 | { | ||
56 | int status; | ||
57 | |||
58 | status = class_register(&merisc_class); | ||
59 | if (status < 0) | ||
60 | return status; | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | postcore_initcall(merisc_sysfs_init); | ||