Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168186403
D53736.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D53736.id.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
Thu, Aug 27, 6:54 PM (2 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37246311
Default Alt Text
D53736.id.diff (1 KB)
Attached To
Mode
D53736: sound: Simplify logic in dsp_io_ops()
Attached
Detach File
Event Timeline
Log In to Comment