Commit 83766bc6 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: mxser, prints cleanup

- use dev_* for printing in pci probe function
- move ISA p[rints directly into isa find function, do not postpone it.
  Remove macros bound to it then.
- prepend some prints by "mxser: " to know what it belongs to
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Acked-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 729f0edb
...@@ -55,11 +55,6 @@ ...@@ -55,11 +55,6 @@
#define MXSER_PORTS (MXSER_BOARDS * MXSER_PORTS_PER_BOARD) #define MXSER_PORTS (MXSER_BOARDS * MXSER_PORTS_PER_BOARD)
#define MXSER_ISR_PASS_LIMIT 100 #define MXSER_ISR_PASS_LIMIT 100
#define MXSER_ERR_IOADDR -1
#define MXSER_ERR_IRQ -2
#define MXSER_ERR_IRQ_CONFLIT -3
#define MXSER_ERR_VECTOR -4
/*CheckIsMoxaMust return value*/ /*CheckIsMoxaMust return value*/
#define MOXA_OTHER_UART 0x00 #define MOXA_OTHER_UART 0x00
#define MOXA_MUST_MU150_HWID 0x01 #define MOXA_MUST_MU150_HWID 0x01
...@@ -2481,7 +2476,8 @@ static int __devinit mxser_initbrd(struct mxser_board *brd, ...@@ -2481,7 +2476,8 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
unsigned int i; unsigned int i;
int retval; int retval;
printk(KERN_INFO "max. baud rate = %d bps.\n", brd->ports[0].max_baud); printk(KERN_INFO "mxser: max. baud rate = %d bps\n",
brd->ports[0].max_baud);
for (i = 0; i < brd->info->nports; i++) { for (i = 0; i < brd->info->nports; i++) {
info = &brd->ports[i]; info = &brd->ports[i];
...@@ -2564,28 +2560,32 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd) ...@@ -2564,28 +2560,32 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
irq = regs[9] & 0xF000; irq = regs[9] & 0xF000;
irq = irq | (irq >> 4); irq = irq | (irq >> 4);
if (irq != (regs[9] & 0xFF00)) if (irq != (regs[9] & 0xFF00))
return MXSER_ERR_IRQ_CONFLIT; goto err_irqconflict;
} else if (brd->info->nports == 4) { } else if (brd->info->nports == 4) {
irq = regs[9] & 0xF000; irq = regs[9] & 0xF000;
irq = irq | (irq >> 4); irq = irq | (irq >> 4);
irq = irq | (irq >> 8); irq = irq | (irq >> 8);
if (irq != regs[9]) if (irq != regs[9])
return MXSER_ERR_IRQ_CONFLIT; goto err_irqconflict;
} else if (brd->info->nports == 8) { } else if (brd->info->nports == 8) {
irq = regs[9] & 0xF000; irq = regs[9] & 0xF000;
irq = irq | (irq >> 4); irq = irq | (irq >> 4);
irq = irq | (irq >> 8); irq = irq | (irq >> 8);
if ((irq != regs[9]) || (irq != regs[10])) if ((irq != regs[9]) || (irq != regs[10]))
return MXSER_ERR_IRQ_CONFLIT; goto err_irqconflict;
} }
if (!irq) if (!irq) {
return MXSER_ERR_IRQ; printk(KERN_ERR "mxser: interrupt number unset\n");
return -EIO;
}
brd->irq = ((int)(irq & 0xF000) >> 12); brd->irq = ((int)(irq & 0xF000) >> 12);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
brd->ports[i].ioaddr = (int) regs[i + 1] & 0xFFF8; brd->ports[i].ioaddr = (int) regs[i + 1] & 0xFFF8;
if ((regs[12] & 0x80) == 0) if ((regs[12] & 0x80) == 0) {
return MXSER_ERR_VECTOR; printk(KERN_ERR "mxser: invalid interrupt vector\n");
return -EIO;
}
brd->vector = (int)regs[11]; /* interrupt vector */ brd->vector = (int)regs[11]; /* interrupt vector */
if (id == 1) if (id == 1)
brd->vector_mask = 0x00FF; brd->vector_mask = 0x00FF;
...@@ -2612,13 +2612,26 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd) ...@@ -2612,13 +2612,26 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
else else
brd->uart_type = PORT_16450; brd->uart_type = PORT_16450;
if (!request_region(brd->ports[0].ioaddr, 8 * brd->info->nports, if (!request_region(brd->ports[0].ioaddr, 8 * brd->info->nports,
"mxser(IO)")) "mxser(IO)")) {
return MXSER_ERR_IOADDR; printk(KERN_ERR "mxser: can't request ports I/O region: "
"0x%.8lx-0x%.8lx\n",
brd->ports[0].ioaddr, brd->ports[0].ioaddr +
8 * brd->info->nports - 1);
return -EIO;
}
if (!request_region(brd->vector, 1, "mxser(vector)")) { if (!request_region(brd->vector, 1, "mxser(vector)")) {
release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
return MXSER_ERR_VECTOR; printk(KERN_ERR "mxser: can't request interrupt vector region: "
"0x%.8lx-0x%.8lx\n",
brd->ports[0].ioaddr, brd->ports[0].ioaddr +
8 * brd->info->nports - 1);
return -EIO;
} }
return brd->info->nports; return brd->info->nports;
err_irqconflict:
printk(KERN_ERR "mxser: invalid interrupt number\n");
return -EIO;
} }
static int __devinit mxser_probe(struct pci_dev *pdev, static int __devinit mxser_probe(struct pci_dev *pdev,
...@@ -2635,20 +2648,20 @@ static int __devinit mxser_probe(struct pci_dev *pdev, ...@@ -2635,20 +2648,20 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
break; break;
if (i >= MXSER_BOARDS) { if (i >= MXSER_BOARDS) {
printk(KERN_ERR "Too many Smartio/Industio family boards found " dev_err(&pdev->dev, "too many boards found (maximum %d), board "
"(maximum %d), board not configured\n", MXSER_BOARDS); "not configured\n", MXSER_BOARDS);
goto err; goto err;
} }
brd = &mxser_boards[i]; brd = &mxser_boards[i];
brd->idx = i * MXSER_PORTS_PER_BOARD; brd->idx = i * MXSER_PORTS_PER_BOARD;
printk(KERN_INFO "Found MOXA %s board (BusNo=%d, DevNo=%d)\n", dev_info(&pdev->dev, "found MOXA %s board (BusNo=%d, DevNo=%d)\n",
mxser_cards[ent->driver_data].name, mxser_cards[ent->driver_data].name,
pdev->bus->number, PCI_SLOT(pdev->devfn)); pdev->bus->number, PCI_SLOT(pdev->devfn));
retval = pci_enable_device(pdev); retval = pci_enable_device(pdev);
if (retval) { if (retval) {
printk(KERN_ERR "Moxa SmartI/O PCI enable fail !\n"); dev_err(&pdev->dev, "PCI enable failed\n");
goto err; goto err;
} }
...@@ -2798,33 +2811,14 @@ static int __init mxser_module_init(void) ...@@ -2798,33 +2811,14 @@ static int __init mxser_module_init(void)
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)
printk(KERN_INFO "Found MOXA %s board "
"(CAP=0x%x)\n",
brd->info->name, ioaddr[b]);
if (retval <= 0) { 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");
brd->info = NULL; brd->info = NULL;
continue; continue;
} }
printk(KERN_INFO "mxser: found MOXA %s board "
"(CAP=0x%x)\n", brd->info->name, ioaddr[b]);
/* mxser_initbrd will hook ISR. */ /* mxser_initbrd will hook ISR. */
if (mxser_initbrd(brd, NULL) < 0) { if (mxser_initbrd(brd, NULL) < 0) {
brd->info = NULL; brd->info = NULL;
...@@ -2841,7 +2835,7 @@ static int __init mxser_module_init(void) ...@@ -2841,7 +2835,7 @@ static int __init mxser_module_init(void)
retval = pci_register_driver(&mxser_driver); retval = pci_register_driver(&mxser_driver);
if (retval) { if (retval) {
printk(KERN_ERR "Can't register pci driver\n"); printk(KERN_ERR "mxser: can't register pci driver\n");
if (!m) { if (!m) {
retval = -ENODEV; retval = -ENODEV;
goto err_unr; goto err_unr;
......
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