From patchwork Tue Apr 14 14:47:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 29173 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Yi28I-0005dT-Qu; Tue, 14 Apr 2015 16:48:10 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1Yi28G-0005nZ-8C; Tue, 14 Apr 2015 16:48:10 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755497AbbDNOsE (ORCPT + 1 other); Tue, 14 Apr 2015 10:48:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46718 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754077AbbDNOsD convert rfc822-to-8bit (ORCPT ); Tue, 14 Apr 2015 10:48:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3EEm1I3019425 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 14 Apr 2015 10:48:01 -0400 Received: from warthog.procyon.org.uk ([10.3.112.15]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3EElwKa012404; Tue, 14 Apr 2015 10:47:59 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: mchehab@osg.samsung.com cc: dhowells@redhat.com, linux-media@vger.kernel.org Subject: [PATCH] libdvbv5: Retry FE_GET_PROPERTY ioctl if it returns EAGAIN MIME-Version: 1.0 Content-ID: <10102.1429022877.1@warthog.procyon.org.uk> Date: Tue, 14 Apr 2015 15:47:57 +0100 Message-ID: <10103.1429022877@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.4.14.143623 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1600_1699 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FW_1LN_BOT_MSGID 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Retry the FE_GET_PROPERTY ioctl used to determine if we have a DVBv5 device if it returns EAGAIN indicating the driver is currently locked by the kernel. Also skip over subsequent information gathering calls to FE_GET_PROPERTY that return EAGAIN. Original-author: Mauro Carvalho Chehab Signed-off-by: David Howells --- dvb-fe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index 04ad907..3657334 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -171,9 +171,12 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, int frontend, dtv_prop.props = parms->dvb_prop; /* Detect a DVBv3 device */ - if (ioctl(fd, FE_GET_PROPERTY, &dtv_prop) == -1) { + while (ioctl(fd, FE_GET_PROPERTY, &dtv_prop) == -1) { + if (errno == EAGAIN) + continue; parms->dvb_prop[0].u.data = 0x300; parms->dvb_prop[1].u.data = SYS_UNDEFINED; + break; } parms->p.version = parms->dvb_prop[0].u.data; parms->p.current_sys = parms->dvb_prop[1].u.data; @@ -1336,8 +1339,11 @@ int dvb_fe_get_stats(struct dvb_v5_fe_parms *p) props.props = parms->stats.prop; /* Do a DVBv5.10 stats call */ - if (ioctl(parms->fd, FE_GET_PROPERTY, &props) == -1) + if (ioctl(parms->fd, FE_GET_PROPERTY, &props) == -1) { + if (errno == EAGAIN) + return 0; goto dvbv3_fallback; + } /* * All props with len=0 mean that this device doesn't have any