Commit 7c99c33b authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move HiSax to spinlocks instead of cli()

Patches by Frank Davis.
parent 3f38cab9
......@@ -24,6 +24,7 @@ extern const char *CardType[];
const char *Asuscom_revision = "$Revision: 1.11.6.3 $";
static spinlock_t asuscom_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -46,13 +47,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&asuscom_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&asuscom_lock, flags);
return (ret);
}
......@@ -69,13 +69,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&asuscom_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&asuscom_lock, flags);
}
static inline void
......
......@@ -18,6 +18,7 @@
extern const char *CardType[];
static const char *avm_revision = "$Revision: 2.13.6.2 $";
static spinlock_t avm_a1_lock = SPIN_LOCK_UNLOCKED;
#define AVM_A1_STAT_ISAC 0x01
#define AVM_A1_STAT_HSCX 0x02
......@@ -179,7 +180,7 @@ setup_avm_a1(struct IsdnCard *card)
{
u_char val;
struct IsdnCardState *cs = card->cs;
long flags;
unsigned long flags;
char tmp[64];
strcpy(tmp, avm_revision);
......@@ -254,9 +255,8 @@ setup_avm_a1(struct IsdnCard *card)
release_ioregs(cs, 0x1f);
return (0);
}
save_flags(flags);
spin_lock_irqsave(&avm_a1_lock, flags);
byteout(cs->hw.avm.cfg_reg, 0x0);
sti();
HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg, 0x1);
HZDELAY(HZ / 5 + 1);
......@@ -269,7 +269,7 @@ setup_avm_a1(struct IsdnCard *card)
HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg, 0x0);
HZDELAY(HZ / 5 + 1);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1_lock, flags);
val = bytein(cs->hw.avm.cfg_reg);
printk(KERN_INFO "AVM A1: Byte at %x is %x\n",
......
......@@ -57,116 +57,109 @@
#define bytein(addr) inb(addr)
static const char *avm_revision = "$Revision: 2.7.6.2 $";
static spinlock_t avm_a1p_lock = SPIN_LOCK_UNLOCKED;
static inline u_char
ReadISAC(struct IsdnCardState *cs, u_char offset)
{
long flags;
unsigned long flags;
u_char ret;
offset -= 0x20;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_REG_OFFSET+offset);
ret = bytein(cs->hw.avm.cfg_reg+DATAREG_OFFSET);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
return ret;
}
static inline void
WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
{
long flags;
unsigned long flags;
offset -= 0x20;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_REG_OFFSET+offset);
byteout(cs->hw.avm.cfg_reg+DATAREG_OFFSET, value);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static inline void
ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_FIFO_OFFSET);
insb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static inline void
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_FIFO_OFFSET);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static inline u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{
u_char ret;
long flags;
unsigned long flags;
offset -= 0x20;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_REG_OFFSET+hscx*HSCX_CH_DIFF+offset);
ret = bytein(cs->hw.avm.cfg_reg+DATAREG_OFFSET);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
return ret;
}
static inline void
WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
{
long flags;
unsigned long flags;
offset -= 0x20;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_REG_OFFSET+hscx*HSCX_CH_DIFF+offset);
byteout(cs->hw.avm.cfg_reg+DATAREG_OFFSET, value);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static inline void
ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_FIFO_OFFSET+hscx*HSCX_CH_DIFF);
insb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static inline void
WriteHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_FIFO_OFFSET+hscx*HSCX_CH_DIFF);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
/*
......@@ -253,7 +246,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
{
u_char model, vers;
struct IsdnCardState *cs = card->cs;
long flags;
unsigned long flags;
char tmp[64];
......@@ -267,9 +260,8 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
cs->irq = card->para[0];
save_flags(flags);
spin_lock_irqsave(&avm_a1p_lock, flags);
outb(cs->hw.avm.cfg_reg+ASL1_OFFSET, ASL1_W_ENABLE_S0);
sti();
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
HZDELAY(HZ / 5 + 1);
......@@ -279,7 +271,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET, ASL0_W_TDISABLE|ASL0_W_TRESET);
restore_flags(flags);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
model = bytein(cs->hw.avm.cfg_reg+MODREG_OFFSET);
vers = bytein(cs->hw.avm.cfg_reg+VERREG_OFFSET);
......
......@@ -23,6 +23,7 @@
extern const char *CardType[];
static const char *avm_pci_rev = "$Revision: 1.22.6.6 $";
static spinlock_t avm_pci_lock = SPIN_LOCK_UNLOCKED;
#define AVM_FRITZ_PCI 1
#define AVM_FRITZ_PNP 2
......@@ -80,13 +81,12 @@ ReadISAC(struct IsdnCardState *cs, u_char offset)
{
register u_char idx = (offset > 0x2f) ? AVM_ISAC_REG_HIGH : AVM_ISAC_REG_LOW;
register u_char val;
register long flags;
register unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
val = inb(cs->hw.avm.isac + (offset & 0xf));
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
return (val);
}
......@@ -94,13 +94,12 @@ static void
WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
{
register u_char idx = (offset > 0x2f) ? AVM_ISAC_REG_HIGH : AVM_ISAC_REG_LOW;
register long flags;
register unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
outb(value, cs->hw.avm.isac + (offset & 0xf));
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
}
static void
......@@ -122,13 +121,12 @@ ReadHDLCPCI(struct IsdnCardState *cs, int chan, u_char offset)
{
register u_int idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register u_int val;
register long flags;
register unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
outl(idx, cs->hw.avm.cfg_reg + 4);
val = inl(cs->hw.avm.isac + offset);
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
return (val);
}
......@@ -136,13 +134,12 @@ static inline void
WriteHDLCPCI(struct IsdnCardState *cs, int chan, u_char offset, u_int value)
{
register u_int idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register long flags;
register unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
outl(idx, cs->hw.avm.cfg_reg + 4);
outl(value, cs->hw.avm.isac + offset);
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
}
static inline u_char
......@@ -150,13 +147,12 @@ ReadHDLCPnP(struct IsdnCardState *cs, int chan, u_char offset)
{
register u_char idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register u_char val;
register long flags;
register unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
val = inb(cs->hw.avm.isac + offset);
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
return (val);
}
......@@ -164,13 +160,12 @@ static inline void
WriteHDLCPnP(struct IsdnCardState *cs, int chan, u_char offset, u_char value)
{
register u_char idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register long flags;
register unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
outb(value, cs->hw.avm.isac + offset);
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
}
static u_char
......@@ -390,11 +385,10 @@ hdlc_fill_fifo(struct BCState *bcs)
static void
fill_hdlc(struct BCState *bcs)
{
long flags;
save_flags(flags);
cli();
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
hdlc_fill_fifo(bcs);
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
}
static inline void
......@@ -493,8 +487,7 @@ HDLC_irq_main(struct IsdnCardState *cs)
long flags;
struct BCState *bcs;
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
if (cs->subtyp == AVM_FRITZ_PCI) {
stat = ReadHDLCPCI(cs, 0, HDLC_STATUS);
} else {
......@@ -523,27 +516,26 @@ HDLC_irq_main(struct IsdnCardState *cs)
} else
HDLC_irq(bcs, stat);
}
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
}
void
hdlc_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
switch (pr) {
case (PH_DATA | REQUEST):
save_flags(flags);
cli();
spin_lock_irqsave(&avm_pci_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->hw.hdlc.count = 0;
restore_flags(flags);
spin_unlock_irqrestore(&avm_pci_lock, flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break;
......
......@@ -21,6 +21,7 @@
#include "bkm_ax.h"
extern const char *CardType[];
static spinlock_t bkm_a4t_lock = SPIN_LOCK_UNLOCKED;
const char *bkm_a4t_revision = "$Revision: 1.13.6.6 $";
......@@ -29,16 +30,15 @@ static inline u_char
readreg(unsigned int ale, unsigned long adr, u_char off)
{
register u_int ret;
long flags;
unsigned long flags;
unsigned int *po = (unsigned int *) adr; /* Postoffice */
save_flags(flags);
cli();
spin_lock_irqsave(&bkm_a4t_lock, flags);
*po = (GCS_2 | PO_WRITE | off);
__WAITI20__(po);
*po = (ale | PO_READ);
__WAITI20__(po);
ret = *po;
restore_flags(flags);
spin_unlock_irqrestore(&bkm_a4t_lock, flags);
return ((unsigned char) ret);
}
......@@ -56,15 +56,14 @@ readfifo(unsigned int ale, unsigned long adr, u_char off, u_char * data, int siz
static inline void
writereg(unsigned int ale, unsigned long adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
unsigned int *po = (unsigned int *) adr; /* Postoffice */
save_flags(flags);
cli();
spin_lock_irqsave(&bkm_a4t_lock, flags);
*po = (GCS_2 | PO_WRITE | off);
__WAITI20__(po);
*po = (ale | PO_WRITE | data);
__WAITI20__(po);
restore_flags(flags);
spin_unlock_irqrestore(&bkm_a4t_lock, flags);
}
......
......@@ -25,7 +25,7 @@
#define ATTEMPT_PCI_REMAPPING /* Required for PLX rev 1 */
extern const char *CardType[];
static spinlock_t bkm_a8_lock = SPIN_LOCK_UNLOCKED;
const char sct_quadro_revision[] = "$Revision: 1.14.6.7 $";
static const char *sct_quadro_subtypes[] =
......@@ -45,12 +45,11 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
save_flags(flags);
cli();
unsigned long flags;
spin_lock_irqsave(&bkm_a8_lock, flags);
wordout(ale, off);
ret = wordin(adr) & 0xFF;
restore_flags(flags);
spin_unlock_irqrestore(&bkm_a8_lock, flags);
return (ret);
}
......@@ -68,12 +67,11 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
save_flags(flags);
cli();
unsigned long flags;
spin_lock_irqsave(&bkm_a8_lock, flags);
wordout(ale, off);
wordout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&bkm_a8_lock, flags);
}
static inline void
......
......@@ -37,6 +37,7 @@ static void release_b_st(struct Channel *chanp);
static struct Fsm callcfsm;
static int chancount;
static spinlock_t callc_lock = SPIN_LOCK_UNLOCKED;
/* experimental REJECT after ALERTING for CALLBACK to beat the 4s delay */
#define ALERT_REJECT 0
......@@ -1803,8 +1804,7 @@ HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb)
return 0;
} else if (chanp->debug & 0x800)
link_debug(chanp, 1, "writebuf %d/%d/%d", len, chanp->bcs->tx_cnt,MAX_DATA_MEM);
save_flags(flags);
cli();
spin_lock_irqsave(&callc_lock, flags);
nskb = skb_clone(skb, GFP_ATOMIC);
if (nskb) {
nskb->truesize = nskb->len;
......@@ -1819,7 +1819,7 @@ HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb)
dev_kfree_skb(skb);
} else
len = 0;
restore_flags(flags);
spin_unlock_irqrestore(&callc_lock, flags);
}
return (len);
}
......@@ -99,6 +99,7 @@ const char *CardType[] = {
};
void HiSax_closecard(int cardnr);
static spinlock_t hisax_config_lock = SPIN_LOCK_UNLOCKED;
#ifdef CONFIG_HISAX_ELSA
#define DEFAULT_CARD ISDN_CTYPE_ELSA
......@@ -708,14 +709,13 @@ void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
{
/* if head == NULL the fmt contains the full info */
long flags;
unsigned long flags;
int count, i;
u_char *p;
isdn_ctrl ic;
int len;
save_flags(flags);
cli();
spin_lock_irqsave(&hisax_config_lock, flags);
p = tmpbuf;
if (head) {
p += jiftime(p, jiffies);
......@@ -732,13 +732,13 @@ void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
if (!cs) {
printk(KERN_WARNING "HiSax: No CardStatus for message %s",
p);
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
return;
}
if (len > HISAX_STATUS_BUFSIZE) {
printk(KERN_WARNING "HiSax: status overflow %d/%d\n",
len, HISAX_STATUS_BUFSIZE);
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
return;
}
count = len;
......@@ -767,7 +767,7 @@ void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
count++;
}
#endif
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
if (count) {
ic.command = ISDN_STAT_STAVAIL;
ic.driver = cs->myid;
......@@ -787,16 +787,15 @@ void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...)
int ll_run(struct IsdnCardState *cs, int addfeatures)
{
long flags;
unsigned long flags;
isdn_ctrl ic;
save_flags(flags);
cli();
spin_lock_irqsave(&hisax_config_lock, flags);
ic.driver = cs->myid;
ic.command = ISDN_STAT_RUN;
cs->iif.features |= addfeatures;
cs->iif.statcallb(&ic);
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
return 0;
}
......@@ -857,28 +856,26 @@ static void closecard(int cardnr)
static int __devinit init_card(struct IsdnCardState *cs)
{
int irq_cnt, cnt = 3;
long flags;
unsigned long flags;
if (!cs->irq)
return cs->cardmsg(cs, CARD_INIT, NULL);
save_flags(flags);
cli();
spin_lock_irqsave(&hisax_config_lock, flags);
irq_cnt = kstat_irqs(cs->irq);
printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
cs->irq, irq_cnt);
if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) {
printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
cs->irq);
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
return 1;
}
while (cnt) {
cs->cardmsg(cs, CARD_INIT, NULL);
sti();
set_current_state(TASK_UNINTERRUPTIBLE);
/* Timeout 10ms */
schedule_timeout((10 * HZ) / 1000);
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
printk(KERN_INFO "%s: IRQ %d count %d\n",
CardType[cs->typ], cs->irq, kstat_irqs(cs->irq));
if (kstat_irqs(cs->irq) == irq_cnt) {
......@@ -897,19 +894,18 @@ static int __devinit init_card(struct IsdnCardState *cs)
return 0;
}
}
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
return 3;
}
static int __devinit checkcard(int cardnr, char *id, int *busy_flag)
{
long flags;
unsigned long flags;
int ret = 0;
struct IsdnCard *card = cards + cardnr;
struct IsdnCardState *cs;
save_flags(flags);
cli();
spin_lock_irqsave(&hisax_config_lock, flags);
cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
if (!cs) {
printk(KERN_WARNING
......@@ -1216,7 +1212,7 @@ static int __devinit checkcard(int cardnr, char *id, int *busy_flag)
kfree(cs);
card->cs = NULL;
out:
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
return ret;
}
......@@ -1542,10 +1538,9 @@ static int __init HiSax_init(void)
static void __exit HiSax_exit(void)
{
int cardnr = nrcards - 1;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&hisax_config_lock, flags);
while (cardnr >= 0)
HiSax_closecard(cardnr--);
Isdnl1Free();
......@@ -1553,7 +1548,7 @@ static void __exit HiSax_exit(void)
Isdnl2Free();
Isdnl3Free();
CallcFree();
restore_flags(flags);
spin_unlock_irqrestore(&hisax_config_lock, flags);
printk(KERN_INFO "HiSax module removed\n");
}
......
......@@ -29,6 +29,7 @@
extern const char *CardType[];
const char *Diva_revision = "$Revision: 1.25.6.5 $";
static spinlock_t diva_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -85,13 +86,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&diva_lock, flags);
return (ret);
}
......@@ -108,13 +108,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&diva_lock, flags);
}
static inline void
......@@ -408,13 +407,12 @@ MemwaitforXFW(struct IsdnCardState *cs, int hscx)
static inline void
MemWriteHSCXCMDR(struct IsdnCardState *cs, int hscx, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&diva_lock, flags);
MemwaitforCEC(cs, hscx);
MemWriteHSCX(cs, hscx, HSCX_CMDR, data);
restore_flags(flags);
spin_unlock_irqrestore(&diva_lock, flags);
}
static void
......@@ -422,7 +420,7 @@ Memhscx_empty_fifo(struct BCState *bcs, int count)
{
u_char *ptr;
struct IsdnCardState *cs = bcs->cs;
long flags;
unsigned long flags;
int cnt;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
......@@ -435,8 +433,7 @@ Memhscx_empty_fifo(struct BCState *bcs, int count)
bcs->hw.hscx.rcvidx = 0;
return;
}
save_flags(flags);
cli();
spin_lock_irqsave(&diva_lock, flags);
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
cnt = count;
while (cnt--)
......@@ -444,7 +441,7 @@ Memhscx_empty_fifo(struct BCState *bcs, int count)
MemWriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x80);
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
bcs->hw.hscx.rcvidx += count;
restore_flags(flags);
spin_unlock_irqrestore(&diva_lock, flags);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......@@ -462,7 +459,7 @@ Memhscx_fill_fifo(struct BCState *bcs)
int more, count, cnt;
int fifo_size = test_bit(HW_IPAC, &cs->HW_Flags)? 64: 32;
u_char *ptr,*p;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
......@@ -481,8 +478,7 @@ Memhscx_fill_fifo(struct BCState *bcs)
count = bcs->tx_skb->len;
cnt = count;
MemwaitforXFW(cs, bcs->hw.hscx.hscx);
save_flags(flags);
cli();
spin_lock_irqsave(&diva_lock, flags);
p = ptr = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count;
......@@ -491,7 +487,7 @@ Memhscx_fill_fifo(struct BCState *bcs)
memwritereg(cs->hw.diva.cfg_reg, bcs->hw.hscx.hscx ? 0x40 : 0,
*p++);
MemWriteHSCXCMDR(cs, bcs->hw.hscx.hscx, more ? 0x8 : 0xa);
restore_flags(flags);
spin_unlock_irqrestore(&diva_lock, flags);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......
......@@ -32,6 +32,7 @@
#include <linux/serial_reg.h>
extern const char *CardType[];
static spinlock_t elsa_lock = SPIN_LOCK_UNLOCKED;
const char *Elsa_revision = "$Revision: 2.26.6.6 $";
const char *Elsa_Types[] =
......@@ -145,13 +146,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_lock, flags);
return (ret);
}
......@@ -168,13 +168,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_lock, flags);
}
static inline void
......@@ -253,26 +252,24 @@ static inline u_char
readitac(struct IsdnCardState *cs, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_lock, flags);
byteout(cs->hw.elsa.ale, off);
ret = bytein(cs->hw.elsa.itac);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_lock, flags);
return (ret);
}
static inline void
writeitac(struct IsdnCardState *cs, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_lock, flags);
byteout(cs->hw.elsa.ale, off);
byteout(cs->hw.elsa.itac, data);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_lock, flags);
}
static inline int
......@@ -798,7 +795,7 @@ probe_elsa_adr(unsigned int adr, int typ)
{
int i, in1, in2, p16_1 = 0, p16_2 = 0, p8_1 = 0, p8_2 = 0, pc_1 = 0,
pc_2 = 0, pfp_1 = 0, pfp_2 = 0;
long flags;
unsigned long flags;
/* In case of the elsa pcmcia card, this region is in use,
reserved for us by the card manager. So we do not check it
......@@ -809,8 +806,7 @@ probe_elsa_adr(unsigned int adr, int typ)
adr);
return (0);
}
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_lock, flags);
for (i = 0; i < 16; i++) {
in1 = inb(adr + ELSA_CONFIG); /* 'toggelt' bei */
in2 = inb(adr + ELSA_CONFIG); /* jedem Zugriff */
......@@ -823,7 +819,7 @@ probe_elsa_adr(unsigned int adr, int typ)
pfp_1 += 0x40 & in1;
pfp_2 += 0x40 & in2;
}
restore_flags(flags);
spin_unlock_irqrestore(&elsa_lock, flags);
printk(KERN_INFO "Elsa: Probing IO 0x%x", adr);
if (65 == ++p16_1 * ++p16_2) {
printk(" PCC-16/PCF found\n");
......@@ -878,7 +874,7 @@ static struct pci_bus *pnp_c __devinitdata = NULL;
int __devinit
setup_elsa(struct IsdnCard *card)
{
long flags;
unsigned long flags;
int bytecnt;
u_char val, pci_rev;
struct IsdnCardState *cs = card->cs;
......@@ -1170,10 +1166,9 @@ setup_elsa(struct IsdnCard *card)
return (0);
}
}
save_flags(flags);
sti();
spin_lock_irqsave(&elsa_lock, flags);
HZDELAY(1); /* wait >=10 ms */
restore_flags(flags);
spin_unlock_irqrestore(&elsa_lock, flags);
if (TimerRun(cs)) {
printk(KERN_WARNING "Elsa: timer do not run down\n");
release_io_elsa(cs);
......
......@@ -30,6 +30,7 @@ static u_char deb[32];
const char *ModemIn[] = {"RBR","IER","IIR","LCR","MCR","LSR","MSR","SCR"};
const char *ModemOut[] = {"THR","IER","FCR","LCR","MCR","LSR","MSR","SCR"};
#endif
static spinlock_t elsa_ser_lock = SPIN_LOCK_UNLOCKED;
static char *MInit_1 = "AT&F&C1E0&D2\r\0";
static char *MInit_2 = "ATL2M1S64=13\r\0";
......@@ -134,23 +135,22 @@ static void change_speed(struct IsdnCardState *cs, int baud)
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
debugl1(cs,"modem quot=0x%x", quot);
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_ser_lock, flags);
serial_outp(cs, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */
serial_outp(cs, UART_DLL, quot & 0xff); /* LS of divisor */
serial_outp(cs, UART_DLM, quot >> 8); /* MS of divisor */
serial_outp(cs, UART_LCR, cval); /* reset DLAB */
serial_inp(cs, UART_RX);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
}
static int mstartup(struct IsdnCardState *cs)
{
unsigned long flags;
unsigned unsigned long flags;
int retval=0;
save_flags(flags); cli();
spin_lock_irqsave(&elsa_ser_lock, flags);
/*
* Clear the FIFO buffers and disable them
......@@ -207,7 +207,7 @@ static int mstartup(struct IsdnCardState *cs)
change_speed(cs, BASE_BAUD);
cs->hw.elsa.MFlag = 1;
errout:
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
return retval;
}
......@@ -224,7 +224,7 @@ static void mshutdown(struct IsdnCardState *cs)
printk(KERN_DEBUG"Shutting down serial ....");
#endif
save_flags(flags); cli(); /* Disable interrupts */
spin_lock_irqsave(&elsa_ser_lock, flags); /* Disable interrupts */
/*
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq
......@@ -245,7 +245,7 @@ static void mshutdown(struct IsdnCardState *cs)
serial_outp(cs, UART_FCR, (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT));
serial_inp(cs, UART_RX); /* read data port to reset things */
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
#ifdef SERIAL_DEBUG_OPEN
printk(" done\n");
#endif
......@@ -256,14 +256,13 @@ write_modem(struct BCState *bcs) {
int ret=0;
struct IsdnCardState *cs = bcs->cs;
int count, len, fp;
long flags;
unsigned long flags;
if (!bcs->tx_skb)
return 0;
if (bcs->tx_skb->len <= 0)
return 0;
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_ser_lock, flags);
len = bcs->tx_skb->len;
if (len > MAX_MODEM_BUF - cs->hw.elsa.transcnt)
len = MAX_MODEM_BUF - cs->hw.elsa.transcnt;
......@@ -289,7 +288,7 @@ write_modem(struct BCState *bcs) {
cs->hw.elsa.IER |= UART_IER_THRI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
}
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
return(ret);
}
......@@ -460,14 +459,13 @@ void
modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
int count, fp;
u_char *msg = buf;
long flags;
unsigned long flags;
if (!len)
return;
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_ser_lock, flags);
if (len > (MAX_MODEM_BUF - cs->hw.elsa.transcnt)) {
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
return;
}
fp = cs->hw.elsa.transcnt + cs->hw.elsa.transp;
......@@ -488,17 +486,16 @@ modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
cs->hw.elsa.IER |= UART_IER_THRI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
}
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
}
void
modem_set_init(struct IsdnCardState *cs) {
long flags;
unsigned long flags;
int timeout;
#define RCV_DELAY 20000
save_flags(flags);
sti();
spin_lock_irqsave(&elsa_ser_lock, flags);
modem_write_cmd(cs, MInit_1, strlen(MInit_1));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
......@@ -541,17 +538,16 @@ modem_set_init(struct IsdnCardState *cs) {
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
udelay(RCV_DELAY);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
}
void
modem_set_dial(struct IsdnCardState *cs, int outgoing) {
long flags;
unsigned long flags;
int timeout;
#define RCV_DELAY 20000
save_flags(flags);
sti();
spin_lock_irqsave(&elsa_ser_lock, flags);
modem_write_cmd(cs, MInit_speed28800, strlen(MInit_speed28800));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
......@@ -567,26 +563,25 @@ modem_set_dial(struct IsdnCardState *cs, int outgoing) {
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
udelay(RCV_DELAY);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
}
void
modem_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
if (pr == (PH_DATA | REQUEST)) {
save_flags(flags);
cli();
spin_lock_irqsave(&elsa_ser_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->hw.hscx.count = 0;
restore_flags(flags);
spin_unlock_irqrestore(&elsa_ser_lock, flags);
write_modem(st->l1.bcs);
}
} else if (pr == (PH_ACTIVATE | REQUEST)) {
......
......@@ -75,7 +75,7 @@
const char *enternow_pci_rev = "$Revision: 1.1.2.1 $";
static spinlock_t enternow_pci_lock = SPIN_LOCK_UNLOCKED;
/* *************************** I/O-Interface functions ************************************* */
......@@ -237,7 +237,7 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{
struct IsdnCardState *cs = dev_id;
BYTE sval, ir;
long flags;
unsigned long flags;
if (!cs) {
......@@ -257,8 +257,7 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
/* DMA-Interrupt: B-channel-stuff */
/* set bits in sval to indicate which page is free */
save_flags(flags);
cli();
spin_lock_irqsave(&enternow_pci_lock, flags);
/* set bits in sval to indicate which page is free */
if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) <
inl(cs->hw.njet.base + NETJET_DMA_WRITE_IRQ))
......@@ -275,11 +274,11 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */
{
if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
restore_flags(flags);
spin_unlock_irqrestore(&enternow_pci_lock, flags);
return;
}
cs->hw.njet.irqstat0 = sval;
restore_flags(flags);
spin_unlock_irqrestore(&enternow_pci_lock, flags);
if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) !=
(cs->hw.njet.last_is0 & NETJET_IRQM0_READ))
/* we have a read dma int */
......@@ -290,7 +289,7 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
write_tiger(cs);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
restore_flags(flags);
spin_unlock_irqrestore(&enternow_pci_lock, flags);
}
......@@ -303,7 +302,7 @@ setup_enternow_pci(struct IsdnCard *card)
int bytecnt;
struct IsdnCardState *cs = card->cs;
char tmp[64];
long flags;
unsigned long flags;
#if CONFIG_PCI
#ifdef __BIG_ENDIAN
......
......@@ -22,6 +22,7 @@
extern const char *CardType[];
const char *gazel_revision = "$Revision: 2.11.6.7 $";
static spinlock_t gazel_lock = SPIN_LOCK_UNLOCKED;
#define R647 1
#define R685 2
......@@ -72,26 +73,24 @@ static inline u_char
readreg_ipac(unsigned int adr, u_short off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&gazel_lock, flags);
byteout(adr, off);
ret = bytein(adr + 4);
restore_flags(flags);
spin_unlock_irqrestore(&gazel_lock, flags);
return ret;
}
static inline void
writereg_ipac(unsigned int adr, u_short off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&gazel_lock, flags);
byteout(adr, off);
byteout(adr + 4, data);
restore_flags(flags);
spin_unlock_irqrestore(&gazel_lock, flags);
}
......@@ -357,18 +356,17 @@ release_io_gazel(struct IsdnCardState *cs)
static int
reset_gazel(struct IsdnCardState *cs)
{
long flags;
unsigned long flags;
unsigned long plxcntrl, addr = cs->hw.gazel.cfg_reg;
switch (cs->subtyp) {
case R647:
save_flags(flags);
cli();
spin_lock_irqsave(&gazel_lock, flags);
writereg(addr, 0, 0);
HZDELAY(10);
writereg(addr, 0, 1);
HZDELAY(2);
restore_flags(flags);
spin_unlock_irqrestore(&gazel_lock, flags);
break;
case R685:
plxcntrl = inl(addr + PLX_CNTRL);
......
......@@ -23,6 +23,7 @@
#define DBUSY_TIMER_VALUE 80
#define ARCOFI_USE 0
static spinlock_t icc_lock = SPIN_LOCK_UNLOCKED;
static char *ICCVer[] __initdata =
{"2070 A1/A3", "2070 B1", "2070 B2/B3", "2070 V2.4"};
......@@ -112,7 +113,7 @@ void
icc_empty_fifo(struct IsdnCardState *cs, int count)
{
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "icc_empty_fifo");
......@@ -127,11 +128,10 @@ icc_empty_fifo(struct IsdnCardState *cs, int count)
}
ptr = cs->rcvbuf + cs->rcvidx;
cs->rcvidx += count;
save_flags(flags);
cli();
spin_lock_irqsave(&icc_lock, flags);
cs->readisacfifo(cs, ptr, count);
cs->writeisac(cs, ICC_CMDR, 0x80);
restore_flags(flags);
spin_unlock_irqrestore(&icc_lock, flags);
if (cs->debug & L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -146,7 +146,7 @@ icc_fill_fifo(struct IsdnCardState *cs)
{
int count, more;
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "icc_fill_fifo");
......@@ -163,8 +163,7 @@ icc_fill_fifo(struct IsdnCardState *cs)
more = !0;
count = 32;
}
save_flags(flags);
cli();
spin_lock_irqsave(&icc_lock, flags);
ptr = cs->tx_skb->data;
skb_pull(cs->tx_skb, count);
cs->tx_cnt += count;
......@@ -177,7 +176,7 @@ icc_fill_fifo(struct IsdnCardState *cs)
init_timer(&cs->dbusytimer);
cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
add_timer(&cs->dbusytimer);
restore_flags(flags);
spin_unlock_irqrestore(&icc_lock, flags);
if (cs->debug & L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -200,7 +199,7 @@ icc_interrupt(struct IsdnCardState *cs, u_char val)
u_char exval, v1;
struct sk_buff *skb;
unsigned int count;
long flags;
unsigned long flags;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "ICC interrupt %x", val);
......@@ -227,8 +226,7 @@ icc_interrupt(struct IsdnCardState *cs, u_char val)
if (count == 0)
count = 32;
icc_empty_fifo(cs, count);
save_flags(flags);
cli();
spin_lock_irqsave(&icc_lock, flags);
if ((count = cs->rcvidx) > 0) {
cs->rcvidx = 0;
if (!(skb = alloc_skb(count, GFP_ATOMIC)))
......@@ -238,7 +236,7 @@ icc_interrupt(struct IsdnCardState *cs, u_char val)
skb_queue_tail(&cs->rq, skb);
}
}
restore_flags(flags);
spin_unlock_irqrestore(&icc_lock, flags);
}
cs->rcvidx = 0;
icc_sched_event(cs, D_RCVBUFREADY);
......
......@@ -23,7 +23,7 @@
#define MAX_DFRAME_LEN_L1 300
#define B_FIFO_SIZE 64
#define D_FIFO_SIZE 32
static spinlock_t ipacx_lock = SPIN_LOCK_UNLOCKED;
// ipacx interrupt mask values
#define _MASK_IMASK 0x2E // global mask
......@@ -314,7 +314,7 @@ dch_sched_event(struct IsdnCardState *cs, int event)
static void
dch_empty_fifo(struct IsdnCardState *cs, int count)
{
long flags;
unsigned long flags;
u_char *ptr;
if ((cs->debug &L1_DEB_ISAC) && !(cs->debug &L1_DEB_ISAC_FIFO))
......@@ -332,11 +332,10 @@ dch_empty_fifo(struct IsdnCardState *cs, int count)
ptr = cs->rcvbuf + cs->rcvidx;
cs->rcvidx += count;
save_flags(flags);
cli();
spin_lock_irqsave(&ipacx_lock, flags);
cs->readisacfifo(cs, ptr, count);
cs->writeisac(cs, IPACX_CMDRD, 0x80); // RMC
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -353,7 +352,7 @@ dch_empty_fifo(struct IsdnCardState *cs, int count)
static void
dch_fill_fifo(struct IsdnCardState *cs)
{
long flags;
unsigned long flags;
int count;
u_char cmd, *ptr;
......@@ -371,8 +370,7 @@ dch_fill_fifo(struct IsdnCardState *cs)
cmd = 0x0A; // XTF | XME
}
save_flags(flags);
cli();
spin_lock_irqsave(&ipacx_lock, flags);
ptr = cs->tx_skb->data;
skb_pull(cs->tx_skb, count);
cs->tx_cnt += count;
......@@ -387,7 +385,7 @@ dch_fill_fifo(struct IsdnCardState *cs)
init_timer(&cs->dbusytimer);
cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
add_timer(&cs->dbusytimer);
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -406,7 +404,7 @@ dch_int(struct IsdnCardState *cs)
{
struct sk_buff *skb;
u_char istad, rstad;
long flags;
unsigned long flags;
int count;
istad = cs->readisac(cs, IPACX_ISTAD);
......@@ -430,8 +428,7 @@ dch_int(struct IsdnCardState *cs)
count &= D_FIFO_SIZE-1;
if (count == 0) count = D_FIFO_SIZE;
dch_empty_fifo(cs, count);
save_flags(flags);
cli();
spin_lock_irqsave(&ipacx_lock, flags);
if ((count = cs->rcvidx) > 0) {
cs->rcvidx = 0;
if (!(skb = dev_alloc_skb(count)))
......@@ -441,7 +438,7 @@ dch_int(struct IsdnCardState *cs)
skb_queue_tail(&cs->rq, skb);
}
}
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
}
cs->rcvidx = 0;
dch_sched_event(cs, D_RCVBUFREADY);
......@@ -535,20 +532,19 @@ static void
bch_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
switch (pr) {
case (PH_DATA | REQUEST):
save_flags(flags);
cli();
spin_lock_irqsave(&ipacx_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->hw.hscx.count = 0;
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
bch_fill_fifo(st->l1.bcs);
}
break;
......@@ -604,7 +600,7 @@ bch_empty_fifo(struct BCState *bcs, int count)
{
u_char *ptr, hscx;
struct IsdnCardState *cs;
long flags;
unsigned long flags;
int cnt;
cs = bcs->cs;
......@@ -622,8 +618,7 @@ bch_empty_fifo(struct BCState *bcs, int count)
}
// Read data uninterruptible
save_flags(flags);
cli();
spin_lock_irqsave(&ipacx_lock, flags);
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
cnt = count;
while (cnt--) *ptr++ = cs->BC_Read_Reg(cs, hscx, IPACX_RFIFOB);
......@@ -631,7 +626,7 @@ bch_empty_fifo(struct BCState *bcs, int count)
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
bcs->hw.hscx.rcvidx += count;
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......@@ -651,7 +646,7 @@ bch_fill_fifo(struct BCState *bcs)
struct IsdnCardState *cs;
int more, count, cnt;
u_char *ptr, *p, hscx;
long flags;
unsigned long flags;
cs = bcs->cs;
if ((cs->debug &L1_DEB_HSCX) && !(cs->debug &L1_DEB_HSCX_FIFO))
......@@ -670,15 +665,14 @@ bch_fill_fifo(struct BCState *bcs)
}
cnt = count;
save_flags(flags);
cli();
spin_lock_irqsave(&ipacx_lock, flags);
p = ptr = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count;
bcs->hw.hscx.count += count;
while (cnt--) cs->BC_Write_Reg(cs, hscx, IPACX_XFIFOB, *p++);
cs->BC_Write_Reg(cs, hscx, IPACX_CMDRB, (more ? 0x08 : 0x0a));
restore_flags(flags);
spin_unlock_irqrestore(&ipacx_lock, flags);
if (cs->debug &L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......
......@@ -22,6 +22,7 @@
#define DBUSY_TIMER_VALUE 80
#define ARCOFI_USE 1
static spinlock_t isac_lock = SPIN_LOCK_UNLOCKED;
static char *ISACVer[] __devinitdata =
{"2086/2186 V1.1", "2085 B1", "2085 B2",
......@@ -116,7 +117,7 @@ void
isac_empty_fifo(struct IsdnCardState *cs, int count)
{
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "isac_empty_fifo");
......@@ -131,11 +132,10 @@ isac_empty_fifo(struct IsdnCardState *cs, int count)
}
ptr = cs->rcvbuf + cs->rcvidx;
cs->rcvidx += count;
save_flags(flags);
cli();
spin_lock_irqsave(&isac_lock, flags);
cs->readisacfifo(cs, ptr, count);
cs->writeisac(cs, ISAC_CMDR, 0x80);
restore_flags(flags);
spin_unlock_irqrestore(&isac_lock, flags);
if (cs->debug & L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -150,7 +150,7 @@ isac_fill_fifo(struct IsdnCardState *cs)
{
int count, more;
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "isac_fill_fifo");
......@@ -167,8 +167,7 @@ isac_fill_fifo(struct IsdnCardState *cs)
more = !0;
count = 32;
}
save_flags(flags);
cli();
spin_lock_irqsave(&isac_lock, flags);
ptr = cs->tx_skb->data;
skb_pull(cs->tx_skb, count);
cs->tx_cnt += count;
......@@ -181,7 +180,7 @@ isac_fill_fifo(struct IsdnCardState *cs)
init_timer(&cs->dbusytimer);
cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000);
add_timer(&cs->dbusytimer);
restore_flags(flags);
spin_unlock_irqrestore(&isac_lock, flags);
if (cs->debug & L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -204,7 +203,7 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
u_char exval, v1;
struct sk_buff *skb;
unsigned int count;
long flags;
unsigned long flags;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "ISAC interrupt %x", val);
......@@ -231,8 +230,7 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
if (count == 0)
count = 32;
isac_empty_fifo(cs, count);
save_flags(flags);
cli();
spin_lock_irqsave(&isac_lock, flags);
if ((count = cs->rcvidx) > 0) {
cs->rcvidx = 0;
if (!(skb = alloc_skb(count, GFP_ATOMIC)))
......@@ -242,7 +240,7 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
skb_queue_tail(&cs->rq, skb);
}
}
restore_flags(flags);
spin_unlock_irqrestore(&isac_lock, flags);
}
cs->rcvidx = 0;
isac_sched_event(cs, D_RCVBUFREADY);
......
......@@ -28,7 +28,7 @@ const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
void isar_setup(struct IsdnCardState *cs);
static void isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para);
static inline void ll_deliver_faxstat(struct BCState *bcs, u_char status);
static spinlock_t isar_lock = SPIN_LOCK_UNLOCKED;
static inline int
waitforHIA(struct IsdnCardState *cs, int timeout)
{
......@@ -47,7 +47,7 @@ int
sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len,
u_char *msg)
{
long flags;
unsigned long flags;
int i;
if (!waitforHIA(cs, 4000))
......@@ -56,8 +56,7 @@ sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len,
if (cs->debug & L1_DEB_HSCX)
debugl1(cs, "sendmsg(%02x,%02x,%d)", his, creg, len);
#endif
save_flags(flags);
cli();
spin_lock_irqsave(&isar_lock, flags);
cs->BC_Write_Reg(cs, 0, ISAR_CTRL_H, creg);
cs->BC_Write_Reg(cs, 0, ISAR_CTRL_L, len);
cs->BC_Write_Reg(cs, 0, ISAR_WADR, 0);
......@@ -81,7 +80,7 @@ sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len,
#endif
}
cs->BC_Write_Reg(cs, 1, ISAR_HIS, his);
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
waitforHIA(cs, 10000);
return(1);
}
......@@ -134,7 +133,7 @@ waitrecmsg(struct IsdnCardState *cs, u_char *len,
u_char *msg, int maxdelay)
{
int timeout = 0;
long flags;
unsigned long flags;
struct isar_reg *ir = cs->bcs[0].hw.isar.reg;
......@@ -145,12 +144,11 @@ waitrecmsg(struct IsdnCardState *cs, u_char *len,
printk(KERN_WARNING"isar recmsg IRQSTA timeout\n");
return(0);
}
save_flags(flags);
cli();
spin_lock_irqsave(&isar_lock, flags);
get_irq_infos(cs, ir);
rcv_mbox(cs, ir, msg);
*len = ir->clsb;
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
return(1);
}
......@@ -192,7 +190,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
u_short sadr, left, *sp;
u_char *p = buf;
u_char *msg, *tmpmsg, *mp, tmp[64];
long flags;
unsigned long flags;
struct isar_reg *ireg = cs->bcs[0].hw.isar.reg;
struct {u_short sadr;
......@@ -346,8 +344,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
/* NORMAL mode entered */
/* Enable IRQs of ISAR */
cs->BC_Write_Reg(cs, 0, ISAR_IRQBIT, ISAR_IRQSTA);
save_flags(flags);
sti();
spin_lock_irqsave(&isar_lock, flags);
cnt = 1000; /* max 1s */
while ((!ireg->bstat) && cnt) {
udelay(1000);
......@@ -415,7 +412,7 @@ isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
isar_setup(cs);
ret = 0;
reterrflg:
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
reterror:
cs->debug = debug;
if (ret)
......@@ -669,7 +666,7 @@ isar_fill_fifo(struct BCState *bcs)
int count;
u_char msb;
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "isar_fill_fifo");
......@@ -687,8 +684,7 @@ isar_fill_fifo(struct BCState *bcs)
count = bcs->tx_skb->len;
msb = HDLC_FED;
}
save_flags(flags);
cli();
spin_lock_irqsave(&isar_lock, flags);
ptr = bcs->tx_skb->data;
if (!bcs->hw.isar.txcnt) {
msb |= HDLC_FST;
......@@ -739,7 +735,7 @@ isar_fill_fifo(struct BCState *bcs)
printk(KERN_ERR"isar_fill_fifo mode(%x) error\n", bcs->mode);
break;
}
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
}
inline
......@@ -1163,12 +1159,11 @@ static char debbuf[128];
void
isar_int_main(struct IsdnCardState *cs)
{
long flags;
unsigned long flags;
struct isar_reg *ireg = cs->bcs[0].hw.isar.reg;
struct BCState *bcs;
save_flags(flags);
cli();
spin_lock_irqsave(&isar_lock, flags);
get_irq_infos(cs, ireg);
switch (ireg->iis & ISAR_IIS_MSCMSD) {
case ISAR_IIS_RDATA:
......@@ -1254,7 +1249,7 @@ isar_int_main(struct IsdnCardState *cs)
ireg->iis, ireg->cmsb, ireg->clsb);
break;
}
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
}
static void
......@@ -1568,22 +1563,21 @@ void
isar_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
switch (pr) {
case (PH_DATA | REQUEST):
save_flags(flags);
cli();
spin_lock_irqsave(&isar_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
if (st->l1.bcs->cs->debug & L1_DEB_HSCX)
debugl1(st->l1.bcs->cs, "DRQ set BC_FLG_BUSY");
st->l1.bcs->hw.isar.txcnt = 0;
restore_flags(flags);
spin_unlock_irqrestore(&isar_lock, flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break;
......
......@@ -20,7 +20,7 @@
#include "isdnl2.h"
const char *l2_revision = "$Revision: 2.25.6.4 $";
static spinlock_t isdnl2_lock = SPIN_LOCK_UNLOCKED;
static void l2m_debug(struct FsmInst *fi, char *fmt, ...);
static struct Fsm l2fsm;
......@@ -1256,7 +1256,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
u_char header[MAX_HEADER_LEN];
int i;
int unsigned p1;
long flags;
unsigned long flags;
if (!cansend(st))
return;
......@@ -1265,8 +1265,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
if (!skb)
return;
save_flags(flags);
cli();
spin_lock_irqsave(&isdnl2_lock, flags);
if(test_bit(FLG_MOD128, &l2->flag))
p1 = (l2->vs - l2->va) % 128;
else
......@@ -1289,7 +1288,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
header[i++] = (l2->vr << 5) | (l2->vs << 1);
l2->vs = (l2->vs + 1) % 8;
}
restore_flags(flags);
spin_unlock_irqrestore(&isdnl2_lock, flags);
p1 = skb->data - skb->head;
if (p1 >= i)
......
......@@ -20,6 +20,7 @@
extern const char *CardType[];
static const char *ISurf_revision = "$Revision: 1.10.6.2 $";
static spinlock_t isurf_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......
......@@ -26,6 +26,7 @@
extern const char *CardType[];
const char *ix1_revision = "$Revision: 2.10.6.2 $";
static spinlock_t ix1_micro_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -43,13 +44,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&ix1_micro_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&ix1_micro_lock, flags);
return (ret);
}
......@@ -66,13 +66,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&ix1_micro_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&ix1_micro_lock, flags);
}
static inline void
......@@ -184,19 +183,18 @@ release_io_ix1micro(struct IsdnCardState *cs)
static void
ix1_reset(struct IsdnCardState *cs)
{
long flags;
unsigned long flags;
int cnt;
/* reset isac */
save_flags(flags);
spin_lock_irqsave(&ix1_micro_lock, flags);
cnt = 3 * (HZ / 10) + 1;
sti();
while (cnt--) {
byteout(cs->hw.ix1.cfg_reg + SPECIAL_PORT_OFFSET, 1);
HZDELAY(1); /* wait >=10 ms */
}
byteout(cs->hw.ix1.cfg_reg + SPECIAL_PORT_OFFSET, 0);
restore_flags(flags);
spin_unlock_irqrestore(&ix1_micro_lock, flags);
}
static int
......
......@@ -18,6 +18,7 @@
#include "isdnl1.h"
#include <linux/interrupt.h>
static spinlock_t jade_lock = SPIN_LOCK_UNLOCKED;
int __init
JadeVersion(struct IsdnCardState *cs, char *s)
......@@ -50,10 +51,9 @@ static void
jade_write_indirect(struct IsdnCardState *cs, u_char reg, u_char value)
{
int to = 50;
long flags;
unsigned long flags;
u_char ret;
save_flags(flags);
cli();
spin_lock_irqsave(&jade_lock, flags);
/* Write the data */
cs->BC_Write_Reg(cs, -1, COMM_JADE+1, value);
/* Say JADE we wanna write indirect reg 'reg' */
......@@ -68,12 +68,12 @@ jade_write_indirect(struct IsdnCardState *cs, u_char reg, u_char value)
/* Got acknowledge */
break;
if (!to) {
restore_flags(flags);
spin_unlock_irqrestore(&jade_lock, flags);
printk(KERN_INFO "Can not see ready bit from JADE DSP (reg=0x%X, value=0x%X)\n", reg, value);
return;
}
}
restore_flags(flags);
spin_unlock_irqrestore(&jade_lock, flags);
}
......@@ -145,20 +145,19 @@ static void
jade_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
switch (pr) {
case (PH_DATA | REQUEST):
save_flags(flags);
cli();
spin_lock_irqsave(&jade_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&jade_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->hw.hscx.count = 0;
restore_flags(flags);
spin_unlock_irqrestore(&jade_lock, flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break;
......
......@@ -9,6 +9,7 @@
* of the GNU General Public License, incorporated herein by reference.
*
*/
static spinlock_t jade_irq_lock = SPIN_LOCK_UNLOCKED;
static inline void
waitforCEC(struct IsdnCardState *cs, int jade, int reg)
......@@ -33,13 +34,12 @@ waitforXFW(struct IsdnCardState *cs, int jade)
static inline void
WriteJADECMDR(struct IsdnCardState *cs, int jade, int reg, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&jade_irq_lock, flags);
waitforCEC(cs, jade, reg);
WRITEJADE(cs, jade, reg, data);
restore_flags(flags);
spin_unlock_irqrestore(&jade_irq_lock, flags);
}
......@@ -49,7 +49,7 @@ jade_empty_fifo(struct BCState *bcs, int count)
{
u_char *ptr;
struct IsdnCardState *cs = bcs->cs;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "jade_empty_fifo");
......@@ -63,11 +63,10 @@ jade_empty_fifo(struct BCState *bcs, int count)
}
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
bcs->hw.hscx.rcvidx += count;
save_flags(flags);
cli();
spin_lock_irqsave(&jade_irq_lock, flags);
READJADEFIFO(cs, bcs->hw.hscx.hscx, ptr, count);
WriteJADECMDR(cs, bcs->hw.hscx.hscx, jade_HDLC_RCMD, jadeRCMD_RMC);
restore_flags(flags);
spin_unlock_irqrestore(&jade_irq_lock, flags);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......@@ -85,7 +84,7 @@ jade_fill_fifo(struct BCState *bcs)
int more, count;
int fifo_size = 32;
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "jade_fill_fifo");
......@@ -103,15 +102,14 @@ jade_fill_fifo(struct BCState *bcs)
count = bcs->tx_skb->len;
waitforXFW(cs, bcs->hw.hscx.hscx);
save_flags(flags);
cli();
spin_lock_irqsave(&jade_irq_lock, flags);
ptr = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count;
bcs->hw.hscx.count += count;
WRITEJADEFIFO(cs, bcs->hw.hscx.hscx, ptr, count);
WriteJADECMDR(cs, bcs->hw.hscx.hscx, jade_HDLC_XCMD, more ? jadeXCMD_XF : (jadeXCMD_XF|jadeXCMD_XME));
restore_flags(flags);
spin_unlock_irqrestore(&jade_irq_lock, flags);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......
......@@ -27,6 +27,7 @@
extern char *HiSax_getrev(const char *revision);
const char *dss1_revision = "$Revision: 2.30.6.2 $";
static spinlock_t l3dss1_lock = SPIN_LOCK_UNLOCKED;
#define EXT_BEARER_CAPS 1
......@@ -53,8 +54,7 @@ static unsigned char new_invoke_id(struct PStack *p)
i = 32; /* maximum search depth */
save_flags(flags);
cli();
spin_lock_irqsave(&l3dss1_lock, flags);
retval = p->prot.dss1.last_invoke_id + 1; /* try new id */
while ((i) && (p->prot.dss1.invoke_used[retval >> 3] == 0xFF)) {
......@@ -68,7 +68,7 @@ static unsigned char new_invoke_id(struct PStack *p)
retval = 0;
p->prot.dss1.last_invoke_id = retval;
p->prot.dss1.invoke_used[retval >> 3] |= (1 << (retval & 7));
restore_flags(flags);
spin_unlock_irqrestore(&l3dss1_lock, flags);
return(retval);
} /* new_invoke_id */
......@@ -81,10 +81,9 @@ static void free_invoke_id(struct PStack *p, unsigned char id)
if (!id) return; /* 0 = invalid value */
save_flags(flags);
cli();
spin_lock_irqsave(&l3dss1_lock, flags);
p->prot.dss1.invoke_used[id >> 3] &= ~(1 << (id & 7));
restore_flags(flags);
spin_unlock_irqrestore(&l3dss1_lock, flags);
} /* free_invoke_id */
......
......@@ -25,6 +25,7 @@
extern char *HiSax_getrev(const char *revision);
const char *ni1_revision = "$Revision: 2.5.6.3 $";
static spinlock_t l3ni1_lock = SPIN_LOCK_UNLOCKED;
#define EXT_BEARER_CAPS 1
......@@ -51,8 +52,7 @@ static unsigned char new_invoke_id(struct PStack *p)
i = 32; /* maximum search depth */
save_flags(flags);
cli();
spin_lock_irqsave(&l3ni1_lock, flags);
retval = p->prot.ni1.last_invoke_id + 1; /* try new id */
while ((i) && (p->prot.ni1.invoke_used[retval >> 3] == 0xFF)) {
......@@ -66,7 +66,7 @@ static unsigned char new_invoke_id(struct PStack *p)
retval = 0;
p->prot.ni1.last_invoke_id = retval;
p->prot.ni1.invoke_used[retval >> 3] |= (1 << (retval & 7));
restore_flags(flags);
spin_unlock_irqrestore(&l3ni1_lock, flags);
return(retval);
} /* new_invoke_id */
......@@ -79,10 +79,9 @@ static void free_invoke_id(struct PStack *p, unsigned char id)
if (!id) return; /* 0 = invalid value */
save_flags(flags);
cli();
spin_lock_irqsave(&l3ni1_lock, flags);
p->prot.ni1.invoke_used[id >> 3] &= ~(1 << (id & 7));
restore_flags(flags);
spin_unlock_irqrestore(&l3ni1_lock, flags);
} /* free_invoke_id */
......
......@@ -19,6 +19,7 @@
extern const char *CardType[];
const char *mic_revision = "$Revision: 1.10.6.2 $";
static spinlock_t mic_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -34,13 +35,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&mic_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&mic_lock, flags);
return (ret);
}
......@@ -58,13 +58,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&mic_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&mic_lock, flags);
}
static inline void
......
......@@ -26,37 +26,36 @@
#include "netjet.h"
const char *NETjet_revision = "$Revision: 1.24.6.6 $";
static spinlock_t netjet_lock = SPIN_LOCK_UNLOCKED;
/* Interface functions */
u_char
NETjet_ReadIC(struct IsdnCardState *cs, u_char offset)
{
long flags;
unsigned long flags;
u_char ret;
save_flags(flags);
cli();
spin_lock_irqsave(&netjet_lock, flags);
cs->hw.njet.auxd &= 0xfc;
cs->hw.njet.auxd |= (offset>>4) & 3;
byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
ret = bytein(cs->hw.njet.isac + ((offset & 0xf)<<2));
restore_flags(flags);
spin_unlock_irqrestore(&netjet_lock, flags);
return(ret);
}
void
NETjet_WriteIC(struct IsdnCardState *cs, u_char offset, u_char value)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&netjet_lock, flags);
cs->hw.njet.auxd &= 0xfc;
cs->hw.njet.auxd |= (offset>>4) & 3;
byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
byteout(cs->hw.njet.isac + ((offset & 0xf)<<2), value);
restore_flags(flags);
spin_unlock_irqrestore(&netjet_lock, flags);
}
void
......@@ -839,19 +838,18 @@ static void
tiger_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
switch (pr) {
case (PH_DATA | REQUEST):
save_flags(flags);
cli();
spin_lock_irqsave(&netjet_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&netjet_lock, flags);
} else {
st->l1.bcs->tx_skb = skb;
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
restore_flags(flags);
spin_unlock_irqrestore(&netjet_lock, flags);
}
break;
case (PH_PULL | INDICATION):
......@@ -859,11 +857,10 @@ tiger_l2l1(struct PStack *st, int pr, void *arg)
printk(KERN_WARNING "tiger_l2l1: this shouldn't happen\n");
break;
}
save_flags(flags);
cli();
spin_lock_irqsave(&netjet_lock, flags);
st->l1.bcs->tx_skb = skb;
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
restore_flags(flags);
spin_unlock_irqrestore(&netjet_lock, flags);
break;
case (PH_PULL | REQUEST):
if (!st->l1.bcs->tx_skb) {
......
......@@ -25,6 +25,7 @@
extern const char *CardType[];
const char *niccy_revision = "$Revision: 1.15.6.6 $";
static spinlock_t niccy_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -50,13 +51,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&niccy_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&niccy_lock, flags);
return (ret);
}
......@@ -73,13 +73,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&niccy_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&niccy_lock, flags);
}
static inline void
......
......@@ -16,6 +16,7 @@
#include "netjet.h"
const char *NETjet_S_revision = "$Revision: 2.7.6.6 $";
static spinlock_t nj_s_lock = SPIN_LOCK_UNLOCKED;
static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
{
......@@ -31,7 +32,7 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{
struct IsdnCardState *cs = dev_id;
u_char val, sval;
long flags;
unsigned long flags;
if (!cs) {
printk(KERN_WARNING "NETjet-S: Spurious interrupt!\n");
......@@ -48,8 +49,7 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
NETjet_WriteIC(cs, ISAC_MASK, 0x0);
}
}
save_flags(flags);
cli();
spin_lock_irqsave(&nj_s_lock, flags);
/* start new code 13/07/00 GE */
/* set bits in sval to indicate which page is free */
if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) <
......@@ -67,11 +67,11 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */
{
if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
restore_flags(flags);
spin_unlock_irqrestore(&nj_s_lock, flags);
return;
}
cs->hw.njet.irqstat0 = sval;
restore_flags(flags);
spin_unlock_irqrestore(&nj_s_lock, flags);
if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) !=
(cs->hw.njet.last_is0 & NETJET_IRQM0_READ))
/* we have a read dma int */
......@@ -83,7 +83,7 @@ netjet_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
/* end new code 13/07/00 GE */
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
restore_flags(flags);
spin_unlock_irqrestore(&nj_s_lock, flags);
/* if (!testcnt--) {
cs->hw.njet.dmactrl = 0;
......@@ -149,7 +149,7 @@ setup_netjet_s(struct IsdnCard *card)
int bytecnt;
struct IsdnCardState *cs = card->cs;
char tmp[64];
long flags;
unsigned long flags;
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
......
......@@ -16,6 +16,7 @@
#include "netjet.h"
const char *NETjet_U_revision = "$Revision: 2.8.6.6 $";
static spinlock_t nj_u_lock = SPIN_LOCK_UNLOCKED;
static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
{
......@@ -31,7 +32,7 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{
struct IsdnCardState *cs = dev_id;
u_char val, sval;
long flags;
unsigned long flags;
if (!cs) {
printk(KERN_WARNING "NETspider-U: Spurious interrupt!\n");
......@@ -48,8 +49,7 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
NETjet_WriteIC(cs, ICC_MASK, 0x0);
}
}
save_flags(flags);
cli();
spin_lock_irqsave(&nj_u_lock, flags);
/* start new code 13/07/00 GE */
/* set bits in sval to indicate which page is free */
if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) <
......@@ -67,11 +67,11 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (sval != cs->hw.njet.last_is0) /* we have a DMA interrupt */
{
if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
restore_flags(flags);
spin_unlock_irqrestore(&nj_u_lock, flags);
return;
}
cs->hw.njet.irqstat0 = sval;
restore_flags(flags);
spin_unlock_irqrestore(&nj_u_lock, flags);
if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) !=
(cs->hw.njet.last_is0 & NETJET_IRQM0_READ))
/* we have a read dma int */
......@@ -83,7 +83,7 @@ netjet_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
/* end new code 13/07/00 GE */
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
} else
restore_flags(flags);
spin_unlock_irqrestore(&nj_u_lock, flags);
/* if (!testcnt--) {
cs->hw.njet.dmactrl = 0;
......@@ -196,7 +196,6 @@ setup_netjet_u(struct IsdnCard *card)
save_flags(flags);
sti();
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
......
......@@ -18,13 +18,13 @@
extern const char *CardType[];
const char *s0box_revision = "$Revision: 2.4.6.2 $";
static spinlock_t s0box_lock = SPIN_LOCK_UNLOCKED;
static inline void
writereg(unsigned int padr, signed int addr, u_char off, u_char val) {
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&s0box_lock, flags);
outb_p(0x1c,padr+2);
outb_p(0x14,padr+2);
outb_p((addr+off)&0x7f,padr);
......@@ -33,7 +33,7 @@ writereg(unsigned int padr, signed int addr, u_char off, u_char val) {
outb_p(0x17,padr+2);
outb_p(0x14,padr+2);
outb_p(0x1c,padr+2);
restore_flags(flags);
spin_unlock_irqrestore(&s0box_lock, flags);
}
static u_char nibtab[] = { 1, 9, 5, 0xd, 3, 0xb, 7, 0xf,
......@@ -45,8 +45,7 @@ readreg(unsigned int padr, signed int addr, u_char off) {
register u_char n1, n2;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&s0box_lock, flags);
outb_p(0x1c,padr+2);
outb_p(0x14,padr+2);
outb_p((addr+off)|0x80,padr);
......@@ -57,7 +56,7 @@ readreg(unsigned int padr, signed int addr, u_char off) {
n2 = (inb_p(padr+1) >> 3) & 0x17;
outb_p(0x14,padr+2);
outb_p(0x1c,padr+2);
restore_flags(flags);
spin_unlock_irqrestore(&s0box_lock, flags);
return nibtab[n1] | (nibtab[n2] << 4);
}
......
......@@ -20,6 +20,7 @@
extern const char *CardType[];
static char *saphir_rev = "$Revision: 1.8.6.2 $";
static spinlock_t saphir_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -35,13 +36,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&saphir_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&saphir_lock, flags);
return (ret);
}
......@@ -58,13 +58,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&saphir_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&saphir_lock, flags);
}
static inline void
......@@ -182,14 +181,13 @@ SaphirWatchDog(struct IsdnCardState *cs)
void
release_io_saphir(struct IsdnCardState *cs)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&saphir_lock, flags);
byteout(cs->hw.saphir.cfg_reg + IRQ_REG, 0xff);
del_timer(&cs->hw.saphir.timer);
cs->hw.saphir.timer.function = NULL;
restore_flags(flags);
spin_unlock_irqrestore(&saphir_lock, flags);
if (cs->hw.saphir.cfg_reg)
release_region(cs->hw.saphir.cfg_reg, 6);
}
......
......@@ -50,6 +50,7 @@
#include <linux/isapnp.h>
extern const char *CardType[];
static spinlock_t sedlbauer_lock = SPIN_LOCK_UNLOCKED;
const char *Sedlbauer_revision = "$Revision: 1.25.6.6 $";
......@@ -121,13 +122,12 @@ static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&sedlbauer_lock, flags);
byteout(ale, off);
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&sedlbauer_lock, flags);
return (ret);
}
......@@ -144,13 +144,12 @@ readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size
static inline void
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&sedlbauer_lock, flags);
byteout(ale, off);
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&sedlbauer_lock, flags);
}
static inline void
......@@ -552,7 +551,7 @@ setup_sedlbauer(struct IsdnCard *card)
struct IsdnCardState *cs = card->cs;
char tmp[64];
u16 sub_vendor_id, sub_id;
long flags;
unsigned long flags;
strcpy(tmp, Sedlbauer_revision);
printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp));
......
......@@ -20,6 +20,7 @@
extern const char *CardType[];
const char *sportster_revision = "$Revision: 1.14.6.2 $";
static spinlock_t sportster_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......
......@@ -19,6 +19,7 @@
extern const char *CardType[];
const char *TeleInt_revision = "$Revision: 1.14.6.2 $";
static spinlock_t teleint_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -28,21 +29,20 @@ readreg(unsigned int ale, unsigned int adr, u_char off)
{
register u_char ret;
int max_delay = 2000;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&teleint_lock, flags);
byteout(ale, off);
ret = HFC_BUSY & bytein(ale);
while (ret && --max_delay)
ret = HFC_BUSY & bytein(ale);
if (!max_delay) {
printk(KERN_WARNING "TeleInt Busy not inactive\n");
restore_flags(flags);
spin_unlock_irqrestore(&teleint_lock, flags);
return (0);
}
ret = bytein(adr);
restore_flags(flags);
spin_unlock_irqrestore(&teleint_lock, flags);
return (ret);
}
......@@ -72,21 +72,20 @@ writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
{
register u_char ret;
int max_delay = 2000;
long flags;
unsigned long flags;
save_flags(flags);
cli();
spin_lock_irqsave(&teleint_lock, flags);
byteout(ale, off);
ret = HFC_BUSY & bytein(ale);
while (ret && --max_delay)
ret = HFC_BUSY & bytein(ale);
if (!max_delay) {
printk(KERN_WARNING "TeleInt Busy not inactive\n");
restore_flags(flags);
spin_unlock_irqrestore(&teleint_lock, flags);
return;
}
byteout(adr, data);
restore_flags(flags);
spin_unlock_irqrestore(&teleint_lock, flags);
}
static inline void
......
......@@ -24,6 +24,7 @@
extern const char *CardType[];
const char *teles0_revision = "$Revision: 2.13.6.2 $";
static spinlock_t teles0_lock = SPIN_LOCK_UNLOCKED;
#define TELES_IOMEM_SIZE 0x400
#define byteout(addr,val) outb(val,addr)
......@@ -196,10 +197,9 @@ static int
reset_teles0(struct IsdnCardState *cs)
{
u_char cfval;
long flags;
unsigned long flags;
save_flags(flags);
sti();
spin_lock_irqsave(&teles0_lock, flags);
if (cs->hw.teles0.cfg_reg) {
switch (cs->irq) {
case 2:
......@@ -228,6 +228,7 @@ reset_teles0(struct IsdnCardState *cs)
cfval = 0x0E;
break;
default:
spin_unlock_irqrestore(&teles0_lock, flags);
return(1);
}
cfval |= ((cs->hw.teles0.phymem >> 9) & 0xF0);
......@@ -240,7 +241,7 @@ reset_teles0(struct IsdnCardState *cs)
HZDELAY(HZ / 5 + 1);
writeb(1, cs->hw.teles0.membase + 0x80); mb();
HZDELAY(HZ / 5 + 1);
restore_flags(flags);
spin_unlock_irqrestore(&teles0_lock, flags);
return(0);
}
......
......@@ -22,6 +22,7 @@
extern const char *CardType[];
const char *teles3_revision = "$Revision: 2.17.6.2 $";
static spinlock_t teles3_lock = SPIN_LOCK_UNLOCKED;
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
......@@ -174,7 +175,7 @@ release_io_teles3(struct IsdnCardState *cs)
static int
reset_teles3(struct IsdnCardState *cs)
{
long flags;
unsigned long flags;
u_char irqcfg;
if (cs->typ != ISDN_CTYPE_TELESPCMCIA) {
......@@ -208,28 +209,27 @@ reset_teles3(struct IsdnCardState *cs)
default:
return(1);
}
save_flags(flags);
spin_lock_irqsave(&teles3_lock, flags);
byteout(cs->hw.teles3.cfg_reg + 4, irqcfg);
sti();
HZDELAY(HZ / 10 + 1);
byteout(cs->hw.teles3.cfg_reg + 4, irqcfg | 1);
HZDELAY(HZ / 10 + 1);
restore_flags(flags);
spin_unlock_irqrestore(&teles3_lock, flags);
} else if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) {
save_flags(flags);
spin_lock_irqsave(&teles3_lock, flags);
byteout(cs->hw.teles3.cfg_reg, 0xff);
HZDELAY(2);
byteout(cs->hw.teles3.cfg_reg, 0x00);
HZDELAY(2);
restore_flags(flags);
spin_unlock_irqrestore(&teles3_lock, flags);
} else {
/* Reset off for 16.3 PnP , thanks to Georg Acher */
save_flags(flags);
spin_lock_irqsave(&teles3_lock, flags);
byteout(cs->hw.teles3.isac + 0x3c, 0);
HZDELAY(2);
byteout(cs->hw.teles3.isac + 0x3c, 1);
HZDELAY(2);
restore_flags(flags);
spin_unlock_irqrestore(&teles3_lock, flags);
}
}
return(0);
......
......@@ -43,6 +43,8 @@ extern const char *CardType[];
const char *w6692_revision = "$Revision: 1.12.6.6 $";
static spinlock_t w6692_lock = SPIN_LOCK_UNLOCKED;
#define DBUSY_TIMER_VALUE 80
static char *W6692Ver[] __initdata =
......@@ -149,7 +151,7 @@ static void
W6692_empty_fifo(struct IsdnCardState *cs, int count)
{
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "W6692_empty_fifo");
......@@ -164,11 +166,10 @@ W6692_empty_fifo(struct IsdnCardState *cs, int count)
}
ptr = cs->rcvbuf + cs->rcvidx;
cs->rcvidx += count;
save_flags(flags);
cli();
spin_lock_irqsave(&w6692_lock, flags);
cs->readW6692fifo(cs, ptr, count);
cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RACK);
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock, flags);
if (cs->debug & L1_DEB_ISAC_FIFO) {
char *t = cs->dlog;
......@@ -183,7 +184,7 @@ W6692_fill_fifo(struct IsdnCardState *cs)
{
int count, more;
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "W6692_fill_fifo");
......@@ -200,14 +201,13 @@ W6692_fill_fifo(struct IsdnCardState *cs)
more = !0;
count = W_D_FIFO_THRESH;
}
save_flags(flags);
cli();
spin_lock_irqsave(&w6692_lock, flags);
ptr = cs->tx_skb->data;
skb_pull(cs->tx_skb, count);
cs->tx_cnt += count;
cs->writeW6692fifo(cs, ptr, count);
cs->writeW6692(cs, W_D_CMDR, more ? W_D_CMDR_XMS : (W_D_CMDR_XMS | W_D_CMDR_XME));
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock , flags);
if (test_and_set_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
debugl1(cs, "W6692_fill_fifo dbusytimer running");
del_timer(&cs->dbusytimer);
......@@ -229,7 +229,7 @@ W6692B_empty_fifo(struct BCState *bcs, int count)
{
u_char *ptr;
struct IsdnCardState *cs = bcs->cs;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
debugl1(cs, "W6692B_empty_fifo");
......@@ -243,11 +243,10 @@ W6692B_empty_fifo(struct BCState *bcs, int count)
}
ptr = bcs->hw.w6692.rcvbuf + bcs->hw.w6692.rcvidx;
bcs->hw.w6692.rcvidx += count;
save_flags(flags);
cli();
spin_lock_irqsave(&w6692_lock, flags);
READW6692BFIFO(cs, bcs->channel, ptr, count);
cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT);
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock , flags);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......@@ -264,7 +263,7 @@ W6692B_fill_fifo(struct BCState *bcs)
struct IsdnCardState *cs = bcs->cs;
int more, count;
u_char *ptr;
long flags;
unsigned long flags;
if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
......@@ -282,15 +281,14 @@ W6692B_fill_fifo(struct BCState *bcs)
} else
count = bcs->tx_skb->len;
save_flags(flags);
cli();
spin_lock_irqsave(&w6692_lock, flags);
ptr = bcs->tx_skb->data;
skb_pull(bcs->tx_skb, count);
bcs->tx_cnt -= count;
bcs->hw.w6692.count += count;
WRITEW6692BFIFO(cs, bcs->channel, ptr, count);
cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACT | W_B_CMDR_XMS | (more ? 0 : W_B_CMDR_XME));
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock , flags);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......@@ -411,7 +409,7 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
u_char val, exval, v1;
struct sk_buff *skb;
unsigned int count;
long flags;
unsigned long flags;
int icnt = 5;
if (!cs) {
......@@ -442,8 +440,7 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (count == 0)
count = W_D_FIFO_THRESH;
W6692_empty_fifo(cs, count);
save_flags(flags);
cli();
spin_lock_irqsave(&w6692_lock, flags);
if ((count = cs->rcvidx) > 0) {
cs->rcvidx = 0;
if (!(skb = alloc_skb(count, GFP_ATOMIC)))
......@@ -453,7 +450,7 @@ W6692_interrupt(int intno, void *dev_id, struct pt_regs *regs)
skb_queue_tail(&cs->rq, skb);
}
}
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock , flags);
}
cs->rcvidx = 0;
W6692_sched_event(cs, D_RCVBUFREADY);
......@@ -745,20 +742,19 @@ static void
W6692_l2l1(struct PStack *st, int pr, void *arg)
{
struct sk_buff *skb = arg;
long flags;
unsigned long flags;
switch (pr) {
case (PH_DATA | REQUEST):
save_flags(flags);
cli();
spin_lock_irqsave(&w6692_lock, flags);
if (st->l1.bcs->tx_skb) {
skb_queue_tail(&st->l1.bcs->squeue, skb);
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock , flags);
} else {
st->l1.bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
st->l1.bcs->hw.w6692.count = 0;
restore_flags(flags);
spin_unlock_irqrestore(&w6692_lock , flags);
st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
}
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment