aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-10-13 05:34:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:39 -0400
commit47babd4c6a16915aeb15d4216d91f03910572982 (patch)
treeca30c2ca459e5e91ccb657be4367e51043d73801 /drivers
parent1361b7d3592b006574fb3cfeb21a02d520cca315 (diff)
Char: merge ip2main and ip2base
It's pretty useless to have one setup() function separated along with module_init() which only calls a function from ip2main anyway. Get rid of ip2base. Remove also checks of always-true now. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/ip2/Makefile2
-rw-r--r--drivers/char/ip2/ip2base.c108
-rw-r--r--drivers/char/ip2/ip2main.c92
3 files changed, 77 insertions, 125 deletions
diff --git a/drivers/char/ip2/Makefile b/drivers/char/ip2/Makefile
index 939618f62fe1..bc397d92b499 100644
--- a/drivers/char/ip2/Makefile
+++ b/drivers/char/ip2/Makefile
@@ -4,5 +4,5 @@
4 4
5obj-$(CONFIG_COMPUTONE) += ip2.o 5obj-$(CONFIG_COMPUTONE) += ip2.o
6 6
7ip2-objs := ip2base.o ip2main.o 7ip2-objs := ip2main.o
8 8
diff --git a/drivers/char/ip2/ip2base.c b/drivers/char/ip2/ip2base.c
deleted file mode 100644
index 8155e247c04b..000000000000
--- a/drivers/char/ip2/ip2base.c
+++ /dev/null
@@ -1,108 +0,0 @@
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//
8
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/wait.h>
12
13#ifndef __init
14#define __init
15#endif
16#ifndef __initfunc
17#define __initfunc(a) a
18#endif
19#ifndef __initdata
20#define __initdata
21#endif
22
23#include "ip2types.h"
24
25int
26ip2_loadmain(int *, int *); // ref into ip2main.c
27
28/* Note: Add compiled in defaults to these arrays, not to the structure
29 in ip2.h any longer. That structure WILL get overridden
30 by these values, or command line values, or insmod values!!! =mhw=
31*/
32static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 };
33static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
34
35static int poll_only = 0;
36
37MODULE_AUTHOR("Doug McNash");
38MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
39module_param_array(irq, int, NULL, 0);
40MODULE_PARM_DESC(irq,"Interrupts for IntelliPort Cards");
41module_param_array(io, int, NULL, 0);
42MODULE_PARM_DESC(io,"I/O ports for IntelliPort Cards");
43module_param(poll_only, bool, 0);
44MODULE_PARM_DESC(poll_only,"Do not use card interrupts");
45
46
47static int __init ip2_init(void)
48{
49 if( poll_only ) {
50 /* Hard lock the interrupts to zero */
51 irq[0] = irq[1] = irq[2] = irq[3] = 0;
52 }
53
54 return ip2_loadmain(io, irq);
55}
56module_init(ip2_init);
57
58MODULE_LICENSE("GPL");
59
60#ifndef MODULE
61/******************************************************************************
62 * ip2_setup:
63 * str: kernel command line string
64 *
65 * Can't autoprobe the boards so user must specify configuration on
66 * kernel command line. Sane people build it modular but the others
67 * come here.
68 *
69 * Alternating pairs of io,irq for up to 4 boards.
70 * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
71 *
72 * io=0 => No board
73 * io=1 => PCI
74 * io=2 => EISA
75 * else => ISA I/O address
76 *
77 * irq=0 or invalid for ISA will revert to polling mode
78 *
79 * Any value = -1, do not overwrite compiled in value.
80 *
81 ******************************************************************************/
82static int __init ip2_setup(char *str)
83{
84 int ints[10]; /* 4 boards, 2 parameters + 2 */
85 int i, j;
86
87 str = get_options (str, ARRAY_SIZE(ints), ints);
88
89 for( i = 0, j = 1; i < 4; i++ ) {
90 if( j > ints[0] ) {
91 break;
92 }
93 if( ints[j] >= 0 ) {
94 io[i] = ints[j];
95 }
96 j++;
97 if( j > ints[0] ) {
98 break;
99 }
100 if( ints[j] >= 0 ) {
101 irq[i] = ints[j];
102 }
103 j++;
104 }
105 return 1;
106}
107__setup("ip2=", ip2_setup);
108#endif /* !MODULE */
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 689f9dcd3b86..79bca611d429 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -157,9 +157,6 @@ static char *pcVersion = "1.2.14";
157static char *pcDriver_name = "ip2"; 157static char *pcDriver_name = "ip2";
158static char *pcIpl = "ip2ipl"; 158static char *pcIpl = "ip2ipl";
159 159
160// cheezy kludge or genius - you decide?
161int ip2_loadmain(int *, int *);
162
163/***********************/ 160/***********************/
164/* Function Prototypes */ 161/* Function Prototypes */
165/***********************/ 162/***********************/
@@ -287,6 +284,7 @@ static int tracewrap;
287 284
288MODULE_AUTHOR("Doug McNash"); 285MODULE_AUTHOR("Doug McNash");
289MODULE_DESCRIPTION("Computone IntelliPort Plus Driver"); 286MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
287MODULE_LICENSE("GPL");
290 288
291static int poll_only = 0; 289static int poll_only = 0;
292 290
@@ -297,6 +295,22 @@ static int iindx;
297static char rirqs[IP2_MAX_BOARDS]; 295static char rirqs[IP2_MAX_BOARDS];
298static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0}; 296static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0};
299 297
298/* Note: Add compiled in defaults to these arrays, not to the structure
299 in ip2.h any longer. That structure WILL get overridden
300 by these values, or command line values, or insmod values!!! =mhw=
301*/
302static int io[IP2_MAX_BOARDS];
303static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
304
305MODULE_AUTHOR("Doug McNash");
306MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
307module_param_array(irq, int, NULL, 0);
308MODULE_PARM_DESC(irq, "Interrupts for IntelliPort Cards");
309module_param_array(io, int, NULL, 0);
310MODULE_PARM_DESC(io, "I/O ports for IntelliPort Cards");
311module_param(poll_only, bool, 0);
312MODULE_PARM_DESC(poll_only, "Do not use card interrupts");
313
300/* for sysfs class support */ 314/* for sysfs class support */
301static struct class *ip2_class; 315static struct class *ip2_class;
302 316
@@ -494,8 +508,53 @@ static const struct firmware *ip2_request_firmware(void)
494 return fw; 508 return fw;
495} 509}
496 510
497int 511#ifndef MODULE
498ip2_loadmain(int *iop, int *irqp) 512/******************************************************************************
513 * ip2_setup:
514 * str: kernel command line string
515 *
516 * Can't autoprobe the boards so user must specify configuration on
517 * kernel command line. Sane people build it modular but the others
518 * come here.
519 *
520 * Alternating pairs of io,irq for up to 4 boards.
521 * ip2=io0,irq0,io1,irq1,io2,irq2,io3,irq3
522 *
523 * io=0 => No board
524 * io=1 => PCI
525 * io=2 => EISA
526 * else => ISA I/O address
527 *
528 * irq=0 or invalid for ISA will revert to polling mode
529 *
530 * Any value = -1, do not overwrite compiled in value.
531 *
532 ******************************************************************************/
533static int __init ip2_setup(char *str)
534{
535 int j, ints[10]; /* 4 boards, 2 parameters + 2 */
536 unsigned int i;
537
538 str = get_options(str, ARRAY_SIZE(ints), ints);
539
540 for (i = 0, j = 1; i < 4; i++) {
541 if (j > ints[0])
542 break;
543 if (ints[j] >= 0)
544 io[i] = ints[j];
545 j++;
546 if (j > ints[0])
547 break;
548 if (ints[j] >= 0)
549 irq[i] = ints[j];
550 j++;
551 }
552 return 1;
553}
554__setup("ip2=", ip2_setup);
555#endif /* !MODULE */
556
557static int ip2_loadmain(void)
499{ 558{
500 int i, j, box; 559 int i, j, box;
501 int err = 0; 560 int err = 0;
@@ -505,6 +564,11 @@ ip2_loadmain(int *iop, int *irqp)
505 static struct pci_dev *pci_dev_i = NULL; 564 static struct pci_dev *pci_dev_i = NULL;
506 const struct firmware *fw = NULL; 565 const struct firmware *fw = NULL;
507 566
567 if (poll_only) {
568 /* Hard lock the interrupts to zero */
569 irq[0] = irq[1] = irq[2] = irq[3] = poll_only = 0;
570 }
571
508 ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 ); 572 ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_ENTER, 0 );
509 573
510 /* process command line arguments to modprobe or 574 /* process command line arguments to modprobe or
@@ -512,14 +576,11 @@ ip2_loadmain(int *iop, int *irqp)
512 /* irqp and iop should ALWAYS be specified now... But we check 576 /* irqp and iop should ALWAYS be specified now... But we check
513 them individually just to be sure, anyways... */ 577 them individually just to be sure, anyways... */
514 for ( i = 0; i < IP2_MAX_BOARDS; ++i ) { 578 for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
515 if (iop) { 579 ip2config.addr[i] = io[i];
516 ip2config.addr[i] = iop[i]; 580 if (irq[i] >= 0)
517 if (irqp) { 581 ip2config.irq[i] = irq[i];
518 if( irqp[i] >= 0 ) { 582 else
519 ip2config.irq[i] = irqp[i]; 583 ip2config.irq[i] = 0;
520 } else {
521 ip2config.irq[i] = 0;
522 }
523 // This is a little bit of a hack. If poll_only=1 on command 584 // This is a little bit of a hack. If poll_only=1 on command
524 // line back in ip2.c OR all IRQs on all specified boards are 585 // line back in ip2.c OR all IRQs on all specified boards are
525 // explicitly set to 0, then drop to poll only mode and override 586 // explicitly set to 0, then drop to poll only mode and override
@@ -531,9 +592,7 @@ ip2_loadmain(int *iop, int *irqp)
531 // to -1, is to use 0 as a hard coded, do not probe. 592 // to -1, is to use 0 as a hard coded, do not probe.
532 // 593 //
533 // /\/\|=mhw=|\/\/ 594 // /\/\|=mhw=|\/\/
534 poll_only |= irqp[i]; 595 poll_only |= irq[i];
535 }
536 }
537 } 596 }
538 poll_only = !poll_only; 597 poll_only = !poll_only;
539 598
@@ -783,6 +842,7 @@ out_chrdev:
783out: 842out:
784 return err; 843 return err;
785} 844}
845module_init(ip2_loadmain);
786 846
787/******************************************************************************/ 847/******************************************************************************/
788/* Function: ip2_init_board() */ 848/* Function: ip2_init_board() */