Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / isdn / sc / init.c
index 930845c..62b7acf 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/delay.h>
 #include "includes.h"
 #include "hardware.h"
 #include "card.h"
 MODULE_DESCRIPTION("ISDN4Linux: Driver for Spellcaster card");
 MODULE_AUTHOR("Spellcaster Telecommunications Inc.");
 MODULE_LICENSE("GPL");
-MODULE_PARM( io, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(ram, "1-" __MODULE_STRING(MAX_CARDS) "i");
-MODULE_PARM(do_reset, "i");
 
 board *sc_adapter[MAX_CARDS];
 int cinst;
 
 static char devname[] = "scX";
-const char version[] = "2.0b1";
+static const char version[] = "2.0b1";
 
-const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" };
+static const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" };
 
 /* insmod set parameters */
 static unsigned int io[] = {0,0,0,0};
@@ -33,8 +30,10 @@ static unsigned char irq[] = {0,0,0,0};
 static unsigned long ram[] = {0,0,0,0};
 static int do_reset = 0;
 
-static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 };
-#define MAX_IRQS       10
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(ram, int, NULL, 0);
+module_param(do_reset, bool, 0);
 
 extern irqreturn_t interrupt_handler(int, void *, struct pt_regs *);
 extern int sndpkt(int, int, int, struct sk_buff *);
@@ -42,17 +41,7 @@ extern int command(isdn_ctrl *);
 extern int indicate_status(int, int, ulong, char*);
 extern int reset(int);
 
-int identify_board(unsigned long, unsigned int);
-
-int irq_supported(int irq_x)
-{
-       int i;
-       for(i=0 ; i < MAX_IRQS ; i++) {
-               if(sup_irq[i] == irq_x)
-                       return 1;
-       }
-       return 0;
-}
+static int identify_board(unsigned long, unsigned int);
 
 static int __init sc_init(void)
 {
@@ -98,7 +87,7 @@ static int __init sc_init(void)
                         */
                        for (i = 0 ; i < MAX_IO_REGS - 1 ; i++) {
                                if(!request_region(io[b] + i * 0x400, 1, "sc test")) {
-                                       pr_debug("check_region for 0x%x failed\n", io[b] + i * 0x400);
+                                       pr_debug("request_region for 0x%x failed\n", io[b] + i * 0x400);
                                        io[b] = 0;
                                        break;
                                } else
@@ -167,8 +156,7 @@ static int __init sc_init(void)
                if(do_reset) {
                        pr_debug("Doing a SAFE probe reset\n");
                        outb(0xFF, io[b] + RESET_OFFSET);
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(milliseconds(10000));
+                       msleep_interruptible(10000);
                }
                pr_debug("RAM Base for board %d is 0x%x, %s probe\n", b, ram[b],
                        ram[b] == 0 ? "will" : "won't");
@@ -193,7 +181,7 @@ static int __init sc_init(void)
                        for (i = SRAM_MIN ; i < SRAM_MAX ; i += SRAM_PAGESIZE) {
                                pr_debug("Checking RAM address 0x%x...\n", i);
                                if(request_region(i, SRAM_PAGESIZE, "sc test")) {
-                                       pr_debug("  check_region succeeded\n");
+                                       pr_debug("  request_region succeeded\n");
                                        model = identify_board(i, io[b]);
                                        release_region(i, SRAM_PAGESIZE);
                                        if (model >= 0) {
@@ -453,7 +441,7 @@ static void __exit sc_exit(void)
        pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n");
 }
 
-int identify_board(unsigned long rambase, unsigned int iobase) 
+static int identify_board(unsigned long rambase, unsigned int iobase)
 {
        unsigned int pgport;
        unsigned long sig;
@@ -500,8 +488,7 @@ int identify_board(unsigned long rambase, unsigned int iobase)
         * Try to identify a PRI card
         */
        outb(PRI_BASEPG_VAL, pgport);
-       set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(HZ);
+       msleep_interruptible(1000);
        sig = readl(rambase + SIG_OFFSET);
        pr_debug("Looking for a signature, got 0x%x\n", sig);
        if(sig == SIGNATURE)
@@ -511,8 +498,7 @@ int identify_board(unsigned long rambase, unsigned int iobase)
         * Try to identify a PRI card
         */
        outb(BRI_BASEPG_VAL, pgport);
-       set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(HZ);
+       msleep_interruptible(1000);
        sig = readl(rambase + SIG_OFFSET);
        pr_debug("Looking for a signature, got 0x%x\n", sig);
        if(sig == SIGNATURE)
@@ -543,8 +529,7 @@ int identify_board(unsigned long rambase, unsigned int iobase)
         */
        x = 0;
        while((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
                x++;
        }
        if(x == 100) {