]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] drivers/isdn: replace milliseconds() with msecs_to_jiffies()
authorMaximilian Attems <janitor@sternwelten.at>
Tue, 19 Oct 2004 01:23:30 +0000 (18:23 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 19 Oct 2004 01:23:30 +0000 (18:23 -0700)
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
15 files changed:
drivers/isdn/act2000/act2000_isa.c
drivers/isdn/capi/kcapi.c
drivers/isdn/hisax/config.c
drivers/isdn/hisax/elsa.c
drivers/isdn/hisax/hfc_pci.c
drivers/isdn/hisax/hfc_sx.c
drivers/isdn/hisax/hfcscard.c
drivers/isdn/hysdn/boardergo.c
drivers/isdn/hysdn/hysdn_sched.c
drivers/isdn/i4l/isdn_tty.c
drivers/isdn/icn/icn.c
drivers/isdn/isdnloop/isdnloop.c
drivers/isdn/sc/card.h
drivers/isdn/sc/hardware.h
drivers/isdn/sc/init.c

index b363d09764653b98dc197429f53303c6ebd117ca..df7923c5b843a33d4c4af95b9bf56335264837a2 100644 (file)
 
 static act2000_card *irq2card_map[16];
 
-static void
-act2000_isa_delay(long t)
-{
-        set_current_state(TASK_INTERRUPTIBLE);
-        schedule_timeout(t);
-}
-
 /*
  * Reset Controller, then try to read the Card's signature.
  + Return:
@@ -419,7 +412,7 @@ act2000_isa_download(act2000_card * card, act2000_ddef __user * cb)
 
         if (!act2000_isa_reset(card->port))
                 return -ENXIO;
-        act2000_isa_delay(HZ / 2);
+        msleep_interruptible(500);
         if(copy_from_user(&cblock, cb, sizeof(cblock)))
                return -EFAULT;
         length = cblock.length;
@@ -452,6 +445,6 @@ act2000_isa_download(act2000_card * card, act2000_ddef __user * cb)
                 p += l;
         }
         kfree(buf);
-        act2000_isa_delay(HZ / 2);
+        msleep_interruptible(500);
         return (act2000_isa_getid(card));
 }
index 8d58cfd45b0e4813063bbc636e58d5a7c50784eb..8cd4dde06a810a2322e3710794ef9b84dca12729 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/capi.h>
 #include <linux/kernelcapi.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <asm/uaccess.h>
 #include <linux/isdn/capicmd.h>
 #include <linux/isdn/capiutil.h>
@@ -831,8 +832,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
 
                while (card->cardstate != CARD_RUNNING) {
 
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(HZ/10);        /* 0.1 sec */
+                       msleep_interruptible(100);      /* 0.1 sec */
 
                        if (signal_pending(current)) {
                                capi_ctr_put(card);
@@ -856,8 +856,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
 
                while (card->cardstate > CARD_DETECTED) {
 
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(HZ/10);        /* 0.1 sec */
+                       msleep_interruptible(100);      /* 0.1 sec */
 
                        if (signal_pending(current))
                                return -EINTR;
index 26bb71d96b38a2c4e1e661266dbf49e5117a4745..15b80c844205d72a1ef1d27525348c572431148a 100644 (file)
@@ -843,9 +843,8 @@ static int init_card(struct IsdnCardState *cs)
        }
        while (cnt) {
                cs->cardmsg(cs, CARD_INIT, NULL);
-               set_current_state(TASK_UNINTERRUPTIBLE);
                /* Timeout 10ms */
-               schedule_timeout((10 * HZ) / 1000);
+               msleep(10);
                printk(KERN_INFO "%s: IRQ %d count %d\n",
                       CardType[cs->typ], cs->irq, kstat_irqs(cs->irq));
                if (kstat_irqs(cs->irq) == irq_cnt) {
index 3b526d704fa63951882016d4cf053cf935af98de..21271465bd2f23703a779996add17b564315d9b0 100644 (file)
@@ -691,8 +691,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
                                byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
                                byteout(cs->hw.elsa.timer, 0);
                                spin_unlock_irqrestore(&cs->lock, flags);
-                               set_current_state(TASK_UNINTERRUPTIBLE);
-                               schedule_timeout((110*HZ)/1000);
+                               msleep(110);
                                spin_lock_irqsave(&cs->lock, flags);
                                cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT;
                                byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
index 3946536d112b7dae3fec8122f2624a77c827c82c..c2db52696a86bb2350261556116877aa1fe8e06c 100644 (file)
@@ -1619,8 +1619,7 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
                        inithfcpci(cs);
                        reset_hfcpci(cs);
                        spin_unlock_irqrestore(&cs->lock, flags);
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout((80 * HZ) / 1000);     /* Timeout 80ms */
+                       msleep(80);                             /* Timeout 80ms */
                        /* now switch timer interrupt off */
                        spin_lock_irqsave(&cs->lock, flags);
                        cs->hw.hfcpci.int_m1 &= ~HFCPCI_INTS_TIMER;
index 07a07aab792b2a5fffbc60d8189efe0da4a56a92..685fcc2d7256790670ad4a64f6c46cb8f4697a49 100644 (file)
@@ -314,8 +314,7 @@ release_io_hfcsx(struct IsdnCardState *cs)
        cs->hw.hfcsx.int_m2 = 0;        /* interrupt output off ! */
        Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2);
        Write_hfc(cs, HFCSX_CIRM, HFCSX_RESET); /* Reset On */
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout((30 * HZ) / 1000);     /* Timeout 30ms */
+       msleep(30);                             /* Timeout 30ms */
        Write_hfc(cs, HFCSX_CIRM, 0);   /* Reset Off */
        del_timer(&cs->hw.hfcsx.timer);
        release_region(cs->hw.hfcsx.base, 2); /* release IO-Block */
@@ -1367,8 +1366,7 @@ hfcsx_card_msg(struct IsdnCardState *cs, int mt, void *arg)
                        spin_lock_irqsave(&cs->lock, flags);
                        inithfcsx(cs);
                        spin_unlock_irqrestore(&cs->lock, flags);
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout((80 * HZ) / 1000);     /* Timeout 80ms */
+                       msleep(80);                             /* Timeout 80ms */
                        /* now switch timer interrupt off */
                        spin_lock_irqsave(&cs->lock, flags);
                        cs->hw.hfcsx.int_m1 &= ~HFCSX_INTS_TIMER;
index ea8da997039f801517b5697ea9b9309aefc3789f..6fc55fea17029bb70428d8231a4e66662b1f931c 100644 (file)
@@ -125,8 +125,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg)
                        init2bds0(cs);
                        spin_unlock_irqrestore(&cs->lock, flags);
                        delay = (80*HZ)/1000 +1;
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout((80*HZ)/1000);
+                       msleep(80);
                        spin_lock_irqsave(&cs->lock, flags);
                        cs->hw.hfcD.ctmt |= HFCD_TIM800;
                        cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcD.ctmt); 
index 2f2731520d40365eacf5623317c665a1933d86be..e19a01a305a9f2a7d4800cc51247f63e314e0a79 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/vmalloc.h>
+#include <linux/delay.h>
 #include <asm/io.h>
 
 #include "hysdn_defs.h"
@@ -246,8 +247,7 @@ ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs)
                /* the interrupts are still masked */
 
                sti();
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout((20 * HZ) / 1000);     /* Timeout 20ms */
+               msleep_interruptible(20);               /* Timeout 20ms */
 
                if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) {
                        if (card->debug_flags & LOG_POF_CARD)
@@ -386,8 +386,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)
                        return (0);     /* success */
                }               /* data has arrived */
                sti();
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout((50 * HZ) / 1000);     /* Timeout 50ms */
+               msleep_interruptible(50);               /* Timeout 50ms */
        }                       /* wait until timeout */
 
        if (card->debug_flags & LOG_POF_CARD)
index 1a2015ecfda51af00370507d9d1d582044b1fc69..4fa3b01707cd2f72ecb7b9fbb377b224ab95b030 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
+#include <linux/delay.h>
 #include <asm/io.h>
 
 #include "hysdn_defs.h"
@@ -160,8 +161,7 @@ hysdn_tx_cfgline(hysdn_card * card, uchar * line, word chan)
                if (card->debug_flags & LOG_SCHED_ASYN)
                        hysdn_addlog(card, "async tx-cfg delayed");
 
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout((20 * HZ) / 1000);     /* Timeout 20ms */
+               msleep_interruptible(20);               /* Timeout 20ms */
                if (!--cnt) {
                        restore_flags(flags);
                        return (-ERR_ASYNC_TIME);       /* timed out */
@@ -190,8 +190,7 @@ hysdn_tx_cfgline(hysdn_card * card, uchar * line, word chan)
                if (card->debug_flags & LOG_SCHED_ASYN)
                        hysdn_addlog(card, "async tx-cfg waiting for tx-ready");
 
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout((20 * HZ) / 1000);     /* Timeout 20ms */
+               msleep_interruptible(20);               /* Timeout 20ms */
                if (!--cnt) {
                        restore_flags(flags);
                        return (-ERR_ASYNC_TIME);       /* timed out */
index 921c3c2ab97a19bcce843dbb5a93cca81ff03fee..6b6d839930f1b53bc29d50c73aadd188077ad780 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/config.h>
 #include <linux/isdn.h>
+#include <linux/delay.h>
 #include "isdn_common.h"
 #include "isdn_tty.h"
 #ifdef CONFIG_ISDN_AUDIO
@@ -1748,8 +1749,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
        tty->closing = 0;
        module_put(info->owner);
        if (info->blocked_open) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(HZ/2);
+               msleep_interruptible(500);
                wake_up_interruptible(&info->open_wait);
        }
        info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CLOSING);
index 0c256d69868695b5760544f33cd43f0474b2ae26..70989aa4c157c8207ca477c6dcd3a30e5d70f34c 100644 (file)
@@ -762,8 +762,7 @@ icn_check_loader(int cardnumber)
 #ifdef BOOT_DEBUG
                        printk(KERN_DEBUG "Loader %d TO?\n", cardnumber);
 #endif
-                       current->state = TASK_INTERRUPTIBLE;
-                       schedule_timeout(ICN_BOOT_TIMEOUT1);
+                       msleep_interruptible(ICN_BOOT_TIMEOUT1);
                } else {
 #ifdef BOOT_DEBUG
                        printk(KERN_DEBUG "Loader %d OK\n", cardnumber);
@@ -788,8 +787,7 @@ icn_check_loader(int cardnumber)
 int slsec = sec; \
   printk(KERN_DEBUG "SLEEP(%d)\n",slsec); \
   while (slsec) { \
-    current->state = TASK_INTERRUPTIBLE; \
-    schedule_timeout(HZ); \
+    msleep_interruptible(1000); \
     slsec--; \
   } \
 }
@@ -950,7 +948,7 @@ icn_loadproto(u_char __user * buffer, icn_card * card)
                                icn_maprelease_channel(card, 0);
                                return -EIO;
                        }
-                       current->state = TASK_INTERRUPTIBLE;
+                       set_current_state(TASK_INTERRUPTIBLE);
                        schedule_timeout(10);
                }
        }
@@ -974,8 +972,7 @@ icn_loadproto(u_char __user * buffer, icn_card * card)
 #ifdef BOOT_DEBUG
                        printk(KERN_DEBUG "Proto TO?\n");
 #endif
-                       current->state = TASK_INTERRUPTIBLE;
-                       schedule_timeout(ICN_BOOT_TIMEOUT1);
+                       msleep_interruptible(ICN_BOOT_TIMEOUT1);
                } else {
                        if ((card->secondhalf) || (!card->doubleS0)) {
 #ifdef BOOT_DEBUG
@@ -1271,9 +1268,9 @@ icn_command(isdn_ctrl * c, icn_card * card)
                                                if (!card->leased) {
                                                        card->leased = 1;
                                                        while (card->ptype == ISDN_PTYPE_UNKNOWN) {
-                                                               schedule_timeout(ICN_BOOT_TIMEOUT1);
+                                                               msleep_interruptible(ICN_BOOT_TIMEOUT1);
                                                        }
-                                                       schedule_timeout(ICN_BOOT_TIMEOUT1);
+                                                       msleep_interruptible(ICN_BOOT_TIMEOUT1);
                                                        sprintf(cbuf, "00;FV2ON\n01;EAZ%c\n02;EAZ%c\n",
                                                                (a & 1)?'1':'C', (a & 2)?'2':'C');
                                                        i = icn_writecmd(cbuf, strlen(cbuf), 0, card);
index 544f41b413ed98683b8f0938ad509b0555d10010..7f17ab1ac7ee0f68f5e11dae011f2f107cde2a9a 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/sched.h>
 #include "isdnloop.h"
 
 static char *revision = "$Revision: 1.11.6.7 $";
@@ -1161,8 +1162,10 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
                                                if (!card->leased) {
                                                        card->leased = 1;
                                                        while (card->ptype == ISDN_PTYPE_UNKNOWN) {
+                                                               set_current_state(TASK_INTERRUPTIBLE);
                                                                schedule_timeout(10);
                                                        }
+                                                       set_current_state(TASK_INTERRUPTIBLE);
                                                        schedule_timeout(10);
                                                        sprintf(cbuf, "00;FV2ON\n01;EAZ1\n02;EAZ2\n");
                                                        i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);
index bdb27fae6f205380987c6059949a04bcdb40d5ad..8e44928cdf1c40d74a5d035a39be96d795421bbf 100644 (file)
  * We need these if they're not already included
  */
 #include <linux/timer.h>
+#include <linux/time.h>
 #include <linux/isdnif.h>
 #include "message.h"
 
 /*
  * Amount of time to wait for a reset to complete
  */
-#define CHECKRESET_TIME                milliseconds(4000)
+#define CHECKRESET_TIME                msecs_to_jiffies(4000)
 
 /*
  * Amount of time between line status checks
  */
-#define CHECKSTAT_TIME         milliseconds(8000)
+#define CHECKSTAT_TIME         msecs_to_jiffies(8000)
 
 /*
  * The maximum amount of time to wait for a message response
  * to arrive. Use exclusively by send_and_receive
  */
-#define SAR_TIMEOUT            milliseconds(10000)
+#define SAR_TIMEOUT            msecs_to_jiffies(10000)
 
 /*
  * Macro to determine is a card id is valid
index adde8fb1466551a7258dfa9815cd796d455a4ec9..9e6d5302bf8e34f0bcb66ec1a7bb0cf77ebdb1ff 100644 (file)
  * Some handy macros
  */
 
-/* Return the number of jiffies in a given number of msecs */
-#define milliseconds(x)        (((x)*HZ)/1000)
-
 /* Determine if a channel number is valid for the adapter */
 #define IS_VALID_CHANNEL(y,x)  ((x>0) && (x <= sc_adapter[y]->channels))
 
index 930845cff800857c31a0eb102f971e22963b6d3c..a10c6af42a97d1d864534d472d7a9ef5287255ed 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"
@@ -167,8 +168,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");
@@ -500,8 +500,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 +510,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)