--- linux/drivers/net/pcmcia/3c574_cs.c.old Fri Nov 22 23:20:59 2002
+++ linux/drivers/net/pcmcia/3c574_cs.c Sat Dec 28 19:53:10 2002
@@ -96,9 +96,12 @@
#include <asm/io.h>
#include <asm/system.h>
#include <asm/bitops.h>
+#include <linux/spinlock.h>
/*====================================================================*/
+static spinlock_t 3c574_cs_lock = SPIN_LOCK_UNLOCKED;
+
/* Module parameters */
MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
@@ -1043,13 +1046,12 @@
return;
}
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&3c574_cs_lock, flags);
EL3WINDOW(4);
media = mdio_read(ioaddr, lp->phys, 1);
partner = mdio_read(ioaddr, lp->phys, 5);
EL3WINDOW(1);
- restore_flags(flags);
+ spin_unlock_irqrestore(&3c574_cs_lock, flags);
if (media != lp->media_status) {
if ((media ^ lp->media_status) & 0x0004)
@@ -1232,31 +1234,29 @@
case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
{
int saved_window;
- unsigned long flags;
+ unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&3c574_cs_lock, flags);
saved_window = inw(ioaddr + EL3_CMD) >> 13;
EL3WINDOW(4);
data[3] = mdio_read(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
EL3WINDOW(saved_window);
- restore_flags(flags);
+ spin_unlock_irqrestore(&3c574_cs_lock,flags);
return 0;
}
case SIOCDEVPRIVATE+2: /* Write the specified MII register */
{
int saved_window;
- unsigned long flags;
+ unsigned long flags;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&3c574_cs_lock, flags);
saved_window = inw(ioaddr + EL3_CMD) >> 13;
EL3WINDOW(4);
mdio_write(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2]);
EL3WINDOW(saved_window);
- restore_flags(flags);
+ spin_unlock_irqrestore(&3c574_cs_lock, flags);
return 0;
}
default:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/