|
@@ -514,12 +514,14 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp,
|
|
void *data)
|
|
void *data)
|
|
{
|
|
{
|
|
unsigned long irq_flags;
|
|
unsigned long irq_flags;
|
|
- mutex_lock(&sp->mutex); do {
|
|
|
|
|
|
+ mutex_lock(&sp->mutex);
|
|
|
|
+ do {
|
|
spin_lock_irqsave(&sp->list_lock,irq_flags);
|
|
spin_lock_irqsave(&sp->list_lock,irq_flags);
|
|
sp->callback_data = data;
|
|
sp->callback_data = data;
|
|
sp->callback_func = func;
|
|
sp->callback_func = func;
|
|
spin_unlock_irqrestore(&sp->list_lock,irq_flags);
|
|
spin_unlock_irqrestore(&sp->list_lock,irq_flags);
|
|
- } while(0); mutex_unlock(&sp->mutex);
|
|
|
|
|
|
+ } while(0);
|
|
|
|
+ mutex_unlock(&sp->mutex);
|
|
}
|
|
}
|
|
|
|
|
|
void pvr2_stream_get_stats(struct pvr2_stream *sp,
|
|
void pvr2_stream_get_stats(struct pvr2_stream *sp,
|
|
@@ -554,10 +556,12 @@ int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
if (sp->buffer_target_count == cnt) return 0;
|
|
if (sp->buffer_target_count == cnt) return 0;
|
|
- mutex_lock(&sp->mutex); do {
|
|
|
|
|
|
+ mutex_lock(&sp->mutex);
|
|
|
|
+ do {
|
|
sp->buffer_target_count = cnt;
|
|
sp->buffer_target_count = cnt;
|
|
ret = pvr2_stream_achieve_buffer_count(sp);
|
|
ret = pvr2_stream_achieve_buffer_count(sp);
|
|
- } while(0); mutex_unlock(&sp->mutex);
|
|
|
|
|
|
+ } while(0);
|
|
|
|
+ mutex_unlock(&sp->mutex);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -590,7 +594,8 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp)
|
|
void pvr2_stream_kill(struct pvr2_stream *sp)
|
|
void pvr2_stream_kill(struct pvr2_stream *sp)
|
|
{
|
|
{
|
|
struct pvr2_buffer *bp;
|
|
struct pvr2_buffer *bp;
|
|
- mutex_lock(&sp->mutex); do {
|
|
|
|
|
|
+ mutex_lock(&sp->mutex);
|
|
|
|
+ do {
|
|
pvr2_stream_internal_flush(sp);
|
|
pvr2_stream_internal_flush(sp);
|
|
while ((bp = pvr2_stream_get_ready_buffer(sp)) != NULL) {
|
|
while ((bp = pvr2_stream_get_ready_buffer(sp)) != NULL) {
|
|
pvr2_buffer_set_idle(bp);
|
|
pvr2_buffer_set_idle(bp);
|
|
@@ -598,7 +603,8 @@ void pvr2_stream_kill(struct pvr2_stream *sp)
|
|
if (sp->buffer_total_count != sp->buffer_target_count) {
|
|
if (sp->buffer_total_count != sp->buffer_target_count) {
|
|
pvr2_stream_achieve_buffer_count(sp);
|
|
pvr2_stream_achieve_buffer_count(sp);
|
|
}
|
|
}
|
|
- } while(0); mutex_unlock(&sp->mutex);
|
|
|
|
|
|
+ } while(0);
|
|
|
|
+ mutex_unlock(&sp->mutex);
|
|
}
|
|
}
|
|
|
|
|
|
int pvr2_buffer_queue(struct pvr2_buffer *bp)
|
|
int pvr2_buffer_queue(struct pvr2_buffer *bp)
|
|
@@ -612,7 +618,8 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
|
|
struct pvr2_stream *sp;
|
|
struct pvr2_stream *sp;
|
|
if (!bp) return -EINVAL;
|
|
if (!bp) return -EINVAL;
|
|
sp = bp->stream;
|
|
sp = bp->stream;
|
|
- mutex_lock(&sp->mutex); do {
|
|
|
|
|
|
+ mutex_lock(&sp->mutex);
|
|
|
|
+ do {
|
|
pvr2_buffer_wipe(bp);
|
|
pvr2_buffer_wipe(bp);
|
|
if (!sp->dev) {
|
|
if (!sp->dev) {
|
|
ret = -EIO;
|
|
ret = -EIO;
|
|
@@ -636,7 +643,8 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
|
|
buffer_complete,
|
|
buffer_complete,
|
|
bp);
|
|
bp);
|
|
usb_submit_urb(bp->purb,GFP_KERNEL);
|
|
usb_submit_urb(bp->purb,GFP_KERNEL);
|
|
- } while(0); mutex_unlock(&sp->mutex);
|
|
|
|
|
|
+ } while(0);
|
|
|
|
+ mutex_unlock(&sp->mutex);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -647,7 +655,8 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
|
|
struct pvr2_stream *sp;
|
|
struct pvr2_stream *sp;
|
|
if (!bp) return -EINVAL;
|
|
if (!bp) return -EINVAL;
|
|
sp = bp->stream;
|
|
sp = bp->stream;
|
|
- mutex_lock(&sp->mutex); do {
|
|
|
|
|
|
+ mutex_lock(&sp->mutex);
|
|
|
|
+ do {
|
|
spin_lock_irqsave(&sp->list_lock,irq_flags);
|
|
spin_lock_irqsave(&sp->list_lock,irq_flags);
|
|
if (bp->state != pvr2_buffer_state_idle) {
|
|
if (bp->state != pvr2_buffer_state_idle) {
|
|
ret = -EPERM;
|
|
ret = -EPERM;
|
|
@@ -664,7 +673,8 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
|
|
bp->stream->i_bcount,bp->stream->i_count);
|
|
bp->stream->i_bcount,bp->stream->i_count);
|
|
}
|
|
}
|
|
spin_unlock_irqrestore(&sp->list_lock,irq_flags);
|
|
spin_unlock_irqrestore(&sp->list_lock,irq_flags);
|
|
- } while(0); mutex_unlock(&sp->mutex);
|
|
|
|
|
|
+ } while(0);
|
|
|
|
+ mutex_unlock(&sp->mutex);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|