diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 65077c77082a2f042117a0889c2b15099c58eae5..4ef653ae8564c6d2a5120cdaef12db1e1b218b39 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c @@ -229,19 +229,22 @@ static inline void PRINT_PKT(u_char *buf, int length) { } * if at all, but let's avoid deadlocking the system if the hardware * decides to go south. */ -#define SMC_WAIT_MMU_BUSY(lp) do { \ - if (unlikely(SMC_GET_MMU_CMD(lp) & MC_BUSY)) { \ - unsigned long timeout = jiffies + 2; \ - while (SMC_GET_MMU_CMD(lp) & MC_BUSY) { \ - if (time_after(jiffies, timeout)) { \ - netdev_dbg(dev, "timeout %s line %d\n", \ - __FILE__, __LINE__); \ - break; \ - } \ - cpu_relax(); \ - } \ - } \ -} while (0) +static void SMC_WAIT_MMU_BUSY(struct smc_local *lp) +{ + unsigned long timeout = jiffies + 2; + unsigned int count = 10000; + + while (SMC_GET_MMU_CMD(lp) & MC_BUSY) { + count--; + if (!count || time_after(jiffies, timeout)) { + netdev_dbg(lp->dev, "timeout %s line %d\n", + __FILE__, __LINE__); + break; + } + /* TODO : investigate using cond_resched() from allowed contexts */ + cpu_relax(); + } +} /*