Commit eae4436a authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Char: mxser_new, compress isa finding

ISA cards finding was too complex -- 2 (module params + predefined) absolutely
same routines, join them together with one for loop, one if and one indent
level.

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ead568c9
...@@ -2803,7 +2803,8 @@ static int __init mxser_module_init(void) ...@@ -2803,7 +2803,8 @@ static int __init mxser_module_init(void)
{ {
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
struct mxser_board *brd; struct mxser_board *brd;
unsigned int i, m; unsigned long cap;
unsigned int i, m, isaloop;
int retval, b, n; int retval, b, n;
pr_debug("Loading module mxser ...\n"); pr_debug("Loading module mxser ...\n");
...@@ -2839,29 +2840,38 @@ static int __init mxser_module_init(void) ...@@ -2839,29 +2840,38 @@ static int __init mxser_module_init(void)
m = 0; m = 0;
/* Start finding ISA boards here */ /* Start finding ISA boards here */
for (isaloop = 0; isaloop < 2; isaloop++)
for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) {
int cap; if (!isaloop)
cap = mxserBoardCAP[b]; /* predefined */
else
cap = ioaddr[b]; /* module param */
if (!(cap = mxserBoardCAP[b])) if (!cap)
continue; continue;
brd = &mxser_boards[m]; brd = &mxser_boards[m];
retval = mxser_get_ISA_conf(cap, brd); retval = mxser_get_ISA_conf(cap, brd);
if (retval != 0) if (retval != 0)
printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", printk(KERN_INFO "Found MOXA %s board "
mxser_brdname[brd->board_type - 1], ioaddr[b]); "(CAP=0x%x)\n",
mxser_brdname[brd->board_type - 1],
ioaddr[b]);
if (retval <= 0) { if (retval <= 0) {
if (retval == MXSER_ERR_IRQ) if (retval == MXSER_ERR_IRQ)
printk(KERN_ERR "Invalid interrupt number, " printk(KERN_ERR "Invalid interrupt "
"board not configured\n"); "number, board not "
"configured\n");
else if (retval == MXSER_ERR_IRQ_CONFLIT) else if (retval == MXSER_ERR_IRQ_CONFLIT)
printk(KERN_ERR "Invalid interrupt number, " printk(KERN_ERR "Invalid interrupt "
"board not configured\n"); "number, board not "
"configured\n");
else if (retval == MXSER_ERR_VECTOR) else if (retval == MXSER_ERR_VECTOR)
printk(KERN_ERR "Invalid interrupt vector, " printk(KERN_ERR "Invalid interrupt "
"board not configured\n"); "vector, board not "
"configured\n");
else if (retval == MXSER_ERR_IOADDR) else if (retval == MXSER_ERR_IOADDR)
printk(KERN_ERR "Invalid I/O address, " printk(KERN_ERR "Invalid I/O address, "
"board not configured\n"); "board not configured\n");
...@@ -2878,45 +2888,6 @@ static int __init mxser_module_init(void) ...@@ -2878,45 +2888,6 @@ static int __init mxser_module_init(void)
m++; m++;
} }
/* Start finding ISA boards from module arg */
for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) {
unsigned long cap;
if (!(cap = ioaddr[b]))
continue;
brd = &mxser_boards[m];
retval = mxser_get_ISA_conf(cap, &mxser_boards[m]);
if (retval != 0)
printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n",
mxser_brdname[brd->board_type - 1], ioaddr[b]);
if (retval <= 0) {
if (retval == MXSER_ERR_IRQ)
printk(KERN_ERR "Invalid interrupt number, "
"board not configured\n");
else if (retval == MXSER_ERR_IRQ_CONFLIT)
printk(KERN_ERR "Invalid interrupt number, "
"board not configured\n");
else if (retval == MXSER_ERR_VECTOR)
printk(KERN_ERR "Invalid interrupt vector, "
"board not configured\n");
else if (retval == MXSER_ERR_IOADDR)
printk(KERN_ERR "Invalid I/O address, "
"board not configured\n");
continue;
}
brd->pdev = NULL;
/* mxser_initbrd will hook ISR. */
if (mxser_initbrd(brd) < 0)
continue;
m++;
}
/* start finding PCI board here */ /* start finding PCI board here */
n = ARRAY_SIZE(mxser_pcibrds) - 1; n = ARRAY_SIZE(mxser_pcibrds) - 1;
b = 0; b = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment