drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / drivers / block / aoe / aoemain.c
blob6238c4c87cfc73a58e81d3648457f2b95e1541db
1 /* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */
2 /*
3 * aoemain.c
4 * Module initialization routines, discover timer
5 */
7 #include <linux/hdreg.h>
8 #include <linux/blkdev.h>
9 #include <linux/module.h>
10 #include <linux/skbuff.h>
11 #include "aoe.h"
13 MODULE_LICENSE("GPL");
14 MODULE_AUTHOR("Sam Hopkins <sah@coraid.com>");
15 MODULE_DESCRIPTION("AoE block/char driver for 2.6.2 and newer 2.6 kernels");
16 MODULE_VERSION(VERSION);
18 static struct timer_list timer;
19 struct workqueue_struct *aoe_wq;
21 static void discover_timer(struct timer_list *t)
23 mod_timer(t, jiffies + HZ * 60); /* one minute */
25 aoecmd_cfg(0xffff, 0xff);
28 static void __exit
29 aoe_exit(void)
31 del_timer_sync(&timer);
33 aoenet_exit();
34 unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
35 aoecmd_exit();
36 aoechr_exit();
37 aoedev_exit();
38 aoeblk_exit(); /* free cache after de-allocating bufs */
39 destroy_workqueue(aoe_wq);
42 static int __init
43 aoe_init(void)
45 int ret;
47 aoe_wq = alloc_workqueue("aoe_wq", 0, 0);
48 if (!aoe_wq)
49 return -ENOMEM;
51 ret = aoedev_init();
52 if (ret)
53 goto dev_fail;
54 ret = aoechr_init();
55 if (ret)
56 goto chr_fail;
57 ret = aoeblk_init();
58 if (ret)
59 goto blk_fail;
60 ret = aoenet_init();
61 if (ret)
62 goto net_fail;
63 ret = aoecmd_init();
64 if (ret)
65 goto cmd_fail;
66 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
67 if (ret < 0) {
68 printk(KERN_ERR "aoe: can't register major\n");
69 goto blkreg_fail;
71 printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
73 timer_setup(&timer, discover_timer, 0);
74 discover_timer(&timer);
75 return 0;
76 blkreg_fail:
77 aoecmd_exit();
78 cmd_fail:
79 aoenet_exit();
80 net_fail:
81 aoeblk_exit();
82 blk_fail:
83 aoechr_exit();
84 chr_fail:
85 aoedev_exit();
86 dev_fail:
87 destroy_workqueue(aoe_wq);
89 printk(KERN_INFO "aoe: initialisation failure.\n");
90 return ret;
93 module_init(aoe_init);
94 module_exit(aoe_exit);