Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177926415
D53736.1795582589.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D53736.1795582589.diff
View Options
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -464,8 +464,7 @@
struct snddev_info *d;
struct pcm_channel *ch;
int (*chn_io)(struct pcm_channel *, struct uio *);
- int prio, ret;
- pid_t runpid;
+ int ret;
d = priv->sc;
if (!DSP_REGISTERED(d))
@@ -475,37 +474,27 @@
switch (buf->uio_rw) {
case UIO_READ:
- prio = FREAD;
ch = priv->rdch;
chn_io = chn_read;
break;
case UIO_WRITE:
- prio = FWRITE;
ch = priv->wrch;
chn_io = chn_write;
break;
}
-
- runpid = buf->uio_td->td_proc->p_pid;
-
- dsp_lock_chans(priv, prio);
-
- if (ch == NULL || !(ch->flags & CHN_F_BUSY)) {
- if (priv->rdch != NULL || priv->wrch != NULL)
- dsp_unlock_chans(priv, prio);
+ if (ch == NULL) {
PCM_GIANT_EXIT(d);
- return (EBADF);
+ return (ENXIO);
}
+ CHN_LOCK(ch);
- if (ch->flags & (CHN_F_MMAP | CHN_F_DEAD) ||
- (ch->flags & CHN_F_RUNNING && ch->pid != runpid)) {
- dsp_unlock_chans(priv, prio);
+ if (!(ch->flags & CHN_F_BUSY) ||
+ (ch->flags & (CHN_F_MMAP | CHN_F_DEAD))) {
+ CHN_UNLOCK(ch);
PCM_GIANT_EXIT(d);
- return (EINVAL);
- } else if (!(ch->flags & CHN_F_RUNNING)) {
+ return (ENXIO);
+ } else if (!(ch->flags & CHN_F_RUNNING))
ch->flags |= CHN_F_RUNNING;
- ch->pid = runpid;
- }
/*
* chn_read/write must give up channel lock in order to copy bytes
@@ -517,8 +506,7 @@
ch->inprog--;
CHN_BROADCAST(&ch->cv);
-
- dsp_unlock_chans(priv, prio);
+ CHN_UNLOCK(ch);
PCM_GIANT_LEAVE(d);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 4:56 AM (23 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41967030
Default Alt Text
D53736.1795582589.diff (1 KB)
Attached To
Mode
D53736: sound: Simplify logic in dsp_io_ops()
Attached
Detach File
Event Timeline