Commit 954bea35 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] intel8x0 - Clean up delay function

Modules: Intel8x0 driver,Intel8x0-modem driver

Remove superfluous delay macro.
Call appropriate functions directly.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c9a49bb1
...@@ -2149,10 +2149,6 @@ static void do_ali_reset(intel8x0_t *chip) ...@@ -2149,10 +2149,6 @@ static void do_ali_reset(intel8x0_t *chip)
iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000);
} }
#define do_delay(chip) do {\
schedule_timeout_uninterruptible(1);\
} while (0)
static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
{ {
unsigned long end_time; unsigned long end_time;
...@@ -2176,7 +2172,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -2176,7 +2172,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
do { do {
if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0)
goto __ok; goto __ok;
do_delay(chip); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT)));
return -EIO; return -EIO;
...@@ -2192,7 +2188,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -2192,7 +2188,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
status = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR); status = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR);
if (status) if (status)
break; break;
do_delay(chip); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
if (! status) { if (! status) {
/* no codec is found */ /* no codec is found */
...@@ -2210,7 +2206,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -2210,7 +2206,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
/* wait for other codecs ready status. */ /* wait for other codecs ready status. */
end_time = jiffies + HZ / 4; end_time = jiffies + HZ / 4;
while (status != nstatus && time_after_eq(end_time, jiffies)) { while (status != nstatus && time_after_eq(end_time, jiffies)) {
do_delay(chip); schedule_timeout_uninterruptible(1);
status |= igetdword(chip, ICHREG(GLOB_STA)) & nstatus; status |= igetdword(chip, ICHREG(GLOB_STA)) & nstatus;
} }
...@@ -2227,7 +2223,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -2227,7 +2223,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing)
nstatus = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR); nstatus = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR);
if (status == nstatus) if (status == nstatus)
break; break;
do_delay(chip); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
} }
...@@ -2261,7 +2257,7 @@ static int snd_intel8x0_ali_chip_init(intel8x0_t *chip, int probing) ...@@ -2261,7 +2257,7 @@ static int snd_intel8x0_ali_chip_init(intel8x0_t *chip, int probing)
for (i = 0; i < HZ / 2; i++) { for (i = 0; i < HZ / 2; i++) {
if (! (igetdword(chip, ICHREG(ALI_INTERRUPTSR)) & ALI_INT_GPIO)) if (! (igetdword(chip, ICHREG(ALI_INTERRUPTSR)) & ALI_INT_GPIO))
goto __ok; goto __ok;
do_delay(chip); schedule_timeout_uninterruptible(1);
} }
snd_printk(KERN_ERR "AC'97 reset failed.\n"); snd_printk(KERN_ERR "AC'97 reset failed.\n");
if (probing) if (probing)
...@@ -2273,7 +2269,7 @@ static int snd_intel8x0_ali_chip_init(intel8x0_t *chip, int probing) ...@@ -2273,7 +2269,7 @@ static int snd_intel8x0_ali_chip_init(intel8x0_t *chip, int probing)
if (reg & 0x80) /* primary codec */ if (reg & 0x80) /* primary codec */
break; break;
iputdword(chip, ICHREG(ALI_RTSR), reg | 0x80); iputdword(chip, ICHREG(ALI_RTSR), reg | 0x80);
do_delay(chip); schedule_timeout_uninterruptible(1);
} }
do_ali_reset(chip); do_ali_reset(chip);
......
...@@ -889,10 +889,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) ...@@ -889,10 +889,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
* *
*/ */
#define do_delay(chip) do {\
schedule_timeout_uninterruptible(1);\
} while (0)
static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
{ {
unsigned long end_time; unsigned long end_time;
...@@ -914,7 +910,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -914,7 +910,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
do { do {
if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0)
goto __ok; goto __ok;
do_delay(chip); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT)));
return -EIO; return -EIO;
...@@ -930,7 +926,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -930,7 +926,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
status = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR); status = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR);
if (status) if (status)
break; break;
do_delay(chip); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
if (! status) { if (! status) {
/* no codec is found */ /* no codec is found */
...@@ -944,7 +940,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -944,7 +940,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
/* wait for other codecs ready status. */ /* wait for other codecs ready status. */
end_time = jiffies + HZ / 4; end_time = jiffies + HZ / 4;
while (status != nstatus && time_after_eq(end_time, jiffies)) { while (status != nstatus && time_after_eq(end_time, jiffies)) {
do_delay(chip); schedule_timeout_uninterruptible(1);
status |= igetdword(chip, ICHREG(GLOB_STA)) & nstatus; status |= igetdword(chip, ICHREG(GLOB_STA)) & nstatus;
} }
...@@ -959,7 +955,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) ...@@ -959,7 +955,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
nstatus = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR); nstatus = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR);
if (status == nstatus) if (status == nstatus)
break; break;
do_delay(chip); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment