diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:38:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:54 -0500 |
commit | eae4436a4e513f5f912dcc5dac79038f22fb6403 (patch) | |
tree | 32f06f9f85f82446cd2e62df6542b2c2e54c115b /drivers/char/mxser_new.c | |
parent | ead568c9cdab2592abdbd1f023931665cc24b5db (diff) |
[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: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/mxser_new.c')
-rw-r--r-- | drivers/char/mxser_new.c | 109 |
1 files changed, 40 insertions, 69 deletions
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 47af0bba5240..27871e503d80 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c | |||
@@ -2803,7 +2803,8 @@ static int __init mxser_module_init(void) | |||
2803 | { | 2803 | { |
2804 | struct pci_dev *pdev = NULL; | 2804 | struct pci_dev *pdev = NULL; |
2805 | struct mxser_board *brd; | 2805 | struct mxser_board *brd; |
2806 | unsigned int i, m; | 2806 | unsigned long cap; |
2807 | unsigned int i, m, isaloop; | ||
2807 | int retval, b, n; | 2808 | int retval, b, n; |
2808 | 2809 | ||
2809 | pr_debug("Loading module mxser ...\n"); | 2810 | pr_debug("Loading module mxser ...\n"); |
@@ -2839,84 +2840,54 @@ static int __init mxser_module_init(void) | |||
2839 | 2840 | ||
2840 | m = 0; | 2841 | m = 0; |
2841 | /* Start finding ISA boards here */ | 2842 | /* Start finding ISA boards here */ |
2842 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { | 2843 | for (isaloop = 0; isaloop < 2; isaloop++) |
2843 | int cap; | 2844 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { |
2844 | 2845 | if (!isaloop) | |
2845 | if (!(cap = mxserBoardCAP[b])) | 2846 | cap = mxserBoardCAP[b]; /* predefined */ |
2846 | continue; | 2847 | else |
2847 | 2848 | cap = ioaddr[b]; /* module param */ | |
2848 | brd = &mxser_boards[m]; | ||
2849 | retval = mxser_get_ISA_conf(cap, brd); | ||
2850 | |||
2851 | if (retval != 0) | ||
2852 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", | ||
2853 | mxser_brdname[brd->board_type - 1], ioaddr[b]); | ||
2854 | |||
2855 | if (retval <= 0) { | ||
2856 | if (retval == MXSER_ERR_IRQ) | ||
2857 | printk(KERN_ERR "Invalid interrupt number, " | ||
2858 | "board not configured\n"); | ||
2859 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | ||
2860 | printk(KERN_ERR "Invalid interrupt number, " | ||
2861 | "board not configured\n"); | ||
2862 | else if (retval == MXSER_ERR_VECTOR) | ||
2863 | printk(KERN_ERR "Invalid interrupt vector, " | ||
2864 | "board not configured\n"); | ||
2865 | else if (retval == MXSER_ERR_IOADDR) | ||
2866 | printk(KERN_ERR "Invalid I/O address, " | ||
2867 | "board not configured\n"); | ||
2868 | 2849 | ||
2869 | continue; | 2850 | if (!cap) |
2870 | } | 2851 | continue; |
2871 | 2852 | ||
2872 | brd->pdev = NULL; | 2853 | brd = &mxser_boards[m]; |
2854 | retval = mxser_get_ISA_conf(cap, brd); | ||
2873 | 2855 | ||
2874 | /* mxser_initbrd will hook ISR. */ | 2856 | if (retval != 0) |
2875 | if (mxser_initbrd(brd) < 0) | 2857 | printk(KERN_INFO "Found MOXA %s board " |
2876 | continue; | 2858 | "(CAP=0x%x)\n", |
2859 | mxser_brdname[brd->board_type - 1], | ||
2860 | ioaddr[b]); | ||
2877 | 2861 | ||
2878 | m++; | 2862 | if (retval <= 0) { |
2879 | } | 2863 | if (retval == MXSER_ERR_IRQ) |
2864 | printk(KERN_ERR "Invalid interrupt " | ||
2865 | "number, board not " | ||
2866 | "configured\n"); | ||
2867 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | ||
2868 | printk(KERN_ERR "Invalid interrupt " | ||
2869 | "number, board not " | ||
2870 | "configured\n"); | ||
2871 | else if (retval == MXSER_ERR_VECTOR) | ||
2872 | printk(KERN_ERR "Invalid interrupt " | ||
2873 | "vector, board not " | ||
2874 | "configured\n"); | ||
2875 | else if (retval == MXSER_ERR_IOADDR) | ||
2876 | printk(KERN_ERR "Invalid I/O address, " | ||
2877 | "board not configured\n"); | ||
2880 | 2878 | ||
2881 | /* Start finding ISA boards from module arg */ | 2879 | continue; |
2882 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { | 2880 | } |
2883 | unsigned long cap; | ||
2884 | 2881 | ||
2885 | if (!(cap = ioaddr[b])) | 2882 | brd->pdev = NULL; |
2886 | continue; | ||
2887 | 2883 | ||
2888 | brd = &mxser_boards[m]; | 2884 | /* mxser_initbrd will hook ISR. */ |
2889 | retval = mxser_get_ISA_conf(cap, &mxser_boards[m]); | 2885 | if (mxser_initbrd(brd) < 0) |
2890 | 2886 | continue; | |
2891 | if (retval != 0) | ||
2892 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", | ||
2893 | mxser_brdname[brd->board_type - 1], ioaddr[b]); | ||
2894 | |||
2895 | if (retval <= 0) { | ||
2896 | if (retval == MXSER_ERR_IRQ) | ||
2897 | printk(KERN_ERR "Invalid interrupt number, " | ||
2898 | "board not configured\n"); | ||
2899 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | ||
2900 | printk(KERN_ERR "Invalid interrupt number, " | ||
2901 | "board not configured\n"); | ||
2902 | else if (retval == MXSER_ERR_VECTOR) | ||
2903 | printk(KERN_ERR "Invalid interrupt vector, " | ||
2904 | "board not configured\n"); | ||
2905 | else if (retval == MXSER_ERR_IOADDR) | ||
2906 | printk(KERN_ERR "Invalid I/O address, " | ||
2907 | "board not configured\n"); | ||
2908 | 2887 | ||
2909 | continue; | 2888 | m++; |
2910 | } | 2889 | } |
2911 | 2890 | ||
2912 | brd->pdev = NULL; | ||
2913 | /* mxser_initbrd will hook ISR. */ | ||
2914 | if (mxser_initbrd(brd) < 0) | ||
2915 | continue; | ||
2916 | |||
2917 | m++; | ||
2918 | } | ||
2919 | |||
2920 | /* start finding PCI board here */ | 2891 | /* start finding PCI board here */ |
2921 | n = ARRAY_SIZE(mxser_pcibrds) - 1; | 2892 | n = ARRAY_SIZE(mxser_pcibrds) - 1; |
2922 | b = 0; | 2893 | b = 0; |