Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp848962imm; Fri, 11 May 2018 07:19:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYLvaNdeEK48DRjLi/f9XnbZUwA6yGqj6l8tOHWnNK8SQ/mGotP0jMZ0kWB6GqB/JTR7/Z X-Received: by 2002:a62:6e88:: with SMTP id j130-v6mr5656241pfc.111.1526048356597; Fri, 11 May 2018 07:19:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526048356; cv=none; d=google.com; s=arc-20160816; b=CKsfPtPKW20N+9N4AU0Ty+k9zwAteU3fYfZpZbNuFe1F5hfjRoTqaZhwrIvkRA0GJv Aisms6g0sXIVr8xCm3rkYApw/QkhrZ3GxWzUO+dr+fo/aqIhyx+Wu6SQEIOJNntZnZtk NgK6ZcJIIVijs1DtaBa8f3KBM5llts830ARLD7Og4QoHNsSQieliMxGvgWOuKTmihFFx Ob+jtNS/Btvfe148yxtKfC/gG/89yYuuKbHXBf1828Wb3I5kbsVoY52/bYCH6pPMakxX Vgf2NhKbiSLhKHFeoU6RmuwA2l93RlhjPwdvxuMPnDNk4dmiA2jAxaG5ETKrmi3nIRuu Qfng== 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=Ixx6k77Sc6HW82sANBYmXUTHoO+Pl6T31aQn5a7UievubX/vu9RXSlECueyU4f8kLv eT30mxWm5wULAvp7RRWo7liSKBDnIAq4Ifpg/uL3/+HG17TosJY0VVd2AiiLlGqQE1T5 toBcwrchUYxMLWAIWmEdVXdAwpmdn+tym+BnrGz4lIBIhPxZj2S3EhstniRPt7zDpaa2 be496h1ErRFEwXzYPMOBTXj6j24AZNgS8A1uviaOm0u6bhQZMYZp67lfdLYV1afewtPR fRRmyOnWxZNr8DNT37Lu5QNptSLaTn9fnDVEyKhyDu4KobY/YYqtOe8CSKeD1Hj3NkTg Tb2w== 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 136-v6si2775441pgh.114.2018.05.11.07.19.02; Fri, 11 May 2018 07:19:16 -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 S1753193AbeEKOSq (ORCPT + 99 others); Fri, 11 May 2018 10:18:46 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:42160 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753137AbeEKOSn (ORCPT ); Fri, 11 May 2018 10:18:43 -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 271501596; Fri, 11 May 2018 07:18:43 -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 A19803F577; Fri, 11 May 2018 07:18:41 -0700 (PDT) Date: Fri, 11 May 2018 15:18:36 +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: <20180511141836.GA29104@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 >