set_current_state usage in oss/
Subsystems (2)
PATCH 1/1 set_current_state usage in oss/
hi,
since we have a macro to set the current state,
we should use it, instead of open coding it.
sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +2 -2
@@ -531,7 +531,7 @@ static ssize_t btaudio_dsp_read(struct fbreak ; }mutex_unlock (&bta->lock); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule ();mutex_lock (&bta->lock);if (signal_pending (current)) {
@@ -608,7 +608,7 @@ static ssize_t btaudio_dsp_read(struct f }mutex_unlock (&bta->lock);remove_wait_queue (&bta->readq, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return ret; }
sound/oss/cs4232.c renamed from sound/oss/cs4232.c.orig +1 -1
@@ -98,7 +98,7 @@ static unsigned char crystal_key[] = /*static void sleep (unsigned howlong) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (howlong); }
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +7 -7
@@ -1435,7 +1435,7 @@ static int drain_dac(struct cs_state *stfor (;;) {/* It seems that we have to set the current state to TASK_INTERRUPTIBLE every time to make the process really go to sleep */ - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );spin_lock_irqsave (&state->card->lock, flags); count = dmabuf->count;
@@ -1449,7 +1449,7 @@ static int drain_dac(struct cs_state *stif (nonblock) {remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return -EBUSY ; }
@@ -1463,7 +1463,7 @@ static int drain_dac(struct cs_state *st } }remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );if (signal_pending (current)) {CS_DBGOUT (CS_FUNCTION ,4 ,printk ("cs46xx: drain_dac()- -ERESTARTSYS\n" ));/*
@@ -1834,7 +1834,7 @@ static int cs_midi_release(struct inodeunsigned count, tmo;if (file->f_mode &FMODE_WRITE ) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&card->midi.owait, &wait);for (;;) {spin_lock_irqsave (&card->midi.lock, flags);
@@ -1851,7 +1851,7 @@ static int cs_midi_release(struct inodeprintk (KERN_DEBUG "cs46xx: midi timed out??\n" ); }remove_wait_queue (&card->midi.owait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING ); }mutex_lock (&card->midi.open_mutex); card->midi.open_mode &= (~(file->f_mode & (FMODE_READ |FMODE_WRITE )));
@@ -4770,7 +4770,7 @@ static int cs_hardware_init(struct cs_ca*/ if (cs461x_peekBA0 (card,BA0_ACSTS ) &ACSTS_CRDY )break ; - current->state =TASK_UNINTERRUPTIBLE ; +__set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (1 ); }while (time_before (jiffies, end_time)); }else {
@@ -4815,7 +4815,7 @@ static int cs_hardware_init(struct cs_ca*/ if ((cs461x_peekBA0 (card,BA0_ACISV ) & (ACISV_ISV3 |ACISV_ISV4 )) = (ACISV_ISV3 |ACISV_ISV4 ))break ; - current->state =TASK_UNINTERRUPTIBLE ; +__set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (1 ); }while (time_before (jiffies, end_time)); }else {
sound/oss/emu10k1/ecard.c renamed from sound/oss/emu10k1/ecard.c.orig +1 -1
@@ -139,7 +139,7 @@ void __devinit emu10k1_ecard_init(struct/* Step 3: Wait for awhile; FIXME: Is this correct? */ - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (HZ );/* Step 4: Switch off the DAC and ADC calibration. Note
sound/oss/msnd_pinnacle.c renamed from sound/oss/msnd_pinnacle.c.orig +2 -2
@@ -671,7 +671,7 @@ static void dsp_write_flush(void) get_play_delay_jiffies(dev.DAPF.len));clear_bit (F_WRITEFLUSH , &dev.flags);if (!signal_pending (current)) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (get_play_delay_jiffies (DAP_BUFF_SIZE )); }clear_bit (F_WRITING , &dev.flags);
@@ -1277,7 +1277,7 @@ static int __init calibrate_adc(WORD sra & ~0x0001, dev.SMA + SMA_wCurrHostStatusFlags);if (msnd_send_word (&dev,0 ,0 ,HDEXAR_CAL_A_TO_D ) =0 &&chk_send_dsp_cmd (&dev,HDEX_AUX_REQ ) =0 ) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (HZ /3 );return 0 ; }
sound/oss/sscape.c renamed from sound/oss/sscape.c.orig +1 -1
@@ -156,7 +156,7 @@ static char old_hardware;static void sleep (unsigned howlong) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (howlong); }
sound/oss/swarm_cs4297a.c renamed from sound/oss/swarm_cs4297a.c.orig +1 -1
@@ -1633,7 +1633,7 @@ static int drain_dac(struct cs4297a_stat s->dma_dac.hwptr = s->dma_dac.swptr = hwptr;spin_unlock_irqrestore (&s->lock, flags);remove_wait_queue (&s->dma_dac.wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return 0 ; }
sound/oss/vwsnd.c renamed from sound/oss/vwsnd.c.orig +8 -8
@@ -1834,7 +1834,7 @@ static void pcm_shutdown_port(vwsnd_dev_break ;schedule (); } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&aport->queue, &wait);li_disable_interrupts (&devc->lith, mask);if (aport = &devc->rport)
@@ -2204,7 +2204,7 @@ static void pcm_write_sync(vwsnd_dev_t *break ;schedule (); } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&wport->queue, &wait);DBGPV ("swstate = %d, hwstate = %d\n" , wport->swstate, wport->hwstate);DBGRV ();
@@ -2281,18 +2281,18 @@ static ssize_t vwsnd_audio_do_read(strucset_current_state (TASK_INTERRUPTIBLE );if (rport->flags &DISABLED || file->f_flags &O_NONBLOCK ) { - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&rport->queue, &wait);return ret ? ret : -EAGAIN ; }schedule ();if (signal_pending (current)) { - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&rport->queue, &wait);return ret ? ret : -ERESTARTSYS ; } } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&rport->queue, &wait);pcm_input (devc,0 ,0 );/* nb bytes are available in userbuf. */
@@ -2357,18 +2357,18 @@ static ssize_t vwsnd_audio_do_write(struset_current_state (TASK_INTERRUPTIBLE );if (wport->flags &DISABLED || file->f_flags &O_NONBLOCK ) { - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&wport->queue, &wait);return ret ? ret : -EAGAIN ; }schedule ();if (signal_pending (current)) { - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&wport->queue, &wait);return ret ? ret : -ERESTARTSYS ; } } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );remove_wait_queue (&wport->queue, &wait);/* nb bytes are available in userbuf. */ if (nb > count)
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 19 lines · Eric Sesterhenn
hi,
since we have a macro to set the current state,
we should use it, instead of open coding it.Signed-off-by Eric Sesterhenn <[email protected]>sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +1
-1@@ -531,7 +531,7 @@ static ssize_t btaudio_dsp_read(struct fbreak ; }mutex_unlock (&bta->lock); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule ();mutex_lock (&bta->lock);if (signal_pending (current)) {
sound/oss/btaudio.c static ssize_t btaudio_dsp_read(struct f · line 611
Quoted 5 lines
sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +1
-1@@ -608,7 +608,7 @@ static ssize_t btaudio_dsp_read(struct f }mutex_unlock (&bta->lock);remove_wait_queue (&bta->readq, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );
Both lines might be replaced with something like finish_wait().
sound/oss/cs4232.c static unsigned char crystal_key[] = /* · line 102
Quoted 12 lines
sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +0
-0return ret; }sound/oss/cs4232.c renamed from sound/oss/cs4232.c.orig +1
-1@@ -98,7 +98,7 @@ static unsigned char crystal_key[] = /*static void sleep (unsigned howlong) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (howlong);
schedule_timeout_interruptible()
Quoted 14 lines
sound/oss/cs4232.c renamed from sound/oss/cs4232.c.orig +0
-0}sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1@@ -1435,7 +1435,7 @@ static int drain_dac(struct cs_state *stfor (;;) {/* It seems that we have to set the current state to TASK_INTERRUPTIBLE every time to make the process really go to sleep */ - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );spin_lock_irqsave (&state->card->lock, flags); count = dmabuf->count;
sound/oss/cs46xx.c static int drain_dac(struct cs_state *st · line 1452
Quoted 5 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1@@ -1449,7 +1449,7 @@ static int drain_dac(struct cs_state *stif (nonblock) {remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );
finish_wait()
sound/oss/cs46xx.c static int drain_dac(struct cs_state *st · line 1466
Quoted 9 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1return -EBUSY ; }@@ -1463,7 +1463,7 @@ static int drain_dac(struct cs_state *st } }remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );
ditto
sound/oss/cs46xx.c static int cs_midi_release(struct inode · line 1838
Quoted 10 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1if (signal_pending (current)) {CS_DBGOUT (CS_FUNCTION ,4 ,printk ("cs46xx: drain_dac()- -ERESTARTSYS\n" ));/* @@ -1834,7 +1834,7 @@ static int cs_midi_release(struct inodeunsigned count, tmo;if (file->f_mode &FMODE_WRITE ) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&card->midi.owait, &wait);
prepare_to_wait()
sound/oss/cs46xx.c static int cs_midi_release(struct inode · line 1854
Quoted 8 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1for (;;) {spin_lock_irqsave (&card->midi.lock, flags);@@ -1851,7 +1851,7 @@ static int cs_midi_release(struct inodeprintk (KERN_DEBUG "cs46xx: midi timed out??\n" ); }remove_wait_queue (&card->midi.owait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );
<snip>
And so on. Consider using these APIs (schedule_timeout_{,un}interruptible(), prepare_to_wait(), finish_wait()) rather than just the small change of using the __set_current_state() macro. Admittedly, this is all in OSS, which is slowly being removed (by Adrian Bunk) in favor of ALSA. I sent in many patches before for fixing up similar callers, but left OSS alone.
Thanks,
Nish
Signature · 6 lines
Nishanth Aravamudan <[email protected]> IBM Linux Technology Center _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.osdl.org/mailman/listinfo/kernel-janitors
hi,
thanks for your comments, i am sorry i
didnt have time to look at this again until now
Quoted 7 lines
Quoted 7 lines
(quoted diff) +1
-1} mutex_unlock(&bta->lock); - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); schedule(); mutex_lock(&bta->lock); if(signal_pending(current)) {
Quoted 8 lines
Review static ssize_t btaudio_dsp_read(struct f · line 611
Quoted 6 lines
(quoted diff) +1
-1@@ -608,7 +608,7 @@ static ssize_t btaudio_dsp_read(struct f } mutex_unlock(&bta->lock); remove_wait_queue(&bta->readq, &wait); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING);Both lines might be replaced with something like
finish_wait().
care to explain the first one?
Quoted 13 lines
Quoted 13 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1@@ -1435,7 +1435,7 @@ static int drain_dac(struct cs_state *stfor (;;) {/* It seems that we have to set the current state to TASK_INTERRUPTIBLE every time to make the process really go to sleep */ - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );spin_lock_irqsave (&state->card->lock, flags); count = dmabuf->count;@@ -1449,7 +1449,7 @@ static int drain_dac(struct cs_state *st
Quoted 6 lines
sound/oss/cs46xx.c static int drain_dac(struct cs_state *st · line 1452
Quoted 4 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1if (nonblock) {remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );
finish_wait()
same here, the second one is clear
Quoted 6 lines
And so on. Consider using these APIs (schedule_timeout_{,un}interruptible(),
prepare_to_wait(),finish_wait()) rather than just the small change of using the__set_current_state()macro. Admittedly, this is all in OSS, which is slowly being removed (by Adrian Bunk) in favor of ALSA. I sent in many patches before for fixing up similar callers, but left OSS alone.
A grep found me ~178 usages of this type in the kernel, and so i decided i should start where not much can go wrong :-)
I tried to redo the patch, taking the wait api into consideration, but left the two cases above unchanged. Patch is a bit bigger now, since we could replace the sleep() functions with a direct call to schedule_timeout_interruptible().
sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +1 -2
@@ -607,8 +607,7 @@ static ssize_t btaudio_dsp_read(struct f bta->read_offset =0 ; }mutex_unlock (&bta->lock); -remove_wait_queue (&bta->readq, &wait); - current->state =TASK_RUNNING ; +finish_wait (&bta->readq, &wait);return ret; }
sound/oss/cs4232.c renamed from sound/oss/cs4232.c.orig +4 -10
@@ -96,12 +96,6 @@ static unsigned char crystal_key[] = /* 0x09, 0x84, 0x42, 0xa1, 0xd0, 0x68, 0x34, 0x1a }; -static void sleep (unsigned howlong) -{ - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (howlong); -} -static void enable_xctrl (int baseio) {unsigned char regd;
@@ -179,7 +173,7 @@ static int __init probe_cs4232(struct adfor (i =0 ; i <32 ; i++)CS_OUT (crystal_key[i]); -sleep (HZ /10 ); +schedule_timeout_interruptible (HZ /10 );/* * Now set the CSN (Card Select Number).
@@ -212,7 +206,7 @@ static int __init probe_cs4232(struct adCS_OUT2 (0x33 ,0x01 );/* Activate logical dev 0 */ -sleep (HZ /10 ); +schedule_timeout_interruptible (HZ /10 );/* * Initialize logical device 3 (MPU)
@@ -241,7 +235,7 @@ static int __init probe_cs4232(struct adCS_OUT (0x79 ); -sleep (HZ /5 ); +schedule_timeout_interruptible (HZ /5 );/* * Then try to detect the codec part of the chip
@@ -250,7 +244,7 @@ static int __init probe_cs4232(struct adif (ad1848_detect (ports,NULL , hw_config->osp)) goto got_it; -sleep (HZ ); +schedule_timeout_interruptible (HZ ); } fail:release_region (base,4 );
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +6 -12
@@ -1448,8 +1448,7 @@ static int drain_dac(struct cs_state *stbreak ;if (nonblock) { -remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +finish_wait (&dmabuf->wait, &wait);return -EBUSY ; }
@@ -1462,8 +1461,7 @@ static int drain_dac(struct cs_state *stbreak ; } } -remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +finish_wait (&dmabuf->wait, &wait);if (signal_pending (current)) {CS_DBGOUT (CS_FUNCTION ,4 ,printk ("cs46xx: drain_dac()- -ERESTARTSYS\n" ));/*
@@ -1834,8 +1832,7 @@ static int cs_midi_release(struct inodeunsigned count, tmo;if (file->f_mode &FMODE_WRITE ) { - current->state =TASK_INTERRUPTIBLE ; -add_wait_queue (&card->midi.owait, &wait); +prepare_to_wait (&card->midi.owait, &wait,TASK_INTERRUPTIBLE );for (;;) {spin_lock_irqsave (&card->midi.lock, flags); count = card->midi.ocnt;
@@ -1850,8 +1847,7 @@ static int cs_midi_release(struct inodeif (!schedule_timeout (tmo ? :1 ) && tmo)printk (KERN_DEBUG "cs46xx: midi timed out??\n" ); } -remove_wait_queue (&card->midi.owait, &wait); - current->state =TASK_RUNNING ; +finish_wait (&card->midi.owait, &wait); }mutex_lock (&card->midi.open_mutex); card->midi.open_mode &= (~(file->f_mode & (FMODE_READ |FMODE_WRITE )));
@@ -4770,8 +4766,7 @@ static int cs_hardware_init(struct cs_ca*/ if (cs461x_peekBA0 (card,BA0_ACSTS ) &ACSTS_CRDY )break ; - current->state =TASK_UNINTERRUPTIBLE ; -schedule_timeout (1 ); +schedule_timeout_interruptible (1 ); }while (time_before (jiffies, end_time)); }else {for (count =0 ; count <100 ; count++) {
@@ -4815,8 +4810,7 @@ static int cs_hardware_init(struct cs_ca*/ if ((cs461x_peekBA0 (card,BA0_ACISV ) & (ACISV_ISV3 |ACISV_ISV4 )) = (ACISV_ISV3 |ACISV_ISV4 ))break ; - current->state =TASK_UNINTERRUPTIBLE ; -schedule_timeout (1 ); +schedule_timeout_interruptible (1 ); }while (time_before (jiffies, end_time)); }else {for (count =0 ; count <100 ; count++) {
sound/oss/emu10k1/ecard.c renamed from sound/oss/emu10k1/ecard.c.orig +1 -3
@@ -138,9 +138,7 @@ void __devinit emu10k1_ecard_init(structecard_write (card,EC_DACCAL |EC_LEDN |EC_TRIM_CSN );/* Step 3: Wait for awhile; FIXME: Is this correct? */ - - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (HZ ); +schedule_timeout_interruptible (HZ );/* Step 4: Switch off the DAC and ADC calibration. Note * That ADC_CAL is actually an inverted signal, so we assert
sound/oss/msnd_pinnacle.c renamed from sound/oss/msnd_pinnacle.c.orig +2 -4
@@ -671,8 +671,7 @@ static void dsp_write_flush(void) get_play_delay_jiffies(dev.DAPF.len));clear_bit (F_WRITEFLUSH , &dev.flags);if (!signal_pending (current)) { - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (get_play_delay_jiffies (DAP_BUFF_SIZE )); +schedule_timeout_interruptible (get_play_delay_jiffies (DAP_BUFF_SIZE )); }clear_bit (F_WRITING , &dev.flags); }
@@ -1277,8 +1276,7 @@ static int __init calibrate_adc(WORD sra & ~0x0001, dev.SMA + SMA_wCurrHostStatusFlags);if (msnd_send_word (&dev,0 ,0 ,HDEXAR_CAL_A_TO_D ) =0 &&chk_send_dsp_cmd (&dev,HDEX_AUX_REQ ) =0 ) { - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (HZ /3 ); +schedule_timeout_interruptible (HZ /3 );return 0 ; } printk(KERN_WARNING LOGNAME ": ADC calibration failed\n");
sound/oss/sscape.c renamed from sound/oss/sscape.c.orig +6 -11
@@ -154,11 +154,6 @@ static char old_hardware = 1;static char old_hardware;#endif -static void sleep (unsigned howlong) -{ - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (howlong); -}static unsigned char sscape_read (struct sscape_info *devc,int reg) {
@@ -464,7 +459,7 @@ static int sscape_download_boot(struct sint resid;if (HZ /50 ) -sleep (HZ /50 ); +schedule_timeout_interruptible (HZ /50 );clear_dma_ff (devc->dma);if ((resid =get_dma_residue (devc->dma)) =0 ) done =1 ;
@@ -496,7 +491,7 @@ static int sscape_download_boot(struct s {unsigned char x; -sleep (1 ); +schedule_timeout_interruptible (1 ); x =inb (PORT (HOST_DATA ));if (x =0xff || x =0xfe )/* OBP startup acknowledge */ {
@@ -517,7 +512,7 @@ static int sscape_download_boot(struct s timeout_val =5 *HZ ;while (!done && timeout_val-- >0 ) { -sleep (1 ); +schedule_timeout_interruptible (1 );if (inb (PORT (HOST_DATA )) =0xfe )/* Host startup acknowledge */ done =1 ; }
@@ -882,7 +877,7 @@ static int sscape_pnp_wait_dma (sscape_iif (arg =0 ) reg =2 ;else reg =3 ; -sleep (1 ); +schedule_timeout_interruptible (1 ); i =0 ; do { d = sscape_read(devc, reg) & 1;
@@ -957,7 +952,7 @@ static int sscape_pnp_upload_file(sscapewhile (!done && timeout_val-- >0 ) {unsigned char x; -sleep (1 ); +schedule_timeout_interruptible (1 ); x =inb ( devc -> base +3 );if (x =0xff || x =0xfe )/* OBP startup acknowledge */ {
@@ -970,7 +965,7 @@ static int sscape_pnp_upload_file(sscapewhile (!done && timeout_val-- >0 ) {unsigned char x; -sleep (1 ); +schedule_timeout_interruptible (1 ); x =inb ( devc -> base +3 );if (x =0xfe )/* OBP startup acknowledge */ {
sound/oss/swarm_cs4297a.c renamed from sound/oss/swarm_cs4297a.c.orig +1 -2
@@ -1632,8 +1632,7 @@ static int drain_dac(struct cs4297a_stat s->dma_dac.descrtab_phys) / sizeof(serdma_descr_t)); s->dma_dac.hwptr = s->dma_dac.swptr = hwptr;spin_unlock_irqrestore (&s->lock, flags); -remove_wait_queue (&s->dma_dac.wait, &wait); - current->state =TASK_RUNNING ; +finish_wait (&s->dma_dac.wait, &wait);return 0 ; }
sound/oss/vwsnd.c renamed from sound/oss/vwsnd.c.orig +8 -16
@@ -1834,8 +1834,7 @@ static void pcm_shutdown_port(vwsnd_dev_break ;schedule (); } - current->state =TASK_RUNNING ; -remove_wait_queue (&aport->queue, &wait); +finish_wait (&aport->queue, &wait);li_disable_interrupts (&devc->lith, mask);if (aport = &devc->rport)ad1843_shutdown_adc (&devc->lith);
@@ -2204,8 +2203,7 @@ static void pcm_write_sync(vwsnd_dev_t *break ;schedule (); } - current->state =TASK_RUNNING ; -remove_wait_queue (&wport->queue, &wait); +finish_wait (&wport->queue, &wait);DBGPV ("swstate = %d, hwstate = %d\n" , wport->swstate, wport->hwstate);DBGRV (); }
@@ -2281,19 +2279,16 @@ static ssize_t vwsnd_audio_do_read(strucset_current_state (TASK_INTERRUPTIBLE );if (rport->flags &DISABLED || file->f_flags &O_NONBLOCK ) { - current->state =TASK_RUNNING ; -remove_wait_queue (&rport->queue, &wait); +finish_wait (&rport->queue, &wait);return ret ? ret : -EAGAIN ; }schedule ();if (signal_pending (current)) { - current->state =TASK_RUNNING ; -remove_wait_queue (&rport->queue, &wait); +finish_wait (&rport->queue, &wait);return ret ? ret : -ERESTARTSYS ; } } - current->state =TASK_RUNNING ; -remove_wait_queue (&rport->queue, &wait); +finish_wait (&rport->queue, &wait);pcm_input (devc,0 ,0 );/* nb bytes are available in userbuf. */ if (nb > count)
@@ -2357,19 +2352,16 @@ static ssize_t vwsnd_audio_do_write(struset_current_state (TASK_INTERRUPTIBLE );if (wport->flags &DISABLED || file->f_flags &O_NONBLOCK ) { - current->state =TASK_RUNNING ; -remove_wait_queue (&wport->queue, &wait); +finish_wait (&wport->queue, &wait);return ret ? ret : -EAGAIN ; }schedule ();if (signal_pending (current)) { - current->state =TASK_RUNNING ; -remove_wait_queue (&wport->queue, &wait); +finish_wait (&wport->queue, &wait);return ret ? ret : -ERESTARTSYS ; } } - current->state =TASK_RUNNING ; -remove_wait_queue (&wport->queue, &wait); +finish_wait (&wport->queue, &wait);/* nb bytes are available in userbuf. */ if (nb > count) nb = count;
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 37 lines · Eric Sesterhenn
hi,
thanks for your comments, i am sorry i
didnt have time to look at this again until nowQuoted 7 lines
Quoted 7 lines
sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +1
-1}mutex_unlock (&bta->lock); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule ();mutex_lock (&bta->lock);if (signal_pending (current)) {Quoted 8 lines
sound/oss/btaudio.c static ssize_t btaudio_dsp_read(struct f · line 611
Quoted 6 lines
sound/oss/btaudio.c renamed from sound/oss/btaudio.c.orig +1
-1@@ -608,7 +608,7 @@ static ssize_t btaudio_dsp_read(struct f }mutex_unlock (&bta->lock);remove_wait_queue (&bta->readq, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );Both lines might be replaced with something like
finish_wait().care to explain the first one?
Quoted 13 lines
Quoted 13 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1@@ -1435,7 +1435,7 @@ static int drain_dac(struct cs_state *stfor (;;) {/* It seems that we have to set the current state to TASK_INTERRUPTIBLE every time to make the process really go to sleep */ - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );spin_lock_irqsave (&state->card->lock, flags); count = dmabuf->count;@@ -1449,7 +1449,7 @@ static int drain_dac(struct cs_state *st
Quoted 8 lines
Quoted 6 lines
sound/oss/cs46xx.c static int drain_dac(struct cs_state *st · line 1452
Quoted 4 lines
sound/oss/cs46xx.c renamed from sound/oss/cs46xx.c.orig +1
-1if (nonblock) {remove_wait_queue (&dmabuf->wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );
finish_wait()same here, the second one is clear
Sorry, in both these cases, I just forgot to snip the earlier bits, new patch looks much better. Note, that in the case of several OSS drivers, they are already replaced by ALSA ones -- and the ALSA ones are much better maintained. A lot of the wait-queue bits in OSS seem to be poorly done, or more obfuscated than necessary.
Oh well.
Thanks,
Nish
Signature · 6 lines
Nishanth Aravamudan <[email protected]> IBM Linux Technology Center _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.osdl.org/mailman/listinfo/kernel-janitors