Received: by 10.192.165.148 with SMTP id m20csp4149519imm; Tue, 8 May 2018 03:55:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrIgNMJ8tbnv2hlWv0ZW4ypcWW3t/saCZUTOWxeWgfc55Ul21EtJT5r0H7wbRjXfP576dNv X-Received: by 10.98.163.145 with SMTP id q17mr39828085pfl.87.1525776944013; Tue, 08 May 2018 03:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525776943; cv=none; d=google.com; s=arc-20160816; b=YXbAp8YsofdMekGnqIfm+vhA+KqNCDg28LvPpCwfMGf7svnWiGR9WbMUysBVriKnlM xdl3lIF8Jqrcst2X9E/DY9ExTwESkTcuLQwXYtW55cvivzkhoPYqAVM2pM8XQOfAw0Rl aqcew4EpmSeYRwDGxGi94mmlnflQX5e9z5i7iS7XUnQfyPa+2Zmcm58twbVVa0p8ZuXG h3v5x0W+Agfo1G8xca2jptKYbNt1vOY0kSP1M9DF+e8v9N0emstB838K2wXFebs6Zpmi auSb0YLTUmhekVoSIdHyIJaYPGF9qBJXUFiPlrRtk1FR4YtUXdEV9TtEroiBYDvtN5EE djEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=O7XDpzkbAAd4Ryl3gm5WXXIN5cQLa7vs3b8VSaJKrVw=; b=qcnb3IMw3NRp3eJ4ag5IgM9FYHTZutSScKpxUeOpFFirz7ViKYCHQx2QRRkqBAoWry Bk2K6oaa1xBQgP2EmygHmyLNvj05Z4YdXGIfZWdATdmOAe7tH+QA5EKhzkm0ov99Y8yB WAYQc966FscVP7dtNfm33c6juSlVi6D/6408bWH5K7brAFYTV15vHfuGTZICI3RW1dVw r7/iMaXNqQXMf/N4pjP1yz/gqD/hwukZU25tnDqMWxNFFvbW5h595aod1BhOFQoJWg37 xoY7lbnTrAE89ZSvGWAiQkjsedozGdllQ5ifbRbJTkSNyFyZI9PVJ3q2hLE57s2iH+C5 wUzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si24908438pfh.215.2018.05.08.03.55.29; Tue, 08 May 2018 03:55:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752145AbeEHKyF (ORCPT + 99 others); Tue, 8 May 2018 06:54:05 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56132 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbeEHKyD (ORCPT ); Tue, 8 May 2018 06:54:03 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8E0B01529; Tue, 8 May 2018 03:54:03 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 155F13F592; Tue, 8 May 2018 03:54:01 -0700 (PDT) Date: Tue, 8 May 2018 11:53:57 +0100 From: Lorenzo Pieralisi To: Jia-Ju Bai Cc: kishon@ti.com, bhelgaas@google.com, nsekhar@ti.com, john@metanate.com, shawn.lin@rock-chips.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write Message-ID: <20180508105357.GA9394@e107981-ln.cambridge.arm.com> References: <1523365446-31563-1-git-send-email-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523365446-31563-1-git-send-email-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 10, 2018 at 09:04:06PM +0800, Jia-Ju Bai wrote: > pci_epf_test_write() is never called in atomic context. > > The call chain ending up at pci_epf_test_write() is: > [1] pci_epf_test_write() <- pci_epf_test_cmd_handler() > > pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK() > in pci_epf_test_probe(). > This function is not called in atomic context. > > Despite never getting called from atomic context, pci_epf_test_write() > calls mdelay() to busily wait. > This is not necessary and can be replaced with usleep_range() to > avoid busy waiting. > > This is found by a static analysis tool named DCNS written by myself. > And I also manually check it. > > Signed-off-by: Jia-Ju Bai > --- > drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied to pci/endpoint for v4.18, thanks. Lorenzo > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c > index f9308c2..2f0642e 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) > * wait 1ms inorder for the write to complete. Without this delay L3 > * error in observed in the host system. > */ > - mdelay(1); > + usleep_range(1000, 2000); > > kfree(buf); > > -- > 1.9.1 >