]> err.no Git - linux-2.6/commitdiff
[ALSA] Fix schedule_timeout usage
authorNishanth Aravamudan <nacc@us.ibm.com>
Mon, 24 Oct 2005 13:02:37 +0000 (15:02 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 4 Nov 2005 12:19:49 +0000 (13:19 +0100)
Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.  Also use
human-time conversion functions instead of hard-coded division to avoid
rounding issues.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
28 files changed:
sound/core/seq/seq_instr.c
sound/core/seq/seq_lock.c
sound/core/seq/seq_memory.c
sound/i2c/cs8427.c
sound/isa/ad1848/ad1848_lib.c
sound/isa/gus/gus_pcm.c
sound/isa/sb/emu8000.c
sound/isa/sb/emu8000_patch.c
sound/isa/sb/emu8000_pcm.c
sound/isa/sscape.c
sound/isa/wavefront/wavefront_synth.c
sound/pci/ac97/ac97_codec.c
sound/pci/ali5451/ali5451.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/cs4281.c
sound/pci/ens1370.c
sound/pci/fm801.c
sound/pci/ice1712/pontis.c
sound/pci/intel8x0.c
sound/pci/intel8x0m.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/trident/trident_main.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c
sound/pci/ymfpci/ymfpci_main.c
sound/usb/usbaudio.c

index 019d43a462d7ade1e8094189094a9b4c1bb0c8c2..1d525b13ebb673a2a1bbf127dce7e586054a48c8 100644 (file)
@@ -109,8 +109,7 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
                        spin_lock_irqsave(&list->lock, flags);
                        while (instr->use) {
                                spin_unlock_irqrestore(&list->lock, flags);
-                               set_current_state(TASK_INTERRUPTIBLE);
-                               schedule_timeout(1);
+                               schedule_timeout_interruptible(1);
                                spin_lock_irqsave(&list->lock, flags);
                        }                               
                        spin_unlock_irqrestore(&list->lock, flags);
@@ -199,10 +198,8 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
                while (flist) {
                        instr = flist;
                        flist = instr->next;
-                       while (instr->use) {
-                               set_current_state(TASK_INTERRUPTIBLE);
-                               schedule_timeout(1);
-                       }                               
+                       while (instr->use)
+                               schedule_timeout_interruptible(1);
                        if (snd_seq_instr_free(instr, atomic)<0)
                                snd_printk(KERN_WARNING "instrument free problem\n");
                        instr = next;
@@ -554,8 +551,7 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
                        instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
                while (instr->use) {
                        spin_unlock_irqrestore(&list->lock, flags);
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_interruptible(1);
                        spin_lock_irqsave(&list->lock, flags);
                }                               
                spin_unlock_irqrestore(&list->lock, flags);
index b09cee058fa7bac3e2ff705a36ef53872d237338..a837a94b2d2a816e7fce833e74115b1f59fcf4da 100644 (file)
@@ -39,8 +39,7 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
                        snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line);
                        break;
                }
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
                max_count--;
        }
 }
index d4d7d326c4b150af1fc4589d1a4794cf9fdf2d20..8416bcffa0914f4b12fc8541d42ee6bcd6838064 100644 (file)
@@ -423,8 +423,7 @@ int snd_seq_pool_done(pool_t *pool)
                        snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
                        break;
                }
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
                max_count--;
        }
        
index 21133eb6e8812c6f691435159f2290680caa4263..1a05cfbdc7c6ec96fb876f8e5e92d5032828f141 100644 (file)
@@ -302,8 +302,7 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
                snd_i2c_unlock(cs8427->bus);
                if (!(data & CS8427_UNLOCK))
                        break;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        }
        snd_i2c_lock(cs8427->bus);
        chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK;
index 744b65a35c9ccfb80d8151fd45bf948d4cff2421..891bacc94f68cc0e6da6fe943c9cf779a7f6aed3 100644 (file)
@@ -243,8 +243,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
                        snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n");
                        return;
                }
-               set_current_state(TASK_INTERRUPTIBLE);
-               time = schedule_timeout(time);
+               time = schedule_timeout_interruptible(time);
                spin_lock_irqsave(&chip->reg_lock, flags);
        }
 #if 0
@@ -257,8 +256,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
                        snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
                        return;
                }
-               set_current_state(TASK_INTERRUPTIBLE);
-               time = schedule_timeout(time);
+               time = schedule_timeout_interruptible(time);
                spin_lock_irqsave(&chip->reg_lock, flags);
        }
        spin_unlock_irqrestore(&chip->reg_lock, flags);
index 720c0739c3a577b6262c8c719965657dc0762863..1cc89fb67bf29419fb67cfd088c0b36b22cc70d9 100644 (file)
@@ -333,8 +333,7 @@ static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf,
                        }
                }
                if (count > 0 && !in_interrupt()) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_interruptible(1);
                        if (signal_pending(current))
                                return -EAGAIN;
                }
index 95540f1331995dbfa4f71ae2b2b6443abf8efac6..b09c6575e01ae4dbc2975506d0927e17b3779369 100644 (file)
@@ -135,8 +135,7 @@ static void __init
 snd_emu8000_read_wait(emu8000_t *emu)
 {
        while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
                if (signal_pending(current))
                        break;
        }
@@ -148,8 +147,7 @@ static void __init
 snd_emu8000_write_wait(emu8000_t *emu)
 {
        while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
                if (signal_pending(current))
                        break;
        }
@@ -437,8 +435,7 @@ size_dram(emu8000_t *emu)
        for (i = 0; i < 10000; i++) {
                if ((EMU8000_SMALW_READ(emu) & 0x80000000) == 0)
                        break;
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
                if (signal_pending(current))
                        break;
        }
index 26e693078cb3a1231e56874f5f9bcb7960884984..2fea67e71c78294dc987a87a2e7f2f26f56469d6 100644 (file)
@@ -109,8 +109,7 @@ static void
 snd_emu8000_write_wait(emu8000_t *emu)
 {
        while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
                if (signal_pending(current))
                        break;
        }
index 0209790dc4b5dafdf4b92fbabec323956652aacf..b323beeeda156b8e9448fedcc161d5348c5b56ac 100644 (file)
@@ -117,8 +117,7 @@ snd_emu8000_write_wait(emu8000_t *emu, int can_schedule)
 {
        while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
                if (can_schedule) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_interruptible(1);
                        if (signal_pending(current))
                                break;
                }
index 1036876146c4e9c8460b3d1554a2055f5ebdcbc6..11588067fa4fe6218ea990a615eb74af7b85f6d1 100644 (file)
@@ -342,19 +342,6 @@ static void soundscape_free(snd_card_t * c)
        free_dma(sscape->chip->dma1);
 }
 
-/*
- * Put this process into an idle wait-state for a certain number
- * of "jiffies". The process can almost certainly be rescheduled
- * while we're waiting, and so we must NOT be holding any spinlocks
- * when we call this function. If we are then we risk DEADLOCK in
- * SMP (Ha!) or pre-emptible kernels.
- */
-static inline void sleep(long jiffs, int state)
-{
-       set_current_state(state);
-       schedule_timeout(jiffs);
-}
-
 /*
  * Tell the SoundScape to begin a DMA tranfer using the given channel.
  * All locking issues are left to the caller.
@@ -392,7 +379,7 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout)
                unsigned long flags;
                unsigned char x;
 
-               sleep(1, TASK_INTERRUPTIBLE);
+               schedule_timeout_interruptible(1);
 
                spin_lock_irqsave(&s->lock, flags);
                x = inb(HOST_DATA_IO(s->io_base));
@@ -419,7 +406,7 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout)
                unsigned long flags;
                unsigned char x;
 
-               sleep(1, TASK_INTERRUPTIBLE);
+               schedule_timeout_interruptible(1);
 
                spin_lock_irqsave(&s->lock, flags);
                x = inb(HOST_DATA_IO(s->io_base));
index 0c3c951009d85682de4a82f74c75b380032c77e6..abd79b781412c9be99d7973b84110f440c134780 100644 (file)
@@ -275,8 +275,7 @@ static int
 wavefront_sleep (int limit)
 
 {
-       set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(limit);
+       schedule_timeout_interruptible(limit);
 
        return signal_pending(current);
 }
@@ -1788,8 +1787,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev,
        outb (val,port);
        spin_unlock_irq(&dev->irq_lock);
        while (1) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               if ((timeout = schedule_timeout(timeout)) == 0)
+               if ((timeout = schedule_timeout_interruptible(timeout)) == 0)
                        return;
                if (dev->irq_ok)
                        return;
index bbc409ae7ee905c9377c80336784b595c45cb7d7..3b589104510b1e0aa4115a1e5576b5024280a529 100644 (file)
@@ -1745,8 +1745,7 @@ static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem)
                        if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05)
                                return 0;
                }
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_after_eq(end_time, jiffies));
        return -ENODEV;
 }
@@ -1992,8 +1991,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
                do {
                        if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f)
                                goto __ready_ok;
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
                snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num);
        }
@@ -2025,8 +2023,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
                do {
                        if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp)
                                goto __ready_ok;
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
                snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
        }
@@ -2260,8 +2257,7 @@ void snd_ac97_resume(ac97_t *ac97)
                do {
                        if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
                                break;
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
                /* FIXME: extra delay */
                ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000);
@@ -2273,8 +2269,7 @@ void snd_ac97_resume(ac97_t *ac97)
                        unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID);
                        if (val != 0xffff && (val & 1) != 0)
                                break;
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
        }
 __reset_ready:
index e33653439cb50fa763aabd24c53db27f6df43cca..4e76c4a636d93e9de0d6116fd3d4fde9edd72077 100644 (file)
@@ -398,10 +398,8 @@ static int snd_ali_codec_ready(    ali_t *codec,
                res = snd_ali_5451_peek(codec,port);
                if (! (res & 0x8000))
                        return 0;
-               if (sched) {
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
-               }
+               if (sched)
+                       schedule_timeout_uninterruptible(1);
        } while (time_after_eq(end_time, jiffies));
        snd_ali_5451_poke(codec, port, res & ~0x8000);
        snd_printdd("ali_codec_ready: codec is not ready.\n ");
@@ -421,10 +419,8 @@ static int snd_ali_stimer_ready(ali_t *codec, int sched)
                dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
                if (dwChk2 != dwChk1)
                        return 0;
-               if (sched) {
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
-               }
+               if (sched)
+                       schedule_timeout_uninterruptible(1);
        } while (time_after_eq(end_time, jiffies));
        snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n");
        return -EIO;
index a9314363abd81ef98f73fde3b464af14165e10ea..f5dad9248e3999b8a69290391e9a6c3845d33975 100644 (file)
@@ -330,8 +330,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
 
 /* delay for one tick */
 #define do_delay() do { \
-       set_current_state(TASK_UNINTERRUPTIBLE); \
-       schedule_timeout(1); \
+       schedule_timeout_uninterruptible(1); \
 } while (0)
 
 
index 210eb676945c0dbff0e76a1c0a05c3044f1a9410..0cf2020795718e358ce79f5baa6d91a1ddbf1f98 100644 (file)
@@ -307,8 +307,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
 
 /* delay for one tick */
 #define do_delay() do { \
-       set_current_state(TASK_UNINTERRUPTIBLE); \
-       schedule_timeout(1); \
+       schedule_timeout_uninterruptible(1); \
 } while (0)
 
 
index dc87e0144b5adc7fe5b1b452f33e62cf9fbde246..aea2c47712f91068033f13d5e70b3db5f6fcfe36 100644 (file)
@@ -523,8 +523,7 @@ static void snd_cs4281_delay(unsigned int delay)
                        delay = 1;
                end_time = jiffies + delay;
                do {
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
        } else {
                udelay(delay);
@@ -533,8 +532,7 @@ static void snd_cs4281_delay(unsigned int delay)
 
 static inline void snd_cs4281_delay_long(void)
 {
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(1);
+       schedule_timeout_uninterruptible(1);
 }
 
 static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val)
index b4d0a9c2b0b591a8430c7be6792791b0f60515bc..92ff7c510f2b8453705c5eefccdcbef454e7a3c2 100644 (file)
@@ -576,8 +576,7 @@ static void snd_es1370_codec_write(ak4531_t *ak4531,
                        outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
                        return;
                }
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_after(end_time, jiffies));
        snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS)));
 }
index 47dbe317069f7ce1b36cddae3b9049869b81a4de..4c7c8d225c7f69825e77b9261675eddd5208b416 100644 (file)
@@ -1303,8 +1303,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
        do {
                if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8))
                        goto __ac97_secondary;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_after(timeout, jiffies));
        snd_printk(KERN_ERR "Primary AC'97 codec not found\n");
        snd_fm801_free(chip);
@@ -1329,8 +1328,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
                                        goto __ac97_ok;
                                }
                        }
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after(timeout, jiffies));
        }
 
@@ -1343,8 +1341,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
        do {
                if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8))
                        goto __ac97_ok;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_after(timeout, jiffies));
        snd_printk(KERN_ERR "Primary AC'97 codec not responding\n");
        snd_fm801_free(chip);
index a5f852b1f575b81d4f14b68e1d63153cef27fbda..773a1ecb75ceecac6612b85d1bb9e2a2988b49a4 100644 (file)
@@ -794,8 +794,7 @@ static int __devinit pontis_init(ice1712_t *ice)
        /* initialize WM8776 codec */
        for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
                wm_put(ice, wm_inits[i], wm_inits[i+1]);
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(1);
+       schedule_timeout_uninterruptible(1);
        for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2)
                wm_put(ice, wm_inits2[i], wm_inits2[i+1]);
 
index 383a3ac5ecba77ed3f5b0b4e7ff6f3a28aacef1a..c2f05021532176f1538c34f64ed602a256e215ee 100644 (file)
@@ -2144,8 +2144,7 @@ static void do_ali_reset(intel8x0_t *chip)
 }
 
 #define do_delay(chip) do {\
-       set_current_state(TASK_UNINTERRUPTIBLE);\
-       schedule_timeout(1);\
+       schedule_timeout_uninterruptible(1);\
 } while (0)
 
 static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
index 49a9f4d08963921c474b29bfb4d4e4564ba486c2..acfb197a833cddc9a17f14f4d80ed71e87e94725 100644 (file)
@@ -890,8 +890,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
  */
 
 #define do_delay(chip) do {\
-       set_current_state(TASK_UNINTERRUPTIBLE);\
-       schedule_timeout(1);\
+       schedule_timeout_uninterruptible(1);\
 } while (0)
 
 static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
index ad77b4145824500433ea4d38391d2c215e106007..99eb76c56f81059e6b0709c598108d5c9e18d7d1 100644 (file)
@@ -2046,8 +2046,7 @@ static void snd_m3_ac97_reset(m3_t *chip)
                outw(0, io + GPIO_DATA);
                outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION);
 
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout((delay1 * HZ) / 1000);
+               schedule_timeout_uninterruptible(msecs_to_jiffies(delay1));
 
                outw(GPO_PRIMARY_AC97, io + GPIO_DATA);
                udelay(5);
@@ -2055,8 +2054,7 @@ static void snd_m3_ac97_reset(m3_t *chip)
                outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A);
                outw(~0, io + GPIO_MASK);
 
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout((delay2 * HZ) / 1000);
+               schedule_timeout_uninterruptible(msecs_to_jiffies(delay2));
 
                if (! snd_m3_try_read_vendor(chip))
                        break;
@@ -2101,8 +2099,7 @@ static int __devinit snd_m3_mixer(m3_t *chip)
 
        /* seems ac97 PCM needs initialization.. hack hack.. */
        snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15);
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(HZ / 10);
+       schedule_timeout_uninterruptible(msecs_to_jiffies(100));
        snd_ac97_write(chip->ac97, AC97_PCM, 0);
 
        memset(&id, 0, sizeof(id));
index 1a62c7f6c52bb396666d8b13693a4a9c7a2cd3a3..c341c99ec783d97f97dc110c52dfabd99ed88e4a 100644 (file)
@@ -451,8 +451,7 @@ static int mixart_sync_nonblock_events(mixart_mgr_t *mgr)
                        snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n");
                        return -EBUSY;
                }
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        }
        return 0;
 }
index 08226f523eb80e1b1d277d673f57c7199a1ac263..b9b93c7faafd65d189b26274519dfa66c3e5b7c6 100644 (file)
@@ -3207,8 +3207,7 @@ static inline void snd_trident_free_gameport(trident_t *chip) { }
  */
 static inline void do_delay(trident_t *chip)
 {
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(1);
+       schedule_timeout_uninterruptible(1);
 }
 
 /*
index 9b2bea866d1b140b29dd5df975a08d59b300690a..523eace250f7c4e96ad081ea774d494b9776ec36 100644 (file)
@@ -2027,8 +2027,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
                pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
                if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
                        break;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
 
        if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -2047,8 +2046,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
                        chip->ac97_secondary = 1;
                        goto __ac97_ok2;
                }
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
        } while (time_before(jiffies, end_time));
        /* This is ok, the most of motherboards have only one codec */
 
index bc7330ace96a05e6b96e9852538c44e1f2e9fc0c..011f0fb63bf9e5b288675b77df5bbb4841039b38 100644 (file)
@@ -968,8 +968,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
                pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
                if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
                        break;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
 
        if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -987,8 +986,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
                        chip->ac97_secondary = 1;
                        goto __ac97_ok2;
                }
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_interruptible(1);
        } while (time_before(jiffies, end_time));
        /* This is ok, the most of motherboards have only one codec */
 
index a53117733d51366546911bc18878e592a33f51df..88a43e091d77e96aa05c9d694a8ad4a02104868c 100644 (file)
@@ -92,7 +92,7 @@ static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary)
                if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
                        return 0;
                set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
        snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
        return -EBUSY;
@@ -728,8 +728,7 @@ static void snd_ymfpci_irq_wait(ymfpci_t *chip)
                init_waitqueue_entry(&wait, current);
                add_wait_queue(&chip->interrupt_sleep, &wait);
                atomic_inc(&chip->interrupt_sleep_count);
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ/20);
+               schedule_timeout_uninterruptible(msecs_to_jiffies(50));
                remove_wait_queue(&chip->interrupt_sleep, &wait);
        }
 }
index fce6ad62df6cd87d6c069c6747de469566db1e85..8818918c4237039a6aa6eaa1d1017816394d5397 100644 (file)
@@ -838,8 +838,7 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
                }
                if (! alive)
                        break;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
        if (alive)
                snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive);