1 #include <linux/kernel.h>
2 #include <linux/module.h>
6 #include <linux/slab.h>
7 #include <linux/string.h>
14 #define LED_MAX_LENGTH 8
16 static inline void led_toggle(
void)
19 unsigned char on, off;
34 static void led_blink(
unsigned long timeout)
40 led_blink_timer.expires =
jiffies +
42 led_blink_timer.data = 0;
44 led_blink_timer.expires =
jiffies + (timeout *
HZ);
45 led_blink_timer.data = timeout;
50 static int led_proc_show(
struct seq_file *
m,
void *
v)
65 size_t count, loff_t *ppos)
84 if (buf[count - 1] ==
'\n')
85 buf[count - 1] =
'\0';
94 }
else if (!
strcmp(buf,
"toggle")) {
96 }
else if ((*buf >
'0') && (*buf <=
'9')) {
98 }
else if (!
strcmp(buf,
"load")) {
111 .open = led_proc_open,
115 .write = led_proc_write,
120 #define LED_VERSION "0.1"
127 led = proc_create(
"led", 0,
NULL, &led_proc_fops);
138 static void __exit led_exit(
void)