drivers/char/ip2 updates

Stephen Frost (sfrost@ns.snowman.net)
Tue, 21 Dec 1999 00:58:55 -0500 (EST)


Okay, this is a little more serious and should be looked over by
the maintainer, who this is primarily being sent to (Assuming they still
exist and whatnot). It fixes all of the warnings I saw, it compiles,
but it changes some things around and, while it looks okay to me, I
didn't write this code, so I've no clue if what I'm doing is actually
correct and what is intended.

Stephen

diff -u --recursive --new-file v2.3.33/drivers/char/ip2/i2ellis.c linux/drivers/char/ip2/i2ellis.c
--- v2.3.33/drivers/char/ip2/i2ellis.c Mon Aug 23 13:23:23 1999
+++ linux/drivers/char/ip2/i2ellis.c Tue Dec 21 00:35:18 1999
@@ -58,6 +58,7 @@
static struct timer_list * pDelayTimer; // Used by iiDelayTimer
static wait_queue_head_t pDelayWait; // Used by iiDelayTimer
static spinlock_t Dl_spinlock;
+static rwlock_t Dl_rwlock;

//********
//* Code *
@@ -966,7 +967,7 @@
// interrupts of any kind.


- WRITE_LOCK_IRQSAVE(&Dl_spinlock,flags)
+ WRITE_LOCK_IRQSAVE(&Dl_rwlock,flags)
OUTB(pB->i2ePointer, SEL_COMMAND);
OUTB(pB->i2ePointer, SEL_CMD_SH);

@@ -1029,7 +1030,7 @@
// you will generally not want to service interrupts or in any way
// disrupt the assumptions implicit in the larger context.

- WRITE_LOCK_IRQSAVE(&Dl_spinlock,flags)
+ WRITE_LOCK_IRQSAVE(&Dl_rwlock,flags)

if (INB(pB->i2eStatus) & STE_OUT_MT) {
UPDATE_FIFO_ROOM(pB);
diff -u --recursive --new-file v2.3.33/drivers/char/ip2/i2ellis.h linux/drivers/char/ip2/i2ellis.h
--- v2.3.33/drivers/char/ip2/i2ellis.h Mon Aug 23 13:23:23 1999
+++ linux/drivers/char/ip2/i2ellis.h Tue Dec 21 00:38:11 1999
@@ -352,6 +352,7 @@
// Ring-buffers of channel structures whose channels have particular needs.

spinlock_t Fbuf_spinlock;
+ rwlock_t Fbuf_rwlock;
volatile
unsigned short i2Fbuf_strip; // Strip index
volatile
@@ -360,6 +361,7 @@
// of channels who need to send
// flow control packets.
spinlock_t Dbuf_spinlock;
+ rwlock_t Dbuf_rwlock;
volatile
unsigned short i2Dbuf_strip; // Strip index
volatile
@@ -368,6 +370,7 @@
// of channels who need to send
// data or in-line command packets.
spinlock_t Bbuf_spinlock;
+ rwlock_t Bbuf_rwlock;
volatile
unsigned short i2Bbuf_strip; // Strip index
volatile
@@ -397,7 +400,9 @@
unsigned long debugBypassCount;

spinlock_t read_fifo_spinlock;
+ rwlock_t read_fifo_rwlock;
spinlock_t write_fifo_spinlock;
+ rwlock_t write_fifo_rwlock;

} i2eBordStr, *i2eBordStrPtr;

diff -u --recursive --new-file v2.3.33/drivers/char/ip2/i2lib.c linux/drivers/char/ip2/i2lib.c
--- v2.3.33/drivers/char/ip2/i2lib.c Tue Aug 31 14:30:48 1999
+++ linux/drivers/char/ip2/i2lib.c Tue Dec 21 00:35:24 1999
@@ -353,7 +353,7 @@

case NEED_INLINE:

- WRITE_LOCK_IRQSAVE(&pB->Dbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->Dbuf_rwlock,flags);
if ( pB->i2Dbuf_stuff != pB->i2Dbuf_strip)
{
queueIndex = pB->i2Dbuf_strip;
@@ -365,12 +365,12 @@
pB->i2Dbuf_strip = queueIndex;
pCh->channelNeeds &= ~NEED_INLINE;
}
- WRITE_UNLOCK_IRQRESTORE(&pB->Dbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->Dbuf_rwlock,flags);
break;

case NEED_BYPASS:

- WRITE_LOCK_IRQSAVE(&pB->Bbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->Bbuf_rwlock,flags);
if (pB->i2Bbuf_stuff != pB->i2Bbuf_strip)
{
queueIndex = pB->i2Bbuf_strip;
@@ -382,12 +382,12 @@
pB->i2Bbuf_strip = queueIndex;
pCh->channelNeeds &= ~NEED_BYPASS;
}
- WRITE_UNLOCK_IRQRESTORE(&pB->Bbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->Bbuf_rwlock,flags);
break;

case NEED_FLOW:

- WRITE_LOCK_IRQSAVE(&pB->Fbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->Fbuf_rwlock,flags);
if (pB->i2Fbuf_stuff != pB->i2Fbuf_strip)
{
queueIndex = pB->i2Fbuf_strip;
@@ -399,7 +399,7 @@
pB->i2Fbuf_strip = queueIndex;
pCh->channelNeeds &= ~NEED_FLOW;
}
- WRITE_UNLOCK_IRQRESTORE(&pB->Fbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->Fbuf_rwlock,flags);
break;
default:
printk(KERN_ERR "i2DeQueueNeeds called with bad type:%x\n",type);
@@ -432,7 +432,7 @@

case NEED_INLINE:

- WRITE_LOCK_IRQSAVE(&pB->Dbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->Dbuf_rwlock,flags);
if ( !(pCh->channelNeeds & NEED_INLINE) )
{
pCh->channelNeeds |= NEED_INLINE;
@@ -442,12 +442,12 @@
queueIndex = 0;
pB->i2Dbuf_stuff = queueIndex;
}
- WRITE_UNLOCK_IRQRESTORE(&pB->Dbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->Dbuf_rwlock,flags);
break;

case NEED_BYPASS:

- WRITE_LOCK_IRQSAVE(&pB->Bbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->Bbuf_rwlock,flags);
if ((type & NEED_BYPASS) && !(pCh->channelNeeds & NEED_BYPASS))
{
pCh->channelNeeds |= NEED_BYPASS;
@@ -457,12 +457,12 @@
queueIndex = 0;
pB->i2Bbuf_stuff = queueIndex;
}
- WRITE_UNLOCK_IRQRESTORE(&pB->Bbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->Bbuf_rwlock,flags);
break;

case NEED_FLOW:

- WRITE_LOCK_IRQSAVE(&pB->Fbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->Fbuf_rwlock,flags);
if ((type & NEED_FLOW) && !(pCh->channelNeeds & NEED_FLOW))
{
pCh->channelNeeds |= NEED_FLOW;
@@ -472,7 +472,7 @@
queueIndex = 0;
pB->i2Fbuf_stuff = queueIndex;
}
- WRITE_UNLOCK_IRQRESTORE(&pB->Fbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->Fbuf_rwlock,flags);
break;

case NEED_CREDIT:
@@ -529,7 +529,7 @@
unsigned short channel;
int cnt;
unsigned long flags = 0;
- spinlock_t *lock_var_p = NULL;
+ rwlock_t *lock_var_p = NULL;

// Make sure the channel exists, otherwise do nothing
if ( !i2Validate ( pCh ) ) {
@@ -598,13 +598,13 @@
// How much room (this time through) ?
switch(type) {
case PTYPE_INLINE:
- lock_var_p = &pCh->Obuf_spinlock;
+ lock_var_p = &pCh->Obuf_rwlock;
WRITE_LOCK_IRQSAVE(lock_var_p,flags);
stuffIndex = pCh->Obuf_stuff;
bufroom = pCh->Obuf_strip - stuffIndex;
break;
case PTYPE_BYPASS:
- lock_var_p = &pCh->Cbuf_spinlock;
+ lock_var_p = &pCh->Cbuf_rwlock;
WRITE_LOCK_IRQSAVE(lock_var_p,flags);
stuffIndex = pCh->Cbuf_stuff;
bufroom = pCh->Cbuf_strip - stuffIndex;
@@ -729,7 +729,7 @@
{
case PTYPE_INLINE:
pCh->Obuf_stuff = stuffIndex; // Store buffer pointer
- WRITE_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Obuf_rwlock,flags);

pB->debugInlineQueued++;
// Add the channel pointer to list of channels needing service (first
@@ -739,7 +739,7 @@

case PTYPE_BYPASS:
pCh->Cbuf_stuff = stuffIndex; // Store buffer pointer
- WRITE_UNLOCK_IRQRESTORE(&pCh->Cbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Cbuf_rwlock,flags);

pB->debugBypassQueued++;
// Add the channel pointer to list of channels needing service (first
@@ -828,7 +828,7 @@
count = -1;
goto i2Input_exit;
}
- WRITE_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Ibuf_rwlock,flags);

// initialize some accelerators and private copies
stripIndex = pCh->Ibuf_strip;
@@ -838,7 +838,7 @@
// If buffer is empty or requested data count was 0, (trivial case) return
// without any further thought.
if ( count == 0 ) {
- WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags);
goto i2Input_exit;
}
// Adjust for buffer wrap
@@ -879,10 +879,10 @@

if ((pCh->sinceLastFlow += count) >= pCh->whenSendFlow) {
pCh->sinceLastFlow -= pCh->whenSendFlow;
- WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags);
i2QueueNeeds(pCh->pMyBord, pCh, NEED_FLOW);
} else {
- WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags);
}

i2Input_exit:
@@ -917,7 +917,7 @@
ip2trace (CHANN, ITRC_INPUT, 10, 0);
#endif

- WRITE_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Ibuf_rwlock,flags);
count = pCh->Ibuf_stuff - pCh->Ibuf_strip;

// Adjust for buffer wrap
@@ -938,10 +938,10 @@
if ( (pCh->sinceLastFlow += count) >= pCh->whenSendFlow )
{
pCh->sinceLastFlow -= pCh->whenSendFlow;
- WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags);
i2QueueNeeds(pCh->pMyBord, pCh, NEED_FLOW);
} else {
- WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags);
}
#ifdef IP2DEBUG_TRACE
ip2trace (CHANN, ITRC_INPUT, 19, 1, count);
@@ -970,9 +970,9 @@


// initialize some accelerators and private copies
- READ_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags);
+ READ_LOCK_IRQSAVE(&pCh->Ibuf_rwlock,flags);
count = pCh->Ibuf_stuff - pCh->Ibuf_strip;
- READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags);
+ READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags);

// Adjust for buffer wrap
if (count < 0)
@@ -1039,9 +1039,9 @@
while ( count > 0 ) {

// How much room in output buffer is there?
- READ_LOCK_IRQSAVE(&pCh->Obuf_spinlock,flags);
+ READ_LOCK_IRQSAVE(&pCh->Obuf_rwlock,flags);
amountToMove = pCh->Obuf_strip - pCh->Obuf_stuff - 1;
- READ_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags);
+ READ_UNLOCK_IRQRESTORE(&pCh->Obuf_rwlock,flags);
if (amountToMove < 0) {
amountToMove += OBUF_SIZE;
}
@@ -1070,7 +1070,7 @@
if ( !(pCh->flush_flags && i2RetryFlushOutput(pCh) )
&& amountToMove > 0 )
{
- WRITE_LOCK_IRQSAVE(&pCh->Obuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Obuf_rwlock,flags);
stuffIndex = pCh->Obuf_stuff;

// Had room to move some data: don't know whether the block size,
@@ -1102,7 +1102,7 @@
}
pCh->Obuf_stuff = stuffIndex;

- WRITE_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Obuf_rwlock,flags);

#ifdef IP2DEBUG_TRACE
ip2trace (CHANN, ITRC_OUTPUT, 13, 1, stuffIndex );
@@ -1362,9 +1362,9 @@
if ( !i2Validate ( pCh ) ) {
return -1;
}
- READ_LOCK_IRQSAVE(&pCh->Obuf_spinlock,flags);
+ READ_LOCK_IRQSAVE(&pCh->Obuf_rwlock,flags);
amountToMove = pCh->Obuf_strip - pCh->Obuf_stuff - 1;
- READ_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags);
+ READ_UNLOCK_IRQRESTORE(&pCh->Obuf_rwlock,flags);

if (amountToMove < 0) {
amountToMove += OBUF_SIZE;
@@ -1489,7 +1489,7 @@
//ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 2, 0 );
#endif
// Process packet from fifo a one atomic unit
- WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock,bflags);
+ WRITE_LOCK_IRQSAVE(&pB->read_fifo_rwlock,bflags);

// The first word (or two bytes) will have channel number and type of
// packet, possibly other information
@@ -1512,7 +1512,7 @@
// sick!
if ( ((unsigned int)count) > IBUF_SIZE ) {
pB->i2eFatal = 2;
- WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_rwlock,bflags);
return; /* Bail out ASAP */
}
// Channel is illegally big ?
@@ -1520,7 +1520,7 @@
(pCh = (((i2ChanStrPtr*)pB->i2eChannelPtr)[channel])) == NULL)
{
iiReadBuf(pB, junkBuffer, count);
- WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_rwlock,bflags);
break; /* From switch: ready for next packet */
}

@@ -1534,14 +1534,14 @@
if(ID_OF(pB->i2eLeadoffWord) == ID_HOT_KEY)
{
pCh->hotKeyIn = iiReadWord(pB) & 0xff;
- WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_rwlock,bflags);
i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_HOTACK);
break; /* From the switch: ready for next packet */
}

// Normal data! We crudely assume there is room for the data in our
// buffer because the board wouldn't have exceeded his credit limit.
- WRITE_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,cflags);// We have 2 locks now
+ WRITE_LOCK_IRQSAVE(&pCh->Ibuf_rwlock,cflags);// We have 2 locks now
stuffIndex = pCh->Ibuf_stuff;
amountToRead = IBUF_SIZE - stuffIndex;
if (amountToRead > count)
@@ -1581,8 +1581,8 @@

// Update stuff index
pCh->Ibuf_stuff = stuffIndex;
- WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,cflags);
- WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,cflags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_rwlock,bflags);

#ifdef USE_IQ
queue_task(&pCh->tqueue_input, &tq_immediate);
@@ -1607,7 +1607,7 @@

iiReadBuf(pB, cmdBuffer, count);
// We can release early with buffer grab
- WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_rwlock,bflags);

pc = cmdBuffer;
pcLimit = &(cmdBuffer[count]);
@@ -1893,7 +1893,7 @@
{
int rc = 0;
unsigned long flags;
- WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->write_fifo_rwlock,flags);
if (!pB->i2eWaitingForEmptyFifo) {
if (pB->i2eFifoRemains > (count+reserve)) {
pB->i2eFifoRemains -= count;
@@ -1902,7 +1902,7 @@
rc = count;
}
}
- WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_rwlock,flags);
return rc;
}
//******************************************************************************
@@ -1933,7 +1933,7 @@
while ( --bailout && notClogged &&
(NULL != (pCh = i2DeQueueNeeds(pB,NEED_BYPASS))))
{
- WRITE_LOCK_IRQSAVE(&pCh->Cbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Cbuf_rwlock,flags);
stripIndex = pCh->Cbuf_strip;

// as long as there are packets for this channel...
@@ -1965,7 +1965,7 @@
// Done with this channel. Move to next, removing this one from
// the queue of channels if we cleaned it out (i.e., didn't get clogged.
pCh->Cbuf_strip = stripIndex;
- WRITE_UNLOCK_IRQRESTORE(&pCh->Cbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Cbuf_rwlock,flags);
} // Either clogged or finished all the work

#ifdef IP2DEBUG_TRACE
@@ -2050,7 +2050,7 @@
while ( --bailout && notClogged &&
(NULL != (pCh = i2DeQueueNeeds(pB,NEED_INLINE))) )
{
- WRITE_LOCK_IRQSAVE(&pCh->Obuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Obuf_rwlock,flags);
stripIndex = pCh->Obuf_strip;

#ifdef IP2DEBUG_TRACE
@@ -2127,7 +2127,7 @@
// Done with this channel. Move to next, removing this one from the
// queue of channels if we cleaned it out (i.e., didn't get clogged.
pCh->Obuf_strip = stripIndex;
- WRITE_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Obuf_rwlock,flags);
if ( notClogged )
{
#ifdef IP2DEBUG_TRACE
@@ -2232,10 +2232,10 @@

if (inmail & MB_OUT_STRIPPED) {
pB->i2eFifoOutInts++;
- WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->write_fifo_rwlock,flags);
pB->i2eFifoRemains = pB->i2eFifoSize;
pB->i2eWaitingForEmptyFifo = 0;
- WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_rwlock,flags);
#ifdef IP2DEBUG_TRACE
ip2trace (ITRC_NO_PORT, ITRC_INTR, 30, 1, pB->i2eFifoRemains );
#endif
diff -u --recursive --new-file v2.3.33/drivers/char/ip2/i2lib.h linux/drivers/char/ip2/i2lib.h
--- v2.3.33/drivers/char/ip2/i2lib.h Mon Aug 23 13:23:23 1999
+++ linux/drivers/char/ip2/i2lib.h Tue Dec 21 00:38:13 1999
@@ -230,9 +230,13 @@
#endif

spinlock_t Ibuf_spinlock;
+ rwlock_t Ibuf_rwlock;
spinlock_t Obuf_spinlock;
+ rwlock_t Obuf_rwlock;
spinlock_t Cbuf_spinlock;
+ rwlock_t Cbuf_rwlock;
spinlock_t Pbuf_spinlock;
+ rwlock_t Pbuf_rwlock;

} i2ChanStr, *i2ChanStrPtr;

diff -u --recursive --new-file v2.3.33/drivers/char/ip2main.c linux/drivers/char/ip2main.c
--- v2.3.33/drivers/char/ip2main.c Fri Nov 19 14:33:29 1999
+++ linux/drivers/char/ip2main.c Tue Dec 21 00:35:40 1999
@@ -973,7 +973,7 @@
* Write to FIFO; don't bother to adjust fifo capacity for this, since
* board will respond almost immediately after SendMail hit.
*/
- WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->write_fifo_rwlock,flags);
iiWriteBuf(pB, tempCommand, 4);
WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags);
pB->i2eUsingIrq = boardIrq;
@@ -993,9 +993,9 @@
(CMD_OF(tempCommand))[4] = 64; // chars

(CMD_OF(tempCommand))[5] = 87; // HW_TEST
- WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->write_fifo_rwlock,flags);
iiWriteBuf(pB, tempCommand, 8);
- WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_rwlock,flags);

CHANNEL_OF(tempCommand) = 0;
PTYPE_OF(tempCommand) = PTYPE_BYPASS;
@@ -1010,9 +1010,9 @@
CMD_COUNT_OF(tempCommand) = 2;
(CMD_OF(tempCommand))[0] = 44; /* get ping */
(CMD_OF(tempCommand))[1] = 200; /* 200 ms */
- WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pB->write_fifo_rwlock,flags);
iiWriteBuf(pB, tempCommand, 4);
- WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_rwlock,flags);
#endif

iiEnableMailIrq(pB);
@@ -1144,12 +1144,12 @@
#endif
// Data input
if ( pCh->pTTY != NULL ) {
- READ_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags)
+ READ_LOCK_IRQSAVE(&pCh->Ibuf_rwlock,flags)
if (!pCh->throttled && (pCh->Ibuf_stuff != pCh->Ibuf_strip)) {
- READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags)
+ READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags)
i2Input( pCh );
} else
- READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags)
+ READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags)
} else {
#ifdef IP2DEBUG_TRACE
ip2trace(PORTN, ITRC_INPUT, 22, 0 );
@@ -1658,9 +1658,9 @@
ip2_flush_chars( tty );

/* This is the actual move bit. Make sure it does what we need!!!!! */
- WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Pbuf_rwlock,flags);
bytesSent = i2Output( pCh, pData, count, user );
- WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);

#ifdef IP2DEBUG_TRACE
ip2trace (PORTN, ITRC_WRITE, ITRC_RETURN, 1, bytesSent );
@@ -1688,13 +1688,13 @@
// ip2trace (PORTN, ITRC_PUTC, ITRC_ENTER, 1, ch );
#endif

- WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Pbuf_rwlock,flags);
pCh->Pbuf[pCh->Pbuf_stuff++] = ch;
if ( pCh->Pbuf_stuff == sizeof pCh->Pbuf ) {
- WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);
ip2_flush_chars( tty );
} else
- WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);

#ifdef IP2DEBUG_TRACE
// ip2trace (PORTN, ITRC_PUTC, ITRC_RETURN, 1, ch );
@@ -1716,7 +1716,7 @@
i2ChanStrPtr pCh = tty->driver_data;
unsigned long flags;

- WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Pbuf_rwlock,flags);
if ( pCh->Pbuf_stuff ) {
#ifdef IP2DEBUG_TRACE
// ip2trace (PORTN, ITRC_PUTC, 10, 1, strip );
@@ -1730,7 +1730,7 @@
}
pCh->Pbuf_stuff -= strip;
}
- WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);
}

/******************************************************************************/
@@ -1748,9 +1748,9 @@
i2ChanStrPtr pCh = tty->driver_data;
unsigned long flags;

- READ_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags);
+ READ_LOCK_IRQSAVE(&pCh->Pbuf_rwlock,flags);
bytesFree = i2OutputFree( pCh ) - pCh->Pbuf_stuff;
- READ_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ READ_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);

#ifdef IP2DEBUG_TRACE
ip2trace (PORTN, ITRC_WRITE, 11, 1, bytesFree );
@@ -1782,12 +1782,12 @@
pCh->Obuf_char_count + pCh->Pbuf_stuff,
pCh->Obuf_char_count, pCh->Pbuf_stuff );
#endif
- READ_LOCK_IRQSAVE(&pCh->Obuf_spinlock,flags);
+ READ_LOCK_IRQSAVE(&pCh->Obuf_rwlock,flags);
rc = pCh->Obuf_char_count;
- READ_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags);
- READ_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags);
+ READ_UNLOCK_IRQRESTORE(&pCh->Obuf_rwlock,flags);
+ READ_LOCK_IRQSAVE(&pCh->Pbuf_rwlock,flags);
rc += pCh->Pbuf_stuff;
- READ_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ READ_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);
return rc;
}

@@ -1812,9 +1812,9 @@
#ifdef IP2DEBUG_WRITE
printk (KERN_DEBUG "IP2: flush buffer\n" );
#endif
- WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags);
+ WRITE_LOCK_IRQSAVE(&pCh->Pbuf_rwlock,flags);
pCh->Pbuf_stuff = 0;
- WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags);
+ WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_rwlock,flags);
i2FlushOutput( pCh );
ip2_owake(tty);
#ifdef IP2DEBUG_TRACE
@@ -1900,15 +1900,15 @@
pCh->throttled = 0;
i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_RESUME);
serviceOutgoingFifo( pCh->pMyBord );
- READ_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags)
+ READ_LOCK_IRQSAVE(&pCh->Ibuf_rwlock,flags)
if ( pCh->Ibuf_stuff != pCh->Ibuf_strip ) {
- READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags)
+ READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags)
#ifdef IP2DEBUG_READ
printk (KERN_DEBUG "i2Input called from unthrottle\n" );
#endif
i2Input( pCh );
} else
- READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags)
+ READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_rwlock,flags)
}

static void
@@ -2325,7 +2325,7 @@
* base. Also line nunber as such is meaningless but we use it for our
* array index so it is fixed also.
*/
- if ( ns.irq != ip2config.irq
+ if ( (int) ns.irq != (int) ip2config.irq
|| (int) ns.port != ((int) pCh->pMyBord->i2eBase)
|| ns.baud_base != pCh->BaudBase
|| ns.line != pCh->port_index ) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/