Commit 8119a9aa authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Remove unnecessary locking

Realize that *_empty_fifo() and *_fill_fifo() are always called
under the card lock, so no additional protection when reading/writing
fifos is needed.
parent 596e49ed
......@@ -57,37 +57,29 @@ readreg(struct IsdnCardState *cs, unsigned int adr, u8 off)
}
static inline void
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
{
unsigned long flags;
spin_lock_irqsave(&asuscom_lock, flags);
byteout(cs->hw.asus.adr, off);
insb(adr, data, size);
byteout(adr, data);
spin_unlock_irqrestore(&asuscom_lock, flags);
}
static inline void
writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&asuscom_lock, flags);
byteout(cs->hw.asus.adr, off);
byteout(adr, data);
spin_unlock_irqrestore(&asuscom_lock, flags);
insb(adr, data, size);
}
static inline void
writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&asuscom_lock, flags);
byteout(cs->hw.asus.adr, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&asuscom_lock, flags);
}
static u8
......
......@@ -86,24 +86,15 @@ writereg(struct IsdnCardState *cs, int offset, u8 adr, u8 value)
static inline void
readfifo(struct IsdnCardState *cs, int offset, u8 *data, int size)
{
unsigned long flags;
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg + ADDRREG_OFFSET, offset);
insb(cs->hw.avm.cfg_reg + DATAREG_OFFSET, data, size);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
return;
}
static inline void
writefifo(struct IsdnCardState *cs, int offset, u8 *data, int size)
{
unsigned long flags;
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET, offset);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static u8
......
......@@ -79,9 +79,9 @@ static spinlock_t avm_pci_lock = SPIN_LOCK_UNLOCKED;
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
{
register u8 idx = (offset > 0x2f) ? AVM_ISAC_REG_HIGH : AVM_ISAC_REG_LOW;
register u8 val;
register unsigned long flags;
u8 idx = (offset > 0x2f) ? AVM_ISAC_REG_HIGH : AVM_ISAC_REG_LOW;
u8 val;
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
......@@ -93,8 +93,8 @@ ReadISAC(struct IsdnCardState *cs, u8 offset)
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
{
register u8 idx = (offset > 0x2f) ? AVM_ISAC_REG_HIGH : AVM_ISAC_REG_LOW;
register unsigned long flags;
u8 idx = (offset > 0x2f) ? AVM_ISAC_REG_HIGH : AVM_ISAC_REG_LOW;
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
......@@ -126,9 +126,9 @@ static struct dc_hw_ops isac_ops = {
static inline u_int
ReadHDLCPCI(struct IsdnCardState *cs, int chan, u8 offset)
{
register u_int idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register u_int val;
register unsigned long flags;
u_int idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
u_int val;
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
outl(idx, cs->hw.avm.cfg_reg + 4);
......@@ -140,8 +140,8 @@ ReadHDLCPCI(struct IsdnCardState *cs, int chan, u8 offset)
static inline void
WriteHDLCPCI(struct IsdnCardState *cs, int chan, u8 offset, u_int value)
{
register u_int idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register unsigned long flags;
u_int idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
outl(idx, cs->hw.avm.cfg_reg + 4);
......@@ -152,9 +152,9 @@ WriteHDLCPCI(struct IsdnCardState *cs, int chan, u8 offset, u_int value)
static inline u8
ReadHDLCPnP(struct IsdnCardState *cs, int chan, u8 offset)
{
register u8 idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register u8 val;
register unsigned long flags;
u8 idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
u8 val;
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
......@@ -166,8 +166,8 @@ ReadHDLCPnP(struct IsdnCardState *cs, int chan, u8 offset)
static inline void
WriteHDLCPnP(struct IsdnCardState *cs, int chan, u8 offset, u8 value)
{
register u8 idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
register unsigned long flags;
u8 idx = chan ? AVM_HDLC_2 : AVM_HDLC_1;
unsigned long flags;
spin_lock_irqsave(&avm_pci_lock, flags);
outb(idx, cs->hw.avm.cfg_reg + 4);
......
......@@ -29,7 +29,7 @@ const char *bkm_a4t_revision = "$Revision: 1.13.6.6 $";
static inline u8
readreg(unsigned int ale, unsigned long adr, u8 off)
{
register u_int ret;
u_int ret;
unsigned long flags;
unsigned int *po = (unsigned int *) adr; /* Postoffice */
spin_lock_irqsave(&bkm_a4t_lock, flags);
......@@ -42,17 +42,6 @@ readreg(unsigned int ale, unsigned long adr, u8 off)
return ((unsigned char) ret);
}
static inline void
readfifo(unsigned int ale, unsigned long adr, u8 off, u8 * data, int size)
{
/* fifo read without cli because it's allready done */
int i;
for (i = 0; i < size; i++)
*data++ = readreg(ale, adr, off);
}
static inline void
writereg(unsigned int ale, unsigned long adr, u8 off, u8 data)
{
......@@ -66,18 +55,24 @@ writereg(unsigned int ale, unsigned long adr, u8 off, u8 data)
spin_unlock_irqrestore(&bkm_a4t_lock, flags);
}
static inline void
readfifo(unsigned int ale, unsigned long adr, u8 off, u8 * data, int size)
{
int i;
for (i = 0; i < size; i++)
*data++ = readreg(ale, adr, off);
}
static inline void
writefifo(unsigned int ale, unsigned long adr, u8 off, u8 * data, int size)
{
/* fifo write without cli because it's allready done */
int i;
for (i = 0; i < size; i++)
writereg(ale, adr, off, *data++);
}
static u8
isac_read(struct IsdnCardState *cs, u8 offset)
{
......
......@@ -68,26 +68,20 @@ static inline void
readfifo(struct IsdnCardState *cs, u8 off, u8 *data, int size)
{
int i;
unsigned long flags;
spin_lock_irqsave(&bkm_a8_lock, flags);
wordout(cs->hw.ax.base, off);
for (i = 0; i < size; i++)
data[i] = wordin(cs->hw.ax.data_adr) & 0xFF;
spin_unlock_irqrestore(&bkm_a8_lock, flags);
}
static inline void
writefifo(struct IsdnCardState *cs, u8 off, u8 *data, int size)
{
int i;
unsigned long flags;
spin_lock_irqsave(&bkm_a8_lock, flags);
wordout(cs->hw.ax.base, off);
for (i = 0; i < size; i++)
wordout(cs->hw.ax.data_adr, data[i]);
spin_unlock_irqrestore(&bkm_a8_lock, flags);
}
static u8
......
......@@ -96,37 +96,28 @@ readreg(unsigned int ale, unsigned int adr, u8 off)
}
static inline void
readfifo(unsigned int ale, unsigned int adr, u8 off, u8 * data, int size)
writereg(unsigned int ale, unsigned int adr, u8 off, u8 data)
{
unsigned long flags;
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
insb(adr, data, size);
byteout(adr, data);
spin_unlock_irqrestore(&diva_lock, flags);
}
static inline void
writereg(unsigned int ale, unsigned int adr, u8 off, u8 data)
readfifo(unsigned int ale, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
byteout(adr, data);
spin_unlock_irqrestore(&diva_lock, flags);
insb(adr, data, size);
}
static inline void
writefifo(unsigned int ale, unsigned int adr, u8 off, u8 *data, int size)
{
unsigned long flags;
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&diva_lock, flags);
}
static inline u8
......
......@@ -169,23 +169,15 @@ writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
static inline void
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&elsa_lock, flags);
byteout(cs->hw.elsa.ale, off);
insb(adr, data, size);
spin_unlock_irqrestore(&elsa_lock, flags);
}
static inline void
writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&elsa_lock, flags);
byteout(cs->hw.elsa.ale, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&elsa_lock, flags);
}
static u8
......
......@@ -54,37 +54,28 @@ readreg(struct IsdnCardState *cs, unsigned int adr, u8 off)
}
static inline void
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
{
unsigned long flags;
spin_lock_irqsave(&ix1_micro_lock, flags);
byteout(cs->hw.ix1.isac_ale, off);
insb(adr, data, size);
byteout(adr, data);
spin_unlock_irqrestore(&ix1_micro_lock, flags);
}
static inline void
writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&ix1_micro_lock, flags);
byteout(cs->hw.ix1.isac_ale, off);
byteout(adr, data);
spin_unlock_irqrestore(&ix1_micro_lock, flags);
insb(adr, data, size);
}
static inline void
writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&ix1_micro_lock, flags);
byteout(cs->hw.ix1.isac_ale, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&ix1_micro_lock, flags);
}
static u8
......
......@@ -59,23 +59,15 @@ writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
static inline void
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&mic_lock, flags);
byteout(cs->hw.mic.adr, off);
insb(adr, data, size);
spin_unlock_irqrestore(&mic_lock, flags);
}
static inline void
writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&mic_lock, flags);
byteout(cs->hw.mic.adr, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&mic_lock, flags);
}
static u8
......
......@@ -74,23 +74,15 @@ writereg(unsigned int ale, unsigned int adr, u8 off, u8 data)
static inline void
readfifo(unsigned int ale, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&niccy_lock, flags);
byteout(ale, off);
insb(adr, data, size);
spin_unlock_irqrestore(&niccy_lock, flags);
}
static inline void
writefifo(unsigned int ale, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&niccy_lock, flags);
byteout(ale, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&niccy_lock, flags);
}
static u8
......
......@@ -59,23 +59,15 @@ writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
static inline void
readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 *data, int size)
{
unsigned long flags;
spin_lock_irqsave(&saphir_lock, flags);
byteout(cs->hw.saphir.ale, off);
insb(adr, data, size);
spin_unlock_irqrestore(&saphir_lock, flags);
}
static inline void
writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 *data, int size)
{
unsigned long flags;
spin_lock_irqsave(&saphir_lock, flags);
byteout(cs->hw.saphir.ale, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&saphir_lock, flags);
}
static u8
......
......@@ -146,23 +146,15 @@ readfifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size
static inline void
writereg(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 data)
{
unsigned long flags;
spin_lock_irqsave(&sedlbauer_lock, flags);
byteout(cs->hw.sedl.adr, off);
byteout(adr, data);
spin_unlock_irqrestore(&sedlbauer_lock, flags);
}
static inline void
writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int size)
{
unsigned long flags;
spin_lock_irqsave(&sedlbauer_lock, flags);
byteout(cs->hw.sedl.adr, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&sedlbauer_lock, flags);
}
static u8
......
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