Portability cleanup as required by Linus.
[linux-2.6/linux-mips.git] / drivers / char / ip2.c
blob600aea60a144061793589230e8f809d538c432de
1 // ip2.c
2 // This is a dummy module to make the firmware available when needed
3 // and allows it to be unloaded when not. Rumor is the __initdata
4 // macro doesn't always works on all platforms so we use this kludge.
5 // If not compiled as a module it just makes fip_firm avaliable then
6 // __initdata should work as advertized
7 //
9 #include <linux/config.h>
10 #include <linux/module.h>
11 #include <linux/version.h>
12 #include <linux/init.h>
13 #include <linux/wait.h>
15 #ifndef __init
16 #define __init
17 #endif
18 #ifndef __initfunc
19 #define __initfunc(a) a
20 #endif
21 #ifndef __initdata
22 #define __initdata
23 #endif
25 #include "./ip2/ip2types.h"
26 #include "./ip2/fip_firm.h" // the meat
28 int
29 ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c
31 #ifdef MODULE
32 #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
33 # define MODVERSIONS
34 #endif
35 #ifdef MODVERSIONS
36 # include <linux/modversions.h>
37 #endif
39 static int io[IP2_MAX_BOARDS]= { 0,};
40 static int irq[IP2_MAX_BOARDS] = { 0,};
42 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
43 MODULE_AUTHOR("Doug McNash");
44 MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
45 MODULE_PARM(irq,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
46 MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
47 MODULE_PARM(io,"1-"__MODULE_STRING(IP2_MAX_BOARDS) "i");
48 MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
49 # endif /* LINUX_VERSION */
52 //======================================================================
53 int
54 init_module(void)
56 int rc;
58 MOD_INC_USE_COUNT; // hold till done
60 rc = ip2_loadmain(io,irq,(unsigned char *)fip_firm,sizeof(fip_firm));
61 // The call to lock and load main, create dep
63 MOD_DEC_USE_COUNT; //done - kerneld now can unload us
64 return rc;
67 //======================================================================
68 int
69 ip2_init(void)
71 // call to this is int tty_io.c so we need this
72 return 0;
75 //======================================================================
76 void
77 cleanup_module(void)
81 #else // !MODULE
83 #ifndef NULL
84 # define NULL ((void *) 0)
85 #endif
87 int
88 ip2_init(void) {
89 return ip2_loadmain(NULL,NULL,(unsigned char *)fip_firm,sizeof(fip_firm));
92 #endif /* !MODULE */