[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1539689240-11526-2-git-send-email-sunil.kovvuri@gmail.com>
Date: Tue, 16 Oct 2018 16:57:05 +0530
From: sunil.kovvuri@...il.com
To: netdev@...r.kernel.org, davem@...emloft.net
Cc: arnd@...db.de, linux-soc@...r.kernel.org,
Sunil Goutham <sgoutham@...vell.com>
Subject: [PATCH 01/16] octeontx2-af: Improve register polling loop
From: Sunil Goutham <sgoutham@...vell.com>
Instead of looping on a integer timeout, use time_before(jiffies),
so that maximum poll time is capped.
Signed-off-by: Sunil Goutham <sgoutham@...vell.com>
Suggested-by: Arnd Bergmann <arnd@...db.de>
---
drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 2033f42..7cf5865 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -47,18 +47,18 @@ MODULE_DEVICE_TABLE(pci, rvu_id_table);
*/
int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
{
+ unsigned long timeout = jiffies + usecs_to_jiffies(100);
void __iomem *reg;
- int timeout = 100;
u64 reg_val;
reg = rvu->afreg_base + ((block << 28) | offset);
- while (timeout) {
+ while (time_before(jiffies, timeout)) {
reg_val = readq(reg);
if (zero && !(reg_val & mask))
return 0;
if (!zero && (reg_val & mask))
return 0;
- usleep_range(1, 2);
+ usleep_range(1, 5);
timeout--;
}
return -EBUSY;
--
2.7.4
Powered by blists - more mailing lists