diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/isdn/divert/divert_init.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/isdn/divert/divert_init.c')
-rw-r--r-- | drivers/isdn/divert/divert_init.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/isdn/divert/divert_init.c b/drivers/isdn/divert/divert_init.c new file mode 100644 index 000000000000..434e684f5dbb --- /dev/null +++ b/drivers/isdn/divert/divert_init.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* $Id divert_init.c,v 1.5.6.2 2001/01/24 22:18:17 kai Exp $ | ||
2 | * | ||
3 | * Module init for DSS1 diversion services for i4l. | ||
4 | * | ||
5 | * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de) | ||
6 | * | ||
7 | * This software may be used and distributed according to the terms | ||
8 | * of the GNU General Public License, incorporated herein by reference. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/version.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/kernel.h> | ||
16 | |||
17 | #include "isdn_divert.h" | ||
18 | |||
19 | MODULE_DESCRIPTION("ISDN4Linux: Call diversion support"); | ||
20 | MODULE_AUTHOR("Werner Cornelius"); | ||
21 | MODULE_LICENSE("GPL"); | ||
22 | |||
23 | /****************************************/ | ||
24 | /* structure containing interface to hl */ | ||
25 | /****************************************/ | ||
26 | isdn_divert_if divert_if = | ||
27 | { DIVERT_IF_MAGIC, /* magic value */ | ||
28 | DIVERT_CMD_REG, /* register cmd */ | ||
29 | ll_callback, /* callback routine from ll */ | ||
30 | NULL, /* command still not specified */ | ||
31 | NULL, /* drv_to_name */ | ||
32 | NULL, /* name_to_drv */ | ||
33 | }; | ||
34 | |||
35 | /*************************/ | ||
36 | /* Module interface code */ | ||
37 | /* no cmd line parms */ | ||
38 | /*************************/ | ||
39 | static int __init divert_init(void) | ||
40 | { int i; | ||
41 | |||
42 | if (divert_dev_init()) | ||
43 | { printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n"); | ||
44 | return(-EIO); | ||
45 | } | ||
46 | if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) | ||
47 | { divert_dev_deinit(); | ||
48 | printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n",i); | ||
49 | return(-EIO); | ||
50 | } | ||
51 | printk(KERN_INFO "dss1_divert module successfully installed\n"); | ||
52 | return(0); | ||
53 | } | ||
54 | |||
55 | /**********************/ | ||
56 | /* Module deinit code */ | ||
57 | /**********************/ | ||
58 | static void __exit divert_exit(void) | ||
59 | { | ||
60 | unsigned long flags; | ||
61 | int i; | ||
62 | |||
63 | spin_lock_irqsave(&divert_lock, flags); | ||
64 | divert_if.cmd = DIVERT_CMD_REL; /* release */ | ||
65 | if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR) | ||
66 | { printk(KERN_WARNING "dss1_divert: error %d releasing module\n",i); | ||
67 | spin_unlock_irqrestore(&divert_lock, flags); | ||
68 | return; | ||
69 | } | ||
70 | if (divert_dev_deinit()) | ||
71 | { printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n"); | ||
72 | spin_unlock_irqrestore(&divert_lock, flags); | ||
73 | return; | ||
74 | } | ||
75 | spin_unlock_irqrestore(&divert_lock, flags); | ||
76 | deleterule(-1); /* delete all rules and free mem */ | ||
77 | deleteprocs(); | ||
78 | printk(KERN_INFO "dss1_divert module successfully removed \n"); | ||
79 | } | ||
80 | |||
81 | module_init(divert_init); | ||
82 | module_exit(divert_exit); | ||
83 | |||