net: DCB: Validate DCB_ATTR_DCB_BUFFER argument
[linux/fpc-iii.git] / drivers / block / aoe / aoemain.c
blob1e4e2971171caf5c0cafd798fe93bc83c439e0e1
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;
20 static void discover_timer(struct timer_list *t)
22 mod_timer(t, jiffies + HZ * 60); /* one minute */
24 aoecmd_cfg(0xffff, 0xff);
27 static void __exit
28 aoe_exit(void)
30 del_timer_sync(&timer);
32 aoenet_exit();
33 unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
34 aoecmd_exit();
35 aoechr_exit();
36 aoedev_exit();
37 aoeblk_exit(); /* free cache after de-allocating bufs */
40 static int __init
41 aoe_init(void)
43 int ret;
45 ret = aoedev_init();
46 if (ret)
47 return ret;
48 ret = aoechr_init();
49 if (ret)
50 goto chr_fail;
51 ret = aoeblk_init();
52 if (ret)
53 goto blk_fail;
54 ret = aoenet_init();
55 if (ret)
56 goto net_fail;
57 ret = aoecmd_init();
58 if (ret)
59 goto cmd_fail;
60 ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
61 if (ret < 0) {
62 printk(KERN_ERR "aoe: can't register major\n");
63 goto blkreg_fail;
65 printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
67 timer_setup(&timer, discover_timer, 0);
68 discover_timer(&timer);
69 return 0;
70 blkreg_fail:
71 aoecmd_exit();
72 cmd_fail:
73 aoenet_exit();
74 net_fail:
75 aoeblk_exit();
76 blk_fail:
77 aoechr_exit();
78 chr_fail:
79 aoedev_exit();
81 printk(KERN_INFO "aoe: initialisation failure.\n");
82 return ret;
85 module_init(aoe_init);
86 module_exit(aoe_exit);