Commit d7812a54 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dvb: core update

From: Michael Hunold <hunold@linuxtv.org>

- dvb-core: replace usage of sleep_on_...() with
  wait_event_interruptible_timeout()

- dvb-core: fix dvb_ringbuffer_read/write() buffer pointer bug

- video: added VIDEO_EVENT_FRAME_RATE_CHANGED and VIDEO_GET_FRAME_RATE
  ioctl
parent 81260e6d
......@@ -426,6 +426,7 @@ static int dvb_frontend_is_exiting (struct dvb_frontend_data *fe)
static int dvb_frontend_thread (void *data)
{
struct dvb_frontend_data *fe = (struct dvb_frontend_data *) data;
unsigned long timeout;
char name [15];
int quality = 0, delay = 3*HZ;
fe_status_t s;
......@@ -442,12 +443,14 @@ static int dvb_frontend_thread (void *data)
dvb_call_frontend_notifiers (fe, 0);
dvb_frontend_init (fe);
while (!dvb_frontend_is_exiting (fe)) {
while (1) {
up (&fe->sem); /* is locked when we enter the thread... */
interruptible_sleep_on_timeout (&fe->wait_queue, delay);
if (signal_pending(current))
timeout = wait_event_interruptible_timeout(fe->wait_queue,0 != dvb_frontend_is_exiting (fe), delay);
if (-ERESTARTSYS == timeout || 0 != dvb_frontend_is_exiting (fe)) {
/* got signal or quitting */
break;
}
if (down_interruptible (&fe->sem))
break;
......@@ -455,9 +458,6 @@ static int dvb_frontend_thread (void *data)
if (fe->lost_sync_count == -1)
continue;
if (dvb_frontend_is_exiting (fe))
break;
dvb_frontend_internal_ioctl (&fe->frontend, FE_READ_STATUS, &s);
update_delay (&quality, &delay, s & FE_HAS_LOCK);
......@@ -509,6 +509,8 @@ static int dvb_frontend_thread (void *data)
static void dvb_frontend_stop (struct dvb_frontend_data *fe)
{
unsigned long ret;
dprintk ("%s\n", __FUNCTION__);
fe->exit = 1;
......@@ -526,10 +528,16 @@ static void dvb_frontend_stop (struct dvb_frontend_data *fe)
return;
}
/* wake up the frontend thread, so it notices that fe->exit == 1 */
wake_up_interruptible (&fe->wait_queue);
interruptible_sleep_on(&fe->wait_queue);
/* paranoia check */
/* wait until the frontend thread has exited */
ret = wait_event_interruptible(fe->wait_queue,0 == fe->thread_pid);
if (-ERESTARTSYS != ret) {
return;
}
/* paranoia check in case a signal arrived */
if (fe->thread_pid)
printk("dvb_frontend_stop: warning: thread PID %d won't exit\n",
fe->thread_pid);
......
......@@ -123,7 +123,7 @@ ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, in
if (copy_to_user(buf, rbuf->data+rbuf->pread, todo))
return -EFAULT;
rbuf->pread = (rbuf->pread + len) % rbuf->size;
rbuf->pread = (rbuf->pread + todo) % rbuf->size;
return len;
}
......@@ -155,7 +155,7 @@ ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
if (copy_from_user(rbuf->data+rbuf->pwrite, buf, todo))
return -EFAULT;
rbuf->pwrite = (rbuf->pwrite + len) % rbuf->size;
rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size;
return len;
}
......
......@@ -81,9 +81,11 @@ typedef enum {
struct video_event {
int32_t type;
#define VIDEO_EVENT_SIZE_CHANGED 1
#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
time_t timestamp;
union {
video_size_t size;
unsigned int frame_rate; /* in frames per 1000sec */
} u;
};
......@@ -194,6 +196,7 @@ typedef uint16_t video_attributes_t;
#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
#endif /*_DVBVIDEO_H_*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment