From: Brandon Niemczyk <[EMAIL PROTECTED]>

replaces calls to save_flags(); cli() with spinlocks, it also makes
some global variables that aren't used anywhere or declared in a
header static.

Signed-off-by: Brandon Niemczyk <[EMAIL PROTECTED]>
Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>

---
 fec.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

Index: quilt/drivers/net/fec.c
===================================================================
--- quilt.orig/drivers/net/fec.c
+++ quilt/drivers/net/fec.c
@@ -237,10 +237,11 @@ typedef struct mii_list {
 } mii_list_t;
 
 #define                NMII    20
-mii_list_t     mii_cmds[NMII];
-mii_list_t     *mii_free;
-mii_list_t     *mii_head;
-mii_list_t     *mii_tail;
+static mii_list_t      mii_cmds[NMII];
+static mii_list_t      *mii_free;
+static mii_list_t      *mii_head;
+static mii_list_t      *mii_tail;
+static DEFINE_SPINLOCK(mii_lock);
 
 static int     mii_queue(struct net_device *dev, int request, 
                                void (*func)(uint, struct net_device *));
@@ -679,10 +680,13 @@ fec_enet_mii(struct net_device *dev)
        volatile fec_t  *ep;
        mii_list_t      *mip;
        uint            mii_reg;
+       unsigned long   flags;
 
        fep = netdev_priv(dev);
        ep = fep->hwp;
        mii_reg = ep->fec_mii_data;
+
+       spin_lock_irqsave(&mii_lock, flags);
        
        if ((mip = mii_head) == NULL) {
                printk("MII and no head!\n");
@@ -698,6 +702,8 @@ fec_enet_mii(struct net_device *dev)
 
        if ((mip = mii_head) != NULL)
                ep->fec_mii_data = mip->mii_regval;
+
+       spin_unlock_irqrestore(&mii_lock, flags);
 }
 
 static int
@@ -715,8 +721,7 @@ mii_queue(struct net_device *dev, int re
 
        retval = 0;
 
-       save_flags(flags);
-       cli();
+       spin_lock_irqsave(&mii_lock, flags);
 
        if ((mip = mii_free) != NULL) {
                mii_free = mip->mii_next;
@@ -736,7 +741,7 @@ mii_queue(struct net_device *dev, int re
                retval = 1;
        }
 
-       restore_flags(flags);
+       spin_unlock_irqrestore(&mii_lock, flags);
 
        return(retval);
 }

--
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to