diff options
author | Johannes Stezenbach <devnull@localhost> | 2003-04-23 15:08:17 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2003-04-23 15:08:17 +0000 |
commit | c53fd657862cff4bf5e1c92b68d9ff539b463743 (patch) | |
tree | 8fcd5e1add51a8a7664b5eff353ba0e1ad9b51e5 /linux/drivers/media | |
parent | 5e8fe57d32dd88f0f84ff9c19e57d2e586dba9a7 (diff) | |
download | mediapointer-dvb-s2-c53fd657862cff4bf5e1c92b68d9ff539b463743.tar.gz mediapointer-dvb-s2-c53fd657862cff4bf5e1c92b68d9ff539b463743.tar.bz2 |
fixed awkward locking bug for video event queue
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 14 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index c0af67c34..22391bd9f 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -3365,8 +3365,7 @@ void dvb_video_add_event (av7110_t *av7110, struct video_event *event) DEB_D(("\n")); - if (down_interruptible (&events->sem)) - return; + spin_lock_bh(&events->lock); wp = (events->eventw + 1) % MAX_VIDEO_EVENT; @@ -3380,7 +3379,7 @@ void dvb_video_add_event (av7110_t *av7110, struct video_event *event) events->eventw = wp; - up (&events->sem); + spin_unlock_bh(&events->lock); wake_up_interruptible (&events->wait_queue); } @@ -3410,15 +3409,14 @@ int dvb_video_get_event (av7110_t *av7110, struct video_event *event, int flags) return ret; } - if (down_interruptible (&events->sem)) - return -ERESTARTSYS; + spin_lock_bh(&events->lock); memcpy (event, &events->events[events->eventr], sizeof(struct video_event)); events->eventr = (events->eventr + 1) % MAX_VIDEO_EVENT; - up (&events->sem); + spin_unlock_bh(&events->lock); return 0; } @@ -4049,8 +4047,8 @@ int av7110_register(av7110_t *av7110) if (ret < 0) return ret; - init_waitqueue_head (&av7110->video_events.wait_queue); - init_MUTEX (&av7110->video_events.sem); + init_waitqueue_head(&av7110->video_events.wait_queue); + spin_lock_init(&av7110->video_events.lock); av7110->video_events.eventw = av7110->video_events.eventr = 0; av7110->video_events.overflow = 0; memset(&av7110->video_size, 0, sizeof (video_size_t)); diff --git a/linux/drivers/media/dvb/ttpci/av7110.h b/linux/drivers/media/dvb/ttpci/av7110.h index b9d2fc995..0128ba102 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.h +++ b/linux/drivers/media/dvb/ttpci/av7110.h @@ -456,7 +456,7 @@ struct dvb_video_events { int eventr; int overflow; wait_queue_head_t wait_queue; - struct semaphore sem; + spinlock_t lock; }; |