Merge branch 'for-3.4/fixes-for-rc1-and-v3.3' of git://git.kernel.org/pub/scm/linux...
[deliverable/linux.git] / drivers / isdn / divert / divert_init.c
CommitLineData
1da177e4
LT
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)
475be4d8 6 *
1da177e4
LT
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>
1da177e4
LT
13#include <linux/init.h>
14#include <linux/kernel.h>
15
16#include "isdn_divert.h"
17
18MODULE_DESCRIPTION("ISDN4Linux: Call diversion support");
19MODULE_AUTHOR("Werner Cornelius");
20MODULE_LICENSE("GPL");
21
22/****************************************/
23/* structure containing interface to hl */
24/****************************************/
25isdn_divert_if divert_if =
475be4d8
JP
26{ DIVERT_IF_MAGIC, /* magic value */
27 DIVERT_CMD_REG, /* register cmd */
28 ll_callback, /* callback routine from ll */
29 NULL, /* command still not specified */
30 NULL, /* drv_to_name */
31 NULL, /* name_to_drv */
32};
1da177e4
LT
33
34/*************************/
35/* Module interface code */
36/* no cmd line parms */
37/*************************/
38static int __init divert_init(void)
39{ int i;
40
475be4d8
JP
41 if (divert_dev_init())
42 { printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n");
43 return (-EIO);
44 }
45 if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
46 { divert_dev_deinit();
47 printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n", i);
48 return (-EIO);
49 }
50 printk(KERN_INFO "dss1_divert module successfully installed\n");
51 return (0);
1da177e4
LT
52}
53
54/**********************/
55/* Module deinit code */
56/**********************/
57static void __exit divert_exit(void)
58{
475be4d8
JP
59 unsigned long flags;
60 int i;
1da177e4 61
475be4d8
JP
62 spin_lock_irqsave(&divert_lock, flags);
63 divert_if.cmd = DIVERT_CMD_REL; /* release */
64 if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
65 { printk(KERN_WARNING "dss1_divert: error %d releasing module\n", i);
66 spin_unlock_irqrestore(&divert_lock, flags);
67 return;
68 }
69 if (divert_dev_deinit())
70 { printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n");
71 spin_unlock_irqrestore(&divert_lock, flags);
72 return;
73 }
74 spin_unlock_irqrestore(&divert_lock, flags);
75 deleterule(-1); /* delete all rules and free mem */
76 deleteprocs();
77 printk(KERN_INFO "dss1_divert module successfully removed \n");
1da177e4
LT
78}
79
80module_init(divert_init);
81module_exit(divert_exit);
This page took 0.952316 seconds and 5 git commands to generate.