up, remove sem for we are in a interrupt runtine
[arrowworld.git] / serv.c
blobe744fe05775513977f78a93772dff10e54b0a067
1 /* copyleft (C) GPL3 {{{2
2 * Filename: serv.c
4 * Author: arrow <arrow_zhang@sdc.sercomm.com>
5 * Created at: Mon 20 Aug 2007 07:05:37 PM CST
6 * }}}*/
7 /*header files {{{1*/
8 #include <linux/kernel.h>
9 #include <linux/module.h>
10 #include <linux/list.h>
11 #include <linux/timer.h>
12 #include "common.h"
13 /*}}}*/
15 /*declaration {{{1*/
16 LIST_HEAD(list);
17 struct timer_list timer;
18 /*}}}*/
20 /*functions {{{1*/
21 void loop(unsigned long data)
23 struct arrow_t *tp;
25 timer.expires = jiffies + HZ;
26 timer.data = ++ data;
27 sbup("looping data = %ld\n", data);
28 list_for_each_entry(tp, &list, list) {
29 sbup("List name:%s\n", tp->name);
30 tp->fun(data);
32 add_timer(&timer);
35 int __init init_serv(void)
37 init_timer(&timer);
38 timer.expires = jiffies + HZ;
39 timer.function = loop;
40 add_timer(&timer);
41 return 0;
44 void __exit exit_serv(void)
46 del_timer(&timer);
49 int test_register(struct arrow_t *new)
51 list_add(&new->list, &list);
52 return 0;
54 EXPORT_SYMBOL(test_register);
56 int test_unregister(struct arrow_t *del)
58 list_del(&del->list);
59 return 0;
61 EXPORT_SYMBOL(test_unregister);
63 module_init(init_serv);
64 module_exit(exit_serv);
66 /* vim:fdm=marker:ts=8:ft=c:norl:fdl=1:
67 * }}}*/