Commit cf1c63c3 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: ip2, macros cleanup

- remove i2os.h -- there was only macro to macro renaming or useless
  stuff
- remove another uselless stuf (NULLFUNC, NULLPTR, YES, NO)
- use outb/inb directly
- use locking functions directly
- don't define another ROUNDUP, use roundup(x, 2) instead
- some comments and whitespace cleanup
- remove some commented crap
- prepend the rest by I2 prefix to not collide with rest of the world
  like in following output (pointed out by akpm)

In file included from drivers/char/ip2/ip2main.c:128:
drivers/char/ip2/i2ellis.h:608:1: warning: "COMPLETE" redefined
In file included from include/net/netns/ipv4.h:8,
                 from include/net/net_namespace.h:13,
                 from include/linux/seq_file.h:7,
                 from include/asm/machdep.h:12,
                 from include/asm/pci.h:17,
                 from include/linux/pci.h:951,
                 from drivers/char/ip2/ip2main.c:95:
include/net/inet_frag.h:28:1: warning: this is the location of the previous definition
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 83e422b7
This diff is collapsed.
...@@ -185,10 +185,6 @@ typedef struct _i2eBordStr ...@@ -185,10 +185,6 @@ typedef struct _i2eBordStr
// The highest allowable IRQ, based on the // The highest allowable IRQ, based on the
// slot size. // slot size.
unsigned char i2eChangeIrq;
// Whether tis valid to change IRQ's
// ISA = ok, EISA, MicroChannel, no
// Accelerators for various addresses on the board // Accelerators for various addresses on the board
int i2eBase; // I/O Address of the Board int i2eBase; // I/O Address of the Board
int i2eData; // From here data transfers happen int i2eData; // From here data transfers happen
...@@ -431,12 +427,6 @@ typedef struct _i2eBordStr ...@@ -431,12 +427,6 @@ typedef struct _i2eBordStr
// Manifests for i2eBordStr: // Manifests for i2eBordStr:
//------------------------------------------- //-------------------------------------------
#define YES 1
#define NO 0
#define NULLFUNC (void (*)(void))0
#define NULLPTR (void *)0
typedef void (*delayFunc_t)(unsigned int); typedef void (*delayFunc_t)(unsigned int);
// i2eValid // i2eValid
...@@ -494,8 +484,8 @@ typedef void (*delayFunc_t)(unsigned int); ...@@ -494,8 +484,8 @@ typedef void (*delayFunc_t)(unsigned int);
// i2eUsingIrq // i2eUsingIrq
// //
#define IRQ_UNDEFINED 0x1352 // No valid irq (or polling = 0) can ever #define I2_IRQ_UNDEFINED 0x1352 /* No valid irq (or polling = 0) can
// promote to this! * ever promote to this! */
//------------------------------------------ //------------------------------------------
// Handy Macros for i2ellis.c and others // Handy Macros for i2ellis.c and others
// Note these are common to -II and -IIEX // Note these are common to -II and -IIEX
...@@ -504,41 +494,14 @@ typedef void (*delayFunc_t)(unsigned int); ...@@ -504,41 +494,14 @@ typedef void (*delayFunc_t)(unsigned int);
// Given a pointer to the board structure, does the input FIFO have any data or // Given a pointer to the board structure, does the input FIFO have any data or
// not? // not?
// //
#define HAS_INPUT(pB) !(INB(pB->i2eStatus) & ST_IN_EMPTY) #define I2_HAS_INPUT(pB) !(inb(pB->i2eStatus) & ST_IN_EMPTY)
#define HAS_NO_INPUT(pB) (INB(pB->i2eStatus) & ST_IN_EMPTY)
// Given a pointer to board structure, read a byte or word from the fifo
//
#define BYTE_FROM(pB) (unsigned char)INB(pB->i2eData)
#define WORD_FROM(pB) (unsigned short)INW(pB->i2eData)
// Given a pointer to board structure, is there room for any data to be written
// to the data fifo?
//
#define HAS_OUTROOM(pB) !(INB(pB->i2eStatus) & ST_OUT_FULL)
#define HAS_NO_OUTROOM(pB) (INB(pB->i2eStatus) & ST_OUT_FULL)
// Given a pointer to board structure, write a single byte to the fifo
// structure. Note that for 16-bit interfaces, the high order byte is undefined
// and unknown.
//
#define BYTE_TO(pB, c) OUTB(pB->i2eData,(c))
// Write a word to the fifo structure. For 8-bit interfaces, this may have
// unknown results.
//
#define WORD_TO(pB, c) OUTW(pB->i2eData,(c))
// Given a pointer to the board structure, is there anything in the incoming // Given a pointer to the board structure, is there anything in the incoming
// mailbox? // mailbox?
// //
#define HAS_MAIL(pB) (INB(pB->i2eStatus) & ST_IN_MAIL) #define I2_HAS_MAIL(pB) (inb(pB->i2eStatus) & ST_IN_MAIL)
#define UPDATE_FIFO_ROOM(pB) (pB)->i2eFifoRemains=(pB)->i2eFifoSize #define I2_UPDATE_FIFO_ROOM(pB) ((pB)->i2eFifoRemains = (pB)->i2eFifoSize)
// Handy macro to round up a number (like the buffer write and read routines do)
//
#define ROUNDUP(number) (((number)+1) & (~1))
//------------------------------------------ //------------------------------------------
// Function Declarations for i2ellis.c // Function Declarations for i2ellis.c
...@@ -593,20 +556,11 @@ static int iiDownloadBlock(i2eBordStrPtr, loadHdrStrPtr, int); ...@@ -593,20 +556,11 @@ static int iiDownloadBlock(i2eBordStrPtr, loadHdrStrPtr, int);
// //
static int iiDownloadAll(i2eBordStrPtr, loadHdrStrPtr, int, int); static int iiDownloadAll(i2eBordStrPtr, loadHdrStrPtr, int, int);
// Called indirectly always. Needed externally so the routine might be
// SPECIFIED as an argument to iiReset()
//
//static void ii2DelayIO(unsigned int); // N-millisecond delay using
//hardware spin
//static void ii2DelayTimer(unsigned int); // N-millisecond delay using Linux
//timer
// Many functions defined here return True if good, False otherwise, with an // Many functions defined here return True if good, False otherwise, with an
// error code in i2eError field. Here is a handy macro for setting the error // error code in i2eError field. Here is a handy macro for setting the error
// code and returning. // code and returning.
// //
#define COMPLETE(pB,code) \ #define I2_COMPLETE(pB,code) do { \
do { \
pB->i2eError = code; \ pB->i2eError = code; \
return (code == I2EE_GOOD);\ return (code == I2EE_GOOD);\
} while (0) } while (0)
......
...@@ -129,7 +129,6 @@ registers, use byte operations only. ...@@ -129,7 +129,6 @@ registers, use byte operations only.
//------------------------------------------------ //------------------------------------------------
// //
#include "ip2types.h" #include "ip2types.h"
#include "i2os.h" /* For any o.s., compiler, or host-related issues */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Manifests for the I/O map: // Manifests for the I/O map:
...@@ -644,5 +643,10 @@ typedef union _loadHdrStr ...@@ -644,5 +643,10 @@ typedef union _loadHdrStr
#define ABS_BIGGEST_BOX 16 // Absolute the most ports per box #define ABS_BIGGEST_BOX 16 // Absolute the most ports per box
#define ABS_MOST_PORTS (ABS_MAX_BOXES * ABS_BIGGEST_BOX) #define ABS_MOST_PORTS (ABS_MAX_BOXES * ABS_BIGGEST_BOX)
#define I2_OUTSW(port, addr, count) outsw((port), (addr), (((count)+1)/2))
#define I2_OUTSB(port, addr, count) outsb((port), (addr), (((count)+1))&-2)
#define I2_INSW(port, addr, count) insw((port), (addr), (((count)+1)/2))
#define I2_INSB(port, addr, count) insb((port), (addr), (((count)+1))&-2)
#endif // I2HW_H #endif // I2HW_H
This diff is collapsed.
/*******************************************************************************
*
* (c) 1999 by Computone Corporation
*
********************************************************************************
*
*
* PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
* serial I/O controllers.
*
* DESCRIPTION: Defines, definitions and includes which are heavily dependent
* on O/S, host, compiler, etc. This file is tailored for:
* Linux v2.0.0 and later
* Gnu gcc c2.7.2
* 80x86 architecture
*
*******************************************************************************/
#ifndef I2OS_H /* To prevent multiple includes */
#define I2OS_H 1
//-------------------------------------------------
// Required Includes
//-------------------------------------------------
#include "ip2types.h"
#include <asm/io.h> /* For inb, etc */
//------------------------------------
// Defines for I/O instructions:
//------------------------------------
#define INB(port) inb(port)
#define OUTB(port,value) outb((value),(port))
#define INW(port) inw(port)
#define OUTW(port,value) outw((value),(port))
#define OUTSW(port,addr,count) outsw((port),(addr),(((count)+1)/2))
#define OUTSB(port,addr,count) outsb((port),(addr),(((count)+1))&-2)
#define INSW(port,addr,count) insw((port),(addr),(((count)+1)/2))
#define INSB(port,addr,count) insb((port),(addr),(((count)+1))&-2)
//--------------------------------------------
// Interrupt control
//--------------------------------------------
#define LOCK_INIT(a) rwlock_init(a)
#define SAVE_AND_DISABLE_INTS(a,b) { \
/* printk("get_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
spin_lock_irqsave(a,b); \
}
#define RESTORE_INTS(a,b) { \
/* printk("rel_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
spin_unlock_irqrestore(a,b); \
}
#define READ_LOCK_IRQSAVE(a,b) { \
/* printk("get_read_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
read_lock_irqsave(a,b); \
}
#define READ_UNLOCK_IRQRESTORE(a,b) { \
/* printk("rel_read_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
read_unlock_irqrestore(a,b); \
}
#define WRITE_LOCK_IRQSAVE(a,b) { \
/* printk("get_write_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
write_lock_irqsave(a,b); \
}
#define WRITE_UNLOCK_IRQRESTORE(a,b) { \
/* printk("rel_write_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
write_unlock_irqrestore(a,b); \
}
//------------------------------------------------------------------------------
// Hardware-delay loop
//
// Probably used in only one place (see i2ellis.c) but this helps keep things
// together. Note we have unwound the IN instructions. On machines with a
// reasonable cache, the eight instructions (1 byte each) should fit in cache
// nicely, and on un-cached machines, the code-fetch would tend not to dominate.
// Note that cx is shifted so that "count" still reflects the total number of
// iterations assuming no unwinding.
//------------------------------------------------------------------------------
//#define DELAY1MS(port,count,label)
//------------------------------------------------------------------------------
// Macros to switch to a new stack, saving stack pointers, and to restore the
// old stack (Used, for example, in i2lib.c) "heap" is the address of some
// buffer which will become the new stack (working down from highest address).
// The two words at the two lowest addresses in this stack are for storing the
// SS and SP.
//------------------------------------------------------------------------------
//#define TO_NEW_STACK(heap,size)
//#define TO_OLD_STACK(heap)
//------------------------------------------------------------------------------
// Macros to save the original IRQ vectors and masks, and to patch in new ones.
//------------------------------------------------------------------------------
//#define SAVE_IRQ_MASKS(dest)
//#define WRITE_IRQ_MASKS(src)
//#define SAVE_IRQ_VECTOR(value,dest)
//#define WRITE_IRQ_VECTOR(value,src)
//------------------------------------------------------------------------------
// Macro to copy data from one far pointer to another.
//------------------------------------------------------------------------------
#define I2_MOVE_DATA(fpSource,fpDest,count) memmove(fpDest,fpSource,count);
//------------------------------------------------------------------------------
// Macros to issue eoi's to host interrupt control (IBM AT 8259-style).
//------------------------------------------------------------------------------
//#define MASTER_EOI
//#define SLAVE_EOI
#endif /* I2OS_H */
...@@ -1052,9 +1052,9 @@ set_irq( int boardnum, int boardIrq ) ...@@ -1052,9 +1052,9 @@ set_irq( int boardnum, int boardIrq )
* Write to FIFO; don't bother to adjust fifo capacity for this, since * Write to FIFO; don't bother to adjust fifo capacity for this, since
* board will respond almost immediately after SendMail hit. * board will respond almost immediately after SendMail hit.
*/ */
WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags); write_lock_irqsave(&pB->write_fifo_spinlock, flags);
iiWriteBuf(pB, tempCommand, 4); iiWriteBuf(pB, tempCommand, 4);
WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags); write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
pB->i2eUsingIrq = boardIrq; pB->i2eUsingIrq = boardIrq;
pB->i2eOutMailWaiting |= MB_OUT_STUFFED; pB->i2eOutMailWaiting |= MB_OUT_STUFFED;
...@@ -1072,9 +1072,9 @@ set_irq( int boardnum, int boardIrq ) ...@@ -1072,9 +1072,9 @@ set_irq( int boardnum, int boardIrq )
(CMD_OF(tempCommand))[4] = 64; // chars (CMD_OF(tempCommand))[4] = 64; // chars
(CMD_OF(tempCommand))[5] = 87; // HW_TEST (CMD_OF(tempCommand))[5] = 87; // HW_TEST
WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags); write_lock_irqsave(&pB->write_fifo_spinlock, flags);
iiWriteBuf(pB, tempCommand, 8); iiWriteBuf(pB, tempCommand, 8);
WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags); write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
CHANNEL_OF(tempCommand) = 0; CHANNEL_OF(tempCommand) = 0;
PTYPE_OF(tempCommand) = PTYPE_BYPASS; PTYPE_OF(tempCommand) = PTYPE_BYPASS;
...@@ -1089,9 +1089,9 @@ set_irq( int boardnum, int boardIrq ) ...@@ -1089,9 +1089,9 @@ set_irq( int boardnum, int boardIrq )
CMD_COUNT_OF(tempCommand) = 2; CMD_COUNT_OF(tempCommand) = 2;
(CMD_OF(tempCommand))[0] = 44; /* get ping */ (CMD_OF(tempCommand))[0] = 44; /* get ping */
(CMD_OF(tempCommand))[1] = 200; /* 200 ms */ (CMD_OF(tempCommand))[1] = 200; /* 200 ms */
WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags); write_lock_irqsave(&pB->write_fifo_spinlock, flags);
iiWriteBuf(pB, tempCommand, 4); iiWriteBuf(pB, tempCommand, 4);
WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags); write_unlock_irqrestore(&pB->write_fifo_spinlock, flags);
#endif #endif
iiEnableMailIrq(pB); iiEnableMailIrq(pB);
...@@ -1270,12 +1270,12 @@ static void do_input(struct work_struct *work) ...@@ -1270,12 +1270,12 @@ static void do_input(struct work_struct *work)
// Data input // Data input
if ( pCh->pTTY != NULL ) { if ( pCh->pTTY != NULL ) {
READ_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags) read_lock_irqsave(&pCh->Ibuf_spinlock, flags);
if (!pCh->throttled && (pCh->Ibuf_stuff != pCh->Ibuf_strip)) { if (!pCh->throttled && (pCh->Ibuf_stuff != pCh->Ibuf_strip)) {
READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags) read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
i2Input( pCh ); i2Input( pCh );
} else } else
READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags) read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
} else { } else {
ip2trace(CHANN, ITRC_INPUT, 22, 0 ); ip2trace(CHANN, ITRC_INPUT, 22, 0 );
...@@ -1719,9 +1719,9 @@ ip2_write( PTTY tty, const unsigned char *pData, int count) ...@@ -1719,9 +1719,9 @@ ip2_write( PTTY tty, const unsigned char *pData, int count)
ip2_flush_chars( tty ); ip2_flush_chars( tty );
/* This is the actual move bit. Make sure it does what we need!!!!! */ /* 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_spinlock, flags);
bytesSent = i2Output( pCh, pData, count); bytesSent = i2Output( pCh, pData, count);
WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
ip2trace (CHANN, ITRC_WRITE, ITRC_RETURN, 1, bytesSent ); ip2trace (CHANN, ITRC_WRITE, ITRC_RETURN, 1, bytesSent );
...@@ -1746,13 +1746,13 @@ ip2_putchar( PTTY tty, unsigned char ch ) ...@@ -1746,13 +1746,13 @@ ip2_putchar( PTTY tty, unsigned char ch )
// ip2trace (CHANN, ITRC_PUTC, ITRC_ENTER, 1, ch ); // ip2trace (CHANN, ITRC_PUTC, ITRC_ENTER, 1, ch );
WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
pCh->Pbuf[pCh->Pbuf_stuff++] = ch; pCh->Pbuf[pCh->Pbuf_stuff++] = ch;
if ( pCh->Pbuf_stuff == sizeof pCh->Pbuf ) { if ( pCh->Pbuf_stuff == sizeof pCh->Pbuf ) {
WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
ip2_flush_chars( tty ); ip2_flush_chars( tty );
} else } else
WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
// ip2trace (CHANN, ITRC_PUTC, ITRC_RETURN, 1, ch ); // ip2trace (CHANN, ITRC_PUTC, ITRC_RETURN, 1, ch );
} }
...@@ -1772,7 +1772,7 @@ ip2_flush_chars( PTTY tty ) ...@@ -1772,7 +1772,7 @@ ip2_flush_chars( PTTY tty )
i2ChanStrPtr pCh = tty->driver_data; i2ChanStrPtr pCh = tty->driver_data;
unsigned long flags; unsigned long flags;
WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
if ( pCh->Pbuf_stuff ) { if ( pCh->Pbuf_stuff ) {
// ip2trace (CHANN, ITRC_PUTC, 10, 1, strip ); // ip2trace (CHANN, ITRC_PUTC, 10, 1, strip );
...@@ -1786,7 +1786,7 @@ ip2_flush_chars( PTTY tty ) ...@@ -1786,7 +1786,7 @@ ip2_flush_chars( PTTY tty )
} }
pCh->Pbuf_stuff -= strip; pCh->Pbuf_stuff -= strip;
} }
WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
} }
/******************************************************************************/ /******************************************************************************/
...@@ -1804,9 +1804,9 @@ ip2_write_room ( PTTY tty ) ...@@ -1804,9 +1804,9 @@ ip2_write_room ( PTTY tty )
i2ChanStrPtr pCh = tty->driver_data; i2ChanStrPtr pCh = tty->driver_data;
unsigned long flags; unsigned long flags;
READ_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); read_lock_irqsave(&pCh->Pbuf_spinlock, flags);
bytesFree = i2OutputFree( pCh ) - pCh->Pbuf_stuff; bytesFree = i2OutputFree( pCh ) - pCh->Pbuf_stuff;
READ_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); read_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
ip2trace (CHANN, ITRC_WRITE, 11, 1, bytesFree ); ip2trace (CHANN, ITRC_WRITE, 11, 1, bytesFree );
...@@ -1836,12 +1836,12 @@ ip2_chars_in_buf ( PTTY tty ) ...@@ -1836,12 +1836,12 @@ ip2_chars_in_buf ( PTTY tty )
pCh->Obuf_char_count + pCh->Pbuf_stuff, pCh->Obuf_char_count + pCh->Pbuf_stuff,
pCh->Obuf_char_count, pCh->Pbuf_stuff ); pCh->Obuf_char_count, pCh->Pbuf_stuff );
#endif #endif
READ_LOCK_IRQSAVE(&pCh->Obuf_spinlock,flags); read_lock_irqsave(&pCh->Obuf_spinlock, flags);
rc = pCh->Obuf_char_count; rc = pCh->Obuf_char_count;
READ_UNLOCK_IRQRESTORE(&pCh->Obuf_spinlock,flags); read_unlock_irqrestore(&pCh->Obuf_spinlock, flags);
READ_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); read_lock_irqsave(&pCh->Pbuf_spinlock, flags);
rc += pCh->Pbuf_stuff; rc += pCh->Pbuf_stuff;
READ_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); read_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
return rc; return rc;
} }
...@@ -1865,9 +1865,9 @@ ip2_flush_buffer( PTTY tty ) ...@@ -1865,9 +1865,9 @@ ip2_flush_buffer( PTTY tty )
#ifdef IP2DEBUG_WRITE #ifdef IP2DEBUG_WRITE
printk (KERN_DEBUG "IP2: flush buffer\n" ); printk (KERN_DEBUG "IP2: flush buffer\n" );
#endif #endif
WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); write_lock_irqsave(&pCh->Pbuf_spinlock, flags);
pCh->Pbuf_stuff = 0; pCh->Pbuf_stuff = 0;
WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); write_unlock_irqrestore(&pCh->Pbuf_spinlock, flags);
i2FlushOutput( pCh ); i2FlushOutput( pCh );
ip2_owake(tty); ip2_owake(tty);
...@@ -1953,15 +1953,15 @@ ip2_unthrottle ( PTTY tty ) ...@@ -1953,15 +1953,15 @@ ip2_unthrottle ( PTTY tty )
pCh->throttled = 0; pCh->throttled = 0;
i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_RESUME); i2QueueCommands(PTYPE_BYPASS, pCh, 0, 1, CMD_RESUME);
serviceOutgoingFifo( pCh->pMyBord ); serviceOutgoingFifo( pCh->pMyBord );
READ_LOCK_IRQSAVE(&pCh->Ibuf_spinlock,flags) read_lock_irqsave(&pCh->Ibuf_spinlock, flags);
if ( pCh->Ibuf_stuff != pCh->Ibuf_strip ) { if ( pCh->Ibuf_stuff != pCh->Ibuf_strip ) {
READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags) read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
#ifdef IP2DEBUG_READ #ifdef IP2DEBUG_READ
printk (KERN_DEBUG "i2Input called from unthrottle\n" ); printk (KERN_DEBUG "i2Input called from unthrottle\n" );
#endif #endif
i2Input( pCh ); i2Input( pCh );
} else } else
READ_UNLOCK_IRQRESTORE(&pCh->Ibuf_spinlock,flags) read_unlock_irqrestore(&pCh->Ibuf_spinlock, flags);
} }
static void static void
...@@ -2204,9 +2204,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ...@@ -2204,9 +2204,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
* for masking). Caller should use TIOCGICOUNT to see which one it was * for masking). Caller should use TIOCGICOUNT to see which one it was
*/ */
case TIOCMIWAIT: case TIOCMIWAIT:
WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock, flags); write_lock_irqsave(&pB->read_fifo_spinlock, flags);
cprev = pCh->icount; /* note the counters on entry */ cprev = pCh->icount; /* note the counters on entry */
WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock, flags); write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4, i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4,
CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP); CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP);
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
...@@ -2226,9 +2226,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ...@@ -2226,9 +2226,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
rc = -ERESTARTSYS; rc = -ERESTARTSYS;
break; break;
} }
WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock, flags); write_lock_irqsave(&pB->read_fifo_spinlock, flags);
cnow = pCh->icount; /* atomic copy */ cnow = pCh->icount; /* atomic copy */
WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock, flags); write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) { cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
rc = -EIO; /* no change => rc */ rc = -EIO; /* no change => rc */
...@@ -2266,9 +2266,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ...@@ -2266,9 +2266,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
case TIOCGICOUNT: case TIOCGICOUNT:
ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc ); ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc );
WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock, flags); write_lock_irqsave(&pB->read_fifo_spinlock, flags);
cnow = pCh->icount; cnow = pCh->icount;
WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock, flags); write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
p_cuser = argp; p_cuser = argp;
rc = put_user(cnow.cts, &p_cuser->cts); rc = put_user(cnow.cts, &p_cuser->cts);
rc = put_user(cnow.dsr, &p_cuser->dsr); rc = put_user(cnow.dsr, &p_cuser->dsr);
...@@ -2874,7 +2874,7 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg ) ...@@ -2874,7 +2874,7 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
case 65: /* Board - ip2stat */ case 65: /* Board - ip2stat */
if ( pB ) { if ( pB ) {
rc = copy_to_user(argp, pB, sizeof(i2eBordStr)); rc = copy_to_user(argp, pB, sizeof(i2eBordStr));
rc = put_user(INB(pB->i2eStatus), rc = put_user(inb(pB->i2eStatus),
(ULONG __user *)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) ); (ULONG __user *)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) );
} else { } else {
rc = -ENODEV; rc = -ENODEV;
......
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