Import 2.1.81
[davej-history.git] / drivers / misc / parport_init.c
blob1ccb67d3262ce8fc21dde439c65629527bc0ebb1
1 /* Parallel-port initialisation code.
2 *
3 * Authors: David Campbell <campbell@tirian.che.curtin.edu.au>
4 * Tim Waugh <tim@cyberelk.demon.co.uk>
5 * Jose Renau <renau@acm.org>
7 * based on work by Grant Guenther <grant@torque.net>
8 * and Philip Blundell <Philip.Blundell@pobox.com>
9 */
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/tasks.h>
15 #include <linux/parport.h>
16 #include <linux/errno.h>
17 #include <linux/kernel.h>
18 #include <linux/malloc.h>
19 #include <linux/init.h>
20 #include <linux/kerneld.h>
22 #ifndef MODULE
23 static int io[PARPORT_MAX+1] __initdata = { [0 ... PARPORT_MAX] = 0 };
24 static int irq[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_IRQ_NONE };
25 static int dma[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_DMA_NONE };
27 extern int parport_pc_init(int *io, int *irq, int *dma);
28 extern int parport_ax_init(void);
30 static int parport_setup_ptr __initdata = 0;
32 __initfunc(void parport_setup(char *str, int *ints))
34 if (ints[0] == 0 || ints[1] == 0) {
35 /* Disable parport if "parport=" or "parport=0" in cmdline */
36 io[0] = PARPORT_DISABLE;
37 return;
39 if (parport_setup_ptr < PARPORT_MAX) {
40 io[parport_setup_ptr] = ints[1];
41 if (ints[0]>1) {
42 irq[parport_setup_ptr] = ints[2];
43 if (ints[0]>2) dma[parport_setup_ptr] = ints[3];
45 parport_setup_ptr++;
46 } else {
47 printk(KERN_ERR "parport=0x%x", ints[1]);
48 if (ints[0]>1) {
49 printk(",%d", ints[2]);
50 if (ints[0]>2) printk(",%d", ints[3]);
52 printk(" ignored, too many ports.\n");
55 #endif
57 #ifdef MODULE
58 int init_module(void)
60 parport_proc_init();
61 return 0;
64 void cleanup_module(void)
66 parport_proc_cleanup();
68 #else
69 __initfunc(int parport_init(void))
71 if (io[0] == PARPORT_DISABLE)
72 return 1;
74 #ifdef CONFIG_PNP_PARPORT
75 parport_probe_hook = &parport_probe_one;
76 #endif
77 parport_proc_init();
78 #ifdef CONFIG_PARPORT_PC
79 parport_pc_init(io, irq, dma);
80 #endif
81 #ifdef CONFIG_PARPORT_AX
82 parport_ax_init();
83 #endif
84 return 0;
86 #endif
88 /* Exported symbols for modules. */
90 EXPORT_SYMBOL(parport_claim);
91 EXPORT_SYMBOL(parport_release);
92 EXPORT_SYMBOL(parport_register_port);
93 EXPORT_SYMBOL(parport_unregister_port);
94 EXPORT_SYMBOL(parport_quiesce);
95 EXPORT_SYMBOL(parport_register_device);
96 EXPORT_SYMBOL(parport_unregister_device);
97 EXPORT_SYMBOL(parport_enumerate);
98 EXPORT_SYMBOL(parport_ieee1284_nibble_mode_ok);
99 EXPORT_SYMBOL(parport_wait_peripheral);
100 EXPORT_SYMBOL(parport_proc_register);
101 EXPORT_SYMBOL(parport_proc_unregister);
102 EXPORT_SYMBOL(parport_probe_hook);
104 void inc_parport_count(void)
106 #ifdef MODULE
107 MOD_INC_USE_COUNT;
108 #endif
111 void dec_parport_count(void)
113 #ifdef MODULE
114 MOD_DEC_USE_COUNT;
115 #endif