Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] hdpvr: fix interrupted recording

This is a reworking of a patch originally submitted by Ryley Angus,
modified by Hans Verkuil and then seemingly forgotten before changes
suggested by Keith Pyle here:

http://www.mail-archive.com/linux-media@vger.kernel.org/msg75163.html

were made and tested.

I have implemented the suggested changes and have been testing for the
last 2 months. I am no longer experiencing lockups while recording
(with blue light on, requiring power cycling) which had been a long
standing problem with the HD-PVR. I have not noticed any other problems
since applying the patch.

Signed-off-by: Jonathan Sims <jonathan.625266@earthlink.net>
Reported-by: Ryley Angus <ryleyjangus@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Jonathan Sims and committed by
Mauro Carvalho Chehab
a503ff81 708f48e7

+19 -3
+19 -3
drivers/media/usb/hdpvr/hdpvr-video.c
··· 449 449 450 450 if (buf->status != BUFSTAT_READY && 451 451 dev->status != STATUS_DISCONNECTED) { 452 + int err; 452 453 /* return nonblocking */ 453 454 if (file->f_flags & O_NONBLOCK) { 454 455 if (!ret) ··· 457 456 goto err; 458 457 } 459 458 460 - if (wait_event_interruptible(dev->wait_data, 461 - buf->status == BUFSTAT_READY)) 462 - return -ERESTARTSYS; 459 + err = wait_event_interruptible_timeout(dev->wait_data, 460 + buf->status == BUFSTAT_READY, 461 + msecs_to_jiffies(1000)); 462 + if (err < 0) { 463 + ret = err; 464 + goto err; 465 + } 466 + if (!err) { 467 + v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, 468 + "timeout: restart streaming\n"); 469 + hdpvr_stop_streaming(dev); 470 + msecs_to_jiffies(4000); 471 + err = hdpvr_start_streaming(dev); 472 + if (err) { 473 + ret = err; 474 + goto err; 475 + } 476 + } 463 477 } 464 478 465 479 if (buf->status != BUFSTAT_READY)