From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
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
Date: Tue, 8 May 2018 11:53:57 +0100 [thread overview]
Message-ID: <20180508105357.GA9394@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <1523365446-31563-1-git-send-email-baijiaju1990@gmail.com>
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 <baijiaju1990@gmail.com>
> ---
> 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
>
next prev parent reply other threads:[~2018-05-08 10:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 13:04 Jia-Ju Bai
2018-05-04 16:29 ` Lorenzo Pieralisi
2018-05-05 10:03 ` Kishon Vijay Abraham I
2018-05-08 10:53 ` Lorenzo Pieralisi [this message]
2018-05-11 14:18 ` Lorenzo Pieralisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180508105357.GA9394@e107981-ln.cambridge.arm.com \
--to=lorenzo.pieralisi@arm.com \
--cc=baijiaju1990@gmail.com \
--cc=bhelgaas@google.com \
--cc=john@metanate.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=shawn.lin@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®