Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=89c8b0e6cd3859a6445398c5aa94ebd21d0e64ce
Commit:     89c8b0e6cd3859a6445398c5aa94ebd21d0e64ce
Parent:     7da998591798ea52938d8482b52ae3f854f14359
Author:     Ben Dooks <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 5 00:02:07 2008 +0000
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Mon Feb 11 11:06:26 2008 -0500

    DM9000: Do not sleep with spinlock and IRQs held
    
    The phy read and write routines call udelay() with the board
    lock held, and with the posibility of IRQs being disabled. Since
    these delays can be up to 500usec, and are only required as we
    have to save the chip's address register.
    
    To improve the behaviour, hold the lock whilst we are writing
    and then restore the state before the delay and then repeat
    the process once the delay has happened.
    
    Signed-off-by: Ben Dooks <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/dm9000.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 709fd67..071aad1 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -1127,7 +1127,15 @@ dm9000_phy_read(struct net_device *dev, int 
phy_reg_unused, int reg)
        iow(db, DM9000_EPAR, DM9000_PHY | reg);
 
        iow(db, DM9000_EPCR, 0xc);      /* Issue phyxcer read command */
+
+       writeb(reg_save, db->io_addr);
+       spin_unlock_irqrestore(&db->lock,flags);
+
        udelay(100);            /* Wait read complete */
+
+       spin_lock_irqsave(&db->lock,flags);
+       reg_save = readb(db->io_addr);
+
        iow(db, DM9000_EPCR, 0x0);      /* Clear phyxcer read command */
 
        /* The read data keeps on REG_0D & REG_0E */
@@ -1135,7 +1143,6 @@ dm9000_phy_read(struct net_device *dev, int 
phy_reg_unused, int reg)
 
        /* restore the previous address */
        writeb(reg_save, db->io_addr);
-
        spin_unlock_irqrestore(&db->lock,flags);
 
        return ret;
@@ -1164,7 +1171,15 @@ dm9000_phy_write(struct net_device *dev, int 
phyaddr_unused, int reg, int value)
        iow(db, DM9000_EPDRH, ((value >> 8) & 0xff));
 
        iow(db, DM9000_EPCR, 0xa);      /* Issue phyxcer write command */
+
+       writeb(reg_save, db->io_addr);
+       spin_unlock_irqrestore(&db->lock,flags);
+
        udelay(500);            /* Wait write complete */
+
+       spin_lock_irqsave(&db->lock,flags);
+       reg_save = readb(db->io_addr);
+
        iow(db, DM9000_EPCR, 0x0);      /* Clear phyxcer write command */
 
        /* restore the previous address */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to