aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2013-02-06 19:00:35 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-08 15:21:19 -0500
commit3d55399391c8ecb5bb3d1c426bafa2580a889c4e (patch)
treee5cf24b5d875dbf19194d4721f45802b4cbfbbad /drivers/char/pcmcia
parentd34138d057628211b1c835e13a64d0cc2423c969 (diff)
pcmcia: synclink_cs: cleanup checkpatch warnings
ERROR: open brace '{' following struct go on the same line ERROR: space required after that ',' ERROR: space prohibited after that open parenthesis '(' WARNING: please, no spaces at the start of a line WARNING: please, no space before tabs Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/pcmcia')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c616
1 files changed, 310 insertions, 306 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 56e4e940fa19..29f6bec9d489 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -102,8 +102,7 @@ static MGSL_PARAMS default_params = {
102 ASYNC_PARITY_NONE /* unsigned char parity; */ 102 ASYNC_PARITY_NONE /* unsigned char parity; */
103}; 103};
104 104
105typedef struct 105typedef struct {
106{
107 int count; 106 int count;
108 unsigned char status; 107 unsigned char status;
109 char data[1]; 108 char data[1];
@@ -326,10 +325,10 @@ typedef struct _mgslpc_info {
326#define write_reg16(info, reg, val) outw((val), (info)->io_base + (reg)) 325#define write_reg16(info, reg, val) outw((val), (info)->io_base + (reg))
327 326
328#define set_reg_bits(info, reg, mask) \ 327#define set_reg_bits(info, reg, mask) \
329 write_reg(info, (reg), \ 328 write_reg(info, (reg), \
330 (unsigned char) (read_reg(info, (reg)) | (mask))) 329 (unsigned char) (read_reg(info, (reg)) | (mask)))
331#define clear_reg_bits(info, reg, mask) \ 330#define clear_reg_bits(info, reg, mask) \
332 write_reg(info, (reg), \ 331 write_reg(info, (reg), \
333 (unsigned char) (read_reg(info, (reg)) & ~(mask))) 332 (unsigned char) (read_reg(info, (reg)) & ~(mask)))
334/* 333/*
335 * interrupt enable/disable routines 334 * interrupt enable/disable routines
@@ -356,10 +355,10 @@ static void irq_enable(MGSLPC_INFO *info, unsigned char channel, unsigned short
356} 355}
357 356
358#define port_irq_disable(info, mask) \ 357#define port_irq_disable(info, mask) \
359 { info->pim_value |= (mask); write_reg(info, PIM, info->pim_value); } 358 { info->pim_value |= (mask); write_reg(info, PIM, info->pim_value); }
360 359
361#define port_irq_enable(info, mask) \ 360#define port_irq_enable(info, mask) \
362 { info->pim_value &= ~(mask); write_reg(info, PIM, info->pim_value); } 361 { info->pim_value &= ~(mask); write_reg(info, PIM, info->pim_value); }
363 362
364static void rx_start(MGSLPC_INFO *info); 363static void rx_start(MGSLPC_INFO *info);
365static void rx_stop(MGSLPC_INFO *info); 364static void rx_stop(MGSLPC_INFO *info);
@@ -514,56 +513,56 @@ static const struct tty_port_operations mgslpc_port_ops = {
514 513
515static int mgslpc_probe(struct pcmcia_device *link) 514static int mgslpc_probe(struct pcmcia_device *link)
516{ 515{
517 MGSLPC_INFO *info; 516 MGSLPC_INFO *info;
518 int ret; 517 int ret;
519 518
520 if (debug_level >= DEBUG_LEVEL_INFO) 519 if (debug_level >= DEBUG_LEVEL_INFO)
521 printk("mgslpc_attach\n"); 520 printk("mgslpc_attach\n");
522 521
523 info = kzalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); 522 info = kzalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
524 if (!info) { 523 if (!info) {
525 printk("Error can't allocate device instance data\n"); 524 printk("Error can't allocate device instance data\n");
526 return -ENOMEM; 525 return -ENOMEM;
527 } 526 }
528 527
529 info->magic = MGSLPC_MAGIC; 528 info->magic = MGSLPC_MAGIC;
530 tty_port_init(&info->port); 529 tty_port_init(&info->port);
531 info->port.ops = &mgslpc_port_ops; 530 info->port.ops = &mgslpc_port_ops;
532 INIT_WORK(&info->task, bh_handler); 531 INIT_WORK(&info->task, bh_handler);
533 info->max_frame_size = 4096; 532 info->max_frame_size = 4096;
534 info->port.close_delay = 5*HZ/10; 533 info->port.close_delay = 5*HZ/10;
535 info->port.closing_wait = 30*HZ; 534 info->port.closing_wait = 30*HZ;
536 init_waitqueue_head(&info->status_event_wait_q); 535 init_waitqueue_head(&info->status_event_wait_q);
537 init_waitqueue_head(&info->event_wait_q); 536 init_waitqueue_head(&info->event_wait_q);
538 spin_lock_init(&info->lock); 537 spin_lock_init(&info->lock);
539 spin_lock_init(&info->netlock); 538 spin_lock_init(&info->netlock);
540 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); 539 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS));
541 info->idle_mode = HDLC_TXIDLE_FLAGS; 540 info->idle_mode = HDLC_TXIDLE_FLAGS;
542 info->imra_value = 0xffff; 541 info->imra_value = 0xffff;
543 info->imrb_value = 0xffff; 542 info->imrb_value = 0xffff;
544 info->pim_value = 0xff; 543 info->pim_value = 0xff;
545 544
546 info->p_dev = link; 545 info->p_dev = link;
547 link->priv = info; 546 link->priv = info;
548 547
549 /* Initialize the struct pcmcia_device structure */ 548 /* Initialize the struct pcmcia_device structure */
550 549
551 ret = mgslpc_config(link); 550 ret = mgslpc_config(link);
552 if (ret != 0) 551 if (ret != 0)
553 goto failed; 552 goto failed;
554 553
555 ret = mgslpc_add_device(info); 554 ret = mgslpc_add_device(info);
556 if (ret != 0) 555 if (ret != 0)
557 goto failed_release; 556 goto failed_release;
558 557
559 return 0; 558 return 0;
560 559
561failed_release: 560failed_release:
562 mgslpc_release((u_long)link); 561 mgslpc_release((u_long)link);
563failed: 562failed:
564 tty_port_destroy(&info->port); 563 tty_port_destroy(&info->port);
565 kfree(info); 564 kfree(info);
566 return ret; 565 return ret;
567} 566}
568 567
569/* Card has been inserted. 568/* Card has been inserted.
@@ -576,35 +575,35 @@ static int mgslpc_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
576 575
577static int mgslpc_config(struct pcmcia_device *link) 576static int mgslpc_config(struct pcmcia_device *link)
578{ 577{
579 MGSLPC_INFO *info = link->priv; 578 MGSLPC_INFO *info = link->priv;
580 int ret; 579 int ret;
581 580
582 if (debug_level >= DEBUG_LEVEL_INFO) 581 if (debug_level >= DEBUG_LEVEL_INFO)
583 printk("mgslpc_config(0x%p)\n", link); 582 printk("mgslpc_config(0x%p)\n", link);
584 583
585 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 584 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
586 585
587 ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); 586 ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
588 if (ret != 0) 587 if (ret != 0)
589 goto failed; 588 goto failed;
590 589
591 link->config_index = 8; 590 link->config_index = 8;
592 link->config_regs = PRESENT_OPTION; 591 link->config_regs = PRESENT_OPTION;
593 592
594 ret = pcmcia_request_irq(link, mgslpc_isr); 593 ret = pcmcia_request_irq(link, mgslpc_isr);
595 if (ret) 594 if (ret)
596 goto failed; 595 goto failed;
597 ret = pcmcia_enable_device(link); 596 ret = pcmcia_enable_device(link);
598 if (ret) 597 if (ret)
599 goto failed; 598 goto failed;
600 599
601 info->io_base = link->resource[0]->start; 600 info->io_base = link->resource[0]->start;
602 info->irq_level = link->irq; 601 info->irq_level = link->irq;
603 return 0; 602 return 0;
604 603
605failed: 604failed:
606 mgslpc_release((u_long)link); 605 mgslpc_release((u_long)link);
607 return -ENODEV; 606 return -ENODEV;
608} 607}
609 608
610/* Card has been removed. 609/* Card has been removed.
@@ -710,12 +709,12 @@ static void tx_pause(struct tty_struct *tty)
710 if (mgslpc_paranoia_check(info, tty->name, "tx_pause")) 709 if (mgslpc_paranoia_check(info, tty->name, "tx_pause"))
711 return; 710 return;
712 if (debug_level >= DEBUG_LEVEL_INFO) 711 if (debug_level >= DEBUG_LEVEL_INFO)
713 printk("tx_pause(%s)\n",info->device_name); 712 printk("tx_pause(%s)\n", info->device_name);
714 713
715 spin_lock_irqsave(&info->lock,flags); 714 spin_lock_irqsave(&info->lock, flags);
716 if (info->tx_enabled) 715 if (info->tx_enabled)
717 tx_stop(info); 716 tx_stop(info);
718 spin_unlock_irqrestore(&info->lock,flags); 717 spin_unlock_irqrestore(&info->lock, flags);
719} 718}
720 719
721static void tx_release(struct tty_struct *tty) 720static void tx_release(struct tty_struct *tty)
@@ -726,12 +725,12 @@ static void tx_release(struct tty_struct *tty)
726 if (mgslpc_paranoia_check(info, tty->name, "tx_release")) 725 if (mgslpc_paranoia_check(info, tty->name, "tx_release"))
727 return; 726 return;
728 if (debug_level >= DEBUG_LEVEL_INFO) 727 if (debug_level >= DEBUG_LEVEL_INFO)
729 printk("tx_release(%s)\n",info->device_name); 728 printk("tx_release(%s)\n", info->device_name);
730 729
731 spin_lock_irqsave(&info->lock,flags); 730 spin_lock_irqsave(&info->lock, flags);
732 if (!info->tx_enabled) 731 if (!info->tx_enabled)
733 tx_start(info, tty); 732 tx_start(info, tty);
734 spin_unlock_irqrestore(&info->lock,flags); 733 spin_unlock_irqrestore(&info->lock, flags);
735} 734}
736 735
737/* Return next bottom half action to perform. 736/* Return next bottom half action to perform.
@@ -742,7 +741,7 @@ static int bh_action(MGSLPC_INFO *info)
742 unsigned long flags; 741 unsigned long flags;
743 int rc = 0; 742 int rc = 0;
744 743
745 spin_lock_irqsave(&info->lock,flags); 744 spin_lock_irqsave(&info->lock, flags);
746 745
747 if (info->pending_bh & BH_RECEIVE) { 746 if (info->pending_bh & BH_RECEIVE) {
748 info->pending_bh &= ~BH_RECEIVE; 747 info->pending_bh &= ~BH_RECEIVE;
@@ -761,7 +760,7 @@ static int bh_action(MGSLPC_INFO *info)
761 info->bh_requested = false; 760 info->bh_requested = false;
762 } 761 }
763 762
764 spin_unlock_irqrestore(&info->lock,flags); 763 spin_unlock_irqrestore(&info->lock, flags);
765 764
766 return rc; 765 return rc;
767} 766}
@@ -776,7 +775,7 @@ static void bh_handler(struct work_struct *work)
776 return; 775 return;
777 776
778 if (debug_level >= DEBUG_LEVEL_BH) 777 if (debug_level >= DEBUG_LEVEL_BH)
779 printk( "%s(%d):bh_handler(%s) entry\n", 778 printk("%s(%d):bh_handler(%s) entry\n",
780 __FILE__,__LINE__,info->device_name); 779 __FILE__,__LINE__,info->device_name);
781 780
782 info->bh_running = true; 781 info->bh_running = true;
@@ -785,8 +784,8 @@ static void bh_handler(struct work_struct *work)
785 while((action = bh_action(info)) != 0) { 784 while((action = bh_action(info)) != 0) {
786 785
787 /* Process work item */ 786 /* Process work item */
788 if ( debug_level >= DEBUG_LEVEL_BH ) 787 if (debug_level >= DEBUG_LEVEL_BH)
789 printk( "%s(%d):bh_handler() work item action=%d\n", 788 printk("%s(%d):bh_handler() work item action=%d\n",
790 __FILE__,__LINE__,action); 789 __FILE__,__LINE__,action);
791 790
792 switch (action) { 791 switch (action) {
@@ -809,7 +808,7 @@ static void bh_handler(struct work_struct *work)
809 808
810 tty_kref_put(tty); 809 tty_kref_put(tty);
811 if (debug_level >= DEBUG_LEVEL_BH) 810 if (debug_level >= DEBUG_LEVEL_BH)
812 printk( "%s(%d):bh_handler(%s) exit\n", 811 printk("%s(%d):bh_handler(%s) exit\n",
813 __FILE__,__LINE__,info->device_name); 812 __FILE__,__LINE__,info->device_name);
814} 813}
815 814
@@ -838,7 +837,7 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
838 RXBUF *buf = (RXBUF*)(info->rx_buf + (info->rx_put * info->rx_buf_size)); 837 RXBUF *buf = (RXBUF*)(info->rx_buf + (info->rx_put * info->rx_buf_size));
839 838
840 if (debug_level >= DEBUG_LEVEL_ISR) 839 if (debug_level >= DEBUG_LEVEL_ISR)
841 printk("%s(%d):rx_ready_hdlc(eom=%d)\n",__FILE__,__LINE__,eom); 840 printk("%s(%d):rx_ready_hdlc(eom=%d)\n", __FILE__, __LINE__, eom);
842 841
843 if (!info->rx_enabled) 842 if (!info->rx_enabled)
844 return; 843 return;
@@ -854,7 +853,8 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
854 853
855 if (eom) { 854 if (eom) {
856 /* end of frame, get FIFO count from RBCL register */ 855 /* end of frame, get FIFO count from RBCL register */
857 if (!(fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f))) 856 fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f);
857 if (fifo_count == 0)
858 fifo_count = 32; 858 fifo_count = 32;
859 } else 859 } else
860 fifo_count = 32; 860 fifo_count = 32;
@@ -898,13 +898,13 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
898 unsigned char data, status, flag; 898 unsigned char data, status, flag;
899 int fifo_count; 899 int fifo_count;
900 int work = 0; 900 int work = 0;
901 struct mgsl_icount *icount = &info->icount; 901 struct mgsl_icount *icount = &info->icount;
902 902
903 if (!tty) { 903 if (!tty) {
904 /* tty is not available anymore */ 904 /* tty is not available anymore */
905 issue_command(info, CHA, CMD_RXRESET); 905 issue_command(info, CHA, CMD_RXRESET);
906 if (debug_level >= DEBUG_LEVEL_ISR) 906 if (debug_level >= DEBUG_LEVEL_ISR)
907 printk("%s(%d):rx_ready_async(tty=NULL)\n",__FILE__,__LINE__); 907 printk("%s(%d):rx_ready_async(tty=NULL)\n", __FILE__, __LINE__);
908 return; 908 return;
909 } 909 }
910 910
@@ -1011,7 +1011,7 @@ static void tx_ready(MGSLPC_INFO *info, struct tty_struct *tty)
1011 int c; 1011 int c;
1012 1012
1013 if (debug_level >= DEBUG_LEVEL_ISR) 1013 if (debug_level >= DEBUG_LEVEL_ISR)
1014 printk("%s(%d):tx_ready(%s)\n", __FILE__,__LINE__,info->device_name); 1014 printk("%s(%d):tx_ready(%s)\n", __FILE__, __LINE__, info->device_name);
1015 1015
1016 if (info->params.mode == MGSL_MODE_HDLC) { 1016 if (info->params.mode == MGSL_MODE_HDLC) {
1017 if (!info->tx_active) 1017 if (!info->tx_active)
@@ -1256,7 +1256,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id)
1256 */ 1256 */
1257 1257
1258 if (info->pending_bh && !info->bh_running && !info->bh_requested) { 1258 if (info->pending_bh && !info->bh_running && !info->bh_requested) {
1259 if ( debug_level >= DEBUG_LEVEL_ISR ) 1259 if (debug_level >= DEBUG_LEVEL_ISR)
1260 printk("%s(%d):%s queueing bh task.\n", 1260 printk("%s(%d):%s queueing bh task.\n",
1261 __FILE__,__LINE__,info->device_name); 1261 __FILE__,__LINE__,info->device_name);
1262 schedule_work(&info->task); 1262 schedule_work(&info->task);
@@ -1280,7 +1280,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
1280 int retval = 0; 1280 int retval = 0;
1281 1281
1282 if (debug_level >= DEBUG_LEVEL_INFO) 1282 if (debug_level >= DEBUG_LEVEL_INFO)
1283 printk("%s(%d):startup(%s)\n",__FILE__,__LINE__,info->device_name); 1283 printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name);
1284 1284
1285 if (info->port.flags & ASYNC_INITIALIZED) 1285 if (info->port.flags & ASYNC_INITIALIZED)
1286 return 0; 1286 return 0;
@@ -1290,7 +1290,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
1290 info->tx_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); 1290 info->tx_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
1291 if (!info->tx_buf) { 1291 if (!info->tx_buf) {
1292 printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", 1292 printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n",
1293 __FILE__,__LINE__,info->device_name); 1293 __FILE__, __LINE__, info->device_name);
1294 return -ENOMEM; 1294 return -ENOMEM;
1295 } 1295 }
1296 } 1296 }
@@ -1305,15 +1305,15 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
1305 retval = claim_resources(info); 1305 retval = claim_resources(info);
1306 1306
1307 /* perform existence check and diagnostics */ 1307 /* perform existence check and diagnostics */
1308 if ( !retval ) 1308 if (!retval)
1309 retval = adapter_test(info); 1309 retval = adapter_test(info);
1310 1310
1311 if ( retval ) { 1311 if (retval) {
1312 if (capable(CAP_SYS_ADMIN) && tty) 1312 if (capable(CAP_SYS_ADMIN) && tty)
1313 set_bit(TTY_IO_ERROR, &tty->flags); 1313 set_bit(TTY_IO_ERROR, &tty->flags);
1314 release_resources(info); 1314 release_resources(info);
1315 return retval; 1315 return retval;
1316 } 1316 }
1317 1317
1318 /* program hardware for current parameters */ 1318 /* program hardware for current parameters */
1319 mgslpc_change_params(info, tty); 1319 mgslpc_change_params(info, tty);
@@ -1337,7 +1337,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1337 1337
1338 if (debug_level >= DEBUG_LEVEL_INFO) 1338 if (debug_level >= DEBUG_LEVEL_INFO)
1339 printk("%s(%d):mgslpc_shutdown(%s)\n", 1339 printk("%s(%d):mgslpc_shutdown(%s)\n",
1340 __FILE__,__LINE__, info->device_name ); 1340 __FILE__, __LINE__, info->device_name);
1341 1341
1342 /* clear status wait queue because status changes */ 1342 /* clear status wait queue because status changes */
1343 /* can't happen after shutting down the hardware */ 1343 /* can't happen after shutting down the hardware */
@@ -1351,7 +1351,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1351 info->tx_buf = NULL; 1351 info->tx_buf = NULL;
1352 } 1352 }
1353 1353
1354 spin_lock_irqsave(&info->lock,flags); 1354 spin_lock_irqsave(&info->lock, flags);
1355 1355
1356 rx_stop(info); 1356 rx_stop(info);
1357 tx_stop(info); 1357 tx_stop(info);
@@ -1359,12 +1359,12 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1359 /* TODO:disable interrupts instead of reset to preserve signal states */ 1359 /* TODO:disable interrupts instead of reset to preserve signal states */
1360 reset_device(info); 1360 reset_device(info);
1361 1361
1362 if (!tty || tty->termios.c_cflag & HUPCL) { 1362 if (!tty || tty->termios.c_cflag & HUPCL) {
1363 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 1363 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
1364 set_signals(info); 1364 set_signals(info);
1365 } 1365 }
1366 1366
1367 spin_unlock_irqrestore(&info->lock,flags); 1367 spin_unlock_irqrestore(&info->lock, flags);
1368 1368
1369 release_resources(info); 1369 release_resources(info);
1370 1370
@@ -1378,7 +1378,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty)
1378{ 1378{
1379 unsigned long flags; 1379 unsigned long flags;
1380 1380
1381 spin_lock_irqsave(&info->lock,flags); 1381 spin_lock_irqsave(&info->lock, flags);
1382 1382
1383 rx_stop(info); 1383 rx_stop(info);
1384 tx_stop(info); 1384 tx_stop(info);
@@ -1403,7 +1403,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty)
1403 if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) 1403 if (info->netcount || (tty && (tty->termios.c_cflag & CREAD)))
1404 rx_start(info); 1404 rx_start(info);
1405 1405
1406 spin_unlock_irqrestore(&info->lock,flags); 1406 spin_unlock_irqrestore(&info->lock, flags);
1407} 1407}
1408 1408
1409/* Reconfigure adapter based on new parameters 1409/* Reconfigure adapter based on new parameters
@@ -1418,13 +1418,13 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty)
1418 1418
1419 if (debug_level >= DEBUG_LEVEL_INFO) 1419 if (debug_level >= DEBUG_LEVEL_INFO)
1420 printk("%s(%d):mgslpc_change_params(%s)\n", 1420 printk("%s(%d):mgslpc_change_params(%s)\n",
1421 __FILE__,__LINE__, info->device_name ); 1421 __FILE__, __LINE__, info->device_name);
1422 1422
1423 cflag = tty->termios.c_cflag; 1423 cflag = tty->termios.c_cflag;
1424 1424
1425 /* if B0 rate (hangup) specified then negate DTR and RTS */ 1425 /* if B0 rate (hangup) specified then negate DTR and RTS */
1426 /* otherwise assert DTR and RTS */ 1426 /* otherwise assert DTR and RTS */
1427 if (cflag & CBAUD) 1427 if (cflag & CBAUD)
1428 info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; 1428 info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
1429 else 1429 else
1430 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 1430 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
@@ -1470,7 +1470,7 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty)
1470 info->params.data_rate = tty_get_baud_rate(tty); 1470 info->params.data_rate = tty_get_baud_rate(tty);
1471 } 1471 }
1472 1472
1473 if ( info->params.data_rate ) { 1473 if (info->params.data_rate) {
1474 info->timeout = (32*HZ*bits_per_char) / 1474 info->timeout = (32*HZ*bits_per_char) /
1475 info->params.data_rate; 1475 info->params.data_rate;
1476 } 1476 }
@@ -1505,8 +1505,8 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch)
1505 unsigned long flags; 1505 unsigned long flags;
1506 1506
1507 if (debug_level >= DEBUG_LEVEL_INFO) { 1507 if (debug_level >= DEBUG_LEVEL_INFO) {
1508 printk( "%s(%d):mgslpc_put_char(%d) on %s\n", 1508 printk("%s(%d):mgslpc_put_char(%d) on %s\n",
1509 __FILE__,__LINE__,ch,info->device_name); 1509 __FILE__, __LINE__, ch, info->device_name);
1510 } 1510 }
1511 1511
1512 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) 1512 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char"))
@@ -1515,7 +1515,7 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch)
1515 if (!info->tx_buf) 1515 if (!info->tx_buf)
1516 return 0; 1516 return 0;
1517 1517
1518 spin_lock_irqsave(&info->lock,flags); 1518 spin_lock_irqsave(&info->lock, flags);
1519 1519
1520 if (info->params.mode == MGSL_MODE_ASYNC || !info->tx_active) { 1520 if (info->params.mode == MGSL_MODE_ASYNC || !info->tx_active) {
1521 if (info->tx_count < TXBUFSIZE - 1) { 1521 if (info->tx_count < TXBUFSIZE - 1) {
@@ -1525,7 +1525,7 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch)
1525 } 1525 }
1526 } 1526 }
1527 1527
1528 spin_unlock_irqrestore(&info->lock,flags); 1528 spin_unlock_irqrestore(&info->lock, flags);
1529 return 1; 1529 return 1;
1530} 1530}
1531 1531
@@ -1538,8 +1538,8 @@ static void mgslpc_flush_chars(struct tty_struct *tty)
1538 unsigned long flags; 1538 unsigned long flags;
1539 1539
1540 if (debug_level >= DEBUG_LEVEL_INFO) 1540 if (debug_level >= DEBUG_LEVEL_INFO)
1541 printk( "%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n", 1541 printk("%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n",
1542 __FILE__,__LINE__,info->device_name,info->tx_count); 1542 __FILE__, __LINE__, info->device_name, info->tx_count);
1543 1543
1544 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars")) 1544 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars"))
1545 return; 1545 return;
@@ -1549,13 +1549,13 @@ static void mgslpc_flush_chars(struct tty_struct *tty)
1549 return; 1549 return;
1550 1550
1551 if (debug_level >= DEBUG_LEVEL_INFO) 1551 if (debug_level >= DEBUG_LEVEL_INFO)
1552 printk( "%s(%d):mgslpc_flush_chars() entry on %s starting transmitter\n", 1552 printk("%s(%d):mgslpc_flush_chars() entry on %s starting transmitter\n",
1553 __FILE__,__LINE__,info->device_name); 1553 __FILE__, __LINE__, info->device_name);
1554 1554
1555 spin_lock_irqsave(&info->lock,flags); 1555 spin_lock_irqsave(&info->lock, flags);
1556 if (!info->tx_active) 1556 if (!info->tx_active)
1557 tx_start(info, tty); 1557 tx_start(info, tty);
1558 spin_unlock_irqrestore(&info->lock,flags); 1558 spin_unlock_irqrestore(&info->lock, flags);
1559} 1559}
1560 1560
1561/* Send a block of data 1561/* Send a block of data
@@ -1576,8 +1576,8 @@ static int mgslpc_write(struct tty_struct * tty,
1576 unsigned long flags; 1576 unsigned long flags;
1577 1577
1578 if (debug_level >= DEBUG_LEVEL_INFO) 1578 if (debug_level >= DEBUG_LEVEL_INFO)
1579 printk( "%s(%d):mgslpc_write(%s) count=%d\n", 1579 printk("%s(%d):mgslpc_write(%s) count=%d\n",
1580 __FILE__,__LINE__,info->device_name,count); 1580 __FILE__, __LINE__, info->device_name, count);
1581 1581
1582 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || 1582 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") ||
1583 !info->tx_buf) 1583 !info->tx_buf)
@@ -1603,26 +1603,26 @@ static int mgslpc_write(struct tty_struct * tty,
1603 1603
1604 memcpy(info->tx_buf + info->tx_put, buf, c); 1604 memcpy(info->tx_buf + info->tx_put, buf, c);
1605 1605
1606 spin_lock_irqsave(&info->lock,flags); 1606 spin_lock_irqsave(&info->lock, flags);
1607 info->tx_put = (info->tx_put + c) & (TXBUFSIZE-1); 1607 info->tx_put = (info->tx_put + c) & (TXBUFSIZE-1);
1608 info->tx_count += c; 1608 info->tx_count += c;
1609 spin_unlock_irqrestore(&info->lock,flags); 1609 spin_unlock_irqrestore(&info->lock, flags);
1610 1610
1611 buf += c; 1611 buf += c;
1612 count -= c; 1612 count -= c;
1613 ret += c; 1613 ret += c;
1614 } 1614 }
1615start: 1615start:
1616 if (info->tx_count && !tty->stopped && !tty->hw_stopped) { 1616 if (info->tx_count && !tty->stopped && !tty->hw_stopped) {
1617 spin_lock_irqsave(&info->lock,flags); 1617 spin_lock_irqsave(&info->lock, flags);
1618 if (!info->tx_active) 1618 if (!info->tx_active)
1619 tx_start(info, tty); 1619 tx_start(info, tty);
1620 spin_unlock_irqrestore(&info->lock,flags); 1620 spin_unlock_irqrestore(&info->lock, flags);
1621 } 1621 }
1622cleanup: 1622cleanup:
1623 if (debug_level >= DEBUG_LEVEL_INFO) 1623 if (debug_level >= DEBUG_LEVEL_INFO)
1624 printk( "%s(%d):mgslpc_write(%s) returning=%d\n", 1624 printk("%s(%d):mgslpc_write(%s) returning=%d\n",
1625 __FILE__,__LINE__,info->device_name,ret); 1625 __FILE__, __LINE__, info->device_name, ret);
1626 return ret; 1626 return ret;
1627} 1627}
1628 1628
@@ -1650,7 +1650,7 @@ static int mgslpc_write_room(struct tty_struct *tty)
1650 1650
1651 if (debug_level >= DEBUG_LEVEL_INFO) 1651 if (debug_level >= DEBUG_LEVEL_INFO)
1652 printk("%s(%d):mgslpc_write_room(%s)=%d\n", 1652 printk("%s(%d):mgslpc_write_room(%s)=%d\n",
1653 __FILE__,__LINE__, info->device_name, ret); 1653 __FILE__, __LINE__, info->device_name, ret);
1654 return ret; 1654 return ret;
1655} 1655}
1656 1656
@@ -1663,7 +1663,7 @@ static int mgslpc_chars_in_buffer(struct tty_struct *tty)
1663 1663
1664 if (debug_level >= DEBUG_LEVEL_INFO) 1664 if (debug_level >= DEBUG_LEVEL_INFO)
1665 printk("%s(%d):mgslpc_chars_in_buffer(%s)\n", 1665 printk("%s(%d):mgslpc_chars_in_buffer(%s)\n",
1666 __FILE__,__LINE__, info->device_name ); 1666 __FILE__, __LINE__, info->device_name);
1667 1667
1668 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer")) 1668 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer"))
1669 return 0; 1669 return 0;
@@ -1675,7 +1675,7 @@ static int mgslpc_chars_in_buffer(struct tty_struct *tty)
1675 1675
1676 if (debug_level >= DEBUG_LEVEL_INFO) 1676 if (debug_level >= DEBUG_LEVEL_INFO)
1677 printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n", 1677 printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n",
1678 __FILE__,__LINE__, info->device_name, rc); 1678 __FILE__, __LINE__, info->device_name, rc);
1679 1679
1680 return rc; 1680 return rc;
1681} 1681}
@@ -1689,15 +1689,15 @@ static void mgslpc_flush_buffer(struct tty_struct *tty)
1689 1689
1690 if (debug_level >= DEBUG_LEVEL_INFO) 1690 if (debug_level >= DEBUG_LEVEL_INFO)
1691 printk("%s(%d):mgslpc_flush_buffer(%s) entry\n", 1691 printk("%s(%d):mgslpc_flush_buffer(%s) entry\n",
1692 __FILE__,__LINE__, info->device_name ); 1692 __FILE__, __LINE__, info->device_name);
1693 1693
1694 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer")) 1694 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer"))
1695 return; 1695 return;
1696 1696
1697 spin_lock_irqsave(&info->lock,flags); 1697 spin_lock_irqsave(&info->lock, flags);
1698 info->tx_count = info->tx_put = info->tx_get = 0; 1698 info->tx_count = info->tx_put = info->tx_get = 0;
1699 del_timer(&info->tx_timer); 1699 del_timer(&info->tx_timer);
1700 spin_unlock_irqrestore(&info->lock,flags); 1700 spin_unlock_irqrestore(&info->lock, flags);
1701 1701
1702 wake_up_interruptible(&tty->write_wait); 1702 wake_up_interruptible(&tty->write_wait);
1703 tty_wakeup(tty); 1703 tty_wakeup(tty);
@@ -1712,17 +1712,17 @@ static void mgslpc_send_xchar(struct tty_struct *tty, char ch)
1712 1712
1713 if (debug_level >= DEBUG_LEVEL_INFO) 1713 if (debug_level >= DEBUG_LEVEL_INFO)
1714 printk("%s(%d):mgslpc_send_xchar(%s,%d)\n", 1714 printk("%s(%d):mgslpc_send_xchar(%s,%d)\n",
1715 __FILE__,__LINE__, info->device_name, ch ); 1715 __FILE__, __LINE__, info->device_name, ch);
1716 1716
1717 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar")) 1717 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar"))
1718 return; 1718 return;
1719 1719
1720 info->x_char = ch; 1720 info->x_char = ch;
1721 if (ch) { 1721 if (ch) {
1722 spin_lock_irqsave(&info->lock,flags); 1722 spin_lock_irqsave(&info->lock, flags);
1723 if (!info->tx_enabled) 1723 if (!info->tx_enabled)
1724 tx_start(info, tty); 1724 tx_start(info, tty);
1725 spin_unlock_irqrestore(&info->lock,flags); 1725 spin_unlock_irqrestore(&info->lock, flags);
1726 } 1726 }
1727} 1727}
1728 1728
@@ -1735,7 +1735,7 @@ static void mgslpc_throttle(struct tty_struct * tty)
1735 1735
1736 if (debug_level >= DEBUG_LEVEL_INFO) 1736 if (debug_level >= DEBUG_LEVEL_INFO)
1737 printk("%s(%d):mgslpc_throttle(%s) entry\n", 1737 printk("%s(%d):mgslpc_throttle(%s) entry\n",
1738 __FILE__,__LINE__, info->device_name ); 1738 __FILE__, __LINE__, info->device_name);
1739 1739
1740 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle")) 1740 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle"))
1741 return; 1741 return;
@@ -1743,11 +1743,11 @@ static void mgslpc_throttle(struct tty_struct * tty)
1743 if (I_IXOFF(tty)) 1743 if (I_IXOFF(tty))
1744 mgslpc_send_xchar(tty, STOP_CHAR(tty)); 1744 mgslpc_send_xchar(tty, STOP_CHAR(tty));
1745 1745
1746 if (tty->termios.c_cflag & CRTSCTS) { 1746 if (tty->termios.c_cflag & CRTSCTS) {
1747 spin_lock_irqsave(&info->lock,flags); 1747 spin_lock_irqsave(&info->lock, flags);
1748 info->serial_signals &= ~SerialSignal_RTS; 1748 info->serial_signals &= ~SerialSignal_RTS;
1749 set_signals(info); 1749 set_signals(info);
1750 spin_unlock_irqrestore(&info->lock,flags); 1750 spin_unlock_irqrestore(&info->lock, flags);
1751 } 1751 }
1752} 1752}
1753 1753
@@ -1760,7 +1760,7 @@ static void mgslpc_unthrottle(struct tty_struct * tty)
1760 1760
1761 if (debug_level >= DEBUG_LEVEL_INFO) 1761 if (debug_level >= DEBUG_LEVEL_INFO)
1762 printk("%s(%d):mgslpc_unthrottle(%s) entry\n", 1762 printk("%s(%d):mgslpc_unthrottle(%s) entry\n",
1763 __FILE__,__LINE__, info->device_name ); 1763 __FILE__, __LINE__, info->device_name);
1764 1764
1765 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle")) 1765 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle"))
1766 return; 1766 return;
@@ -1772,11 +1772,11 @@ static void mgslpc_unthrottle(struct tty_struct * tty)
1772 mgslpc_send_xchar(tty, START_CHAR(tty)); 1772 mgslpc_send_xchar(tty, START_CHAR(tty));
1773 } 1773 }
1774 1774
1775 if (tty->termios.c_cflag & CRTSCTS) { 1775 if (tty->termios.c_cflag & CRTSCTS) {
1776 spin_lock_irqsave(&info->lock,flags); 1776 spin_lock_irqsave(&info->lock, flags);
1777 info->serial_signals |= SerialSignal_RTS; 1777 info->serial_signals |= SerialSignal_RTS;
1778 set_signals(info); 1778 set_signals(info);
1779 spin_unlock_irqrestore(&info->lock,flags); 1779 spin_unlock_irqrestore(&info->lock, flags);
1780 } 1780 }
1781} 1781}
1782 1782
@@ -1814,33 +1814,33 @@ static int get_params(MGSLPC_INFO * info, MGSL_PARAMS __user *user_params)
1814 * 1814 *
1815 * Arguments: 1815 * Arguments:
1816 * 1816 *
1817 * info pointer to device instance data 1817 * info pointer to device instance data
1818 * new_params user buffer containing new serial params 1818 * new_params user buffer containing new serial params
1819 * 1819 *
1820 * Returns: 0 if success, otherwise error code 1820 * Returns: 0 if success, otherwise error code
1821 */ 1821 */
1822static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty) 1822static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty)
1823{ 1823{
1824 unsigned long flags; 1824 unsigned long flags;
1825 MGSL_PARAMS tmp_params; 1825 MGSL_PARAMS tmp_params;
1826 int err; 1826 int err;
1827 1827
1828 if (debug_level >= DEBUG_LEVEL_INFO) 1828 if (debug_level >= DEBUG_LEVEL_INFO)
1829 printk("%s(%d):set_params %s\n", __FILE__,__LINE__, 1829 printk("%s(%d):set_params %s\n", __FILE__,__LINE__,
1830 info->device_name ); 1830 info->device_name);
1831 COPY_FROM_USER(err,&tmp_params, new_params, sizeof(MGSL_PARAMS)); 1831 COPY_FROM_USER(err,&tmp_params, new_params, sizeof(MGSL_PARAMS));
1832 if (err) { 1832 if (err) {
1833 if ( debug_level >= DEBUG_LEVEL_INFO ) 1833 if (debug_level >= DEBUG_LEVEL_INFO)
1834 printk( "%s(%d):set_params(%s) user buffer copy failed\n", 1834 printk("%s(%d):set_params(%s) user buffer copy failed\n",
1835 __FILE__,__LINE__,info->device_name); 1835 __FILE__, __LINE__, info->device_name);
1836 return -EFAULT; 1836 return -EFAULT;
1837 } 1837 }
1838 1838
1839 spin_lock_irqsave(&info->lock,flags); 1839 spin_lock_irqsave(&info->lock, flags);
1840 memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); 1840 memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS));
1841 spin_unlock_irqrestore(&info->lock,flags); 1841 spin_unlock_irqrestore(&info->lock, flags);
1842 1842
1843 mgslpc_change_params(info, tty); 1843 mgslpc_change_params(info, tty);
1844 1844
1845 return 0; 1845 return 0;
1846} 1846}
@@ -1858,13 +1858,13 @@ static int get_txidle(MGSLPC_INFO * info, int __user *idle_mode)
1858 1858
1859static int set_txidle(MGSLPC_INFO * info, int idle_mode) 1859static int set_txidle(MGSLPC_INFO * info, int idle_mode)
1860{ 1860{
1861 unsigned long flags; 1861 unsigned long flags;
1862 if (debug_level >= DEBUG_LEVEL_INFO) 1862 if (debug_level >= DEBUG_LEVEL_INFO)
1863 printk("set_txidle(%s,%d)\n", info->device_name, idle_mode); 1863 printk("set_txidle(%s,%d)\n", info->device_name, idle_mode);
1864 spin_lock_irqsave(&info->lock,flags); 1864 spin_lock_irqsave(&info->lock, flags);
1865 info->idle_mode = idle_mode; 1865 info->idle_mode = idle_mode;
1866 tx_set_idle(info); 1866 tx_set_idle(info);
1867 spin_unlock_irqrestore(&info->lock,flags); 1867 spin_unlock_irqrestore(&info->lock, flags);
1868 return 0; 1868 return 0;
1869} 1869}
1870 1870
@@ -1881,11 +1881,11 @@ static int get_interface(MGSLPC_INFO * info, int __user *if_mode)
1881 1881
1882static int set_interface(MGSLPC_INFO * info, int if_mode) 1882static int set_interface(MGSLPC_INFO * info, int if_mode)
1883{ 1883{
1884 unsigned long flags; 1884 unsigned long flags;
1885 unsigned char val; 1885 unsigned char val;
1886 if (debug_level >= DEBUG_LEVEL_INFO) 1886 if (debug_level >= DEBUG_LEVEL_INFO)
1887 printk("set_interface(%s,%d)\n", info->device_name, if_mode); 1887 printk("set_interface(%s,%d)\n", info->device_name, if_mode);
1888 spin_lock_irqsave(&info->lock,flags); 1888 spin_lock_irqsave(&info->lock, flags);
1889 info->if_mode = if_mode; 1889 info->if_mode = if_mode;
1890 1890
1891 val = read_reg(info, PVR) & 0x0f; 1891 val = read_reg(info, PVR) & 0x0f;
@@ -1897,18 +1897,18 @@ static int set_interface(MGSLPC_INFO * info, int if_mode)
1897 } 1897 }
1898 write_reg(info, PVR, val); 1898 write_reg(info, PVR, val);
1899 1899
1900 spin_unlock_irqrestore(&info->lock,flags); 1900 spin_unlock_irqrestore(&info->lock, flags);
1901 return 0; 1901 return 0;
1902} 1902}
1903 1903
1904static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty) 1904static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty)
1905{ 1905{
1906 unsigned long flags; 1906 unsigned long flags;
1907 1907
1908 if (debug_level >= DEBUG_LEVEL_INFO) 1908 if (debug_level >= DEBUG_LEVEL_INFO)
1909 printk("set_txenable(%s,%d)\n", info->device_name, enable); 1909 printk("set_txenable(%s,%d)\n", info->device_name, enable);
1910 1910
1911 spin_lock_irqsave(&info->lock,flags); 1911 spin_lock_irqsave(&info->lock, flags);
1912 if (enable) { 1912 if (enable) {
1913 if (!info->tx_enabled) 1913 if (!info->tx_enabled)
1914 tx_start(info, tty); 1914 tx_start(info, tty);
@@ -1916,18 +1916,18 @@ static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty)
1916 if (info->tx_enabled) 1916 if (info->tx_enabled)
1917 tx_stop(info); 1917 tx_stop(info);
1918 } 1918 }
1919 spin_unlock_irqrestore(&info->lock,flags); 1919 spin_unlock_irqrestore(&info->lock, flags);
1920 return 0; 1920 return 0;
1921} 1921}
1922 1922
1923static int tx_abort(MGSLPC_INFO * info) 1923static int tx_abort(MGSLPC_INFO * info)
1924{ 1924{
1925 unsigned long flags; 1925 unsigned long flags;
1926 1926
1927 if (debug_level >= DEBUG_LEVEL_INFO) 1927 if (debug_level >= DEBUG_LEVEL_INFO)
1928 printk("tx_abort(%s)\n", info->device_name); 1928 printk("tx_abort(%s)\n", info->device_name);
1929 1929
1930 spin_lock_irqsave(&info->lock,flags); 1930 spin_lock_irqsave(&info->lock, flags);
1931 if (info->tx_active && info->tx_count && 1931 if (info->tx_active && info->tx_count &&
1932 info->params.mode == MGSL_MODE_HDLC) { 1932 info->params.mode == MGSL_MODE_HDLC) {
1933 /* clear data count so FIFO is not filled on next IRQ. 1933 /* clear data count so FIFO is not filled on next IRQ.
@@ -1936,18 +1936,18 @@ static int tx_abort(MGSLPC_INFO * info)
1936 info->tx_count = info->tx_put = info->tx_get = 0; 1936 info->tx_count = info->tx_put = info->tx_get = 0;
1937 info->tx_aborting = true; 1937 info->tx_aborting = true;
1938 } 1938 }
1939 spin_unlock_irqrestore(&info->lock,flags); 1939 spin_unlock_irqrestore(&info->lock, flags);
1940 return 0; 1940 return 0;
1941} 1941}
1942 1942
1943static int set_rxenable(MGSLPC_INFO * info, int enable) 1943static int set_rxenable(MGSLPC_INFO * info, int enable)
1944{ 1944{
1945 unsigned long flags; 1945 unsigned long flags;
1946 1946
1947 if (debug_level >= DEBUG_LEVEL_INFO) 1947 if (debug_level >= DEBUG_LEVEL_INFO)
1948 printk("set_rxenable(%s,%d)\n", info->device_name, enable); 1948 printk("set_rxenable(%s,%d)\n", info->device_name, enable);
1949 1949
1950 spin_lock_irqsave(&info->lock,flags); 1950 spin_lock_irqsave(&info->lock, flags);
1951 if (enable) { 1951 if (enable) {
1952 if (!info->rx_enabled) 1952 if (!info->rx_enabled)
1953 rx_start(info); 1953 rx_start(info);
@@ -1955,21 +1955,21 @@ static int set_rxenable(MGSLPC_INFO * info, int enable)
1955 if (info->rx_enabled) 1955 if (info->rx_enabled)
1956 rx_stop(info); 1956 rx_stop(info);
1957 } 1957 }
1958 spin_unlock_irqrestore(&info->lock,flags); 1958 spin_unlock_irqrestore(&info->lock, flags);
1959 return 0; 1959 return 0;
1960} 1960}
1961 1961
1962/* wait for specified event to occur 1962/* wait for specified event to occur
1963 * 1963 *
1964 * Arguments: info pointer to device instance data 1964 * Arguments: info pointer to device instance data
1965 * mask pointer to bitmask of events to wait for 1965 * mask pointer to bitmask of events to wait for
1966 * Return Value: 0 if successful and bit mask updated with 1966 * Return Value: 0 if successful and bit mask updated with
1967 * of events triggerred, 1967 * of events triggerred,
1968 * otherwise error code 1968 * otherwise error code
1969 */ 1969 */
1970static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) 1970static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
1971{ 1971{
1972 unsigned long flags; 1972 unsigned long flags;
1973 int s; 1973 int s;
1974 int rc=0; 1974 int rc=0;
1975 struct mgsl_icount cprev, cnow; 1975 struct mgsl_icount cprev, cnow;
@@ -1985,18 +1985,18 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
1985 if (debug_level >= DEBUG_LEVEL_INFO) 1985 if (debug_level >= DEBUG_LEVEL_INFO)
1986 printk("wait_events(%s,%d)\n", info->device_name, mask); 1986 printk("wait_events(%s,%d)\n", info->device_name, mask);
1987 1987
1988 spin_lock_irqsave(&info->lock,flags); 1988 spin_lock_irqsave(&info->lock, flags);
1989 1989
1990 /* return immediately if state matches requested events */ 1990 /* return immediately if state matches requested events */
1991 get_signals(info); 1991 get_signals(info);
1992 s = info->serial_signals; 1992 s = info->serial_signals;
1993 events = mask & 1993 events = mask &
1994 ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) + 1994 ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) +
1995 ((s & SerialSignal_DCD) ? MgslEvent_DcdActive:MgslEvent_DcdInactive) + 1995 ((s & SerialSignal_DCD) ? MgslEvent_DcdActive:MgslEvent_DcdInactive) +
1996 ((s & SerialSignal_CTS) ? MgslEvent_CtsActive:MgslEvent_CtsInactive) + 1996 ((s & SerialSignal_CTS) ? MgslEvent_CtsActive:MgslEvent_CtsInactive) +
1997 ((s & SerialSignal_RI) ? MgslEvent_RiActive :MgslEvent_RiInactive) ); 1997 ((s & SerialSignal_RI) ? MgslEvent_RiActive :MgslEvent_RiInactive) );
1998 if (events) { 1998 if (events) {
1999 spin_unlock_irqrestore(&info->lock,flags); 1999 spin_unlock_irqrestore(&info->lock, flags);
2000 goto exit; 2000 goto exit;
2001 } 2001 }
2002 2002
@@ -2011,7 +2011,7 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
2011 set_current_state(TASK_INTERRUPTIBLE); 2011 set_current_state(TASK_INTERRUPTIBLE);
2012 add_wait_queue(&info->event_wait_q, &wait); 2012 add_wait_queue(&info->event_wait_q, &wait);
2013 2013
2014 spin_unlock_irqrestore(&info->lock,flags); 2014 spin_unlock_irqrestore(&info->lock, flags);
2015 2015
2016 2016
2017 for(;;) { 2017 for(;;) {
@@ -2022,11 +2022,11 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
2022 } 2022 }
2023 2023
2024 /* get current irq counts */ 2024 /* get current irq counts */
2025 spin_lock_irqsave(&info->lock,flags); 2025 spin_lock_irqsave(&info->lock, flags);
2026 cnow = info->icount; 2026 cnow = info->icount;
2027 newsigs = info->input_signal_events; 2027 newsigs = info->input_signal_events;
2028 set_current_state(TASK_INTERRUPTIBLE); 2028 set_current_state(TASK_INTERRUPTIBLE);
2029 spin_unlock_irqrestore(&info->lock,flags); 2029 spin_unlock_irqrestore(&info->lock, flags);
2030 2030
2031 /* if no change, wait aborted for some reason */ 2031 /* if no change, wait aborted for some reason */
2032 if (newsigs.dsr_up == oldsigs.dsr_up && 2032 if (newsigs.dsr_up == oldsigs.dsr_up &&
@@ -2065,10 +2065,10 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
2065 set_current_state(TASK_RUNNING); 2065 set_current_state(TASK_RUNNING);
2066 2066
2067 if (mask & MgslEvent_ExitHuntMode) { 2067 if (mask & MgslEvent_ExitHuntMode) {
2068 spin_lock_irqsave(&info->lock,flags); 2068 spin_lock_irqsave(&info->lock, flags);
2069 if (!waitqueue_active(&info->event_wait_q)) 2069 if (!waitqueue_active(&info->event_wait_q))
2070 irq_disable(info, CHA, IRQ_EXITHUNT); 2070 irq_disable(info, CHA, IRQ_EXITHUNT);
2071 spin_unlock_irqrestore(&info->lock,flags); 2071 spin_unlock_irqrestore(&info->lock, flags);
2072 } 2072 }
2073exit: 2073exit:
2074 if (rc == 0) 2074 if (rc == 0)
@@ -2078,17 +2078,17 @@ exit:
2078 2078
2079static int modem_input_wait(MGSLPC_INFO *info,int arg) 2079static int modem_input_wait(MGSLPC_INFO *info,int arg)
2080{ 2080{
2081 unsigned long flags; 2081 unsigned long flags;
2082 int rc; 2082 int rc;
2083 struct mgsl_icount cprev, cnow; 2083 struct mgsl_icount cprev, cnow;
2084 DECLARE_WAITQUEUE(wait, current); 2084 DECLARE_WAITQUEUE(wait, current);
2085 2085
2086 /* save current irq counts */ 2086 /* save current irq counts */
2087 spin_lock_irqsave(&info->lock,flags); 2087 spin_lock_irqsave(&info->lock, flags);
2088 cprev = info->icount; 2088 cprev = info->icount;
2089 add_wait_queue(&info->status_event_wait_q, &wait); 2089 add_wait_queue(&info->status_event_wait_q, &wait);
2090 set_current_state(TASK_INTERRUPTIBLE); 2090 set_current_state(TASK_INTERRUPTIBLE);
2091 spin_unlock_irqrestore(&info->lock,flags); 2091 spin_unlock_irqrestore(&info->lock, flags);
2092 2092
2093 for(;;) { 2093 for(;;) {
2094 schedule(); 2094 schedule();
@@ -2098,10 +2098,10 @@ static int modem_input_wait(MGSLPC_INFO *info,int arg)
2098 } 2098 }
2099 2099
2100 /* get new irq counts */ 2100 /* get new irq counts */
2101 spin_lock_irqsave(&info->lock,flags); 2101 spin_lock_irqsave(&info->lock, flags);
2102 cnow = info->icount; 2102 cnow = info->icount;
2103 set_current_state(TASK_INTERRUPTIBLE); 2103 set_current_state(TASK_INTERRUPTIBLE);
2104 spin_unlock_irqrestore(&info->lock,flags); 2104 spin_unlock_irqrestore(&info->lock, flags);
2105 2105
2106 /* if no change, wait aborted for some reason */ 2106 /* if no change, wait aborted for some reason */
2107 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && 2107 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
@@ -2132,11 +2132,11 @@ static int tiocmget(struct tty_struct *tty)
2132{ 2132{
2133 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; 2133 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
2134 unsigned int result; 2134 unsigned int result;
2135 unsigned long flags; 2135 unsigned long flags;
2136 2136
2137 spin_lock_irqsave(&info->lock,flags); 2137 spin_lock_irqsave(&info->lock, flags);
2138 get_signals(info); 2138 get_signals(info);
2139 spin_unlock_irqrestore(&info->lock,flags); 2139 spin_unlock_irqrestore(&info->lock, flags);
2140 2140
2141 result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) + 2141 result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) +
2142 ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) + 2142 ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) +
@@ -2147,7 +2147,7 @@ static int tiocmget(struct tty_struct *tty)
2147 2147
2148 if (debug_level >= DEBUG_LEVEL_INFO) 2148 if (debug_level >= DEBUG_LEVEL_INFO)
2149 printk("%s(%d):%s tiocmget() value=%08X\n", 2149 printk("%s(%d):%s tiocmget() value=%08X\n",
2150 __FILE__,__LINE__, info->device_name, result ); 2150 __FILE__, __LINE__, info->device_name, result);
2151 return result; 2151 return result;
2152} 2152}
2153 2153
@@ -2157,11 +2157,11 @@ static int tiocmset(struct tty_struct *tty,
2157 unsigned int set, unsigned int clear) 2157 unsigned int set, unsigned int clear)
2158{ 2158{
2159 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; 2159 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
2160 unsigned long flags; 2160 unsigned long flags;
2161 2161
2162 if (debug_level >= DEBUG_LEVEL_INFO) 2162 if (debug_level >= DEBUG_LEVEL_INFO)
2163 printk("%s(%d):%s tiocmset(%x,%x)\n", 2163 printk("%s(%d):%s tiocmset(%x,%x)\n",
2164 __FILE__,__LINE__,info->device_name, set, clear); 2164 __FILE__, __LINE__, info->device_name, set, clear);
2165 2165
2166 if (set & TIOCM_RTS) 2166 if (set & TIOCM_RTS)
2167 info->serial_signals |= SerialSignal_RTS; 2167 info->serial_signals |= SerialSignal_RTS;
@@ -2172,9 +2172,9 @@ static int tiocmset(struct tty_struct *tty,
2172 if (clear & TIOCM_DTR) 2172 if (clear & TIOCM_DTR)
2173 info->serial_signals &= ~SerialSignal_DTR; 2173 info->serial_signals &= ~SerialSignal_DTR;
2174 2174
2175 spin_lock_irqsave(&info->lock,flags); 2175 spin_lock_irqsave(&info->lock, flags);
2176 set_signals(info); 2176 set_signals(info);
2177 spin_unlock_irqrestore(&info->lock,flags); 2177 spin_unlock_irqrestore(&info->lock, flags);
2178 2178
2179 return 0; 2179 return 0;
2180} 2180}
@@ -2191,17 +2191,17 @@ static int mgslpc_break(struct tty_struct *tty, int break_state)
2191 2191
2192 if (debug_level >= DEBUG_LEVEL_INFO) 2192 if (debug_level >= DEBUG_LEVEL_INFO)
2193 printk("%s(%d):mgslpc_break(%s,%d)\n", 2193 printk("%s(%d):mgslpc_break(%s,%d)\n",
2194 __FILE__,__LINE__, info->device_name, break_state); 2194 __FILE__, __LINE__, info->device_name, break_state);
2195 2195
2196 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break")) 2196 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break"))
2197 return -EINVAL; 2197 return -EINVAL;
2198 2198
2199 spin_lock_irqsave(&info->lock,flags); 2199 spin_lock_irqsave(&info->lock, flags);
2200 if (break_state == -1) 2200 if (break_state == -1)
2201 set_reg_bits(info, CHA+DAFO, BIT6); 2201 set_reg_bits(info, CHA+DAFO, BIT6);
2202 else 2202 else
2203 clear_reg_bits(info, CHA+DAFO, BIT6); 2203 clear_reg_bits(info, CHA+DAFO, BIT6);
2204 spin_unlock_irqrestore(&info->lock,flags); 2204 spin_unlock_irqrestore(&info->lock, flags);
2205 return 0; 2205 return 0;
2206} 2206}
2207 2207
@@ -2212,9 +2212,9 @@ static int mgslpc_get_icount(struct tty_struct *tty,
2212 struct mgsl_icount cnow; /* kernel counter temps */ 2212 struct mgsl_icount cnow; /* kernel counter temps */
2213 unsigned long flags; 2213 unsigned long flags;
2214 2214
2215 spin_lock_irqsave(&info->lock,flags); 2215 spin_lock_irqsave(&info->lock, flags);
2216 cnow = info->icount; 2216 cnow = info->icount;
2217 spin_unlock_irqrestore(&info->lock,flags); 2217 spin_unlock_irqrestore(&info->lock, flags);
2218 2218
2219 icount->cts = cnow.cts; 2219 icount->cts = cnow.cts;
2220 icount->dsr = cnow.dsr; 2220 icount->dsr = cnow.dsr;
@@ -2235,9 +2235,9 @@ static int mgslpc_get_icount(struct tty_struct *tty,
2235 * 2235 *
2236 * Arguments: 2236 * Arguments:
2237 * 2237 *
2238 * tty pointer to tty instance data 2238 * tty pointer to tty instance data
2239 * cmd IOCTL command code 2239 * cmd IOCTL command code
2240 * arg command argument/context 2240 * arg command argument/context
2241 * 2241 *
2242 * Return Value: 0 if success, otherwise error code 2242 * Return Value: 0 if success, otherwise error code
2243 */ 2243 */
@@ -2248,8 +2248,8 @@ static int mgslpc_ioctl(struct tty_struct *tty,
2248 void __user *argp = (void __user *)arg; 2248 void __user *argp = (void __user *)arg;
2249 2249
2250 if (debug_level >= DEBUG_LEVEL_INFO) 2250 if (debug_level >= DEBUG_LEVEL_INFO)
2251 printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__, 2251 printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__, __LINE__,
2252 info->device_name, cmd ); 2252 info->device_name, cmd);
2253 2253
2254 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl")) 2254 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl"))
2255 return -ENODEV; 2255 return -ENODEV;
@@ -2295,8 +2295,8 @@ static int mgslpc_ioctl(struct tty_struct *tty,
2295 * 2295 *
2296 * Arguments: 2296 * Arguments:
2297 * 2297 *
2298 * tty pointer to tty structure 2298 * tty pointer to tty structure
2299 * termios pointer to buffer to hold returned old termios 2299 * termios pointer to buffer to hold returned old termios
2300 */ 2300 */
2301static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) 2301static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2302{ 2302{
@@ -2304,8 +2304,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2304 unsigned long flags; 2304 unsigned long flags;
2305 2305
2306 if (debug_level >= DEBUG_LEVEL_INFO) 2306 if (debug_level >= DEBUG_LEVEL_INFO)
2307 printk("%s(%d):mgslpc_set_termios %s\n", __FILE__,__LINE__, 2307 printk("%s(%d):mgslpc_set_termios %s\n", __FILE__, __LINE__,
2308 tty->driver->name ); 2308 tty->driver->name);
2309 2309
2310 /* just return if nothing has changed */ 2310 /* just return if nothing has changed */
2311 if ((tty->termios.c_cflag == old_termios->c_cflag) 2311 if ((tty->termios.c_cflag == old_termios->c_cflag)
@@ -2319,22 +2319,22 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2319 if (old_termios->c_cflag & CBAUD && 2319 if (old_termios->c_cflag & CBAUD &&
2320 !(tty->termios.c_cflag & CBAUD)) { 2320 !(tty->termios.c_cflag & CBAUD)) {
2321 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 2321 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
2322 spin_lock_irqsave(&info->lock,flags); 2322 spin_lock_irqsave(&info->lock, flags);
2323 set_signals(info); 2323 set_signals(info);
2324 spin_unlock_irqrestore(&info->lock,flags); 2324 spin_unlock_irqrestore(&info->lock, flags);
2325 } 2325 }
2326 2326
2327 /* Handle transition away from B0 status */ 2327 /* Handle transition away from B0 status */
2328 if (!(old_termios->c_cflag & CBAUD) && 2328 if (!(old_termios->c_cflag & CBAUD) &&
2329 tty->termios.c_cflag & CBAUD) { 2329 tty->termios.c_cflag & CBAUD) {
2330 info->serial_signals |= SerialSignal_DTR; 2330 info->serial_signals |= SerialSignal_DTR;
2331 if (!(tty->termios.c_cflag & CRTSCTS) || 2331 if (!(tty->termios.c_cflag & CRTSCTS) ||
2332 !test_bit(TTY_THROTTLED, &tty->flags)) { 2332 !test_bit(TTY_THROTTLED, &tty->flags)) {
2333 info->serial_signals |= SerialSignal_RTS; 2333 info->serial_signals |= SerialSignal_RTS;
2334 } 2334 }
2335 spin_lock_irqsave(&info->lock,flags); 2335 spin_lock_irqsave(&info->lock, flags);
2336 set_signals(info); 2336 set_signals(info);
2337 spin_unlock_irqrestore(&info->lock,flags); 2337 spin_unlock_irqrestore(&info->lock, flags);
2338 } 2338 }
2339 2339
2340 /* Handle turning off CRTSCTS */ 2340 /* Handle turning off CRTSCTS */
@@ -2355,15 +2355,15 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
2355 2355
2356 if (debug_level >= DEBUG_LEVEL_INFO) 2356 if (debug_level >= DEBUG_LEVEL_INFO)
2357 printk("%s(%d):mgslpc_close(%s) entry, count=%d\n", 2357 printk("%s(%d):mgslpc_close(%s) entry, count=%d\n",
2358 __FILE__,__LINE__, info->device_name, port->count); 2358 __FILE__, __LINE__, info->device_name, port->count);
2359 2359
2360 WARN_ON(!port->count); 2360 WARN_ON(!port->count);
2361 2361
2362 if (tty_port_close_start(port, tty, filp) == 0) 2362 if (tty_port_close_start(port, tty, filp) == 0)
2363 goto cleanup; 2363 goto cleanup;
2364 2364
2365 if (port->flags & ASYNC_INITIALIZED) 2365 if (port->flags & ASYNC_INITIALIZED)
2366 mgslpc_wait_until_sent(tty, info->timeout); 2366 mgslpc_wait_until_sent(tty, info->timeout);
2367 2367
2368 mgslpc_flush_buffer(tty); 2368 mgslpc_flush_buffer(tty);
2369 2369
@@ -2374,7 +2374,7 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
2374 tty_port_tty_set(port, NULL); 2374 tty_port_tty_set(port, NULL);
2375cleanup: 2375cleanup:
2376 if (debug_level >= DEBUG_LEVEL_INFO) 2376 if (debug_level >= DEBUG_LEVEL_INFO)
2377 printk("%s(%d):mgslpc_close(%s) exit, count=%d\n", __FILE__,__LINE__, 2377 printk("%s(%d):mgslpc_close(%s) exit, count=%d\n", __FILE__, __LINE__,
2378 tty->driver->name, port->count); 2378 tty->driver->name, port->count);
2379} 2379}
2380 2380
@@ -2385,12 +2385,12 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
2385 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; 2385 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
2386 unsigned long orig_jiffies, char_time; 2386 unsigned long orig_jiffies, char_time;
2387 2387
2388 if (!info ) 2388 if (!info)
2389 return; 2389 return;
2390 2390
2391 if (debug_level >= DEBUG_LEVEL_INFO) 2391 if (debug_level >= DEBUG_LEVEL_INFO)
2392 printk("%s(%d):mgslpc_wait_until_sent(%s) entry\n", 2392 printk("%s(%d):mgslpc_wait_until_sent(%s) entry\n",
2393 __FILE__,__LINE__, info->device_name ); 2393 __FILE__, __LINE__, info->device_name);
2394 2394
2395 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent")) 2395 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent"))
2396 return; 2396 return;
@@ -2406,8 +2406,8 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
2406 * Note: use tight timings here to satisfy the NIST-PCTS. 2406 * Note: use tight timings here to satisfy the NIST-PCTS.
2407 */ 2407 */
2408 2408
2409 if ( info->params.data_rate ) { 2409 if (info->params.data_rate) {
2410 char_time = info->timeout/(32 * 5); 2410 char_time = info->timeout/(32 * 5);
2411 if (!char_time) 2411 if (!char_time)
2412 char_time++; 2412 char_time++;
2413 } else 2413 } else
@@ -2438,7 +2438,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
2438exit: 2438exit:
2439 if (debug_level >= DEBUG_LEVEL_INFO) 2439 if (debug_level >= DEBUG_LEVEL_INFO)
2440 printk("%s(%d):mgslpc_wait_until_sent(%s) exit\n", 2440 printk("%s(%d):mgslpc_wait_until_sent(%s) exit\n",
2441 __FILE__,__LINE__, info->device_name ); 2441 __FILE__, __LINE__, info->device_name);
2442} 2442}
2443 2443
2444/* Called by tty_hangup() when a hangup is signaled. 2444/* Called by tty_hangup() when a hangup is signaled.
@@ -2450,7 +2450,7 @@ static void mgslpc_hangup(struct tty_struct *tty)
2450 2450
2451 if (debug_level >= DEBUG_LEVEL_INFO) 2451 if (debug_level >= DEBUG_LEVEL_INFO)
2452 printk("%s(%d):mgslpc_hangup(%s)\n", 2452 printk("%s(%d):mgslpc_hangup(%s)\n",
2453 __FILE__,__LINE__, info->device_name ); 2453 __FILE__, __LINE__, info->device_name);
2454 2454
2455 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup")) 2455 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup"))
2456 return; 2456 return;
@@ -2465,9 +2465,9 @@ static int carrier_raised(struct tty_port *port)
2465 MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); 2465 MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
2466 unsigned long flags; 2466 unsigned long flags;
2467 2467
2468 spin_lock_irqsave(&info->lock,flags); 2468 spin_lock_irqsave(&info->lock, flags);
2469 get_signals(info); 2469 get_signals(info);
2470 spin_unlock_irqrestore(&info->lock,flags); 2470 spin_unlock_irqrestore(&info->lock, flags);
2471 2471
2472 if (info->serial_signals & SerialSignal_DCD) 2472 if (info->serial_signals & SerialSignal_DCD)
2473 return 1; 2473 return 1;
@@ -2479,13 +2479,13 @@ static void dtr_rts(struct tty_port *port, int onoff)
2479 MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); 2479 MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
2480 unsigned long flags; 2480 unsigned long flags;
2481 2481
2482 spin_lock_irqsave(&info->lock,flags); 2482 spin_lock_irqsave(&info->lock, flags);
2483 if (onoff) 2483 if (onoff)
2484 info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; 2484 info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
2485 else 2485 else
2486 info->serial_signals &= ~SerialSignal_RTS + SerialSignal_DTR; 2486 info->serial_signals &= ~SerialSignal_RTS + SerialSignal_DTR;
2487 set_signals(info); 2487 set_signals(info);
2488 spin_unlock_irqrestore(&info->lock,flags); 2488 spin_unlock_irqrestore(&info->lock, flags);
2489} 2489}
2490 2490
2491 2491
@@ -2493,14 +2493,14 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
2493{ 2493{
2494 MGSLPC_INFO *info; 2494 MGSLPC_INFO *info;
2495 struct tty_port *port; 2495 struct tty_port *port;
2496 int retval, line; 2496 int retval, line;
2497 unsigned long flags; 2497 unsigned long flags;
2498 2498
2499 /* verify range of specified line number */ 2499 /* verify range of specified line number */
2500 line = tty->index; 2500 line = tty->index;
2501 if (line >= mgslpc_device_count) { 2501 if (line >= mgslpc_device_count) {
2502 printk("%s(%d):mgslpc_open with invalid line #%d.\n", 2502 printk("%s(%d):mgslpc_open with invalid line #%d.\n",
2503 __FILE__,__LINE__,line); 2503 __FILE__, __LINE__, line);
2504 return -ENODEV; 2504 return -ENODEV;
2505 } 2505 }
2506 2506
@@ -2517,7 +2517,7 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
2517 2517
2518 if (debug_level >= DEBUG_LEVEL_INFO) 2518 if (debug_level >= DEBUG_LEVEL_INFO)
2519 printk("%s(%d):mgslpc_open(%s), old ref count = %d\n", 2519 printk("%s(%d):mgslpc_open(%s), old ref count = %d\n",
2520 __FILE__,__LINE__,tty->driver->name, port->count); 2520 __FILE__, __LINE__, tty->driver->name, port->count);
2521 2521
2522 /* If port is closing, signal caller to try again */ 2522 /* If port is closing, signal caller to try again */
2523 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING){ 2523 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING){
@@ -2552,13 +2552,13 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
2552 if (retval) { 2552 if (retval) {
2553 if (debug_level >= DEBUG_LEVEL_INFO) 2553 if (debug_level >= DEBUG_LEVEL_INFO)
2554 printk("%s(%d):block_til_ready(%s) returned %d\n", 2554 printk("%s(%d):block_til_ready(%s) returned %d\n",
2555 __FILE__,__LINE__, info->device_name, retval); 2555 __FILE__, __LINE__, info->device_name, retval);
2556 goto cleanup; 2556 goto cleanup;
2557 } 2557 }
2558 2558
2559 if (debug_level >= DEBUG_LEVEL_INFO) 2559 if (debug_level >= DEBUG_LEVEL_INFO)
2560 printk("%s(%d):mgslpc_open(%s) success\n", 2560 printk("%s(%d):mgslpc_open(%s) success\n",
2561 __FILE__,__LINE__, info->device_name); 2561 __FILE__, __LINE__, info->device_name);
2562 retval = 0; 2562 retval = 0;
2563 2563
2564cleanup: 2564cleanup:
@@ -2578,9 +2578,9 @@ static inline void line_info(struct seq_file *m, MGSLPC_INFO *info)
2578 info->device_name, info->io_base, info->irq_level); 2578 info->device_name, info->io_base, info->irq_level);
2579 2579
2580 /* output current serial signal states */ 2580 /* output current serial signal states */
2581 spin_lock_irqsave(&info->lock,flags); 2581 spin_lock_irqsave(&info->lock, flags);
2582 get_signals(info); 2582 get_signals(info);
2583 spin_unlock_irqrestore(&info->lock,flags); 2583 spin_unlock_irqrestore(&info->lock, flags);
2584 2584
2585 stat_buf[0] = 0; 2585 stat_buf[0] = 0;
2586 stat_buf[1] = 0; 2586 stat_buf[1] = 0;
@@ -2642,7 +2642,7 @@ static int mgslpc_proc_show(struct seq_file *m, void *v)
2642 seq_printf(m, "synclink driver:%s\n", driver_version); 2642 seq_printf(m, "synclink driver:%s\n", driver_version);
2643 2643
2644 info = mgslpc_device_list; 2644 info = mgslpc_device_list;
2645 while( info ) { 2645 while (info) {
2646 line_info(m, info); 2646 line_info(m, info);
2647 info = info->next_device; 2647 info = info->next_device;
2648 } 2648 }
@@ -2693,8 +2693,8 @@ static void rx_free_buffers(MGSLPC_INFO *info)
2693 2693
2694static int claim_resources(MGSLPC_INFO *info) 2694static int claim_resources(MGSLPC_INFO *info)
2695{ 2695{
2696 if (rx_alloc_buffers(info) < 0 ) { 2696 if (rx_alloc_buffers(info) < 0) {
2697 printk( "Can't allocate rx buffer %s\n", info->device_name); 2697 printk("Can't allocate rx buffer %s\n", info->device_name);
2698 release_resources(info); 2698 release_resources(info);
2699 return -ENODEV; 2699 return -ENODEV;
2700 } 2700 }
@@ -2734,7 +2734,7 @@ static int mgslpc_add_device(MGSLPC_INFO *info)
2734 mgslpc_device_list = info; 2734 mgslpc_device_list = info;
2735 else { 2735 else {
2736 current_dev = mgslpc_device_list; 2736 current_dev = mgslpc_device_list;
2737 while( current_dev->next_device ) 2737 while (current_dev->next_device)
2738 current_dev = current_dev->next_device; 2738 current_dev = current_dev->next_device;
2739 current_dev->next_device = info; 2739 current_dev->next_device = info;
2740 } 2740 }
@@ -2744,7 +2744,7 @@ static int mgslpc_add_device(MGSLPC_INFO *info)
2744 else if (info->max_frame_size > 65535) 2744 else if (info->max_frame_size > 65535)
2745 info->max_frame_size = 65535; 2745 info->max_frame_size = 65535;
2746 2746
2747 printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n", 2747 printk("SyncLink PC Card %s:IO=%04X IRQ=%d\n",
2748 info->device_name, info->io_base, info->irq_level); 2748 info->device_name, info->io_base, info->irq_level);
2749 2749
2750#if SYNCLINK_GENERIC_HDLC 2750#if SYNCLINK_GENERIC_HDLC
@@ -3293,7 +3293,7 @@ static void rx_stop(MGSLPC_INFO *info)
3293{ 3293{
3294 if (debug_level >= DEBUG_LEVEL_ISR) 3294 if (debug_level >= DEBUG_LEVEL_ISR)
3295 printk("%s(%d):rx_stop(%s)\n", 3295 printk("%s(%d):rx_stop(%s)\n",
3296 __FILE__,__LINE__, info->device_name ); 3296 __FILE__, __LINE__, info->device_name);
3297 3297
3298 /* MODE:03 RAC Receiver Active, 0=inactive */ 3298 /* MODE:03 RAC Receiver Active, 0=inactive */
3299 clear_reg_bits(info, CHA + MODE, BIT3); 3299 clear_reg_bits(info, CHA + MODE, BIT3);
@@ -3306,7 +3306,7 @@ static void rx_start(MGSLPC_INFO *info)
3306{ 3306{
3307 if (debug_level >= DEBUG_LEVEL_ISR) 3307 if (debug_level >= DEBUG_LEVEL_ISR)
3308 printk("%s(%d):rx_start(%s)\n", 3308 printk("%s(%d):rx_start(%s)\n",
3309 __FILE__,__LINE__, info->device_name ); 3309 __FILE__, __LINE__, info->device_name);
3310 3310
3311 rx_reset_buffers(info); 3311 rx_reset_buffers(info);
3312 info->rx_enabled = false; 3312 info->rx_enabled = false;
@@ -3322,7 +3322,7 @@ static void tx_start(MGSLPC_INFO *info, struct tty_struct *tty)
3322{ 3322{
3323 if (debug_level >= DEBUG_LEVEL_ISR) 3323 if (debug_level >= DEBUG_LEVEL_ISR)
3324 printk("%s(%d):tx_start(%s)\n", 3324 printk("%s(%d):tx_start(%s)\n",
3325 __FILE__,__LINE__, info->device_name ); 3325 __FILE__, __LINE__, info->device_name);
3326 3326
3327 if (info->tx_count) { 3327 if (info->tx_count) {
3328 /* If auto RTS enabled and RTS is inactive, then assert */ 3328 /* If auto RTS enabled and RTS is inactive, then assert */
@@ -3360,7 +3360,7 @@ static void tx_stop(MGSLPC_INFO *info)
3360{ 3360{
3361 if (debug_level >= DEBUG_LEVEL_ISR) 3361 if (debug_level >= DEBUG_LEVEL_ISR)
3362 printk("%s(%d):tx_stop(%s)\n", 3362 printk("%s(%d):tx_stop(%s)\n",
3363 __FILE__,__LINE__, info->device_name ); 3363 __FILE__, __LINE__, info->device_name);
3364 3364
3365 del_timer(&info->tx_timer); 3365 del_timer(&info->tx_timer);
3366 3366
@@ -3712,7 +3712,7 @@ static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty)
3712 3712
3713 if (debug_level >= DEBUG_LEVEL_BH) 3713 if (debug_level >= DEBUG_LEVEL_BH)
3714 printk("%s(%d):rx_get_frame(%s) status=%04X size=%d\n", 3714 printk("%s(%d):rx_get_frame(%s) status=%04X size=%d\n",
3715 __FILE__,__LINE__,info->device_name,status,framesize); 3715 __FILE__, __LINE__, info->device_name, status, framesize);
3716 3716
3717 if (debug_level >= DEBUG_LEVEL_DATA) 3717 if (debug_level >= DEBUG_LEVEL_DATA)
3718 trace_block(info, buf->data, framesize, 0); 3718 trace_block(info, buf->data, framesize, 0);
@@ -3740,13 +3740,13 @@ static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty)
3740 } 3740 }
3741 } 3741 }
3742 3742
3743 spin_lock_irqsave(&info->lock,flags); 3743 spin_lock_irqsave(&info->lock, flags);
3744 buf->status = buf->count = 0; 3744 buf->status = buf->count = 0;
3745 info->rx_frame_count--; 3745 info->rx_frame_count--;
3746 info->rx_get++; 3746 info->rx_get++;
3747 if (info->rx_get >= info->rx_buf_count) 3747 if (info->rx_get >= info->rx_buf_count)
3748 info->rx_get = 0; 3748 info->rx_get = 0;
3749 spin_unlock_irqrestore(&info->lock,flags); 3749 spin_unlock_irqrestore(&info->lock, flags);
3750 3750
3751 return true; 3751 return true;
3752} 3752}
@@ -3760,7 +3760,7 @@ static bool register_test(MGSLPC_INFO *info)
3760 bool rc = true; 3760 bool rc = true;
3761 unsigned long flags; 3761 unsigned long flags;
3762 3762
3763 spin_lock_irqsave(&info->lock,flags); 3763 spin_lock_irqsave(&info->lock, flags);
3764 reset_device(info); 3764 reset_device(info);
3765 3765
3766 for (i = 0; i < count; i++) { 3766 for (i = 0; i < count; i++) {
@@ -3773,7 +3773,7 @@ static bool register_test(MGSLPC_INFO *info)
3773 } 3773 }
3774 } 3774 }
3775 3775
3776 spin_unlock_irqrestore(&info->lock,flags); 3776 spin_unlock_irqrestore(&info->lock, flags);
3777 return rc; 3777 return rc;
3778} 3778}
3779 3779
@@ -3782,7 +3782,7 @@ static bool irq_test(MGSLPC_INFO *info)
3782 unsigned long end_time; 3782 unsigned long end_time;
3783 unsigned long flags; 3783 unsigned long flags;
3784 3784
3785 spin_lock_irqsave(&info->lock,flags); 3785 spin_lock_irqsave(&info->lock, flags);
3786 reset_device(info); 3786 reset_device(info);
3787 3787
3788 info->testing_irq = true; 3788 info->testing_irq = true;
@@ -3796,7 +3796,7 @@ static bool irq_test(MGSLPC_INFO *info)
3796 write_reg(info, CHA + TIMR, 0); /* 512 cycles */ 3796 write_reg(info, CHA + TIMR, 0); /* 512 cycles */
3797 issue_command(info, CHA, CMD_START_TIMER); 3797 issue_command(info, CHA, CMD_START_TIMER);
3798 3798
3799 spin_unlock_irqrestore(&info->lock,flags); 3799 spin_unlock_irqrestore(&info->lock, flags);
3800 3800
3801 end_time=100; 3801 end_time=100;
3802 while(end_time-- && !info->irq_occurred) { 3802 while(end_time-- && !info->irq_occurred) {
@@ -3805,9 +3805,9 @@ static bool irq_test(MGSLPC_INFO *info)
3805 3805
3806 info->testing_irq = false; 3806 info->testing_irq = false;
3807 3807
3808 spin_lock_irqsave(&info->lock,flags); 3808 spin_lock_irqsave(&info->lock, flags);
3809 reset_device(info); 3809 reset_device(info);
3810 spin_unlock_irqrestore(&info->lock,flags); 3810 spin_unlock_irqrestore(&info->lock, flags);
3811 3811
3812 return info->irq_occurred; 3812 return info->irq_occurred;
3813} 3813}
@@ -3816,21 +3816,21 @@ static int adapter_test(MGSLPC_INFO *info)
3816{ 3816{
3817 if (!register_test(info)) { 3817 if (!register_test(info)) {
3818 info->init_error = DiagStatus_AddressFailure; 3818 info->init_error = DiagStatus_AddressFailure;
3819 printk( "%s(%d):Register test failure for device %s Addr=%04X\n", 3819 printk("%s(%d):Register test failure for device %s Addr=%04X\n",
3820 __FILE__,__LINE__,info->device_name, (unsigned short)(info->io_base) ); 3820 __FILE__, __LINE__, info->device_name, (unsigned short)(info->io_base));
3821 return -ENODEV; 3821 return -ENODEV;
3822 } 3822 }
3823 3823
3824 if (!irq_test(info)) { 3824 if (!irq_test(info)) {
3825 info->init_error = DiagStatus_IrqFailure; 3825 info->init_error = DiagStatus_IrqFailure;
3826 printk( "%s(%d):Interrupt test failure for device %s IRQ=%d\n", 3826 printk("%s(%d):Interrupt test failure for device %s IRQ=%d\n",
3827 __FILE__,__LINE__,info->device_name, (unsigned short)(info->irq_level) ); 3827 __FILE__, __LINE__, info->device_name, (unsigned short)(info->irq_level));
3828 return -ENODEV; 3828 return -ENODEV;
3829 } 3829 }
3830 3830
3831 if (debug_level >= DEBUG_LEVEL_INFO) 3831 if (debug_level >= DEBUG_LEVEL_INFO)
3832 printk("%s(%d):device %s passed diagnostics\n", 3832 printk("%s(%d):device %s passed diagnostics\n",
3833 __FILE__,__LINE__,info->device_name); 3833 __FILE__, __LINE__, info->device_name);
3834 return 0; 3834 return 0;
3835} 3835}
3836 3836
@@ -3839,9 +3839,9 @@ static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit)
3839 int i; 3839 int i;
3840 int linecount; 3840 int linecount;
3841 if (xmit) 3841 if (xmit)
3842 printk("%s tx data:\n",info->device_name); 3842 printk("%s tx data:\n", info->device_name);
3843 else 3843 else
3844 printk("%s rx data:\n",info->device_name); 3844 printk("%s rx data:\n", info->device_name);
3845 3845
3846 while(count) { 3846 while(count) {
3847 if (count > 16) 3847 if (count > 16)
@@ -3850,12 +3850,12 @@ static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit)
3850 linecount = count; 3850 linecount = count;
3851 3851
3852 for(i=0;i<linecount;i++) 3852 for(i=0;i<linecount;i++)
3853 printk("%02X ",(unsigned char)data[i]); 3853 printk("%02X ", (unsigned char)data[i]);
3854 for(;i<17;i++) 3854 for(;i<17;i++)
3855 printk(" "); 3855 printk(" ");
3856 for(i=0;i<linecount;i++) { 3856 for(i=0;i<linecount;i++) {
3857 if (data[i]>=040 && data[i]<=0176) 3857 if (data[i]>=040 && data[i]<=0176)
3858 printk("%c",data[i]); 3858 printk("%c", data[i]);
3859 else 3859 else
3860 printk("."); 3860 printk(".");
3861 } 3861 }
@@ -3874,18 +3874,18 @@ static void tx_timeout(unsigned long context)
3874 MGSLPC_INFO *info = (MGSLPC_INFO*)context; 3874 MGSLPC_INFO *info = (MGSLPC_INFO*)context;
3875 unsigned long flags; 3875 unsigned long flags;
3876 3876
3877 if ( debug_level >= DEBUG_LEVEL_INFO ) 3877 if (debug_level >= DEBUG_LEVEL_INFO)
3878 printk( "%s(%d):tx_timeout(%s)\n", 3878 printk("%s(%d):tx_timeout(%s)\n",
3879 __FILE__,__LINE__,info->device_name); 3879 __FILE__, __LINE__, info->device_name);
3880 if(info->tx_active && 3880 if (info->tx_active &&
3881 info->params.mode == MGSL_MODE_HDLC) { 3881 info->params.mode == MGSL_MODE_HDLC) {
3882 info->icount.txtimeout++; 3882 info->icount.txtimeout++;
3883 } 3883 }
3884 spin_lock_irqsave(&info->lock,flags); 3884 spin_lock_irqsave(&info->lock, flags);
3885 info->tx_active = false; 3885 info->tx_active = false;
3886 info->tx_count = info->tx_put = info->tx_get = 0; 3886 info->tx_count = info->tx_put = info->tx_get = 0;
3887 3887
3888 spin_unlock_irqrestore(&info->lock,flags); 3888 spin_unlock_irqrestore(&info->lock, flags);
3889 3889
3890#if SYNCLINK_GENERIC_HDLC 3890#if SYNCLINK_GENERIC_HDLC
3891 if (info->netcount) 3891 if (info->netcount)
@@ -3967,7 +3967,7 @@ static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
3967 unsigned long flags; 3967 unsigned long flags;
3968 3968
3969 if (debug_level >= DEBUG_LEVEL_INFO) 3969 if (debug_level >= DEBUG_LEVEL_INFO)
3970 printk(KERN_INFO "%s:hdlc_xmit(%s)\n",__FILE__,dev->name); 3970 printk(KERN_INFO "%s:hdlc_xmit(%s)\n", __FILE__, dev->name);
3971 3971
3972 /* stop sending until this frame completes */ 3972 /* stop sending until this frame completes */
3973 netif_stop_queue(dev); 3973 netif_stop_queue(dev);
@@ -3988,13 +3988,13 @@ static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
3988 dev->trans_start = jiffies; 3988 dev->trans_start = jiffies;
3989 3989
3990 /* start hardware transmitter if necessary */ 3990 /* start hardware transmitter if necessary */
3991 spin_lock_irqsave(&info->lock,flags); 3991 spin_lock_irqsave(&info->lock, flags);
3992 if (!info->tx_active) { 3992 if (!info->tx_active) {
3993 struct tty_struct *tty = tty_port_tty_get(&info->port); 3993 struct tty_struct *tty = tty_port_tty_get(&info->port);
3994 tx_start(info, tty); 3994 tx_start(info, tty);
3995 tty_kref_put(tty); 3995 tty_kref_put(tty);
3996 } 3996 }
3997 spin_unlock_irqrestore(&info->lock,flags); 3997 spin_unlock_irqrestore(&info->lock, flags);
3998 3998
3999 return NETDEV_TX_OK; 3999 return NETDEV_TX_OK;
4000} 4000}
@@ -4015,10 +4015,11 @@ static int hdlcdev_open(struct net_device *dev)
4015 unsigned long flags; 4015 unsigned long flags;
4016 4016
4017 if (debug_level >= DEBUG_LEVEL_INFO) 4017 if (debug_level >= DEBUG_LEVEL_INFO)
4018 printk("%s:hdlcdev_open(%s)\n",__FILE__,dev->name); 4018 printk("%s:hdlcdev_open(%s)\n", __FILE__, dev->name);
4019 4019
4020 /* generic HDLC layer open processing */ 4020 /* generic HDLC layer open processing */
4021 if ((rc = hdlc_open(dev))) 4021 rc = hdlc_open(dev);
4022 if (rc != 0)
4022 return rc; 4023 return rc;
4023 4024
4024 /* arbitrate between network and tty opens */ 4025 /* arbitrate between network and tty opens */
@@ -4033,7 +4034,8 @@ static int hdlcdev_open(struct net_device *dev)
4033 4034
4034 tty = tty_port_tty_get(&info->port); 4035 tty = tty_port_tty_get(&info->port);
4035 /* claim resources and init adapter */ 4036 /* claim resources and init adapter */
4036 if ((rc = startup(info, tty)) != 0) { 4037 rc = startup(info, tty);
4038 if (rc != 0) {
4037 tty_kref_put(tty); 4039 tty_kref_put(tty);
4038 spin_lock_irqsave(&info->netlock, flags); 4040 spin_lock_irqsave(&info->netlock, flags);
4039 info->netcount=0; 4041 info->netcount=0;
@@ -4075,7 +4077,7 @@ static int hdlcdev_close(struct net_device *dev)
4075 unsigned long flags; 4077 unsigned long flags;
4076 4078
4077 if (debug_level >= DEBUG_LEVEL_INFO) 4079 if (debug_level >= DEBUG_LEVEL_INFO)
4078 printk("%s:hdlcdev_close(%s)\n",__FILE__,dev->name); 4080 printk("%s:hdlcdev_close(%s)\n", __FILE__, dev->name);
4079 4081
4080 netif_stop_queue(dev); 4082 netif_stop_queue(dev);
4081 4083
@@ -4109,7 +4111,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4109 unsigned int flags; 4111 unsigned int flags;
4110 4112
4111 if (debug_level >= DEBUG_LEVEL_INFO) 4113 if (debug_level >= DEBUG_LEVEL_INFO)
4112 printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); 4114 printk("%s:hdlcdev_ioctl(%s)\n", __FILE__, dev->name);
4113 4115
4114 /* return error if TTY interface open */ 4116 /* return error if TTY interface open */
4115 if (info->port.count) 4117 if (info->port.count)
@@ -4210,14 +4212,14 @@ static void hdlcdev_tx_timeout(struct net_device *dev)
4210 unsigned long flags; 4212 unsigned long flags;
4211 4213
4212 if (debug_level >= DEBUG_LEVEL_INFO) 4214 if (debug_level >= DEBUG_LEVEL_INFO)
4213 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 4215 printk("hdlcdev_tx_timeout(%s)\n", dev->name);
4214 4216
4215 dev->stats.tx_errors++; 4217 dev->stats.tx_errors++;
4216 dev->stats.tx_aborted_errors++; 4218 dev->stats.tx_aborted_errors++;
4217 4219
4218 spin_lock_irqsave(&info->lock,flags); 4220 spin_lock_irqsave(&info->lock, flags);
4219 tx_stop(info); 4221 tx_stop(info);
4220 spin_unlock_irqrestore(&info->lock,flags); 4222 spin_unlock_irqrestore(&info->lock, flags);
4221 4223
4222 netif_wake_queue(dev); 4224 netif_wake_queue(dev);
4223} 4225}
@@ -4248,7 +4250,7 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
4248 struct net_device *dev = info->netdev; 4250 struct net_device *dev = info->netdev;
4249 4251
4250 if (debug_level >= DEBUG_LEVEL_INFO) 4252 if (debug_level >= DEBUG_LEVEL_INFO)
4251 printk("hdlcdev_rx(%s)\n",dev->name); 4253 printk("hdlcdev_rx(%s)\n", dev->name);
4252 4254
4253 if (skb == NULL) { 4255 if (skb == NULL) {
4254 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 4256 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name);
@@ -4291,8 +4293,9 @@ static int hdlcdev_init(MGSLPC_INFO *info)
4291 4293
4292 /* allocate and initialize network and HDLC layer objects */ 4294 /* allocate and initialize network and HDLC layer objects */
4293 4295
4294 if (!(dev = alloc_hdlcdev(info))) { 4296 dev = alloc_hdlcdev(info);
4295 printk(KERN_ERR "%s:hdlc device allocation failure\n",__FILE__); 4297 if (dev == NULL) {
4298 printk(KERN_ERR "%s:hdlc device allocation failure\n", __FILE__);
4296 return -ENOMEM; 4299 return -ENOMEM;
4297 } 4300 }
4298 4301
@@ -4311,8 +4314,9 @@ static int hdlcdev_init(MGSLPC_INFO *info)
4311 hdlc->xmit = hdlcdev_xmit; 4314 hdlc->xmit = hdlcdev_xmit;
4312 4315
4313 /* register objects with HDLC layer */ 4316 /* register objects with HDLC layer */
4314 if ((rc = register_hdlc_device(dev))) { 4317 rc = register_hdlc_device(dev);
4315 printk(KERN_WARNING "%s:unable to register hdlc device\n",__FILE__); 4318 if (rc) {
4319 printk(KERN_WARNING "%s:unable to register hdlc device\n", __FILE__);
4316 free_netdev(dev); 4320 free_netdev(dev);
4317 return rc; 4321 return rc;
4318 } 4322 }