Skip to contentSkip to conversation

net: hisilicon: hns: Replace mdelay() with msleep()

PATCH Applied Jia-Ju Bai 2 participants 2 messages Jul 27, 2018

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 net: hisilicon: hns: Replace mdelay() with msleep()

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.

---
 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(-)
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c +2 -2
index 93e71e27401b..866e4cec423d 100644
@@ -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) {
drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c +2 -2
index 51e7e9f5af49..fbccd1fd94b0 100644
@@ -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);
 
Signature · 1 line
2.17.0
maintainer Applied
#1 lore raw

From: Jia-Ju Bai <[email protected]>
Date: Fri, 27 Jul 2018 16:01:41 +0800

Quoted 8 lines

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.

Applied.