Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6516
b: refs/heads/master
c: 443feb8
h: refs/heads/master
v: v3
  • Loading branch information
Karsten Wiese authored and Jaroslav Kysela committed Aug 30, 2005
1 parent dde1beb commit 1e37398
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9bcf655109ae06a8e652671a0de6fe2da5c213c2
refs/heads/master: 443feb882679e21ba5d1e0ff9eff067ac26d9461
1 change: 0 additions & 1 deletion trunk/include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ struct _snd_pcm_substream {
unsigned int dma_buf_id;
size_t dma_max;
/* -- hardware operations -- */
unsigned int open_flag: 1; /* lowlevel device has been opened */
snd_pcm_ops_t *ops;
/* -- runtime information -- */
snd_pcm_runtime_t *runtime;
Expand Down
11 changes: 4 additions & 7 deletions trunk/sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1705,13 +1705,12 @@ static int snd_pcm_oss_release_file(snd_pcm_oss_file_t *pcm_oss_file)
if (snd_pcm_running(substream))
snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
snd_pcm_stream_unlock_irq(substream);
if (substream->open_flag) {
if (substream->ffile != NULL) {
if (substream->ops->hw_free != NULL)
substream->ops->hw_free(substream);
substream->ops->close(substream);
substream->open_flag = 0;
substream->ffile = NULL;
}
substream->ffile = NULL;
snd_pcm_oss_release_substream(substream);
snd_pcm_release_substream(substream);
}
Expand Down Expand Up @@ -1778,14 +1777,13 @@ static int snd_pcm_oss_open_file(struct file *file,
snd_pcm_oss_release_file(pcm_oss_file);
return err;
}
psubstream->open_flag = 1;
psubstream->ffile = file;
err = snd_pcm_hw_constraints_complete(psubstream);
if (err < 0) {
snd_printd("snd_pcm_hw_constraint_complete failed\n");
snd_pcm_oss_release_file(pcm_oss_file);
return err;
}
psubstream->ffile = file;
snd_pcm_oss_init_substream(psubstream, psetup, minor);
}
if (csubstream != NULL) {
Expand All @@ -1800,14 +1798,13 @@ static int snd_pcm_oss_open_file(struct file *file,
snd_pcm_oss_release_file(pcm_oss_file);
return err;
}
csubstream->open_flag = 1;
csubstream->ffile = file;
err = snd_pcm_hw_constraints_complete(csubstream);
if (err < 0) {
snd_printd("snd_pcm_hw_constraint_complete failed\n");
snd_pcm_oss_release_file(pcm_oss_file);
return err;
}
csubstream->ffile = file;
snd_pcm_oss_init_substream(csubstream, csetup, minor);
}

Expand Down
16 changes: 14 additions & 2 deletions trunk/sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
if (((avail < runtime->control->avail_min && size > avail) ||
(size >= runtime->xfer_align && avail < runtime->xfer_align))) {
wait_queue_t wait;
enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state;
enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state;
long tout;

if (nonblock) {
Expand Down Expand Up @@ -2097,6 +2097,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
case SNDRV_PCM_STATE_SUSPENDED:
state = SUSPENDED;
goto _end_loop;
case SNDRV_PCM_STATE_SETUP:
state = DROPPED;
goto _end_loop;
default:
break;
}
Expand All @@ -2123,6 +2126,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
snd_printd("playback write error (DMA or IRQ trouble?)\n");
err = -EIO;
goto _end_unlock;
case DROPPED:
err = -EBADFD;
goto _end_unlock;
default:
break;
}
Expand Down Expand Up @@ -2359,7 +2365,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
} else if ((avail < runtime->control->avail_min && size > avail) ||
(size >= runtime->xfer_align && avail < runtime->xfer_align)) {
wait_queue_t wait;
enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state;
enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state;
long tout;

if (nonblock) {
Expand Down Expand Up @@ -2394,6 +2400,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
goto _end_loop;
case SNDRV_PCM_STATE_DRAINING:
goto __draining;
case SNDRV_PCM_STATE_SETUP:
state = DROPPED;
goto _end_loop;
default:
break;
}
Expand All @@ -2420,6 +2429,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
snd_printd("capture read error (DMA or IRQ trouble?)\n");
err = -EIO;
goto _end_unlock;
case DROPPED:
err = -EBADFD;
goto _end_unlock;
default:
break;
}
Expand Down
10 changes: 3 additions & 7 deletions trunk/sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,13 +1967,12 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file)
runtime = substream->runtime;
str = substream->pstr;
snd_pcm_unlink(substream);
if (substream->open_flag) {
if (substream->ffile != NULL) {
if (substream->ops->hw_free != NULL)
substream->ops->hw_free(substream);
substream->ops->close(substream);
substream->open_flag = 0;
substream->ffile = NULL;
}
substream->ffile = NULL;
snd_pcm_remove_file(str, pcm_file);
snd_pcm_release_substream(substream);
kfree(pcm_file);
Expand Down Expand Up @@ -2022,18 +2021,15 @@ static int snd_pcm_open_file(struct file *file,
snd_pcm_release_file(pcm_file);
return err;
}
substream->open_flag = 1;
substream->ffile = file;

err = snd_pcm_hw_constraints_complete(substream);
if (err < 0) {
snd_printd("snd_pcm_hw_constraints_complete failed\n");
substream->ops->close(substream);
snd_pcm_release_file(pcm_file);
return err;
}

substream->ffile = file;

file->private_data = pcm_file;
*rpcm_file = pcm_file;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/usb/usx2y/usx2yhwdeppcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ static int usX2Y_pcms_lock_check(snd_card_t *card)
for (s = 0; s < 2; ++s) {
snd_pcm_substream_t *substream;
substream = pcm->streams[s].substream;
if (substream && substream->open_flag)
if (substream && substream->ffile != NULL)
err = -EBUSY;
}
}
Expand Down

0 comments on commit 1e37398

Please sign in to comment.