Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1883964pxk; Tue, 1 Sep 2020 10:00:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySlQuZHWM7KrgWxU+wOjBf6gHhvFTEgttZKzSxEwcDd9llkZxmSJyP6aSPlj9eTmGmmpOD X-Received: by 2002:aa7:cf93:: with SMTP id z19mr2684302edx.187.1598979603037; Tue, 01 Sep 2020 10:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598979603; cv=none; d=google.com; s=arc-20160816; b=XjKS/sBrKKwTwPwcI+6CaKkE4rD8NKq+oj+GhPniH4QtpAdKANmJ7DjFSAEl9Xu/ad cSYwh0m+ePafnWdMoyzQDTZZzwbR5PH2RMHXTw+qD+mvMFjLlY89HaYQqd1woGJvSKbv GwWIhsG3g+JAELxe015rdKMAbiJyDd6TP3agCvvCVY5kngN7kPxbne1Hg298FhheoFRO Jgaaftoy5cvTilXozxj+pBYS9JU38Y/xG0dVBzZYU+zWZ3TmXU5NPshmYd/Mzx+YBvZC jWFCYNBQ7ME+BICeM+QkqE/RnywaiLEhNBYSHzgRVCVJoV1b7qE+UYgGndZWQXF0GEvp CBLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=csssUCebWZ2xBwLe5cTW/RHe3Qj4HcY5UZ//cy8fJJ8=; b=XAP8e/i0WQyF3TIK2jAhRllrcnvqhz1nJ1ULYUszef/f+CZ+hApza858WGe9oo2IGC qB6OI9CWB+gYLEP74Jhp2aBOk9HWbJH24npAfnBt5wFAWmGaMRjtU82LDbPhRN/w+hFE wiuRGPYXBxgukjICM+Px9OY3VM1ZXPHpVu50nNKdG2tnzo77bM/HkidDeAFzfW8ruvj4 8YzSEvNq298jG+tItYUBQ8GwsHxGwIN6bccR/lD+/xsEI+/BByVS0p2pZdxdIMjcEIfZ SVvwt57nOZJA0olXMqpsCDP4fRhOa1nYdVzrjLYjBvLsyxguY5NTftS1M0LzBgyIS4SZ 41FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jk5CdyFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si891549ejx.745.2020.09.01.09.59.39; Tue, 01 Sep 2020 10:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jk5CdyFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729912AbgIAQ52 (ORCPT + 99 others); Tue, 1 Sep 2020 12:57:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:46430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729646AbgIAPXY (ORCPT ); Tue, 1 Sep 2020 11:23:24 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E400020FC3; Tue, 1 Sep 2020 15:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973804; bh=m5M8Awz22GmrEwV0BJ4+h7A02qBUcB/cu5vWpcC9nPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jk5CdyFDZopav0xqTwwPD/kCj0Hy01R/AIQ0YaDVgwlG1sc4C4UBiw58GHhAx6X06 8AzYNn0mspMltnDZy0L7L09OLrcRs7zbVjzNampBu6MD9OU2PMvX65H53O7v3TrZws Tzg1HsgLKrCOrAFHHKnPGtqSFrDFPylno3HGORVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 053/125] media: gpio-ir-tx: improve precision of transmitted signal due to scheduling Date: Tue, 1 Sep 2020 17:10:08 +0200 Message-Id: <20200901150937.150292200@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150934.576210879@linuxfoundation.org> References: <20200901150934.576210879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Young [ Upstream commit ea8912b788f8144e7d32ee61e5ccba45424bef83 ] usleep_range() may take longer than the max argument due to scheduling, especially under load. This is causing random errors in the transmitted IR. Remove the usleep_range() in favour of busy-looping with udelay(). Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/rc/gpio-ir-tx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c index cd476cab97820..4e70b67ccd181 100644 --- a/drivers/media/rc/gpio-ir-tx.c +++ b/drivers/media/rc/gpio-ir-tx.c @@ -87,13 +87,8 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf, // space edge = ktime_add_us(edge, txbuf[i]); delta = ktime_us_delta(edge, ktime_get()); - if (delta > 10) { - spin_unlock_irqrestore(&gpio_ir->lock, flags); - usleep_range(delta, delta + 10); - spin_lock_irqsave(&gpio_ir->lock, flags); - } else if (delta > 0) { + if (delta > 0) udelay(delta); - } } else { // pulse ktime_t last = ktime_add_us(edge, txbuf[i]); -- 2.25.1