提交 0fab6de0 编写于 作者: J Joe Perches 提交者: Linus Torvalds

synclink drivers bool conversion

Remove more TRUE/FALSE defines and uses
Remove == TRUE tests
Convert BOOLEAN to bool
Convert int to bool where appropriate
Signed-off-by: NJoe Perches <joe@perches.com>
Acked-by: NPaul Fulghum <paulkf@microgate.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 7a63ce5a
......@@ -189,20 +189,20 @@ typedef struct _mgslpc_info {
u32 pending_bh;
int bh_running;
int bh_requested;
bool bh_running;
bool bh_requested;
int dcd_chkcount; /* check counts to prevent */
int cts_chkcount; /* too many IRQs if a signal */
int dsr_chkcount; /* is floating */
int ri_chkcount;
int rx_enabled;
int rx_overflow;
bool rx_enabled;
bool rx_overflow;
int tx_enabled;
int tx_active;
int tx_aborting;
bool tx_enabled;
bool tx_active;
bool tx_aborting;
u32 idle_mode;
int if_mode; /* serial interface selection (RS-232, v.35 etc) */
......@@ -216,12 +216,12 @@ typedef struct _mgslpc_info {
unsigned char serial_signals; /* current serial signal states */
char irq_occurred; /* for diagnostics use */
bool irq_occurred; /* for diagnostics use */
char testing_irq;
unsigned int init_error; /* startup error (DIAGS) */
char flag_buf[MAX_ASYNC_BUFFER_SIZE];
BOOLEAN drop_rts_on_tx_done;
bool drop_rts_on_tx_done;
struct _input_signal_events input_signal_events;
......@@ -402,8 +402,8 @@ static void hdlcdev_exit(MGSLPC_INFO *info);
static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit);
static BOOLEAN register_test(MGSLPC_INFO *info);
static BOOLEAN irq_test(MGSLPC_INFO *info);
static bool register_test(MGSLPC_INFO *info);
static bool irq_test(MGSLPC_INFO *info);
static int adapter_test(MGSLPC_INFO *info);
static int claim_resources(MGSLPC_INFO *info);
......@@ -411,7 +411,7 @@ static void release_resources(MGSLPC_INFO *info);
static void mgslpc_add_device(MGSLPC_INFO *info);
static void mgslpc_remove_device(MGSLPC_INFO *info);
static int rx_get_frame(MGSLPC_INFO *info);
static bool rx_get_frame(MGSLPC_INFO *info);
static void rx_reset_buffers(MGSLPC_INFO *info);
static int rx_alloc_buffers(MGSLPC_INFO *info);
static void rx_free_buffers(MGSLPC_INFO *info);
......@@ -719,7 +719,7 @@ static int mgslpc_resume(struct pcmcia_device *link)
}
static inline int mgslpc_paranoia_check(MGSLPC_INFO *info,
static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info,
char *name, const char *routine)
{
#ifdef MGSLPC_PARANOIA_CHECK
......@@ -730,17 +730,17 @@ static inline int mgslpc_paranoia_check(MGSLPC_INFO *info,
if (!info) {
printk(badinfo, name, routine);
return 1;
return true;
}
if (info->magic != MGSLPC_MAGIC) {
printk(badmagic, name, routine);
return 1;
return true;
}
#else
if (!info)
return 1;
return true;
#endif
return 0;
return false;
}
......@@ -752,16 +752,16 @@ static inline int mgslpc_paranoia_check(MGSLPC_INFO *info,
#define CMD_TXEOM BIT1 // transmit end message
#define CMD_TXRESET BIT0 // transmit reset
static BOOLEAN wait_command_complete(MGSLPC_INFO *info, unsigned char channel)
static bool wait_command_complete(MGSLPC_INFO *info, unsigned char channel)
{
int i = 0;
/* wait for command completion */
while (read_reg(info, (unsigned char)(channel+STAR)) & BIT2) {
udelay(1);
if (i++ == 1000)
return FALSE;
return false;
}
return TRUE;
return true;
}
static void issue_command(MGSLPC_INFO *info, unsigned char channel, unsigned char cmd)
......@@ -825,8 +825,8 @@ static int bh_action(MGSLPC_INFO *info)
if (!rc) {
/* Mark BH routine as complete */
info->bh_running = 0;
info->bh_requested = 0;
info->bh_running = false;
info->bh_requested = false;
}
spin_unlock_irqrestore(&info->lock,flags);
......@@ -846,7 +846,7 @@ static void bh_handler(struct work_struct *work)
printk( "%s(%d):bh_handler(%s) entry\n",
__FILE__,__LINE__,info->device_name);
info->bh_running = 1;
info->bh_running = true;
while((action = bh_action(info)) != 0) {
......@@ -913,7 +913,7 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
/* no more free buffers */
issue_command(info, CHA, CMD_RXRESET);
info->pending_bh |= BH_RECEIVE;
info->rx_overflow = 1;
info->rx_overflow = true;
info->icount.buf_overrun++;
return;
}
......@@ -1032,8 +1032,8 @@ static void tx_done(MGSLPC_INFO *info)
if (!info->tx_active)
return;
info->tx_active = 0;
info->tx_aborting = 0;
info->tx_active = false;
info->tx_aborting = false;
if (info->params.mode == MGSL_MODE_ASYNC)
return;
......@@ -1047,7 +1047,7 @@ static void tx_done(MGSLPC_INFO *info)
info->serial_signals &= ~SerialSignal_RTS;
set_signals(info);
}
info->drop_rts_on_tx_done = 0;
info->drop_rts_on_tx_done = false;
}
#if SYNCLINK_GENERIC_HDLC
......@@ -1081,7 +1081,7 @@ static void tx_ready(MGSLPC_INFO *info)
return;
}
if (!info->tx_count)
info->tx_active = 0;
info->tx_active = false;
}
if (!info->tx_count)
......@@ -1261,7 +1261,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id)
{
isr = read_reg16(info, CHA + ISR);
if (isr & IRQ_TIMER) {
info->irq_occurred = 1;
info->irq_occurred = true;
irq_disable(info, CHA, IRQ_TIMER);
}
......@@ -1318,7 +1318,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id)
printk("%s(%d):%s queueing bh task.\n",
__FILE__,__LINE__,info->device_name);
schedule_work(&info->task);
info->bh_requested = 1;
info->bh_requested = true;
}
spin_unlock(&info->lock);
......@@ -1990,7 +1990,7 @@ static int tx_abort(MGSLPC_INFO * info)
* This results in underrun and abort transmission.
*/
info->tx_count = info->tx_put = info->tx_get = 0;
info->tx_aborting = TRUE;
info->tx_aborting = true;
}
spin_unlock_irqrestore(&info->lock,flags);
return 0;
......@@ -2589,7 +2589,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
{
DECLARE_WAITQUEUE(wait, current);
int retval;
int do_clocal = 0, extra_count = 0;
bool do_clocal = false;
bool extra_count = false;
unsigned long flags;
if (debug_level >= DEBUG_LEVEL_INFO)
......@@ -2604,7 +2605,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
}
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
do_clocal = true;
/* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
......@@ -2622,7 +2623,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
spin_lock_irqsave(&info->lock, flags);
if (!tty_hung_up_p(filp)) {
extra_count = 1;
extra_count = true;
info->count--;
}
spin_unlock_irqrestore(&info->lock, flags);
......@@ -3493,8 +3494,8 @@ static void rx_stop(MGSLPC_INFO *info)
/* MODE:03 RAC Receiver Active, 0=inactive */
clear_reg_bits(info, CHA + MODE, BIT3);
info->rx_enabled = 0;
info->rx_overflow = 0;
info->rx_enabled = false;
info->rx_overflow = false;
}
static void rx_start(MGSLPC_INFO *info)
......@@ -3504,13 +3505,13 @@ static void rx_start(MGSLPC_INFO *info)
__FILE__,__LINE__, info->device_name );
rx_reset_buffers(info);
info->rx_enabled = 0;
info->rx_overflow = 0;
info->rx_enabled = false;
info->rx_overflow = false;
/* MODE:03 RAC Receiver Active, 1=active */
set_reg_bits(info, CHA + MODE, BIT3);
info->rx_enabled = 1;
info->rx_enabled = true;
}
static void tx_start(MGSLPC_INFO *info)
......@@ -3523,24 +3524,24 @@ static void tx_start(MGSLPC_INFO *info)
/* If auto RTS enabled and RTS is inactive, then assert */
/* RTS and set a flag indicating that the driver should */
/* negate RTS when the transmission completes. */
info->drop_rts_on_tx_done = 0;
info->drop_rts_on_tx_done = false;
if (info->params.flags & HDLC_FLAG_AUTO_RTS) {
get_signals(info);
if (!(info->serial_signals & SerialSignal_RTS)) {
info->serial_signals |= SerialSignal_RTS;
set_signals(info);
info->drop_rts_on_tx_done = 1;
info->drop_rts_on_tx_done = true;
}
}
if (info->params.mode == MGSL_MODE_ASYNC) {
if (!info->tx_active) {
info->tx_active = 1;
info->tx_active = true;
tx_ready(info);
}
} else {
info->tx_active = 1;
info->tx_active = true;
tx_ready(info);
mod_timer(&info->tx_timer, jiffies +
msecs_to_jiffies(5000));
......@@ -3548,7 +3549,7 @@ static void tx_start(MGSLPC_INFO *info)
}
if (!info->tx_enabled)
info->tx_enabled = 1;
info->tx_enabled = true;
}
static void tx_stop(MGSLPC_INFO *info)
......@@ -3559,8 +3560,8 @@ static void tx_stop(MGSLPC_INFO *info)
del_timer(&info->tx_timer);
info->tx_enabled = 0;
info->tx_active = 0;
info->tx_enabled = false;
info->tx_active = false;
}
/* Reset the adapter to a known state and prepare it for further use.
......@@ -3860,19 +3861,19 @@ static void rx_reset_buffers(MGSLPC_INFO *info)
/* Attempt to return a received HDLC frame
* Only frames received without errors are returned.
*
* Returns 1 if frame returned, otherwise 0
* Returns true if frame returned, otherwise false
*/
static int rx_get_frame(MGSLPC_INFO *info)
static bool rx_get_frame(MGSLPC_INFO *info)
{
unsigned short status;
RXBUF *buf;
unsigned int framesize = 0;
unsigned long flags;
struct tty_struct *tty = info->tty;
int return_frame = 0;
bool return_frame = false;
if (info->rx_frame_count == 0)
return 0;
return false;
buf = (RXBUF*)(info->rx_buf + (info->rx_get * info->rx_buf_size));
......@@ -3891,7 +3892,7 @@ static int rx_get_frame(MGSLPC_INFO *info)
else if (!(status & BIT5)) {
info->icount.rxcrc++;
if (info->params.crc_type & HDLC_CRC_RETURN_EX)
return_frame = 1;
return_frame = true;
}
framesize = 0;
#if SYNCLINK_GENERIC_HDLC
......@@ -3902,7 +3903,7 @@ static int rx_get_frame(MGSLPC_INFO *info)
}
#endif
} else
return_frame = 1;
return_frame = true;
if (return_frame)
framesize = buf->count;
......@@ -3945,16 +3946,16 @@ static int rx_get_frame(MGSLPC_INFO *info)
info->rx_get = 0;
spin_unlock_irqrestore(&info->lock,flags);
return 1;
return true;
}
static BOOLEAN register_test(MGSLPC_INFO *info)
static bool register_test(MGSLPC_INFO *info)
{
static unsigned char patterns[] =
{ 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f };
static unsigned int count = ARRAY_SIZE(patterns);
unsigned int i;
BOOLEAN rc = TRUE;
bool rc = true;
unsigned long flags;
spin_lock_irqsave(&info->lock,flags);
......@@ -3965,7 +3966,7 @@ static BOOLEAN register_test(MGSLPC_INFO *info)
write_reg(info, XAD2, patterns[(i + 1) % count]);
if ((read_reg(info, XAD1) != patterns[i]) ||
(read_reg(info, XAD2) != patterns[(i + 1) % count])) {
rc = FALSE;
rc = false;
break;
}
}
......@@ -3974,7 +3975,7 @@ static BOOLEAN register_test(MGSLPC_INFO *info)
return rc;
}
static BOOLEAN irq_test(MGSLPC_INFO *info)
static bool irq_test(MGSLPC_INFO *info)
{
unsigned long end_time;
unsigned long flags;
......@@ -3982,10 +3983,10 @@ static BOOLEAN irq_test(MGSLPC_INFO *info)
spin_lock_irqsave(&info->lock,flags);
reset_device(info);
info->testing_irq = TRUE;
info->testing_irq = true;
hdlc_mode(info);
info->irq_occurred = FALSE;
info->irq_occurred = false;
/* init hdlc mode */
......@@ -4000,13 +4001,13 @@ static BOOLEAN irq_test(MGSLPC_INFO *info)
msleep_interruptible(10);
}
info->testing_irq = FALSE;
info->testing_irq = false;
spin_lock_irqsave(&info->lock,flags);
reset_device(info);
spin_unlock_irqrestore(&info->lock,flags);
return info->irq_occurred ? TRUE : FALSE;
return info->irq_occurred;
}
static int adapter_test(MGSLPC_INFO *info)
......@@ -4079,7 +4080,7 @@ static void tx_timeout(unsigned long context)
info->icount.txtimeout++;
}
spin_lock_irqsave(&info->lock,flags);
info->tx_active = 0;
info->tx_active = false;
info->tx_count = info->tx_put = info->tx_get = 0;
spin_unlock_irqrestore(&info->lock,flags);
......
此差异已折叠。
......@@ -117,7 +117,7 @@ static struct pci_driver pci_driver = {
.remove = __devexit_p(remove_one),
};
static int pci_registered;
static bool pci_registered;
/*
* module configuration and status
......@@ -289,12 +289,12 @@ struct slgt_info {
struct work_struct task;
u32 pending_bh;
int bh_requested;
int bh_running;
bool bh_requested;
bool bh_running;
int isr_overflow;
int irq_requested; /* nonzero if IRQ requested */
int irq_occurred; /* for diagnostics use */
bool irq_requested; /* true if IRQ requested */
bool irq_occurred; /* for diagnostics use */
/* device configuration */
......@@ -304,7 +304,7 @@ struct slgt_info {
unsigned char __iomem * reg_addr; /* memory mapped registers address */
u32 phys_reg_addr;
int reg_addr_requested;
bool reg_addr_requested;
MGSL_PARAMS params; /* communications parameters */
u32 idle_mode;
......@@ -315,11 +315,11 @@ struct slgt_info {
/* device status */
int rx_enabled;
int rx_restart;
bool rx_enabled;
bool rx_restart;
int tx_enabled;
int tx_active;
bool tx_enabled;
bool tx_active;
unsigned char signals; /* serial signal states */
int init_error; /* initialization error */
......@@ -329,7 +329,7 @@ struct slgt_info {
char flag_buf[MAX_ASYNC_BUFFER_SIZE];
char char_buf[MAX_ASYNC_BUFFER_SIZE];
BOOLEAN drop_rts_on_tx_done;
bool drop_rts_on_tx_done;
struct _input_signal_events input_signal_events;
int dcd_chkcount; /* check counts to prevent */
......@@ -467,8 +467,8 @@ static void rx_start(struct slgt_info *info);
static void reset_rbufs(struct slgt_info *info);
static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last);
static void rdma_reset(struct slgt_info *info);
static int rx_get_frame(struct slgt_info *info);
static int rx_get_buf(struct slgt_info *info);
static bool rx_get_frame(struct slgt_info *info);
static bool rx_get_buf(struct slgt_info *info);
static void tx_start(struct slgt_info *info);
static void tx_stop(struct slgt_info *info);
......@@ -1968,8 +1968,8 @@ static int bh_action(struct slgt_info *info)
rc = BH_STATUS;
} else {
/* Mark BH routine as complete */
info->bh_running = 0;
info->bh_requested = 0;
info->bh_running = false;
info->bh_requested = false;
rc = 0;
}
......@@ -1988,7 +1988,7 @@ static void bh_handler(struct work_struct *work)
if (!info)
return;
info->bh_running = 1;
info->bh_running = true;
while((action = bh_action(info))) {
switch (action) {
......@@ -2158,7 +2158,7 @@ static void isr_serial(struct slgt_info *info)
wr_reg16(info, SSR, status); /* clear pending */
info->irq_occurred = 1;
info->irq_occurred = true;
if (info->params.mode == MGSL_MODE_ASYNC) {
if (status & IRQ_TXIDLE) {
......@@ -2225,7 +2225,7 @@ static void isr_rdma(struct slgt_info *info)
if (status & (BIT5 + BIT4)) {
DBGISR(("%s isr_rdma rx_restart=1\n", info->device_name));
info->rx_restart = 1;
info->rx_restart = true;
}
info->pending_bh |= BH_RECEIVE;
}
......@@ -2276,14 +2276,14 @@ static void isr_txeom(struct slgt_info *info, unsigned short status)
info->icount.txok++;
}
info->tx_active = 0;
info->tx_active = false;
info->tx_count = 0;
del_timer(&info->tx_timer);
if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) {
info->signals &= ~SerialSignal_RTS;
info->drop_rts_on_tx_done = 0;
info->drop_rts_on_tx_done = false;
set_signals(info);
}
......@@ -2337,7 +2337,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
while((gsr = rd_reg32(info, GSR) & 0xffffff00)) {
DBGISR(("%s gsr=%08x\n", info->device_name, gsr));
info->irq_occurred = 1;
info->irq_occurred = true;
for(i=0; i < info->port_count ; i++) {
if (info->port_array[i] == NULL)
continue;
......@@ -2374,7 +2374,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
!port->bh_requested) {
DBGISR(("%s bh queued\n", port->device_name));
schedule_work(&port->task);
port->bh_requested = 1;
port->bh_requested = true;
}
}
......@@ -3110,7 +3110,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
{
DECLARE_WAITQUEUE(wait, current);
int retval;
int do_clocal = 0, extra_count = 0;
bool do_clocal = false;
bool extra_count = false;
unsigned long flags;
DBGINFO(("%s block_til_ready\n", tty->driver->name));
......@@ -3122,7 +3123,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
}
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
do_clocal = true;
/* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
......@@ -3136,7 +3137,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
spin_lock_irqsave(&info->lock, flags);
if (!tty_hung_up_p(filp)) {
extra_count = 1;
extra_count = true;
info->count--;
}
spin_unlock_irqrestore(&info->lock, flags);
......@@ -3321,7 +3322,7 @@ static int claim_resources(struct slgt_info *info)
goto errout;
}
else
info->reg_addr_requested = 1;
info->reg_addr_requested = true;
info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE);
if (!info->reg_addr) {
......@@ -3341,12 +3342,12 @@ static void release_resources(struct slgt_info *info)
{
if (info->irq_requested) {
free_irq(info->irq_level, info);
info->irq_requested = 0;
info->irq_requested = false;
}
if (info->reg_addr_requested) {
release_mem_region(info->phys_reg_addr, SLGT_REG_SIZE);
info->reg_addr_requested = 0;
info->reg_addr_requested = false;
}
if (info->reg_addr) {
......@@ -3511,7 +3512,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
port_array[0]->device_name,
port_array[0]->irq_level));
} else {
port_array[0]->irq_requested = 1;
port_array[0]->irq_requested = true;
adapter_test(port_array[0]);
for (i=1 ; i < port_count ; i++) {
port_array[i]->init_error = port_array[0]->init_error;
......@@ -3654,7 +3655,7 @@ static int __init slgt_init(void)
printk("%s pci_register_driver error=%d\n", driver_name, rc);
goto error;
}
pci_registered = 1;
pci_registered = true;
if (!slgt_device_list)
printk("%s no devices found\n",driver_name);
......@@ -3812,8 +3813,8 @@ static void rx_stop(struct slgt_info *info)
rdma_reset(info);
info->rx_enabled = 0;
info->rx_restart = 0;
info->rx_enabled = false;
info->rx_restart = false;
}
static void rx_start(struct slgt_info *info)
......@@ -3849,8 +3850,8 @@ static void rx_start(struct slgt_info *info)
/* enable receiver */
wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | BIT1));
info->rx_restart = 0;
info->rx_enabled = 1;
info->rx_restart = false;
info->rx_enabled = true;
}
static void tx_start(struct slgt_info *info)
......@@ -3858,11 +3859,11 @@ static void tx_start(struct slgt_info *info)
if (!info->tx_enabled) {
wr_reg16(info, TCR,
(unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2));
info->tx_enabled = TRUE;
info->tx_enabled = true;
}
if (info->tx_count) {
info->drop_rts_on_tx_done = 0;
info->drop_rts_on_tx_done = false;
if (info->params.mode != MGSL_MODE_ASYNC) {
if (info->params.flags & HDLC_FLAG_AUTO_RTS) {
......@@ -3870,7 +3871,7 @@ static void tx_start(struct slgt_info *info)
if (!(info->signals & SerialSignal_RTS)) {
info->signals |= SerialSignal_RTS;
set_signals(info);
info->drop_rts_on_tx_done = 1;
info->drop_rts_on_tx_done = true;
}
}
......@@ -3888,7 +3889,7 @@ static void tx_start(struct slgt_info *info)
wr_reg16(info, SSR, IRQ_TXIDLE);
}
tdma_start(info);
info->tx_active = 1;
info->tx_active = true;
}
}
......@@ -3949,8 +3950,8 @@ static void tx_stop(struct slgt_info *info)
reset_tbufs(info);
info->tx_enabled = 0;
info->tx_active = 0;
info->tx_enabled = false;
info->tx_active = false;
}
static void reset_port(struct slgt_info *info)
......@@ -4470,14 +4471,13 @@ static void reset_rbufs(struct slgt_info *info)
/*
* pass receive HDLC frame to upper layer
*
* return 1 if frame available, otherwise 0
* return true if frame available, otherwise false
*/
static int rx_get_frame(struct slgt_info *info)
static bool rx_get_frame(struct slgt_info *info)
{
unsigned int start, end;
unsigned short status;
unsigned int framesize = 0;
int rc = 0;
unsigned long flags;
struct tty_struct *tty = info->tty;
unsigned char addr_field = 0xff;
......@@ -4601,23 +4601,23 @@ static int rx_get_frame(struct slgt_info *info)
}
}
free_rbufs(info, start, end);
rc = 1;
return true;
cleanup:
return rc;
return false;
}
/*
* pass receive buffer (RAW synchronous mode) to tty layer
* return 1 if buffer available, otherwise 0
* return true if buffer available, otherwise false
*/
static int rx_get_buf(struct slgt_info *info)
static bool rx_get_buf(struct slgt_info *info)
{
unsigned int i = info->rbuf_current;
unsigned int count;
if (!desc_complete(info->rbufs[i]))
return 0;
return false;
count = desc_count(info->rbufs[i]);
switch(info->params.mode) {
case MGSL_MODE_MONOSYNC:
......@@ -4633,7 +4633,7 @@ static int rx_get_buf(struct slgt_info *info)
ldisc_receive_buf(info->tty, info->rbufs[i].buf,
info->flag_buf, count);
free_rbufs(info, i, i);
return 1;
return true;
}
static void reset_tbufs(struct slgt_info *info)
......@@ -4758,7 +4758,7 @@ static int irq_test(struct slgt_info *info)
/* assume failure */
info->init_error = DiagStatus_IrqFailure;
info->irq_occurred = FALSE;
info->irq_occurred = false;
spin_unlock_irqrestore(&info->lock, flags);
......@@ -4891,7 +4891,7 @@ static void tx_timeout(unsigned long context)
info->icount.txtimeout++;
}
spin_lock_irqsave(&info->lock,flags);
info->tx_active = 0;
info->tx_active = false;
info->tx_count = 0;
spin_unlock_irqrestore(&info->lock,flags);
......
......@@ -188,9 +188,9 @@ typedef struct _synclinkmp_info {
u32 pending_bh;
int bh_running; /* Protection from multiple */
bool bh_running; /* Protection from multiple */
int isr_overflow;
int bh_requested;
bool bh_requested;
int dcd_chkcount; /* check counts to prevent */
int cts_chkcount; /* too many IRQs if a signal */
......@@ -213,11 +213,11 @@ typedef struct _synclinkmp_info {
unsigned char *tmp_rx_buf;
unsigned int tmp_rx_buf_count;
int rx_enabled;
int rx_overflow;
bool rx_enabled;
bool rx_overflow;
int tx_enabled;
int tx_active;
bool tx_enabled;
bool tx_active;
u32 idle_mode;
unsigned char ie0_value;
......@@ -238,13 +238,13 @@ typedef struct _synclinkmp_info {
unsigned int irq_level; /* interrupt level */
unsigned long irq_flags;
int irq_requested; /* nonzero if IRQ requested */
bool irq_requested; /* true if IRQ requested */
MGSL_PARAMS params; /* communications parameters */
unsigned char serial_signals; /* current serial signal states */
int irq_occurred; /* for diagnostics use */
bool irq_occurred; /* for diagnostics use */
unsigned int init_error; /* Initialization startup error */
u32 last_mem_alloc;
......@@ -255,7 +255,7 @@ typedef struct _synclinkmp_info {
unsigned char* sca_base; /* HD64570 SCA Memory address */
u32 phys_sca_base;
u32 sca_offset;
int sca_base_requested;
bool sca_base_requested;
unsigned char* lcr_base; /* local config registers (PCI only) */
u32 phys_lcr_base;
......@@ -265,12 +265,12 @@ typedef struct _synclinkmp_info {
unsigned char* statctrl_base; /* status/control register memory */
u32 phys_statctrl_base;
u32 statctrl_offset;
int sca_statctrl_requested;
bool sca_statctrl_requested;
u32 misc_ctrl_value;
char flag_buf[MAX_ASYNC_BUFFER_SIZE];
char char_buf[MAX_ASYNC_BUFFER_SIZE];
BOOLEAN drop_rts_on_tx_done;
bool drop_rts_on_tx_done;
struct _input_signal_events input_signal_events;
......@@ -571,12 +571,12 @@ static void shutdown(SLMP_INFO *info);
static void program_hw(SLMP_INFO *info);
static void change_params(SLMP_INFO *info);
static int init_adapter(SLMP_INFO *info);
static int register_test(SLMP_INFO *info);
static int irq_test(SLMP_INFO *info);
static int loopback_test(SLMP_INFO *info);
static bool init_adapter(SLMP_INFO *info);
static bool register_test(SLMP_INFO *info);
static bool irq_test(SLMP_INFO *info);
static bool loopback_test(SLMP_INFO *info);
static int adapter_test(SLMP_INFO *info);
static int memory_test(SLMP_INFO *info);
static bool memory_test(SLMP_INFO *info);
static void reset_adapter(SLMP_INFO *info);
static void reset_port(SLMP_INFO *info);
......@@ -587,7 +587,7 @@ static void rx_stop(SLMP_INFO *info);
static void rx_start(SLMP_INFO *info);
static void rx_reset_buffers(SLMP_INFO *info);
static void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last);
static int rx_get_frame(SLMP_INFO *info);
static bool rx_get_frame(SLMP_INFO *info);
static void tx_start(SLMP_INFO *info);
static void tx_stop(SLMP_INFO *info);
......@@ -2044,8 +2044,8 @@ int bh_action(SLMP_INFO *info)
if (!rc) {
/* Mark BH routine as complete */
info->bh_running = 0;
info->bh_requested = 0;
info->bh_running = false;
info->bh_requested = false;
}
spin_unlock_irqrestore(&info->lock,flags);
......@@ -2067,7 +2067,7 @@ void bh_handler(struct work_struct *work)
printk( "%s(%d):%s bh_handler() entry\n",
__FILE__,__LINE__,info->device_name);
info->bh_running = 1;
info->bh_running = true;
while((action = bh_action(info)) != 0) {
......@@ -2152,7 +2152,7 @@ void isr_timer(SLMP_INFO * info)
*/
write_reg(info, (unsigned char)(timer + TMCS), 0);
info->irq_occurred = TRUE;
info->irq_occurred = true;
if ( debug_level >= DEBUG_LEVEL_ISR )
printk("%s(%d):%s isr_timer()\n",
......@@ -2232,7 +2232,7 @@ void isr_rxrdy(SLMP_INFO * info)
while((status = read_reg(info,CST0)) & BIT0)
{
int flag = 0;
int over = 0;
bool over = false;
DataByte = read_reg(info,TRB);
icount->rx++;
......@@ -2265,7 +2265,7 @@ void isr_rxrdy(SLMP_INFO * info)
* reported immediately, and doesn't
* affect the current character
*/
over = 1;
over = true;
}
}
} /* end of if (error) */
......@@ -2318,14 +2318,14 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status)
info->icount.txok++;
}
info->tx_active = 0;
info->tx_active = false;
info->tx_count = info->tx_put = info->tx_get = 0;
del_timer(&info->tx_timer);
if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done ) {
info->serial_signals &= ~SerialSignal_RTS;
info->drop_rts_on_tx_done = 0;
info->drop_rts_on_tx_done = false;
set_signals(info);
}
......@@ -2398,7 +2398,7 @@ void isr_txrdy(SLMP_INFO * info)
if ( info->tx_count )
tx_load_fifo( info );
else {
info->tx_active = 0;
info->tx_active = false;
info->ie0_value &= ~TXRDYE;
write_reg(info, IE0, info->ie0_value);
}
......@@ -2438,7 +2438,7 @@ void isr_rxdmaerror(SLMP_INFO * info)
printk("%s(%d):%s isr_rxdmaerror(), status=%02x\n",
__FILE__,__LINE__,info->device_name,status);
info->rx_overflow = TRUE;
info->rx_overflow = true;
info->pending_bh |= BH_RECEIVE;
}
......@@ -2691,7 +2691,7 @@ static irqreturn_t synclinkmp_interrupt(int dummy, void *dev_id)
printk("%s(%d):%s queueing bh task.\n",
__FILE__,__LINE__,port->device_name);
schedule_work(&port->task);
port->bh_requested = 1;
port->bh_requested = true;
}
}
......@@ -3320,7 +3320,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
{
DECLARE_WAITQUEUE(wait, current);
int retval;
int do_clocal = 0, extra_count = 0;
bool do_clocal = false;
bool extra_count = false;
unsigned long flags;
if (debug_level >= DEBUG_LEVEL_INFO)
......@@ -3335,7 +3336,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
}
if (tty->termios->c_cflag & CLOCAL)
do_clocal = 1;
do_clocal = true;
/* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
......@@ -3353,7 +3354,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
spin_lock_irqsave(&info->lock, flags);
if (!tty_hung_up_p(filp)) {
extra_count = 1;
extra_count = true;
info->count--;
}
spin_unlock_irqrestore(&info->lock, flags);
......@@ -3596,7 +3597,7 @@ int claim_resources(SLMP_INFO *info)
goto errout;
}
else
info->shared_mem_requested = 1;
info->shared_mem_requested = true;
if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclinkmp") == NULL) {
printk( "%s(%d):%s lcr mem addr conflict, Addr=%08X\n",
......@@ -3605,7 +3606,7 @@ int claim_resources(SLMP_INFO *info)
goto errout;
}
else
info->lcr_mem_requested = 1;
info->lcr_mem_requested = true;
if (request_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE,"synclinkmp") == NULL) {
printk( "%s(%d):%s sca mem addr conflict, Addr=%08X\n",
......@@ -3614,7 +3615,7 @@ int claim_resources(SLMP_INFO *info)
goto errout;
}
else
info->sca_base_requested = 1;
info->sca_base_requested = true;
if (request_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE,"synclinkmp") == NULL) {
printk( "%s(%d):%s stat/ctrl mem addr conflict, Addr=%08X\n",
......@@ -3623,7 +3624,7 @@ int claim_resources(SLMP_INFO *info)
goto errout;
}
else
info->sca_statctrl_requested = 1;
info->sca_statctrl_requested = true;
info->memory_base = ioremap(info->phys_memory_base,SCA_MEM_SIZE);
if (!info->memory_base) {
......@@ -3682,24 +3683,24 @@ void release_resources(SLMP_INFO *info)
if ( info->irq_requested ) {
free_irq(info->irq_level, info);
info->irq_requested = 0;
info->irq_requested = false;
}
if ( info->shared_mem_requested ) {
release_mem_region(info->phys_memory_base,SCA_MEM_SIZE);
info->shared_mem_requested = 0;
info->shared_mem_requested = false;
}
if ( info->lcr_mem_requested ) {
release_mem_region(info->phys_lcr_base + info->lcr_offset,128);
info->lcr_mem_requested = 0;
info->lcr_mem_requested = false;
}
if ( info->sca_base_requested ) {
release_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE);
info->sca_base_requested = 0;
info->sca_base_requested = false;
}
if ( info->sca_statctrl_requested ) {
release_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE);
info->sca_statctrl_requested = 0;
info->sca_statctrl_requested = false;
}
if (info->memory_base){
......@@ -3902,7 +3903,7 @@ void device_init(int adapter_num, struct pci_dev *pdev)
port_array[0]->irq_level );
}
else {
port_array[0]->irq_requested = 1;
port_array[0]->irq_requested = true;
adapter_test(port_array[0]);
}
}
......@@ -4155,8 +4156,8 @@ void rx_stop(SLMP_INFO *info)
write_reg(info, RXDMA + DCMD, SWABORT); /* reset/init Rx DMA */
write_reg(info, RXDMA + DIR, 0); /* disable Rx DMA interrupts */
info->rx_enabled = 0;
info->rx_overflow = 0;
info->rx_enabled = false;
info->rx_overflow = false;
}
/* enable the receiver
......@@ -4211,8 +4212,8 @@ void rx_start(SLMP_INFO *info)
write_reg(info, CMD, RXENABLE);
info->rx_overflow = FALSE;
info->rx_enabled = 1;
info->rx_overflow = false;
info->rx_enabled = true;
}
/* Enable the transmitter and send a transmit frame if
......@@ -4227,7 +4228,7 @@ void tx_start(SLMP_INFO *info)
if (!info->tx_enabled ) {
write_reg(info, CMD, TXRESET);
write_reg(info, CMD, TXENABLE);
info->tx_enabled = TRUE;
info->tx_enabled = true;
}
if ( info->tx_count ) {
......@@ -4236,7 +4237,7 @@ void tx_start(SLMP_INFO *info)
/* RTS and set a flag indicating that the driver should */
/* negate RTS when the transmission completes. */
info->drop_rts_on_tx_done = 0;
info->drop_rts_on_tx_done = false;
if (info->params.mode != MGSL_MODE_ASYNC) {
......@@ -4245,7 +4246,7 @@ void tx_start(SLMP_INFO *info)
if ( !(info->serial_signals & SerialSignal_RTS) ) {
info->serial_signals |= SerialSignal_RTS;
set_signals( info );
info->drop_rts_on_tx_done = 1;
info->drop_rts_on_tx_done = true;
}
}
......@@ -4282,7 +4283,7 @@ void tx_start(SLMP_INFO *info)
write_reg(info, IE0, info->ie0_value);
}
info->tx_active = 1;
info->tx_active = true;
}
}
......@@ -4308,8 +4309,8 @@ void tx_stop( SLMP_INFO *info )
info->ie0_value &= ~TXRDYE;
write_reg(info, IE0, info->ie0_value); /* disable tx data interrupts */
info->tx_enabled = 0;
info->tx_active = 0;
info->tx_enabled = false;
info->tx_active = false;
}
/* Fill the transmit FIFO until the FIFO is full or
......@@ -4832,14 +4833,14 @@ void rx_reset_buffers(SLMP_INFO *info)
*/
void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last)
{
int done = 0;
bool done = false;
while(!done) {
/* reset current buffer for reuse */
info->rx_buf_list[first].status = 0xff;
if (first == last) {
done = 1;
done = true;
/* set new last rx descriptor address */
write_reg16(info, RXDMA + EDA, info->rx_buf_list_ex[first].phys_entry);
}
......@@ -4856,14 +4857,14 @@ void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int las
/* Return a received frame from the receive DMA buffers.
* Only frames received without errors are returned.
*
* Return Value: 1 if frame returned, otherwise 0
* Return Value: true if frame returned, otherwise false
*/
int rx_get_frame(SLMP_INFO *info)
bool rx_get_frame(SLMP_INFO *info)
{
unsigned int StartIndex, EndIndex; /* index of 1st and last buffers of Rx frame */
unsigned short status;
unsigned int framesize = 0;
int ReturnCode = 0;
bool ReturnCode = false;
unsigned long flags;
struct tty_struct *tty = info->tty;
unsigned char addr_field = 0xff;
......@@ -5014,7 +5015,7 @@ int rx_get_frame(SLMP_INFO *info)
/* Free the buffers used by this frame. */
rx_free_frame_buffers( info, StartIndex, EndIndex );
ReturnCode = 1;
ReturnCode = true;
Cleanup:
if ( info->rx_enabled && info->rx_overflow ) {
......@@ -5073,12 +5074,12 @@ void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count)
info->last_tx_buf = ++i;
}
int register_test(SLMP_INFO *info)
bool register_test(SLMP_INFO *info)
{
static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96};
static unsigned int count = ARRAY_SIZE(testval);
unsigned int i;
int rc = TRUE;
bool rc = true;
unsigned long flags;
spin_lock_irqsave(&info->lock,flags);
......@@ -5101,7 +5102,7 @@ int register_test(SLMP_INFO *info)
(read_reg(info, SA0) != testval[(i+2)%count]) ||
(read_reg(info, SA1) != testval[(i+3)%count]) )
{
rc = FALSE;
rc = false;
break;
}
}
......@@ -5112,7 +5113,7 @@ int register_test(SLMP_INFO *info)
return rc;
}
int irq_test(SLMP_INFO *info)
bool irq_test(SLMP_INFO *info)
{
unsigned long timeout;
unsigned long flags;
......@@ -5124,7 +5125,7 @@ int irq_test(SLMP_INFO *info)
/* assume failure */
info->init_error = DiagStatus_IrqFailure;
info->irq_occurred = FALSE;
info->irq_occurred = false;
/* setup timer0 on SCA0 to interrupt */
......@@ -5163,7 +5164,7 @@ int irq_test(SLMP_INFO *info)
/* initialize individual SCA device (2 ports)
*/
static int sca_init(SLMP_INFO *info)
static bool sca_init(SLMP_INFO *info)
{
/* set wait controller to single mem partition (low), no wait states */
write_reg(info, PABR0, 0); /* wait controller addr boundary 0 */
......@@ -5199,12 +5200,12 @@ static int sca_init(SLMP_INFO *info)
*/
write_reg(info, ITCR, 0);
return TRUE;
return true;
}
/* initialize adapter hardware
*/
int init_adapter(SLMP_INFO *info)
bool init_adapter(SLMP_INFO *info)
{
int i;
......@@ -5257,20 +5258,20 @@ int init_adapter(SLMP_INFO *info)
sca_init(info->port_array[0]);
sca_init(info->port_array[2]);
return TRUE;
return true;
}
/* Loopback an HDLC frame to test the hardware
* interrupt and DMA functions.
*/
int loopback_test(SLMP_INFO *info)
bool loopback_test(SLMP_INFO *info)
{
#define TESTFRAMESIZE 20
unsigned long timeout;
u16 count = TESTFRAMESIZE;
unsigned char buf[TESTFRAMESIZE];
int rc = FALSE;
bool rc = false;
unsigned long flags;
struct tty_struct *oldtty = info->tty;
......@@ -5304,16 +5305,16 @@ int loopback_test(SLMP_INFO *info)
msleep_interruptible(10);
if (rx_get_frame(info)) {
rc = TRUE;
rc = true;
break;
}
}
/* verify received frame length and contents */
if (rc == TRUE &&
( info->tmp_rx_buf_count != count ||
memcmp(buf, info->tmp_rx_buf,count))) {
rc = FALSE;
if (rc &&
( info->tmp_rx_buf_count != count ||
memcmp(buf, info->tmp_rx_buf,count))) {
rc = false;
}
spin_lock_irqsave(&info->lock,flags);
......@@ -5390,7 +5391,7 @@ int adapter_test( SLMP_INFO *info )
/* Test the shared memory on a PCI adapter.
*/
int memory_test(SLMP_INFO *info)
bool memory_test(SLMP_INFO *info)
{
static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa,
0x66666666, 0x99999999, 0xffffffff, 0x12345678 };
......@@ -5404,7 +5405,7 @@ int memory_test(SLMP_INFO *info)
for ( i = 0 ; i < count ; i++ ) {
*addr = testval[i];
if ( *addr != testval[i] )
return FALSE;
return false;
}
/* Test address lines with incrementing pattern over */
......@@ -5419,12 +5420,12 @@ int memory_test(SLMP_INFO *info)
for ( i = 0 ; i < limit ; i++ ) {
if ( *addr != i * 4 )
return FALSE;
return false;
addr++;
}
memset( info->memory_base, 0, SCA_MEM_SIZE );
return TRUE;
return true;
}
/* Load data into PCI adapter shared memory.
......@@ -5508,7 +5509,7 @@ void tx_timeout(unsigned long context)
info->icount.txtimeout++;
}
spin_lock_irqsave(&info->lock,flags);
info->tx_active = 0;
info->tx_active = false;
info->tx_count = info->tx_put = info->tx_get = 0;
spin_unlock_irqrestore(&info->lock,flags);
......
......@@ -13,10 +13,6 @@
#define _SYNCLINK_H_
#define SYNCLINK_H_VERSION 3.6
#define BOOLEAN int
#define TRUE 1
#define FALSE 0
#define BIT0 0x0001
#define BIT1 0x0002
#define BIT2 0x0004
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册