aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclink_gt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/synclink_gt.c')
-rw-r--r--drivers/char/synclink_gt.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 3c89266c8255..f3d8d72e5ea4 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -117,7 +117,7 @@ static struct pci_driver pci_driver = {
117 .remove = __devexit_p(remove_one), 117 .remove = __devexit_p(remove_one),
118}; 118};
119 119
120static int pci_registered; 120static bool pci_registered;
121 121
122/* 122/*
123 * module configuration and status 123 * module configuration and status
@@ -289,12 +289,12 @@ struct slgt_info {
289 289
290 struct work_struct task; 290 struct work_struct task;
291 u32 pending_bh; 291 u32 pending_bh;
292 int bh_requested; 292 bool bh_requested;
293 int bh_running; 293 bool bh_running;
294 294
295 int isr_overflow; 295 int isr_overflow;
296 int irq_requested; /* nonzero if IRQ requested */ 296 bool irq_requested; /* true if IRQ requested */
297 int irq_occurred; /* for diagnostics use */ 297 bool irq_occurred; /* for diagnostics use */
298 298
299 /* device configuration */ 299 /* device configuration */
300 300
@@ -304,7 +304,7 @@ struct slgt_info {
304 304
305 unsigned char __iomem * reg_addr; /* memory mapped registers address */ 305 unsigned char __iomem * reg_addr; /* memory mapped registers address */
306 u32 phys_reg_addr; 306 u32 phys_reg_addr;
307 int reg_addr_requested; 307 bool reg_addr_requested;
308 308
309 MGSL_PARAMS params; /* communications parameters */ 309 MGSL_PARAMS params; /* communications parameters */
310 u32 idle_mode; 310 u32 idle_mode;
@@ -315,11 +315,11 @@ struct slgt_info {
315 315
316 /* device status */ 316 /* device status */
317 317
318 int rx_enabled; 318 bool rx_enabled;
319 int rx_restart; 319 bool rx_restart;
320 320
321 int tx_enabled; 321 bool tx_enabled;
322 int tx_active; 322 bool tx_active;
323 323
324 unsigned char signals; /* serial signal states */ 324 unsigned char signals; /* serial signal states */
325 int init_error; /* initialization error */ 325 int init_error; /* initialization error */
@@ -329,7 +329,7 @@ struct slgt_info {
329 329
330 char flag_buf[MAX_ASYNC_BUFFER_SIZE]; 330 char flag_buf[MAX_ASYNC_BUFFER_SIZE];
331 char char_buf[MAX_ASYNC_BUFFER_SIZE]; 331 char char_buf[MAX_ASYNC_BUFFER_SIZE];
332 BOOLEAN drop_rts_on_tx_done; 332 bool drop_rts_on_tx_done;
333 struct _input_signal_events input_signal_events; 333 struct _input_signal_events input_signal_events;
334 334
335 int dcd_chkcount; /* check counts to prevent */ 335 int dcd_chkcount; /* check counts to prevent */
@@ -467,8 +467,8 @@ static void rx_start(struct slgt_info *info);
467static void reset_rbufs(struct slgt_info *info); 467static void reset_rbufs(struct slgt_info *info);
468static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last); 468static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last);
469static void rdma_reset(struct slgt_info *info); 469static void rdma_reset(struct slgt_info *info);
470static int rx_get_frame(struct slgt_info *info); 470static bool rx_get_frame(struct slgt_info *info);
471static int rx_get_buf(struct slgt_info *info); 471static bool rx_get_buf(struct slgt_info *info);
472 472
473static void tx_start(struct slgt_info *info); 473static void tx_start(struct slgt_info *info);
474static void tx_stop(struct slgt_info *info); 474static void tx_stop(struct slgt_info *info);
@@ -1968,8 +1968,8 @@ static int bh_action(struct slgt_info *info)
1968 rc = BH_STATUS; 1968 rc = BH_STATUS;
1969 } else { 1969 } else {
1970 /* Mark BH routine as complete */ 1970 /* Mark BH routine as complete */
1971 info->bh_running = 0; 1971 info->bh_running = false;
1972 info->bh_requested = 0; 1972 info->bh_requested = false;
1973 rc = 0; 1973 rc = 0;
1974 } 1974 }
1975 1975
@@ -1988,7 +1988,7 @@ static void bh_handler(struct work_struct *work)
1988 1988
1989 if (!info) 1989 if (!info)
1990 return; 1990 return;
1991 info->bh_running = 1; 1991 info->bh_running = true;
1992 1992
1993 while((action = bh_action(info))) { 1993 while((action = bh_action(info))) {
1994 switch (action) { 1994 switch (action) {
@@ -2158,7 +2158,7 @@ static void isr_serial(struct slgt_info *info)
2158 2158
2159 wr_reg16(info, SSR, status); /* clear pending */ 2159 wr_reg16(info, SSR, status); /* clear pending */
2160 2160
2161 info->irq_occurred = 1; 2161 info->irq_occurred = true;
2162 2162
2163 if (info->params.mode == MGSL_MODE_ASYNC) { 2163 if (info->params.mode == MGSL_MODE_ASYNC) {
2164 if (status & IRQ_TXIDLE) { 2164 if (status & IRQ_TXIDLE) {
@@ -2225,7 +2225,7 @@ static void isr_rdma(struct slgt_info *info)
2225 2225
2226 if (status & (BIT5 + BIT4)) { 2226 if (status & (BIT5 + BIT4)) {
2227 DBGISR(("%s isr_rdma rx_restart=1\n", info->device_name)); 2227 DBGISR(("%s isr_rdma rx_restart=1\n", info->device_name));
2228 info->rx_restart = 1; 2228 info->rx_restart = true;
2229 } 2229 }
2230 info->pending_bh |= BH_RECEIVE; 2230 info->pending_bh |= BH_RECEIVE;
2231} 2231}
@@ -2276,14 +2276,14 @@ static void isr_txeom(struct slgt_info *info, unsigned short status)
2276 info->icount.txok++; 2276 info->icount.txok++;
2277 } 2277 }
2278 2278
2279 info->tx_active = 0; 2279 info->tx_active = false;
2280 info->tx_count = 0; 2280 info->tx_count = 0;
2281 2281
2282 del_timer(&info->tx_timer); 2282 del_timer(&info->tx_timer);
2283 2283
2284 if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { 2284 if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) {
2285 info->signals &= ~SerialSignal_RTS; 2285 info->signals &= ~SerialSignal_RTS;
2286 info->drop_rts_on_tx_done = 0; 2286 info->drop_rts_on_tx_done = false;
2287 set_signals(info); 2287 set_signals(info);
2288 } 2288 }
2289 2289
@@ -2337,7 +2337,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
2337 2337
2338 while((gsr = rd_reg32(info, GSR) & 0xffffff00)) { 2338 while((gsr = rd_reg32(info, GSR) & 0xffffff00)) {
2339 DBGISR(("%s gsr=%08x\n", info->device_name, gsr)); 2339 DBGISR(("%s gsr=%08x\n", info->device_name, gsr));
2340 info->irq_occurred = 1; 2340 info->irq_occurred = true;
2341 for(i=0; i < info->port_count ; i++) { 2341 for(i=0; i < info->port_count ; i++) {
2342 if (info->port_array[i] == NULL) 2342 if (info->port_array[i] == NULL)
2343 continue; 2343 continue;
@@ -2374,7 +2374,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
2374 !port->bh_requested) { 2374 !port->bh_requested) {
2375 DBGISR(("%s bh queued\n", port->device_name)); 2375 DBGISR(("%s bh queued\n", port->device_name));
2376 schedule_work(&port->task); 2376 schedule_work(&port->task);
2377 port->bh_requested = 1; 2377 port->bh_requested = true;
2378 } 2378 }
2379 } 2379 }
2380 2380
@@ -3110,7 +3110,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3110{ 3110{
3111 DECLARE_WAITQUEUE(wait, current); 3111 DECLARE_WAITQUEUE(wait, current);
3112 int retval; 3112 int retval;
3113 int do_clocal = 0, extra_count = 0; 3113 bool do_clocal = false;
3114 bool extra_count = false;
3114 unsigned long flags; 3115 unsigned long flags;
3115 3116
3116 DBGINFO(("%s block_til_ready\n", tty->driver->name)); 3117 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,
3122 } 3123 }
3123 3124
3124 if (tty->termios->c_cflag & CLOCAL) 3125 if (tty->termios->c_cflag & CLOCAL)
3125 do_clocal = 1; 3126 do_clocal = true;
3126 3127
3127 /* Wait for carrier detect and the line to become 3128 /* Wait for carrier detect and the line to become
3128 * free (i.e., not in use by the callout). While we are in 3129 * 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,
3136 3137
3137 spin_lock_irqsave(&info->lock, flags); 3138 spin_lock_irqsave(&info->lock, flags);
3138 if (!tty_hung_up_p(filp)) { 3139 if (!tty_hung_up_p(filp)) {
3139 extra_count = 1; 3140 extra_count = true;
3140 info->count--; 3141 info->count--;
3141 } 3142 }
3142 spin_unlock_irqrestore(&info->lock, flags); 3143 spin_unlock_irqrestore(&info->lock, flags);
@@ -3321,7 +3322,7 @@ static int claim_resources(struct slgt_info *info)
3321 goto errout; 3322 goto errout;
3322 } 3323 }
3323 else 3324 else
3324 info->reg_addr_requested = 1; 3325 info->reg_addr_requested = true;
3325 3326
3326 info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE); 3327 info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE);
3327 if (!info->reg_addr) { 3328 if (!info->reg_addr) {
@@ -3341,12 +3342,12 @@ static void release_resources(struct slgt_info *info)
3341{ 3342{
3342 if (info->irq_requested) { 3343 if (info->irq_requested) {
3343 free_irq(info->irq_level, info); 3344 free_irq(info->irq_level, info);
3344 info->irq_requested = 0; 3345 info->irq_requested = false;
3345 } 3346 }
3346 3347
3347 if (info->reg_addr_requested) { 3348 if (info->reg_addr_requested) {
3348 release_mem_region(info->phys_reg_addr, SLGT_REG_SIZE); 3349 release_mem_region(info->phys_reg_addr, SLGT_REG_SIZE);
3349 info->reg_addr_requested = 0; 3350 info->reg_addr_requested = false;
3350 } 3351 }
3351 3352
3352 if (info->reg_addr) { 3353 if (info->reg_addr) {
@@ -3511,7 +3512,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
3511 port_array[0]->device_name, 3512 port_array[0]->device_name,
3512 port_array[0]->irq_level)); 3513 port_array[0]->irq_level));
3513 } else { 3514 } else {
3514 port_array[0]->irq_requested = 1; 3515 port_array[0]->irq_requested = true;
3515 adapter_test(port_array[0]); 3516 adapter_test(port_array[0]);
3516 for (i=1 ; i < port_count ; i++) { 3517 for (i=1 ; i < port_count ; i++) {
3517 port_array[i]->init_error = port_array[0]->init_error; 3518 port_array[i]->init_error = port_array[0]->init_error;
@@ -3654,7 +3655,7 @@ static int __init slgt_init(void)
3654 printk("%s pci_register_driver error=%d\n", driver_name, rc); 3655 printk("%s pci_register_driver error=%d\n", driver_name, rc);
3655 goto error; 3656 goto error;
3656 } 3657 }
3657 pci_registered = 1; 3658 pci_registered = true;
3658 3659
3659 if (!slgt_device_list) 3660 if (!slgt_device_list)
3660 printk("%s no devices found\n",driver_name); 3661 printk("%s no devices found\n",driver_name);
@@ -3812,8 +3813,8 @@ static void rx_stop(struct slgt_info *info)
3812 3813
3813 rdma_reset(info); 3814 rdma_reset(info);
3814 3815
3815 info->rx_enabled = 0; 3816 info->rx_enabled = false;
3816 info->rx_restart = 0; 3817 info->rx_restart = false;
3817} 3818}
3818 3819
3819static void rx_start(struct slgt_info *info) 3820static void rx_start(struct slgt_info *info)
@@ -3849,8 +3850,8 @@ static void rx_start(struct slgt_info *info)
3849 /* enable receiver */ 3850 /* enable receiver */
3850 wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | BIT1)); 3851 wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | BIT1));
3851 3852
3852 info->rx_restart = 0; 3853 info->rx_restart = false;
3853 info->rx_enabled = 1; 3854 info->rx_enabled = true;
3854} 3855}
3855 3856
3856static void tx_start(struct slgt_info *info) 3857static void tx_start(struct slgt_info *info)
@@ -3858,11 +3859,11 @@ static void tx_start(struct slgt_info *info)
3858 if (!info->tx_enabled) { 3859 if (!info->tx_enabled) {
3859 wr_reg16(info, TCR, 3860 wr_reg16(info, TCR,
3860 (unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2)); 3861 (unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2));
3861 info->tx_enabled = TRUE; 3862 info->tx_enabled = true;
3862 } 3863 }
3863 3864
3864 if (info->tx_count) { 3865 if (info->tx_count) {
3865 info->drop_rts_on_tx_done = 0; 3866 info->drop_rts_on_tx_done = false;
3866 3867
3867 if (info->params.mode != MGSL_MODE_ASYNC) { 3868 if (info->params.mode != MGSL_MODE_ASYNC) {
3868 if (info->params.flags & HDLC_FLAG_AUTO_RTS) { 3869 if (info->params.flags & HDLC_FLAG_AUTO_RTS) {
@@ -3870,7 +3871,7 @@ static void tx_start(struct slgt_info *info)
3870 if (!(info->signals & SerialSignal_RTS)) { 3871 if (!(info->signals & SerialSignal_RTS)) {
3871 info->signals |= SerialSignal_RTS; 3872 info->signals |= SerialSignal_RTS;
3872 set_signals(info); 3873 set_signals(info);
3873 info->drop_rts_on_tx_done = 1; 3874 info->drop_rts_on_tx_done = true;
3874 } 3875 }
3875 } 3876 }
3876 3877
@@ -3888,7 +3889,7 @@ static void tx_start(struct slgt_info *info)
3888 wr_reg16(info, SSR, IRQ_TXIDLE); 3889 wr_reg16(info, SSR, IRQ_TXIDLE);
3889 } 3890 }
3890 tdma_start(info); 3891 tdma_start(info);
3891 info->tx_active = 1; 3892 info->tx_active = true;
3892 } 3893 }
3893} 3894}
3894 3895
@@ -3949,8 +3950,8 @@ static void tx_stop(struct slgt_info *info)
3949 3950
3950 reset_tbufs(info); 3951 reset_tbufs(info);
3951 3952
3952 info->tx_enabled = 0; 3953 info->tx_enabled = false;
3953 info->tx_active = 0; 3954 info->tx_active = false;
3954} 3955}
3955 3956
3956static void reset_port(struct slgt_info *info) 3957static void reset_port(struct slgt_info *info)
@@ -4470,14 +4471,13 @@ static void reset_rbufs(struct slgt_info *info)
4470/* 4471/*
4471 * pass receive HDLC frame to upper layer 4472 * pass receive HDLC frame to upper layer
4472 * 4473 *
4473 * return 1 if frame available, otherwise 0 4474 * return true if frame available, otherwise false
4474 */ 4475 */
4475static int rx_get_frame(struct slgt_info *info) 4476static bool rx_get_frame(struct slgt_info *info)
4476{ 4477{
4477 unsigned int start, end; 4478 unsigned int start, end;
4478 unsigned short status; 4479 unsigned short status;
4479 unsigned int framesize = 0; 4480 unsigned int framesize = 0;
4480 int rc = 0;
4481 unsigned long flags; 4481 unsigned long flags;
4482 struct tty_struct *tty = info->tty; 4482 struct tty_struct *tty = info->tty;
4483 unsigned char addr_field = 0xff; 4483 unsigned char addr_field = 0xff;
@@ -4601,23 +4601,23 @@ check_again:
4601 } 4601 }
4602 } 4602 }
4603 free_rbufs(info, start, end); 4603 free_rbufs(info, start, end);
4604 rc = 1; 4604 return true;
4605 4605
4606cleanup: 4606cleanup:
4607 return rc; 4607 return false;
4608} 4608}
4609 4609
4610/* 4610/*
4611 * pass receive buffer (RAW synchronous mode) to tty layer 4611 * pass receive buffer (RAW synchronous mode) to tty layer
4612 * return 1 if buffer available, otherwise 0 4612 * return true if buffer available, otherwise false
4613 */ 4613 */
4614static int rx_get_buf(struct slgt_info *info) 4614static bool rx_get_buf(struct slgt_info *info)
4615{ 4615{
4616 unsigned int i = info->rbuf_current; 4616 unsigned int i = info->rbuf_current;
4617 unsigned int count; 4617 unsigned int count;
4618 4618
4619 if (!desc_complete(info->rbufs[i])) 4619 if (!desc_complete(info->rbufs[i]))
4620 return 0; 4620 return false;
4621 count = desc_count(info->rbufs[i]); 4621 count = desc_count(info->rbufs[i]);
4622 switch(info->params.mode) { 4622 switch(info->params.mode) {
4623 case MGSL_MODE_MONOSYNC: 4623 case MGSL_MODE_MONOSYNC:
@@ -4633,7 +4633,7 @@ static int rx_get_buf(struct slgt_info *info)
4633 ldisc_receive_buf(info->tty, info->rbufs[i].buf, 4633 ldisc_receive_buf(info->tty, info->rbufs[i].buf,
4634 info->flag_buf, count); 4634 info->flag_buf, count);
4635 free_rbufs(info, i, i); 4635 free_rbufs(info, i, i);
4636 return 1; 4636 return true;
4637} 4637}
4638 4638
4639static void reset_tbufs(struct slgt_info *info) 4639static void reset_tbufs(struct slgt_info *info)
@@ -4758,7 +4758,7 @@ static int irq_test(struct slgt_info *info)
4758 4758
4759 /* assume failure */ 4759 /* assume failure */
4760 info->init_error = DiagStatus_IrqFailure; 4760 info->init_error = DiagStatus_IrqFailure;
4761 info->irq_occurred = FALSE; 4761 info->irq_occurred = false;
4762 4762
4763 spin_unlock_irqrestore(&info->lock, flags); 4763 spin_unlock_irqrestore(&info->lock, flags);
4764 4764
@@ -4891,7 +4891,7 @@ static void tx_timeout(unsigned long context)
4891 info->icount.txtimeout++; 4891 info->icount.txtimeout++;
4892 } 4892 }
4893 spin_lock_irqsave(&info->lock,flags); 4893 spin_lock_irqsave(&info->lock,flags);
4894 info->tx_active = 0; 4894 info->tx_active = false;
4895 info->tx_count = 0; 4895 info->tx_count = 0;
4896 spin_unlock_irqrestore(&info->lock,flags); 4896 spin_unlock_irqrestore(&info->lock,flags);
4897 4897