aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ip2/ip2main.c
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/char/ip2/ip2main.c
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/char/ip2/ip2main.c')
-rw-r--r--drivers/char/ip2/ip2main.c92
1 files changed, 76 insertions, 16 deletions
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() */