original comment: +Wilson03172004,marked due to this pci host does not support MWI
[linux-2.4.git] / drivers / isdn / divert / divert_init.c
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 "isdn_divert.h"
16
17 MODULE_DESCRIPTION("ISDN4Linux: Call diversion support");
18 MODULE_AUTHOR("Werner Cornelius");
19 MODULE_LICENSE("GPL");
20
21 /********************/
22 /* needed externals */
23 /********************/
24 extern int printk(const char *fmt,...);
25
26 /****************************************/
27 /* structure containing interface to hl */
28 /****************************************/
29 isdn_divert_if divert_if =
30   { DIVERT_IF_MAGIC,  /* magic value */
31     DIVERT_CMD_REG,   /* register cmd */
32     ll_callback,      /* callback routine from ll */
33     NULL,             /* command still not specified */
34     NULL,             /* drv_to_name */
35     NULL,             /* name_to_drv */
36   };
37
38 /*************************/
39 /* Module interface code */
40 /* no cmd line parms     */
41 /*************************/
42 static int __init divert_init(void)
43 { int i;
44
45   if (divert_dev_init())
46    { printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n");
47      return(-EIO);
48    }
49   if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
50    { divert_dev_deinit();
51      printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n",i);
52      return(-EIO);
53    } 
54 #if (LINUX_VERSION_CODE < 0x020111)
55   register_symtab(0);
56 #endif
57   printk(KERN_INFO "dss1_divert module successfully installed\n");
58   return(0);
59 }
60
61 /**********************/
62 /* Module deinit code */
63 /**********************/
64 static void __exit divert_exit(void)
65 { unsigned long flags;
66   int i;
67
68   save_flags(flags);
69   cli();
70   divert_if.cmd = DIVERT_CMD_REL; /* release */
71   if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
72    { printk(KERN_WARNING "dss1_divert: error %d releasing module\n",i);
73      restore_flags(flags);
74      return;
75    } 
76   if (divert_dev_deinit()) 
77    { printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n");
78      restore_flags(flags);
79      return;
80    }
81   restore_flags(flags);
82   deleterule(-1); /* delete all rules and free mem */
83   deleteprocs();
84   printk(KERN_INFO "dss1_divert module successfully removed \n");
85 }
86
87 module_init(divert_init);
88 module_exit(divert_exit);
89