--- zzzz-none-000/linux-2.4.17/drivers/net/wireless/hermes.c 2001-10-09 22:13:03.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/drivers/net/wireless/hermes.c 2004-11-24 13:23:27.000000000 +0000 @@ -75,9 +75,9 @@ #include #define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ 0x%x: " , hw->iobase); \ - printk(#stuff);} while (0) + printk(stuff);} while (0) -#define DEBUG(lvl, stuff...) if ( (lvl) <= HERMES_DEBUG) DMSG(#stuff) +#define DEBUG(lvl, stuff...) if ( (lvl) <= HERMES_DEBUG) DMSG(stuff) #else /* ! HERMES_DEBUG */ @@ -98,10 +98,17 @@ */ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0) { + int k = CMD_BUSY_TIMEOUT; u16 reg; - /* First check that the command register is not busy */ + /* First wait for the command register to unbusy */ reg = hermes_read_regn(hw, CMD); + while ( (reg % HERMES_CMD_BUSY) && k ) { + k--; + udelay(1); + reg = hermes_read_regn(hw, CMD); + } + DEBUG(3, "hermes_issue_cmd: did %d retries.\n", CMD_BUSY_TIMEOUT-k); if (reg & HERMES_CMD_BUSY) { return -EBUSY; } @@ -223,8 +230,8 @@ hw->iobase); err = -ENODEV; } else - printk(KERN_ERR "hermes @ 0x%x: CMD register busy in hermes_issue_command().\n", - hw->iobase); + printk(KERN_ERR "hermes @ 0x%x: Error %d issuing command.\n", + hw->iobase, err); goto out; } @@ -325,7 +332,7 @@ k = BAP_BUSY_TIMEOUT; reg = hermes_read_reg(hw, oreg); - while ((reg & HERMES_OFFSET_BUSY) & k) { + while ((reg & HERMES_OFFSET_BUSY) && k) { k--; udelay(1); reg = hermes_read_reg(hw, oreg);