From patchwork Wed Apr 19 23:13:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 40918 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0yoK-0002uJ-29; Wed, 19 Apr 2017 23:14:56 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-7) with esmtp id 1d0yoH-0006BG-2u; Thu, 20 Apr 2017 01:14:55 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938415AbdDSXOs (ORCPT + 1 other); Wed, 19 Apr 2017 19:14:48 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:35020 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940326AbdDSXOp (ORCPT ); Wed, 19 Apr 2017 19:14:45 -0400 Received: by mail-qk0-f169.google.com with SMTP id f133so33324063qke.2 for ; Wed, 19 Apr 2017 16:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernellabs-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mq1/Xd3pxSQ/A9VLGP6aYNKvN3RBk5VGW1kztCp4SUE=; b=qcUkT+Lj6CcH7vQzOXOqe7qj8kwfttJ0mbgGL+STydKokodDsLr/Wd/zu3UBNISYyl eQC0Rrukb7aKEQ35FmVY0JIdgGp2wjzTuACzLe5WEw4lmLfnTFcdeHpiRhFZ0BDsghHj ptHiSZmrNqxQimwMcMzR+Xe4Q4GMf/mAVjSLG6gWocTDCvfHodZthVPrZAw1u58C1Z4z A7CeA4yCwX8DaksvwikZXxFW2jTao8rNqYyydbbNGGlMsCHOF1mmCDSWF2BzopJUdV7J MFD8FG1ipdyjOAZdP1vkYXQtJ8UQGYZ/SuAESzc45QBv6/Z4/sqBqxkCqZfqHEDFDPmu jBkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Mq1/Xd3pxSQ/A9VLGP6aYNKvN3RBk5VGW1kztCp4SUE=; b=pNbGGKQ544EMlcN1Lzkl7jbO4VnLt056PwWkLNo8xESWfHUXRsFrdTBIjtq2qZSBXL 5oeuQauoQ55k+0RcHXi6WnOsa1hgjy7M2dNBc1INHLNKQCC/wsI8hpQDa23P1+0BseGF zbbMrvXJZlOPtZ0cCsLaZUiRLm88nEcLU+15oC//I6h2PGEakB8uto/tHOjrz3SZLJnT Peluxdt5WxEKX+5XH/LIaKKCfoX8ja/XeDjcs99y0uwH8GWnHphEx6W2KV1mtHufXLw3 BsE0gy+z2FVI0h/Bos3rAW6kbdoOfweBYuWSpuCt4f6DjNyRS1uSR3jOgyXtQdvP0e7I eslg== X-Gm-Message-State: AN3rC/7R5b1Y0uOnlp8KpxvoYPx3elAJH4eW67+aVZhQlSAy21xkKgZX gKcUQHtPeHwR+321 X-Received: by 10.55.105.129 with SMTP id e123mr4718615qkc.184.1492643674565; Wed, 19 Apr 2017 16:14:34 -0700 (PDT) Received: from localhost.localdomain (cpe-74-71-114-159.nyc.res.rr.com. [74.71.114.159]) by smtp.gmail.com with ESMTPSA id 123sm2951916qkm.22.2017.04.19.16.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 16:14:34 -0700 (PDT) From: Devin Heitmueller To: linux-media@vger.kernel.org Cc: Devin Heitmueller Subject: [PATCH 09/12] xc5000: Don't spin waiting for analog lock Date: Wed, 19 Apr 2017 19:13:52 -0400 Message-Id: <1492643635-30823-10-git-send-email-dheitmueller@kernellabs.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492643635-30823-1-git-send-email-dheitmueller@kernellabs.com> References: <1492643635-30823-1-git-send-email-dheitmueller@kernellabs.com> 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: 2017.4.19.230617 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_SIGNATURE 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, REFERENCES 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_MEDIA_BODY 0, __FROM_DOMAIN_IN_ANY_CC2 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_LIST_ID 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' The xc5000 driver should not be spinning waiting for an analog lock. The ioctl() should be returning immediately and the application is responsible for polling for lock status. This behavior isn't very visible in cases where you tune to a valid channel, since lock is usually achieved much faster than 400ms. However it is highly visible where doing things like changing video standards, which sends tuning request for a frequency that is almost never going to have an actual channel on it. Also fixup the return values to treat zero as success and an actual error code on error (to be consistent with other functions). Note this change has no practical effect at this time as none of the callers inspect the return value. Signed-off-by: Devin Heitmueller --- drivers/media/tuners/xc5000.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c index e823aaf..e144627 100644 --- a/drivers/media/tuners/xc5000.c +++ b/drivers/media/tuners/xc5000.c @@ -565,38 +565,16 @@ static int xc_get_totalgain(struct xc5000_priv *priv, u16 *totalgain) return xc5000_readreg(priv, XREG_TOTALGAIN, totalgain); } -static u16 wait_for_lock(struct xc5000_priv *priv) -{ - u16 lock_state = 0; - int watch_dog_count = 40; - - while ((lock_state == 0) && (watch_dog_count > 0)) { - xc_get_lock_status(priv, &lock_state); - if (lock_state != 1) { - msleep(5); - watch_dog_count--; - } - } - return lock_state; -} - #define XC_TUNE_ANALOG 0 #define XC_TUNE_DIGITAL 1 static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) { - int found = 0; - dprintk(1, "%s(%u)\n", __func__, freq_hz); if (xc_set_rf_frequency(priv, freq_hz) != 0) - return 0; - - if (mode == XC_TUNE_ANALOG) { - if (wait_for_lock(priv) == 1) - found = 1; - } + return -EREMOTEIO; - return found; + return 0; } static int xc_set_xtal(struct dvb_frontend *fe)