Received: by 10.192.165.148 with SMTP id m20csp239103imm; Fri, 4 May 2018 09:31:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNcPnuGQ9CGL+WIfNkG7YGEjoyYMIgY/v/QN0yic2JiSpP9OVNjjeBzDD1tsW89nt2RqIq X-Received: by 2002:a17:902:9898:: with SMTP id s24-v6mr28452170plp.51.1525451482880; Fri, 04 May 2018 09:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525451482; cv=none; d=google.com; s=arc-20160816; b=D2IPXgr7ZpGcTng/a7volsnksc0wXT0idKmoWLHAgJ6leuBoBdE2Q8UmKIoYmPKZFr bMz1tw0ebQcK3H8AAtJNjtSZLRwrzlvRrcfhw7EK0zXLmBBROxTdqGGA2HDPFjafAeHp BbDS9KMm/OZvXMewBkzlwpbCEqjOYqxnkksVolFzVts9NSK6ud18Z0kbwU6VNhdVuNrJ rL03UwMe2WRIc0pAWIpgvGK6t5K6Tn8qWTEKxgcql3Pxoxt9Q51D+28sYYGihvg26tx0 BFJ0VmrM7d6Ta36pBeQfIgHED8tw4zEjY3SRzmviCEv7JN77w644KrdVfetC12YxNjYw oL3g== 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=ndlblKnpHFXt4Gl+k6by7lbV2fre3PUWdi0SHqwt/Ak=; b=hvyOjmEK1edqC5iGULRNcOT8/oSTlh7UPrKCVuigIrDkwbsnTTOshQOYG7nDJ6aBVd oomjTwIv/KRJxrISC7pT/Zx+47zSkEIrp729HL8oxbyGasOWuug18bdsrjHLfH1tWGd/ +LJTNVKiSsAeAjo+efBau14TGI+qF5QPPNIsgTZ6X5P8RTl1L90s7tuvK0ZX+SmpGWWV 2m93H/BJuhvTG8tbFsMGtqPi18WYPBI5DJ0Gtj7DKbX2ZHcCqqbYLW0P9F3QPS0n4Nmd aVT9rSVilHiw6snl/YqzHX8Xbh485uqTLW1X0U4RQbxGYXg1Vxd3jTsngP20NJMllDTa MkGg== 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 r24-v6si13889076pgu.402.2018.05.04.09.31.08; Fri, 04 May 2018 09:31:22 -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 S1751622AbeEDQ3k (ORCPT + 99 others); Fri, 4 May 2018 12:29:40 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56462 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbeEDQ3j (ORCPT ); Fri, 4 May 2018 12:29:39 -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 734F51435; Fri, 4 May 2018 09:29:39 -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 EEFF63F487; Fri, 4 May 2018 09:29:37 -0700 (PDT) Date: Fri, 4 May 2018 17:29:32 +0100 From: Lorenzo Pieralisi To: Jia-Ju Bai , kishon@ti.com Cc: 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: <20180504162932.GA16953@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(-) I'd request Kishon's ACK on this. 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 >