aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-07-25 04:48:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:44 -0400
commit83766bc63f7e49b0215811026e7802bd09a9c7e1 (patch)
treeb36b3ac4c695f5c3951fe7e434d54836d080fd9e /drivers
parent729f0edbecd0c59c82ee9bf92009acc7e984c425 (diff)
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: Jiri Slaby <jirislaby@gmail.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/mxser.c80
1 files changed, 37 insertions, 43 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 3d7f2a970495..57570f7db2be 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -55,11 +55,6 @@
55#define MXSER_PORTS (MXSER_BOARDS * MXSER_PORTS_PER_BOARD) 55#define MXSER_PORTS (MXSER_BOARDS * MXSER_PORTS_PER_BOARD)
56#define MXSER_ISR_PASS_LIMIT 100 56#define MXSER_ISR_PASS_LIMIT 100
57 57
58#define MXSER_ERR_IOADDR -1
59#define MXSER_ERR_IRQ -2
60#define MXSER_ERR_IRQ_CONFLIT -3
61#define MXSER_ERR_VECTOR -4
62
63/*CheckIsMoxaMust return value*/ 58/*CheckIsMoxaMust return value*/
64#define MOXA_OTHER_UART 0x00 59#define MOXA_OTHER_UART 0x00
65#define MOXA_MUST_MU150_HWID 0x01 60#define MOXA_MUST_MU150_HWID 0x01
@@ -2481,7 +2476,8 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2481 unsigned int i; 2476 unsigned int i;
2482 int retval; 2477 int retval;
2483 2478
2484 printk(KERN_INFO "max. baud rate = %d bps.\n", brd->ports[0].max_baud); 2479 printk(KERN_INFO "mxser: max. baud rate = %d bps\n",
2480 brd->ports[0].max_baud);
2485 2481
2486 for (i = 0; i < brd->info->nports; i++) { 2482 for (i = 0; i < brd->info->nports; i++) {
2487 info = &brd->ports[i]; 2483 info = &brd->ports[i];
@@ -2564,28 +2560,32 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
2564 irq = regs[9] & 0xF000; 2560 irq = regs[9] & 0xF000;
2565 irq = irq | (irq >> 4); 2561 irq = irq | (irq >> 4);
2566 if (irq != (regs[9] & 0xFF00)) 2562 if (irq != (regs[9] & 0xFF00))
2567 return MXSER_ERR_IRQ_CONFLIT; 2563 goto err_irqconflict;
2568 } else if (brd->info->nports == 4) { 2564 } else if (brd->info->nports == 4) {
2569 irq = regs[9] & 0xF000; 2565 irq = regs[9] & 0xF000;
2570 irq = irq | (irq >> 4); 2566 irq = irq | (irq >> 4);
2571 irq = irq | (irq >> 8); 2567 irq = irq | (irq >> 8);
2572 if (irq != regs[9]) 2568 if (irq != regs[9])
2573 return MXSER_ERR_IRQ_CONFLIT; 2569 goto err_irqconflict;
2574 } else if (brd->info->nports == 8) { 2570 } else if (brd->info->nports == 8) {
2575 irq = regs[9] & 0xF000; 2571 irq = regs[9] & 0xF000;
2576 irq = irq | (irq >> 4); 2572 irq = irq | (irq >> 4);
2577 irq = irq | (irq >> 8); 2573 irq = irq | (irq >> 8);
2578 if ((irq != regs[9]) || (irq != regs[10])) 2574 if ((irq != regs[9]) || (irq != regs[10]))
2579 return MXSER_ERR_IRQ_CONFLIT; 2575 goto err_irqconflict;
2580 } 2576 }
2581 2577
2582 if (!irq) 2578 if (!irq) {
2583 return MXSER_ERR_IRQ; 2579 printk(KERN_ERR "mxser: interrupt number unset\n");
2580 return -EIO;
2581 }
2584 brd->irq = ((int)(irq & 0xF000) >> 12); 2582 brd->irq = ((int)(irq & 0xF000) >> 12);
2585 for (i = 0; i < 8; i++) 2583 for (i = 0; i < 8; i++)
2586 brd->ports[i].ioaddr = (int) regs[i + 1] & 0xFFF8; 2584 brd->ports[i].ioaddr = (int) regs[i + 1] & 0xFFF8;
2587 if ((regs[12] & 0x80) == 0) 2585 if ((regs[12] & 0x80) == 0) {
2588 return MXSER_ERR_VECTOR; 2586 printk(KERN_ERR "mxser: invalid interrupt vector\n");
2587 return -EIO;
2588 }
2589 brd->vector = (int)regs[11]; /* interrupt vector */ 2589 brd->vector = (int)regs[11]; /* interrupt vector */
2590 if (id == 1) 2590 if (id == 1)
2591 brd->vector_mask = 0x00FF; 2591 brd->vector_mask = 0x00FF;
@@ -2612,13 +2612,26 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
2612 else 2612 else
2613 brd->uart_type = PORT_16450; 2613 brd->uart_type = PORT_16450;
2614 if (!request_region(brd->ports[0].ioaddr, 8 * brd->info->nports, 2614 if (!request_region(brd->ports[0].ioaddr, 8 * brd->info->nports,
2615 "mxser(IO)")) 2615 "mxser(IO)")) {
2616 return MXSER_ERR_IOADDR; 2616 printk(KERN_ERR "mxser: can't request ports I/O region: "
2617 "0x%.8lx-0x%.8lx\n",
2618 brd->ports[0].ioaddr, brd->ports[0].ioaddr +
2619 8 * brd->info->nports - 1);
2620 return -EIO;
2621 }
2617 if (!request_region(brd->vector, 1, "mxser(vector)")) { 2622 if (!request_region(brd->vector, 1, "mxser(vector)")) {
2618 release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); 2623 release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
2619 return MXSER_ERR_VECTOR; 2624 printk(KERN_ERR "mxser: can't request interrupt vector region: "
2625 "0x%.8lx-0x%.8lx\n",
2626 brd->ports[0].ioaddr, brd->ports[0].ioaddr +
2627 8 * brd->info->nports - 1);
2628 return -EIO;
2620 } 2629 }
2621 return brd->info->nports; 2630 return brd->info->nports;
2631
2632err_irqconflict:
2633 printk(KERN_ERR "mxser: invalid interrupt number\n");
2634 return -EIO;
2622} 2635}
2623 2636
2624static int __devinit mxser_probe(struct pci_dev *pdev, 2637static int __devinit mxser_probe(struct pci_dev *pdev,
@@ -2635,20 +2648,20 @@ static int __devinit mxser_probe(struct pci_dev *pdev,
2635 break; 2648 break;
2636 2649
2637 if (i >= MXSER_BOARDS) { 2650 if (i >= MXSER_BOARDS) {
2638 printk(KERN_ERR "Too many Smartio/Industio family boards found " 2651 dev_err(&pdev->dev, "too many boards found (maximum %d), board "
2639 "(maximum %d), board not configured\n", MXSER_BOARDS); 2652 "not configured\n", MXSER_BOARDS);
2640 goto err; 2653 goto err;
2641 } 2654 }
2642 2655
2643 brd = &mxser_boards[i]; 2656 brd = &mxser_boards[i];
2644 brd->idx = i * MXSER_PORTS_PER_BOARD; 2657 brd->idx = i * MXSER_PORTS_PER_BOARD;
2645 printk(KERN_INFO "Found MOXA %s board (BusNo=%d, DevNo=%d)\n", 2658 dev_info(&pdev->dev, "found MOXA %s board (BusNo=%d, DevNo=%d)\n",
2646 mxser_cards[ent->driver_data].name, 2659 mxser_cards[ent->driver_data].name,
2647 pdev->bus->number, PCI_SLOT(pdev->devfn)); 2660 pdev->bus->number, PCI_SLOT(pdev->devfn));
2648 2661
2649 retval = pci_enable_device(pdev); 2662 retval = pci_enable_device(pdev);
2650 if (retval) { 2663 if (retval) {
2651 printk(KERN_ERR "Moxa SmartI/O PCI enable fail !\n"); 2664 dev_err(&pdev->dev, "PCI enable failed\n");
2652 goto err; 2665 goto err;
2653 } 2666 }
2654 2667
@@ -2798,33 +2811,14 @@ static int __init mxser_module_init(void)
2798 2811
2799 brd = &mxser_boards[m]; 2812 brd = &mxser_boards[m];
2800 retval = mxser_get_ISA_conf(cap, brd); 2813 retval = mxser_get_ISA_conf(cap, brd);
2801
2802 if (retval != 0)
2803 printk(KERN_INFO "Found MOXA %s board "
2804 "(CAP=0x%x)\n",
2805 brd->info->name, ioaddr[b]);
2806
2807 if (retval <= 0) { 2814 if (retval <= 0) {
2808 if (retval == MXSER_ERR_IRQ)
2809 printk(KERN_ERR "Invalid interrupt "
2810 "number, board not "
2811 "configured\n");
2812 else if (retval == MXSER_ERR_IRQ_CONFLIT)
2813 printk(KERN_ERR "Invalid interrupt "
2814 "number, board not "
2815 "configured\n");
2816 else if (retval == MXSER_ERR_VECTOR)
2817 printk(KERN_ERR "Invalid interrupt "
2818 "vector, board not "
2819 "configured\n");
2820 else if (retval == MXSER_ERR_IOADDR)
2821 printk(KERN_ERR "Invalid I/O address, "
2822 "board not configured\n");
2823
2824 brd->info = NULL; 2815 brd->info = NULL;
2825 continue; 2816 continue;
2826 } 2817 }
2827 2818
2819 printk(KERN_INFO "mxser: found MOXA %s board "
2820 "(CAP=0x%x)\n", brd->info->name, ioaddr[b]);
2821
2828 /* mxser_initbrd will hook ISR. */ 2822 /* mxser_initbrd will hook ISR. */
2829 if (mxser_initbrd(brd, NULL) < 0) { 2823 if (mxser_initbrd(brd, NULL) < 0) {
2830 brd->info = NULL; 2824 brd->info = NULL;
@@ -2841,7 +2835,7 @@ static int __init mxser_module_init(void)
2841 2835
2842 retval = pci_register_driver(&mxser_driver); 2836 retval = pci_register_driver(&mxser_driver);
2843 if (retval) { 2837 if (retval) {
2844 printk(KERN_ERR "Can't register pci driver\n"); 2838 printk(KERN_ERR "mxser: can't register pci driver\n");
2845 if (!m) { 2839 if (!m) {
2846 retval = -ENODEV; 2840 retval = -ENODEV;
2847 goto err_unr; 2841 goto err_unr;