patch-2.1.88 linux/drivers/sound/cs4232.c
Next file: linux/drivers/sound/dev_table.c
Previous file: linux/drivers/sound/audio.c
Back to the patch index
Back to the overall index
- Lines: 107
- Date:
Thu Feb 19 14:46:14 1998
- Orig file:
v2.1.87/linux/drivers/sound/cs4232.c
- Orig date:
Tue Jan 20 16:44:57 1998
diff -u --recursive --new-file v2.1.87/linux/drivers/sound/cs4232.c linux/drivers/sound/cs4232.c
@@ -67,17 +67,19 @@
0x09, 0x84, 0x42, 0xa1, 0xd0, 0x68, 0x34, 0x1a
};
+static void sleep(unsigned howlong)
+{
+ current->state = TASK_INTERRUPTIBLE;
+ current->timeout = jiffies + howlong;
+ schedule();
+ current->timeout = 0;
+}
+
int probe_cs4232(struct address_info *hw_config)
{
int i, n;
int base = hw_config->io_base, irq = hw_config->irq;
int dma1 = hw_config->dma, dma2 = hw_config->dma2;
- unsigned long tlimit;
-
- static struct wait_queue *cs_sleeper = NULL;
- static volatile struct snd_wait cs_sleep_flag = {
- 0
- };
/*
* Verify that the I/O port range is free.
@@ -104,9 +106,7 @@
* first time.
*/
- for (n = 0; n < 4; n++)
- {
- cs_sleep_flag.opts = WK_NONE;
+ for (n = 0; n < 4; n++) {
/*
* Wake up the card by sending a 32 byte Crystal key to the key port.
@@ -115,15 +115,7 @@
for (i = 0; i < 32; i++)
CS_OUT(crystal_key[i]);
- current->timeout = tlimit = jiffies + (HZ / 10);
- cs_sleep_flag.opts = WK_SLEEP;
- interruptible_sleep_on(&cs_sleeper);
- if (!(cs_sleep_flag.opts & WK_WAKEUP))
- {
- if (jiffies >= tlimit)
- cs_sleep_flag.opts |= WK_TIMEOUT;
- }
- cs_sleep_flag.opts &= ~WK_SLEEP;
+ sleep(HZ / 10);
/*
* Now set the CSN (Card Select Number).
@@ -154,15 +146,7 @@
CS_OUT2(0x33, 0x01); /* Activate logical dev 0 */
- current->timeout = tlimit = jiffies + (HZ / 10);
- cs_sleep_flag.opts = WK_SLEEP;
- interruptible_sleep_on(&cs_sleeper);
- if (!(cs_sleep_flag.opts & WK_WAKEUP))
- {
- if (jiffies >= tlimit)
- cs_sleep_flag.opts |= WK_TIMEOUT;
- }
- cs_sleep_flag.opts &= ~WK_SLEEP;
+ sleep(HZ / 10);
/*
* Initialize logical device 3 (MPU)
@@ -184,15 +168,7 @@
CS_OUT(0x79);
- current->timeout = tlimit = jiffies + (HZ / 5);
- cs_sleep_flag.opts = WK_SLEEP;
- interruptible_sleep_on(&cs_sleeper);
- if (!(cs_sleep_flag.opts & WK_WAKEUP))
- {
- if (jiffies >= tlimit)
- cs_sleep_flag.opts |= WK_TIMEOUT;
- }
- cs_sleep_flag.opts &= ~WK_SLEEP;
+ sleep(HZ / 5);
/*
* Then try to detect the codec part of the chip
@@ -200,16 +176,8 @@
if (ad1848_detect(hw_config->io_base, NULL, hw_config->osp))
return 1;
-
- current->timeout = tlimit = jiffies + (HZ);
- cs_sleep_flag.opts = WK_SLEEP;
- interruptible_sleep_on(&cs_sleeper);
- if (!(cs_sleep_flag.opts & WK_WAKEUP))
- {
- if (jiffies >= tlimit)
- cs_sleep_flag.opts |= WK_TIMEOUT;
- }
- cs_sleep_flag.opts &= ~WK_SLEEP;
+
+ sleep(HZ);
}
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov