From patchwork Sun Oct 23 18:19:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Sims X-Patchwork-Id: 9391145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70AC3607FF for ; Sun, 23 Oct 2016 18:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 604AB28B17 for ; Sun, 23 Oct 2016 18:19:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5490128B1D; Sun, 23 Oct 2016 18:19:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6B7828B17 for ; Sun, 23 Oct 2016 18:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756641AbcJWSTP (ORCPT ); Sun, 23 Oct 2016 14:19:15 -0400 Received: from elasmtp-galgo.atl.sa.earthlink.net ([209.86.89.61]:54131 "EHLO elasmtp-galgo.atl.sa.earthlink.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755088AbcJWSTO (ORCPT ); Sun, 23 Oct 2016 14:19:14 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=O+0rEKZwE/H9KyAo5eaIZHfs5SOYGBBsh8/lzIuQ77epVMwwUofr5sBYdcDpN/MU; h=Received:Date:From:To:Cc:Subject:Message-ID:X-Mailer:MIME-Version:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from [24.144.93.62] (helo=localhost.localdomain) by elasmtp-galgo.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1byNMS-0001LF-Bm; Sun, 23 Oct 2016 14:19:08 -0400 Date: Sun, 23 Oct 2016 14:19:07 -0400 From: Jonathan Sims To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, mchehab@kernel.org, kpyle@austin.rr.com, ryleyjangus@gmail.com Subject: [RFCv2 PATCH RESEND 1/1] hdpvr: fix interrupted recording Message-ID: <20161023141907.25693b37@earthlink.net> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 X-ELNK-Trace: d43b1c40e4339a3af1e48346ad514f70d780f4a490ca6956527bd5036cbc8ac704b39d0e2ecd79bf737d60d35f3b2e04350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 24.144.93.62 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [ Correcting my earlier message - sorry, newbie here ] 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 --- drivers/media/usb/hdpvr/hdpvr-video.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 2a3a8b4..08e69dc 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -454,6 +454,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, if (buf->status != BUFSTAT_READY && dev->status != STATUS_DISCONNECTED) { + int err; /* return nonblocking */ if (file->f_flags & O_NONBLOCK) { if (!ret) @@ -461,9 +462,24 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, goto err; } - if (wait_event_interruptible(dev->wait_data, - buf->status == BUFSTAT_READY)) - return -ERESTARTSYS; + err = wait_event_interruptible_timeout(dev->wait_data, + buf->status == BUFSTAT_READY, + msecs_to_jiffies(1000)); + if (err < 0) { + ret = err; + goto err; + } + if (!err) { + v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, + "timeout: restart streaming\n"); + hdpvr_stop_streaming(dev); + msecs_to_jiffies(4000); + err = hdpvr_start_streaming(dev); + if (err) { + ret = err; + goto err; + } + } } if (buf->status != BUFSTAT_READY)