[PATCH][2.5.37] smc91c92_cs cli fix

Zwane Mwaikambo (zwane@linuxpower.ca)
Sat, 21 Sep 2002 08:04:09 +0200 (SAST)


Patch to make smc useable (tested), although looking around the driver
(and pcmcia cs in general) needs a bit more to be smp safe anyway.

Zwane

Index: linux-2.5.37/drivers/net/pcmcia/smc91c92_cs.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.37/drivers/net/pcmcia/smc91c92_cs.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smc91c92_cs.c
--- linux-2.5.37/drivers/net/pcmcia/smc91c92_cs.c 20 Sep 2002 18:13:10 -0000 1.1.1.1
+++ linux-2.5.37/drivers/net/pcmcia/smc91c92_cs.c 21 Sep 2002 01:16:31 -0000
@@ -109,6 +109,7 @@
struct smc_private {
dev_link_t link;
struct net_device dev;
+ spinlock_t lock;
u_short manfid;
u_short cardid;
struct net_device_stats stats;
@@ -346,7 +347,7 @@
if (!smc) return NULL;
memset(smc, 0, sizeof(struct smc_private));
link = &smc->link; dev = &smc->dev;
-
+ spin_lock_init(&smc->lock);
link->release.function = &smc91c92_release;
link->release.data = (u_long)link;
link->io.NumPorts1 = 16;
@@ -1777,6 +1778,7 @@
static void set_rx_mode(struct net_device *dev)
{
ioaddr_t ioaddr = dev->base_addr;
+ struct smc_private *smc = dev->priv;
u_int multicast_table[ 2 ] = { 0, };
unsigned long flags;
u_short rx_cfg_setting;
@@ -1795,16 +1797,15 @@
}

/* Load MC table and Rx setting into the chip without interrupts. */
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&smc->lock, flags);
SMC_SELECT_BANK(3);
outl(multicast_table[0], ioaddr + MULTICAST0);
outl(multicast_table[1], ioaddr + MULTICAST4);
SMC_SELECT_BANK(0);
outw(rx_cfg_setting, ioaddr + RCR);
SMC_SELECT_BANK(2);
- restore_flags(flags);
-
+ spin_unlock_irqrestore(&smc->lock, flags);
+
return;
}

-- 
function.linuxpower.ca

- 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/