aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/mxser.c67
1 files changed, 27 insertions, 40 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 57570f7db2be..9b4d03cf4e1d 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -173,14 +173,15 @@ static struct pci_device_id mxser_pcibrds[] = {
173}; 173};
174MODULE_DEVICE_TABLE(pci, mxser_pcibrds); 174MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
175 175
176static int ioaddr[MXSER_BOARDS] = { 0, 0, 0, 0 }; 176static unsigned long ioaddr[MXSER_BOARDS];
177static int ttymajor = MXSERMAJOR; 177static int ttymajor = MXSERMAJOR;
178 178
179/* Variables for insmod */ 179/* Variables for insmod */
180 180
181MODULE_AUTHOR("Casper Yang"); 181MODULE_AUTHOR("Casper Yang");
182MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); 182MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver");
183module_param_array(ioaddr, int, NULL, 0); 183module_param_array(ioaddr, ulong, NULL, 0);
184MODULE_PARM_DESC(ioaddr, "ISA io addresses to look for a moxa board");
184module_param(ttymajor, int, 0); 185module_param(ttymajor, int, 0);
185MODULE_LICENSE("GPL"); 186MODULE_LICENSE("GPL");
186 187
@@ -281,11 +282,6 @@ struct mxser_mstatus {
281 int dcd; 282 int dcd;
282}; 283};
283 284
284static int mxserBoardCAP[MXSER_BOARDS] = {
285 0, 0, 0, 0
286 /* 0x180, 0x280, 0x200, 0x320 */
287};
288
289static struct mxser_board mxser_boards[MXSER_BOARDS]; 285static struct mxser_board mxser_boards[MXSER_BOARDS];
290static struct tty_driver *mxvar_sdriver; 286static struct tty_driver *mxvar_sdriver;
291static struct mxser_log mxvar_log; 287static struct mxser_log mxvar_log;
@@ -2763,9 +2759,8 @@ static struct pci_driver mxser_driver = {
2763static int __init mxser_module_init(void) 2759static int __init mxser_module_init(void)
2764{ 2760{
2765 struct mxser_board *brd; 2761 struct mxser_board *brd;
2766 unsigned long cap; 2762 unsigned int b, i, m;
2767 unsigned int i, m, isaloop; 2763 int retval;
2768 int retval, b;
2769 2764
2770 pr_debug("Loading module mxser ...\n"); 2765 pr_debug("Loading module mxser ...\n");
2771 2766
@@ -2797,41 +2792,33 @@ static int __init mxser_module_init(void)
2797 goto err_put; 2792 goto err_put;
2798 } 2793 }
2799 2794
2800 m = 0;
2801 /* Start finding ISA boards here */ 2795 /* Start finding ISA boards here */
2802 for (isaloop = 0; isaloop < 2; isaloop++) 2796 for (m = 0, b = 0; b < MXSER_BOARDS; b++) {
2803 for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { 2797 if (!ioaddr[b])
2804 if (!isaloop) 2798 continue;
2805 cap = mxserBoardCAP[b]; /* predefined */ 2799
2806 else 2800 brd = &mxser_boards[m];
2807 cap = ioaddr[b]; /* module param */ 2801 retval = mxser_get_ISA_conf(!ioaddr[b], brd);
2808 2802 if (retval <= 0) {
2809 if (!cap) 2803 brd->info = NULL;
2810 continue; 2804 continue;
2811 2805 }
2812 brd = &mxser_boards[m];
2813 retval = mxser_get_ISA_conf(cap, brd);
2814 if (retval <= 0) {
2815 brd->info = NULL;
2816 continue;
2817 }
2818 2806
2819 printk(KERN_INFO "mxser: found MOXA %s board " 2807 printk(KERN_INFO "mxser: found MOXA %s board (CAP=0x%lx)\n",
2820 "(CAP=0x%x)\n", brd->info->name, ioaddr[b]); 2808 brd->info->name, ioaddr[b]);
2821 2809
2822 /* mxser_initbrd will hook ISR. */ 2810 /* mxser_initbrd will hook ISR. */
2823 if (mxser_initbrd(brd, NULL) < 0) { 2811 if (mxser_initbrd(brd, NULL) < 0) {
2824 brd->info = NULL; 2812 brd->info = NULL;
2825 continue; 2813 continue;
2826 } 2814 }
2827 2815
2828 brd->idx = m * MXSER_PORTS_PER_BOARD; 2816 brd->idx = m * MXSER_PORTS_PER_BOARD;
2829 for (i = 0; i < brd->info->nports; i++) 2817 for (i = 0; i < brd->info->nports; i++)
2830 tty_register_device(mxvar_sdriver, brd->idx + i, 2818 tty_register_device(mxvar_sdriver, brd->idx + i, NULL);
2831 NULL);
2832 2819
2833 m++; 2820 m++;
2834 } 2821 }
2835 2822
2836 retval = pci_register_driver(&mxser_driver); 2823 retval = pci_register_driver(&mxser_driver);
2837 if (retval) { 2824 if (retval) {