* [PATCH] net: hisilicon: hns: Replace mdelay() with msleep()
@ 2018-07-27 8:01 Jia-Ju Bai
2018-07-27 21:12 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-07-27 8:01 UTC (permalink / raw)
To: yisen.zhuang, salil.mehta, davem, linyunsheng, joe, pombredanne,
bianpan2016, shenjian15, keescook
Cc: netdev, linux-kernel, Jia-Ju Bai
hns_ppe_common_init_hw() and hns_xgmac_init() are never
called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | 4 ++--
drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
index 93e71e27401b..866e4cec423d 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
@@ -203,9 +203,9 @@ static int hns_ppe_common_init_hw(struct ppe_common_cb *ppe_common)
enum dsaf_mode dsaf_mode = dsaf_dev->dsaf_mode;
dsaf_dev->misc_op->ppe_comm_srst(dsaf_dev, 0);
- mdelay(100);
+ msleep(100);
dsaf_dev->misc_op->ppe_comm_srst(dsaf_dev, 1);
- mdelay(100);
+ msleep(100);
if (ppe_common->ppe_mode == PPE_COMMON_MODE_SERVICE) {
switch (dsaf_mode) {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
index 51e7e9f5af49..fbccd1fd94b0 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
@@ -215,10 +215,10 @@ static void hns_xgmac_init(void *mac_drv)
u32 port = drv->mac_id;
dsaf_dev->misc_op->xge_srst(dsaf_dev, port, 0);
- mdelay(100);
+ msleep(100);
dsaf_dev->misc_op->xge_srst(dsaf_dev, port, 1);
- mdelay(100);
+ msleep(100);
hns_xgmac_lf_rf_control_init(drv);
hns_xgmac_exc_irq_en(drv, 0);
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: hisilicon: hns: Replace mdelay() with msleep()
2018-07-27 8:01 [PATCH] net: hisilicon: hns: Replace mdelay() with msleep() Jia-Ju Bai
@ 2018-07-27 21:12 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-27 21:12 UTC (permalink / raw)
To: baijiaju1990
Cc: yisen.zhuang, salil.mehta, linyunsheng, joe, pombredanne,
bianpan2016, shenjian15, keescook, netdev, linux-kernel
From: Jia-Ju Bai <baijiaju1990@gmail.com>
Date: Fri, 27 Jul 2018 16:01:41 +0800
> hns_ppe_common_init_hw() and hns_xgmac_init() are never
> called in atomic context.
> They call mdelay() to busily wait, which is not necessary.
> mdelay() can be replaced with msleep().
>
> This is found by a static analysis tool named DCNS written by myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-27 21:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 8:01 [PATCH] net: hisilicon: hns: Replace mdelay() with msleep() Jia-Ju Bai
2018-07-27 21:12 ` David Miller
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).