* [PATCH 1/2] net: can: sja1000: Replace mdelay with usleep_range in peak_pci_probe
@ 2018-04-11 1:42 Jia-Ju Bai
2018-04-25 14:53 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-04-11 1:42 UTC (permalink / raw)
To: wg, mkl; +Cc: linux-can, netdev, linux-kernel, Jia-Ju Bai
peak_pci_probe() is never called in atomic context.
peak_pci_probe() is set as ".probe" in struct pci_driver.
Despite never getting called from atomic context, peak_pci_probe()
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/net/can/sja1000/peak_pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index 131026f..48cf821 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -608,7 +608,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
writeb(0x00, cfg_base + PITA_GPIOICR);
/* Toggle reset */
writeb(0x05, cfg_base + PITA_MISC + 3);
- mdelay(5);
+ usleep_range(5000, 6000);
/* Leave parport mux mode */
writeb(0x04, cfg_base + PITA_MISC + 3);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] net: can: sja1000: Replace mdelay with usleep_range in peak_pci_probe
2018-04-11 1:42 [PATCH 1/2] net: can: sja1000: Replace mdelay with usleep_range in peak_pci_probe Jia-Ju Bai
@ 2018-04-25 14:53 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2018-04-25 14:53 UTC (permalink / raw)
To: Jia-Ju Bai, wg; +Cc: linux-can, netdev, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 856 bytes --]
On 04/11/2018 03:42 AM, Jia-Ju Bai wrote:
> peak_pci_probe() is never called in atomic context.
>
> peak_pci_probe() is set as ".probe" in struct pci_driver.
>
> Despite never getting called from atomic context, peak_pci_probe()
> 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>
Applied both to linux-can-next.
tnx,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-25 14:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 1:42 [PATCH 1/2] net: can: sja1000: Replace mdelay with usleep_range in peak_pci_probe Jia-Ju Bai
2018-04-25 14:53 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).