diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 16:57:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 16:57:13 -0500 |
commit | 7ed214ac2095f561a94335ca672b6c42a1ea40ff (patch) | |
tree | da41901bff1d0d8d61170bf362384fdc61deb3ab /drivers/char | |
parent | 21eaab6d19ed43e82ed39c8deb7f192134fb4a0e (diff) | |
parent | 29e5507ae4ab34397f538f06b7070c81a4e4a2bf (diff) |
Merge tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver patches from Greg Kroah-Hartman:
"Here's the big char/misc driver patches for 3.9-rc1.
Nothing major here, just lots of different driver updates (mei,
hyperv, ipack, extcon, vmci, etc.).
All of these have been in the linux-next tree for a while."
* tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (209 commits)
w1: w1_therm: Add force-pullup option for "broken" sensors
w1: ds2482: Added 1-Wire pull-up support to the driver
vme: add missing put_device() after device_register() fails
extcon: max8997: Use workqueue to check cable state after completing boot of platform
extcon: max8997: Set default UART/USB path on probe
extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type
extcon: max8997: Set default of ADC debounce time during initialization
extcon: max8997: Remove duplicate code related to set H/W line path
extcon: max8997: Move defined constant to header file
extcon: max77693: Make max77693_extcon_cable static
extcon: max8997: Remove unreachable code
extcon: max8997: Make max8997_extcon_cable static
extcon: max77693: Remove unnecessary goto statement to improve readability
extcon: max77693: Convert to devm_input_allocate_device()
extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style
CREDITS: update email and address of Harald Hoyer
extcon: arizona: Use MICDET for final microphone identification
extcon: arizona: Always take the first HPDET reading as the final one
extcon: arizona: Clear _trig_sts bits after jack detection
extcon: arizona: Don't HPDET magic when headphones are enabled
...
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/exynos-rng.c | 2 | ||||
-rw-r--r-- | drivers/char/mem.c | 10 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 645 |
3 files changed, 346 insertions, 311 deletions
diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c index 4673fc4ad931..ac47631ab34f 100644 --- a/drivers/char/hw_random/exynos-rng.c +++ b/drivers/char/hw_random/exynos-rng.c | |||
@@ -163,7 +163,7 @@ static int exynos_rng_runtime_resume(struct device *dev) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | UNIVERSAL_DEV_PM_OPS(exynos_rng_pm_ops, exynos_rng_runtime_suspend, | 166 | static UNIVERSAL_DEV_PM_OPS(exynos_rng_pm_ops, exynos_rng_runtime_suspend, |
167 | exynos_rng_runtime_resume, NULL); | 167 | exynos_rng_runtime_resume, NULL); |
168 | 168 | ||
169 | static struct platform_driver exynos_rng_driver = { | 169 | static struct platform_driver exynos_rng_driver = { |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index c6fa3bc2baa8..6f6e92a3102d 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -399,7 +399,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf, | |||
399 | { | 399 | { |
400 | unsigned long p = *ppos; | 400 | unsigned long p = *ppos; |
401 | ssize_t low_count, read, sz; | 401 | ssize_t low_count, read, sz; |
402 | char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */ | 402 | char *kbuf; /* k-addr because vread() takes vmlist_lock rwlock */ |
403 | int err = 0; | 403 | int err = 0; |
404 | 404 | ||
405 | read = 0; | 405 | read = 0; |
@@ -527,7 +527,7 @@ static ssize_t write_kmem(struct file *file, const char __user *buf, | |||
527 | unsigned long p = *ppos; | 527 | unsigned long p = *ppos; |
528 | ssize_t wrote = 0; | 528 | ssize_t wrote = 0; |
529 | ssize_t virtr = 0; | 529 | ssize_t virtr = 0; |
530 | char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */ | 530 | char *kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */ |
531 | int err = 0; | 531 | int err = 0; |
532 | 532 | ||
533 | if (p < (unsigned long) high_memory) { | 533 | if (p < (unsigned long) high_memory) { |
@@ -595,7 +595,7 @@ static ssize_t write_port(struct file *file, const char __user *buf, | |||
595 | size_t count, loff_t *ppos) | 595 | size_t count, loff_t *ppos) |
596 | { | 596 | { |
597 | unsigned long i = *ppos; | 597 | unsigned long i = *ppos; |
598 | const char __user * tmp = buf; | 598 | const char __user *tmp = buf; |
599 | 599 | ||
600 | if (!access_ok(VERIFY_READ, buf, count)) | 600 | if (!access_ok(VERIFY_READ, buf, count)) |
601 | return -EFAULT; | 601 | return -EFAULT; |
@@ -729,7 +729,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) | |||
729 | return ret; | 729 | return ret; |
730 | } | 730 | } |
731 | 731 | ||
732 | static int open_port(struct inode * inode, struct file * filp) | 732 | static int open_port(struct inode *inode, struct file *filp) |
733 | { | 733 | { |
734 | return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; | 734 | return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; |
735 | } | 735 | } |
@@ -898,7 +898,7 @@ static int __init chr_dev_init(void) | |||
898 | continue; | 898 | continue; |
899 | 899 | ||
900 | /* | 900 | /* |
901 | * Create /dev/port? | 901 | * Create /dev/port? |
902 | */ | 902 | */ |
903 | if ((minor == DEVPORT_MINOR) && !arch_has_dev_port()) | 903 | if ((minor == DEVPORT_MINOR) && !arch_has_dev_port()) |
904 | continue; | 904 | continue; |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index d0c9852ab875..5c5cc00ebb07 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 | ||
105 | typedef struct | 105 | typedef 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 | ||
364 | static void rx_start(MGSLPC_INFO *info); | 363 | static void rx_start(MGSLPC_INFO *info); |
365 | static void rx_stop(MGSLPC_INFO *info); | 364 | static void rx_stop(MGSLPC_INFO *info); |
@@ -397,7 +396,7 @@ static int adapter_test(MGSLPC_INFO *info); | |||
397 | 396 | ||
398 | static int claim_resources(MGSLPC_INFO *info); | 397 | static int claim_resources(MGSLPC_INFO *info); |
399 | static void release_resources(MGSLPC_INFO *info); | 398 | static void release_resources(MGSLPC_INFO *info); |
400 | static void mgslpc_add_device(MGSLPC_INFO *info); | 399 | static int mgslpc_add_device(MGSLPC_INFO *info); |
401 | static void mgslpc_remove_device(MGSLPC_INFO *info); | 400 | static void mgslpc_remove_device(MGSLPC_INFO *info); |
402 | 401 | ||
403 | static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty); | 402 | static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty); |
@@ -514,49 +513,56 @@ static const struct tty_port_operations mgslpc_port_ops = { | |||
514 | 513 | ||
515 | static int mgslpc_probe(struct pcmcia_device *link) | 514 | static 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) { | 551 | if (ret != 0) |
553 | tty_port_destroy(&info->port); | 552 | goto failed; |
554 | return ret; | 553 | |
555 | } | 554 | ret = mgslpc_add_device(info); |
556 | 555 | if (ret != 0) | |
557 | mgslpc_add_device(info); | 556 | goto failed_release; |
558 | 557 | ||
559 | return 0; | 558 | return 0; |
559 | |||
560 | failed_release: | ||
561 | mgslpc_release((u_long)link); | ||
562 | failed: | ||
563 | tty_port_destroy(&info->port); | ||
564 | kfree(info); | ||
565 | return ret; | ||
560 | } | 566 | } |
561 | 567 | ||
562 | /* Card has been inserted. | 568 | /* Card has been inserted. |
@@ -569,35 +575,35 @@ static int mgslpc_ioprobe(struct pcmcia_device *p_dev, void *priv_data) | |||
569 | 575 | ||
570 | static int mgslpc_config(struct pcmcia_device *link) | 576 | static int mgslpc_config(struct pcmcia_device *link) |
571 | { | 577 | { |
572 | MGSLPC_INFO *info = link->priv; | 578 | MGSLPC_INFO *info = link->priv; |
573 | int ret; | 579 | int ret; |
574 | 580 | ||
575 | if (debug_level >= DEBUG_LEVEL_INFO) | 581 | if (debug_level >= DEBUG_LEVEL_INFO) |
576 | printk("mgslpc_config(0x%p)\n", link); | 582 | printk("mgslpc_config(0x%p)\n", link); |
577 | 583 | ||
578 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; | 584 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
579 | 585 | ||
580 | ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); | 586 | ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL); |
581 | if (ret != 0) | 587 | if (ret != 0) |
582 | goto failed; | 588 | goto failed; |
583 | 589 | ||
584 | link->config_index = 8; | 590 | link->config_index = 8; |
585 | link->config_regs = PRESENT_OPTION; | 591 | link->config_regs = PRESENT_OPTION; |
586 | 592 | ||
587 | ret = pcmcia_request_irq(link, mgslpc_isr); | 593 | ret = pcmcia_request_irq(link, mgslpc_isr); |
588 | if (ret) | 594 | if (ret) |
589 | goto failed; | 595 | goto failed; |
590 | ret = pcmcia_enable_device(link); | 596 | ret = pcmcia_enable_device(link); |
591 | if (ret) | 597 | if (ret) |
592 | goto failed; | 598 | goto failed; |
593 | 599 | ||
594 | info->io_base = link->resource[0]->start; | 600 | info->io_base = link->resource[0]->start; |
595 | info->irq_level = link->irq; | 601 | info->irq_level = link->irq; |
596 | return 0; | 602 | return 0; |
597 | 603 | ||
598 | failed: | 604 | failed: |
599 | mgslpc_release((u_long)link); | 605 | mgslpc_release((u_long)link); |
600 | return -ENODEV; | 606 | return -ENODEV; |
601 | } | 607 | } |
602 | 608 | ||
603 | /* Card has been removed. | 609 | /* Card has been removed. |
@@ -703,12 +709,12 @@ static void tx_pause(struct tty_struct *tty) | |||
703 | if (mgslpc_paranoia_check(info, tty->name, "tx_pause")) | 709 | if (mgslpc_paranoia_check(info, tty->name, "tx_pause")) |
704 | return; | 710 | return; |
705 | if (debug_level >= DEBUG_LEVEL_INFO) | 711 | if (debug_level >= DEBUG_LEVEL_INFO) |
706 | printk("tx_pause(%s)\n",info->device_name); | 712 | printk("tx_pause(%s)\n", info->device_name); |
707 | 713 | ||
708 | spin_lock_irqsave(&info->lock,flags); | 714 | spin_lock_irqsave(&info->lock, flags); |
709 | if (info->tx_enabled) | 715 | if (info->tx_enabled) |
710 | tx_stop(info); | 716 | tx_stop(info); |
711 | spin_unlock_irqrestore(&info->lock,flags); | 717 | spin_unlock_irqrestore(&info->lock, flags); |
712 | } | 718 | } |
713 | 719 | ||
714 | static void tx_release(struct tty_struct *tty) | 720 | static void tx_release(struct tty_struct *tty) |
@@ -719,12 +725,12 @@ static void tx_release(struct tty_struct *tty) | |||
719 | if (mgslpc_paranoia_check(info, tty->name, "tx_release")) | 725 | if (mgslpc_paranoia_check(info, tty->name, "tx_release")) |
720 | return; | 726 | return; |
721 | if (debug_level >= DEBUG_LEVEL_INFO) | 727 | if (debug_level >= DEBUG_LEVEL_INFO) |
722 | printk("tx_release(%s)\n",info->device_name); | 728 | printk("tx_release(%s)\n", info->device_name); |
723 | 729 | ||
724 | spin_lock_irqsave(&info->lock,flags); | 730 | spin_lock_irqsave(&info->lock, flags); |
725 | if (!info->tx_enabled) | 731 | if (!info->tx_enabled) |
726 | tx_start(info, tty); | 732 | tx_start(info, tty); |
727 | spin_unlock_irqrestore(&info->lock,flags); | 733 | spin_unlock_irqrestore(&info->lock, flags); |
728 | } | 734 | } |
729 | 735 | ||
730 | /* Return next bottom half action to perform. | 736 | /* Return next bottom half action to perform. |
@@ -735,7 +741,7 @@ static int bh_action(MGSLPC_INFO *info) | |||
735 | unsigned long flags; | 741 | unsigned long flags; |
736 | int rc = 0; | 742 | int rc = 0; |
737 | 743 | ||
738 | spin_lock_irqsave(&info->lock,flags); | 744 | spin_lock_irqsave(&info->lock, flags); |
739 | 745 | ||
740 | if (info->pending_bh & BH_RECEIVE) { | 746 | if (info->pending_bh & BH_RECEIVE) { |
741 | info->pending_bh &= ~BH_RECEIVE; | 747 | info->pending_bh &= ~BH_RECEIVE; |
@@ -754,7 +760,7 @@ static int bh_action(MGSLPC_INFO *info) | |||
754 | info->bh_requested = false; | 760 | info->bh_requested = false; |
755 | } | 761 | } |
756 | 762 | ||
757 | spin_unlock_irqrestore(&info->lock,flags); | 763 | spin_unlock_irqrestore(&info->lock, flags); |
758 | 764 | ||
759 | return rc; | 765 | return rc; |
760 | } | 766 | } |
@@ -766,7 +772,7 @@ static void bh_handler(struct work_struct *work) | |||
766 | int action; | 772 | int action; |
767 | 773 | ||
768 | if (debug_level >= DEBUG_LEVEL_BH) | 774 | if (debug_level >= DEBUG_LEVEL_BH) |
769 | printk( "%s(%d):bh_handler(%s) entry\n", | 775 | printk("%s(%d):bh_handler(%s) entry\n", |
770 | __FILE__,__LINE__,info->device_name); | 776 | __FILE__,__LINE__,info->device_name); |
771 | 777 | ||
772 | info->bh_running = true; | 778 | info->bh_running = true; |
@@ -775,8 +781,8 @@ static void bh_handler(struct work_struct *work) | |||
775 | while((action = bh_action(info)) != 0) { | 781 | while((action = bh_action(info)) != 0) { |
776 | 782 | ||
777 | /* Process work item */ | 783 | /* Process work item */ |
778 | if ( debug_level >= DEBUG_LEVEL_BH ) | 784 | if (debug_level >= DEBUG_LEVEL_BH) |
779 | printk( "%s(%d):bh_handler() work item action=%d\n", | 785 | printk("%s(%d):bh_handler() work item action=%d\n", |
780 | __FILE__,__LINE__,action); | 786 | __FILE__,__LINE__,action); |
781 | 787 | ||
782 | switch (action) { | 788 | switch (action) { |
@@ -799,7 +805,7 @@ static void bh_handler(struct work_struct *work) | |||
799 | 805 | ||
800 | tty_kref_put(tty); | 806 | tty_kref_put(tty); |
801 | if (debug_level >= DEBUG_LEVEL_BH) | 807 | if (debug_level >= DEBUG_LEVEL_BH) |
802 | printk( "%s(%d):bh_handler(%s) exit\n", | 808 | printk("%s(%d):bh_handler(%s) exit\n", |
803 | __FILE__,__LINE__,info->device_name); | 809 | __FILE__,__LINE__,info->device_name); |
804 | } | 810 | } |
805 | 811 | ||
@@ -828,7 +834,7 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom) | |||
828 | RXBUF *buf = (RXBUF*)(info->rx_buf + (info->rx_put * info->rx_buf_size)); | 834 | RXBUF *buf = (RXBUF*)(info->rx_buf + (info->rx_put * info->rx_buf_size)); |
829 | 835 | ||
830 | if (debug_level >= DEBUG_LEVEL_ISR) | 836 | if (debug_level >= DEBUG_LEVEL_ISR) |
831 | printk("%s(%d):rx_ready_hdlc(eom=%d)\n",__FILE__,__LINE__,eom); | 837 | printk("%s(%d):rx_ready_hdlc(eom=%d)\n", __FILE__, __LINE__, eom); |
832 | 838 | ||
833 | if (!info->rx_enabled) | 839 | if (!info->rx_enabled) |
834 | return; | 840 | return; |
@@ -844,7 +850,8 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom) | |||
844 | 850 | ||
845 | if (eom) { | 851 | if (eom) { |
846 | /* end of frame, get FIFO count from RBCL register */ | 852 | /* end of frame, get FIFO count from RBCL register */ |
847 | if (!(fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f))) | 853 | fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f); |
854 | if (fifo_count == 0) | ||
848 | fifo_count = 32; | 855 | fifo_count = 32; |
849 | } else | 856 | } else |
850 | fifo_count = 32; | 857 | fifo_count = 32; |
@@ -889,7 +896,7 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd) | |||
889 | unsigned char data, status, flag; | 896 | unsigned char data, status, flag; |
890 | int fifo_count; | 897 | int fifo_count; |
891 | int work = 0; | 898 | int work = 0; |
892 | struct mgsl_icount *icount = &info->icount; | 899 | struct mgsl_icount *icount = &info->icount; |
893 | 900 | ||
894 | if (tcd) { | 901 | if (tcd) { |
895 | /* early termination, get FIFO count from RBCL register */ | 902 | /* early termination, get FIFO count from RBCL register */ |
@@ -994,7 +1001,7 @@ static void tx_ready(MGSLPC_INFO *info, struct tty_struct *tty) | |||
994 | int c; | 1001 | int c; |
995 | 1002 | ||
996 | if (debug_level >= DEBUG_LEVEL_ISR) | 1003 | if (debug_level >= DEBUG_LEVEL_ISR) |
997 | printk("%s(%d):tx_ready(%s)\n", __FILE__,__LINE__,info->device_name); | 1004 | printk("%s(%d):tx_ready(%s)\n", __FILE__, __LINE__, info->device_name); |
998 | 1005 | ||
999 | if (info->params.mode == MGSL_MODE_HDLC) { | 1006 | if (info->params.mode == MGSL_MODE_HDLC) { |
1000 | if (!info->tx_active) | 1007 | if (!info->tx_active) |
@@ -1239,7 +1246,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id) | |||
1239 | */ | 1246 | */ |
1240 | 1247 | ||
1241 | if (info->pending_bh && !info->bh_running && !info->bh_requested) { | 1248 | if (info->pending_bh && !info->bh_running && !info->bh_requested) { |
1242 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1249 | if (debug_level >= DEBUG_LEVEL_ISR) |
1243 | printk("%s(%d):%s queueing bh task.\n", | 1250 | printk("%s(%d):%s queueing bh task.\n", |
1244 | __FILE__,__LINE__,info->device_name); | 1251 | __FILE__,__LINE__,info->device_name); |
1245 | schedule_work(&info->task); | 1252 | schedule_work(&info->task); |
@@ -1263,7 +1270,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1263 | int retval = 0; | 1270 | int retval = 0; |
1264 | 1271 | ||
1265 | if (debug_level >= DEBUG_LEVEL_INFO) | 1272 | if (debug_level >= DEBUG_LEVEL_INFO) |
1266 | printk("%s(%d):startup(%s)\n",__FILE__,__LINE__,info->device_name); | 1273 | printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name); |
1267 | 1274 | ||
1268 | if (info->port.flags & ASYNC_INITIALIZED) | 1275 | if (info->port.flags & ASYNC_INITIALIZED) |
1269 | return 0; | 1276 | return 0; |
@@ -1273,7 +1280,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1273 | info->tx_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); | 1280 | info->tx_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); |
1274 | if (!info->tx_buf) { | 1281 | if (!info->tx_buf) { |
1275 | printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", | 1282 | printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", |
1276 | __FILE__,__LINE__,info->device_name); | 1283 | __FILE__, __LINE__, info->device_name); |
1277 | return -ENOMEM; | 1284 | return -ENOMEM; |
1278 | } | 1285 | } |
1279 | } | 1286 | } |
@@ -1288,15 +1295,15 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1288 | retval = claim_resources(info); | 1295 | retval = claim_resources(info); |
1289 | 1296 | ||
1290 | /* perform existence check and diagnostics */ | 1297 | /* perform existence check and diagnostics */ |
1291 | if ( !retval ) | 1298 | if (!retval) |
1292 | retval = adapter_test(info); | 1299 | retval = adapter_test(info); |
1293 | 1300 | ||
1294 | if ( retval ) { | 1301 | if (retval) { |
1295 | if (capable(CAP_SYS_ADMIN) && tty) | 1302 | if (capable(CAP_SYS_ADMIN) && tty) |
1296 | set_bit(TTY_IO_ERROR, &tty->flags); | 1303 | set_bit(TTY_IO_ERROR, &tty->flags); |
1297 | release_resources(info); | 1304 | release_resources(info); |
1298 | return retval; | 1305 | return retval; |
1299 | } | 1306 | } |
1300 | 1307 | ||
1301 | /* program hardware for current parameters */ | 1308 | /* program hardware for current parameters */ |
1302 | mgslpc_change_params(info, tty); | 1309 | mgslpc_change_params(info, tty); |
@@ -1320,7 +1327,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1320 | 1327 | ||
1321 | if (debug_level >= DEBUG_LEVEL_INFO) | 1328 | if (debug_level >= DEBUG_LEVEL_INFO) |
1322 | printk("%s(%d):mgslpc_shutdown(%s)\n", | 1329 | printk("%s(%d):mgslpc_shutdown(%s)\n", |
1323 | __FILE__,__LINE__, info->device_name ); | 1330 | __FILE__, __LINE__, info->device_name); |
1324 | 1331 | ||
1325 | /* clear status wait queue because status changes */ | 1332 | /* clear status wait queue because status changes */ |
1326 | /* can't happen after shutting down the hardware */ | 1333 | /* can't happen after shutting down the hardware */ |
@@ -1334,7 +1341,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1334 | info->tx_buf = NULL; | 1341 | info->tx_buf = NULL; |
1335 | } | 1342 | } |
1336 | 1343 | ||
1337 | spin_lock_irqsave(&info->lock,flags); | 1344 | spin_lock_irqsave(&info->lock, flags); |
1338 | 1345 | ||
1339 | rx_stop(info); | 1346 | rx_stop(info); |
1340 | tx_stop(info); | 1347 | tx_stop(info); |
@@ -1342,12 +1349,12 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1342 | /* TODO:disable interrupts instead of reset to preserve signal states */ | 1349 | /* TODO:disable interrupts instead of reset to preserve signal states */ |
1343 | reset_device(info); | 1350 | reset_device(info); |
1344 | 1351 | ||
1345 | if (!tty || tty->termios.c_cflag & HUPCL) { | 1352 | if (!tty || tty->termios.c_cflag & HUPCL) { |
1346 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); | 1353 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
1347 | set_signals(info); | 1354 | set_signals(info); |
1348 | } | 1355 | } |
1349 | 1356 | ||
1350 | spin_unlock_irqrestore(&info->lock,flags); | 1357 | spin_unlock_irqrestore(&info->lock, flags); |
1351 | 1358 | ||
1352 | release_resources(info); | 1359 | release_resources(info); |
1353 | 1360 | ||
@@ -1361,7 +1368,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1361 | { | 1368 | { |
1362 | unsigned long flags; | 1369 | unsigned long flags; |
1363 | 1370 | ||
1364 | spin_lock_irqsave(&info->lock,flags); | 1371 | spin_lock_irqsave(&info->lock, flags); |
1365 | 1372 | ||
1366 | rx_stop(info); | 1373 | rx_stop(info); |
1367 | tx_stop(info); | 1374 | tx_stop(info); |
@@ -1386,7 +1393,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1386 | if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) | 1393 | if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) |
1387 | rx_start(info); | 1394 | rx_start(info); |
1388 | 1395 | ||
1389 | spin_unlock_irqrestore(&info->lock,flags); | 1396 | spin_unlock_irqrestore(&info->lock, flags); |
1390 | } | 1397 | } |
1391 | 1398 | ||
1392 | /* Reconfigure adapter based on new parameters | 1399 | /* Reconfigure adapter based on new parameters |
@@ -1401,13 +1408,13 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1401 | 1408 | ||
1402 | if (debug_level >= DEBUG_LEVEL_INFO) | 1409 | if (debug_level >= DEBUG_LEVEL_INFO) |
1403 | printk("%s(%d):mgslpc_change_params(%s)\n", | 1410 | printk("%s(%d):mgslpc_change_params(%s)\n", |
1404 | __FILE__,__LINE__, info->device_name ); | 1411 | __FILE__, __LINE__, info->device_name); |
1405 | 1412 | ||
1406 | cflag = tty->termios.c_cflag; | 1413 | cflag = tty->termios.c_cflag; |
1407 | 1414 | ||
1408 | /* if B0 rate (hangup) specified then negate RTS and DTR */ | 1415 | /* if B0 rate (hangup) specified then negate RTS and DTR */ |
1409 | /* otherwise assert RTS and DTR */ | 1416 | /* otherwise assert RTS and DTR */ |
1410 | if (cflag & CBAUD) | 1417 | if (cflag & CBAUD) |
1411 | info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; | 1418 | info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; |
1412 | else | 1419 | else |
1413 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); | 1420 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
@@ -1453,7 +1460,7 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1453 | info->params.data_rate = tty_get_baud_rate(tty); | 1460 | info->params.data_rate = tty_get_baud_rate(tty); |
1454 | } | 1461 | } |
1455 | 1462 | ||
1456 | if ( info->params.data_rate ) { | 1463 | if (info->params.data_rate) { |
1457 | info->timeout = (32*HZ*bits_per_char) / | 1464 | info->timeout = (32*HZ*bits_per_char) / |
1458 | info->params.data_rate; | 1465 | info->params.data_rate; |
1459 | } | 1466 | } |
@@ -1488,8 +1495,8 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch) | |||
1488 | unsigned long flags; | 1495 | unsigned long flags; |
1489 | 1496 | ||
1490 | if (debug_level >= DEBUG_LEVEL_INFO) { | 1497 | if (debug_level >= DEBUG_LEVEL_INFO) { |
1491 | printk( "%s(%d):mgslpc_put_char(%d) on %s\n", | 1498 | printk("%s(%d):mgslpc_put_char(%d) on %s\n", |
1492 | __FILE__,__LINE__,ch,info->device_name); | 1499 | __FILE__, __LINE__, ch, info->device_name); |
1493 | } | 1500 | } |
1494 | 1501 | ||
1495 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) | 1502 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) |
@@ -1498,7 +1505,7 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch) | |||
1498 | if (!info->tx_buf) | 1505 | if (!info->tx_buf) |
1499 | return 0; | 1506 | return 0; |
1500 | 1507 | ||
1501 | spin_lock_irqsave(&info->lock,flags); | 1508 | spin_lock_irqsave(&info->lock, flags); |
1502 | 1509 | ||
1503 | if (info->params.mode == MGSL_MODE_ASYNC || !info->tx_active) { | 1510 | if (info->params.mode == MGSL_MODE_ASYNC || !info->tx_active) { |
1504 | if (info->tx_count < TXBUFSIZE - 1) { | 1511 | if (info->tx_count < TXBUFSIZE - 1) { |
@@ -1508,7 +1515,7 @@ static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch) | |||
1508 | } | 1515 | } |
1509 | } | 1516 | } |
1510 | 1517 | ||
1511 | spin_unlock_irqrestore(&info->lock,flags); | 1518 | spin_unlock_irqrestore(&info->lock, flags); |
1512 | return 1; | 1519 | return 1; |
1513 | } | 1520 | } |
1514 | 1521 | ||
@@ -1521,8 +1528,8 @@ static void mgslpc_flush_chars(struct tty_struct *tty) | |||
1521 | unsigned long flags; | 1528 | unsigned long flags; |
1522 | 1529 | ||
1523 | if (debug_level >= DEBUG_LEVEL_INFO) | 1530 | if (debug_level >= DEBUG_LEVEL_INFO) |
1524 | printk( "%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n", | 1531 | printk("%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n", |
1525 | __FILE__,__LINE__,info->device_name,info->tx_count); | 1532 | __FILE__, __LINE__, info->device_name, info->tx_count); |
1526 | 1533 | ||
1527 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars")) | 1534 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars")) |
1528 | return; | 1535 | return; |
@@ -1532,13 +1539,13 @@ static void mgslpc_flush_chars(struct tty_struct *tty) | |||
1532 | return; | 1539 | return; |
1533 | 1540 | ||
1534 | if (debug_level >= DEBUG_LEVEL_INFO) | 1541 | if (debug_level >= DEBUG_LEVEL_INFO) |
1535 | printk( "%s(%d):mgslpc_flush_chars() entry on %s starting transmitter\n", | 1542 | printk("%s(%d):mgslpc_flush_chars() entry on %s starting transmitter\n", |
1536 | __FILE__,__LINE__,info->device_name); | 1543 | __FILE__, __LINE__, info->device_name); |
1537 | 1544 | ||
1538 | spin_lock_irqsave(&info->lock,flags); | 1545 | spin_lock_irqsave(&info->lock, flags); |
1539 | if (!info->tx_active) | 1546 | if (!info->tx_active) |
1540 | tx_start(info, tty); | 1547 | tx_start(info, tty); |
1541 | spin_unlock_irqrestore(&info->lock,flags); | 1548 | spin_unlock_irqrestore(&info->lock, flags); |
1542 | } | 1549 | } |
1543 | 1550 | ||
1544 | /* Send a block of data | 1551 | /* Send a block of data |
@@ -1559,8 +1566,8 @@ static int mgslpc_write(struct tty_struct * tty, | |||
1559 | unsigned long flags; | 1566 | unsigned long flags; |
1560 | 1567 | ||
1561 | if (debug_level >= DEBUG_LEVEL_INFO) | 1568 | if (debug_level >= DEBUG_LEVEL_INFO) |
1562 | printk( "%s(%d):mgslpc_write(%s) count=%d\n", | 1569 | printk("%s(%d):mgslpc_write(%s) count=%d\n", |
1563 | __FILE__,__LINE__,info->device_name,count); | 1570 | __FILE__, __LINE__, info->device_name, count); |
1564 | 1571 | ||
1565 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || | 1572 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || |
1566 | !info->tx_buf) | 1573 | !info->tx_buf) |
@@ -1586,26 +1593,26 @@ static int mgslpc_write(struct tty_struct * tty, | |||
1586 | 1593 | ||
1587 | memcpy(info->tx_buf + info->tx_put, buf, c); | 1594 | memcpy(info->tx_buf + info->tx_put, buf, c); |
1588 | 1595 | ||
1589 | spin_lock_irqsave(&info->lock,flags); | 1596 | spin_lock_irqsave(&info->lock, flags); |
1590 | info->tx_put = (info->tx_put + c) & (TXBUFSIZE-1); | 1597 | info->tx_put = (info->tx_put + c) & (TXBUFSIZE-1); |
1591 | info->tx_count += c; | 1598 | info->tx_count += c; |
1592 | spin_unlock_irqrestore(&info->lock,flags); | 1599 | spin_unlock_irqrestore(&info->lock, flags); |
1593 | 1600 | ||
1594 | buf += c; | 1601 | buf += c; |
1595 | count -= c; | 1602 | count -= c; |
1596 | ret += c; | 1603 | ret += c; |
1597 | } | 1604 | } |
1598 | start: | 1605 | start: |
1599 | if (info->tx_count && !tty->stopped && !tty->hw_stopped) { | 1606 | if (info->tx_count && !tty->stopped && !tty->hw_stopped) { |
1600 | spin_lock_irqsave(&info->lock,flags); | 1607 | spin_lock_irqsave(&info->lock, flags); |
1601 | if (!info->tx_active) | 1608 | if (!info->tx_active) |
1602 | tx_start(info, tty); | 1609 | tx_start(info, tty); |
1603 | spin_unlock_irqrestore(&info->lock,flags); | 1610 | spin_unlock_irqrestore(&info->lock, flags); |
1604 | } | 1611 | } |
1605 | cleanup: | 1612 | cleanup: |
1606 | if (debug_level >= DEBUG_LEVEL_INFO) | 1613 | if (debug_level >= DEBUG_LEVEL_INFO) |
1607 | printk( "%s(%d):mgslpc_write(%s) returning=%d\n", | 1614 | printk("%s(%d):mgslpc_write(%s) returning=%d\n", |
1608 | __FILE__,__LINE__,info->device_name,ret); | 1615 | __FILE__, __LINE__, info->device_name, ret); |
1609 | return ret; | 1616 | return ret; |
1610 | } | 1617 | } |
1611 | 1618 | ||
@@ -1633,7 +1640,7 @@ static int mgslpc_write_room(struct tty_struct *tty) | |||
1633 | 1640 | ||
1634 | if (debug_level >= DEBUG_LEVEL_INFO) | 1641 | if (debug_level >= DEBUG_LEVEL_INFO) |
1635 | printk("%s(%d):mgslpc_write_room(%s)=%d\n", | 1642 | printk("%s(%d):mgslpc_write_room(%s)=%d\n", |
1636 | __FILE__,__LINE__, info->device_name, ret); | 1643 | __FILE__, __LINE__, info->device_name, ret); |
1637 | return ret; | 1644 | return ret; |
1638 | } | 1645 | } |
1639 | 1646 | ||
@@ -1646,7 +1653,7 @@ static int mgslpc_chars_in_buffer(struct tty_struct *tty) | |||
1646 | 1653 | ||
1647 | if (debug_level >= DEBUG_LEVEL_INFO) | 1654 | if (debug_level >= DEBUG_LEVEL_INFO) |
1648 | printk("%s(%d):mgslpc_chars_in_buffer(%s)\n", | 1655 | printk("%s(%d):mgslpc_chars_in_buffer(%s)\n", |
1649 | __FILE__,__LINE__, info->device_name ); | 1656 | __FILE__, __LINE__, info->device_name); |
1650 | 1657 | ||
1651 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer")) | 1658 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer")) |
1652 | return 0; | 1659 | return 0; |
@@ -1658,7 +1665,7 @@ static int mgslpc_chars_in_buffer(struct tty_struct *tty) | |||
1658 | 1665 | ||
1659 | if (debug_level >= DEBUG_LEVEL_INFO) | 1666 | if (debug_level >= DEBUG_LEVEL_INFO) |
1660 | printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n", | 1667 | printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n", |
1661 | __FILE__,__LINE__, info->device_name, rc); | 1668 | __FILE__, __LINE__, info->device_name, rc); |
1662 | 1669 | ||
1663 | return rc; | 1670 | return rc; |
1664 | } | 1671 | } |
@@ -1672,15 +1679,15 @@ static void mgslpc_flush_buffer(struct tty_struct *tty) | |||
1672 | 1679 | ||
1673 | if (debug_level >= DEBUG_LEVEL_INFO) | 1680 | if (debug_level >= DEBUG_LEVEL_INFO) |
1674 | printk("%s(%d):mgslpc_flush_buffer(%s) entry\n", | 1681 | printk("%s(%d):mgslpc_flush_buffer(%s) entry\n", |
1675 | __FILE__,__LINE__, info->device_name ); | 1682 | __FILE__, __LINE__, info->device_name); |
1676 | 1683 | ||
1677 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer")) | 1684 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer")) |
1678 | return; | 1685 | return; |
1679 | 1686 | ||
1680 | spin_lock_irqsave(&info->lock,flags); | 1687 | spin_lock_irqsave(&info->lock, flags); |
1681 | info->tx_count = info->tx_put = info->tx_get = 0; | 1688 | info->tx_count = info->tx_put = info->tx_get = 0; |
1682 | del_timer(&info->tx_timer); | 1689 | del_timer(&info->tx_timer); |
1683 | spin_unlock_irqrestore(&info->lock,flags); | 1690 | spin_unlock_irqrestore(&info->lock, flags); |
1684 | 1691 | ||
1685 | wake_up_interruptible(&tty->write_wait); | 1692 | wake_up_interruptible(&tty->write_wait); |
1686 | tty_wakeup(tty); | 1693 | tty_wakeup(tty); |
@@ -1695,17 +1702,17 @@ static void mgslpc_send_xchar(struct tty_struct *tty, char ch) | |||
1695 | 1702 | ||
1696 | if (debug_level >= DEBUG_LEVEL_INFO) | 1703 | if (debug_level >= DEBUG_LEVEL_INFO) |
1697 | printk("%s(%d):mgslpc_send_xchar(%s,%d)\n", | 1704 | printk("%s(%d):mgslpc_send_xchar(%s,%d)\n", |
1698 | __FILE__,__LINE__, info->device_name, ch ); | 1705 | __FILE__, __LINE__, info->device_name, ch); |
1699 | 1706 | ||
1700 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar")) | 1707 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar")) |
1701 | return; | 1708 | return; |
1702 | 1709 | ||
1703 | info->x_char = ch; | 1710 | info->x_char = ch; |
1704 | if (ch) { | 1711 | if (ch) { |
1705 | spin_lock_irqsave(&info->lock,flags); | 1712 | spin_lock_irqsave(&info->lock, flags); |
1706 | if (!info->tx_enabled) | 1713 | if (!info->tx_enabled) |
1707 | tx_start(info, tty); | 1714 | tx_start(info, tty); |
1708 | spin_unlock_irqrestore(&info->lock,flags); | 1715 | spin_unlock_irqrestore(&info->lock, flags); |
1709 | } | 1716 | } |
1710 | } | 1717 | } |
1711 | 1718 | ||
@@ -1718,7 +1725,7 @@ static void mgslpc_throttle(struct tty_struct * tty) | |||
1718 | 1725 | ||
1719 | if (debug_level >= DEBUG_LEVEL_INFO) | 1726 | if (debug_level >= DEBUG_LEVEL_INFO) |
1720 | printk("%s(%d):mgslpc_throttle(%s) entry\n", | 1727 | printk("%s(%d):mgslpc_throttle(%s) entry\n", |
1721 | __FILE__,__LINE__, info->device_name ); | 1728 | __FILE__, __LINE__, info->device_name); |
1722 | 1729 | ||
1723 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle")) | 1730 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle")) |
1724 | return; | 1731 | return; |
@@ -1726,11 +1733,11 @@ static void mgslpc_throttle(struct tty_struct * tty) | |||
1726 | if (I_IXOFF(tty)) | 1733 | if (I_IXOFF(tty)) |
1727 | mgslpc_send_xchar(tty, STOP_CHAR(tty)); | 1734 | mgslpc_send_xchar(tty, STOP_CHAR(tty)); |
1728 | 1735 | ||
1729 | if (tty->termios.c_cflag & CRTSCTS) { | 1736 | if (tty->termios.c_cflag & CRTSCTS) { |
1730 | spin_lock_irqsave(&info->lock,flags); | 1737 | spin_lock_irqsave(&info->lock, flags); |
1731 | info->serial_signals &= ~SerialSignal_RTS; | 1738 | info->serial_signals &= ~SerialSignal_RTS; |
1732 | set_signals(info); | 1739 | set_signals(info); |
1733 | spin_unlock_irqrestore(&info->lock,flags); | 1740 | spin_unlock_irqrestore(&info->lock, flags); |
1734 | } | 1741 | } |
1735 | } | 1742 | } |
1736 | 1743 | ||
@@ -1743,7 +1750,7 @@ static void mgslpc_unthrottle(struct tty_struct * tty) | |||
1743 | 1750 | ||
1744 | if (debug_level >= DEBUG_LEVEL_INFO) | 1751 | if (debug_level >= DEBUG_LEVEL_INFO) |
1745 | printk("%s(%d):mgslpc_unthrottle(%s) entry\n", | 1752 | printk("%s(%d):mgslpc_unthrottle(%s) entry\n", |
1746 | __FILE__,__LINE__, info->device_name ); | 1753 | __FILE__, __LINE__, info->device_name); |
1747 | 1754 | ||
1748 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle")) | 1755 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle")) |
1749 | return; | 1756 | return; |
@@ -1755,11 +1762,11 @@ static void mgslpc_unthrottle(struct tty_struct * tty) | |||
1755 | mgslpc_send_xchar(tty, START_CHAR(tty)); | 1762 | mgslpc_send_xchar(tty, START_CHAR(tty)); |
1756 | } | 1763 | } |
1757 | 1764 | ||
1758 | if (tty->termios.c_cflag & CRTSCTS) { | 1765 | if (tty->termios.c_cflag & CRTSCTS) { |
1759 | spin_lock_irqsave(&info->lock,flags); | 1766 | spin_lock_irqsave(&info->lock, flags); |
1760 | info->serial_signals |= SerialSignal_RTS; | 1767 | info->serial_signals |= SerialSignal_RTS; |
1761 | set_signals(info); | 1768 | set_signals(info); |
1762 | spin_unlock_irqrestore(&info->lock,flags); | 1769 | spin_unlock_irqrestore(&info->lock, flags); |
1763 | } | 1770 | } |
1764 | } | 1771 | } |
1765 | 1772 | ||
@@ -1797,33 +1804,33 @@ static int get_params(MGSLPC_INFO * info, MGSL_PARAMS __user *user_params) | |||
1797 | * | 1804 | * |
1798 | * Arguments: | 1805 | * Arguments: |
1799 | * | 1806 | * |
1800 | * info pointer to device instance data | 1807 | * info pointer to device instance data |
1801 | * new_params user buffer containing new serial params | 1808 | * new_params user buffer containing new serial params |
1802 | * | 1809 | * |
1803 | * Returns: 0 if success, otherwise error code | 1810 | * Returns: 0 if success, otherwise error code |
1804 | */ | 1811 | */ |
1805 | static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty) | 1812 | static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty) |
1806 | { | 1813 | { |
1807 | unsigned long flags; | 1814 | unsigned long flags; |
1808 | MGSL_PARAMS tmp_params; | 1815 | MGSL_PARAMS tmp_params; |
1809 | int err; | 1816 | int err; |
1810 | 1817 | ||
1811 | if (debug_level >= DEBUG_LEVEL_INFO) | 1818 | if (debug_level >= DEBUG_LEVEL_INFO) |
1812 | printk("%s(%d):set_params %s\n", __FILE__,__LINE__, | 1819 | printk("%s(%d):set_params %s\n", __FILE__,__LINE__, |
1813 | info->device_name ); | 1820 | info->device_name); |
1814 | COPY_FROM_USER(err,&tmp_params, new_params, sizeof(MGSL_PARAMS)); | 1821 | COPY_FROM_USER(err,&tmp_params, new_params, sizeof(MGSL_PARAMS)); |
1815 | if (err) { | 1822 | if (err) { |
1816 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 1823 | if (debug_level >= DEBUG_LEVEL_INFO) |
1817 | printk( "%s(%d):set_params(%s) user buffer copy failed\n", | 1824 | printk("%s(%d):set_params(%s) user buffer copy failed\n", |
1818 | __FILE__,__LINE__,info->device_name); | 1825 | __FILE__, __LINE__, info->device_name); |
1819 | return -EFAULT; | 1826 | return -EFAULT; |
1820 | } | 1827 | } |
1821 | 1828 | ||
1822 | spin_lock_irqsave(&info->lock,flags); | 1829 | spin_lock_irqsave(&info->lock, flags); |
1823 | memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); | 1830 | memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); |
1824 | spin_unlock_irqrestore(&info->lock,flags); | 1831 | spin_unlock_irqrestore(&info->lock, flags); |
1825 | 1832 | ||
1826 | mgslpc_change_params(info, tty); | 1833 | mgslpc_change_params(info, tty); |
1827 | 1834 | ||
1828 | return 0; | 1835 | return 0; |
1829 | } | 1836 | } |
@@ -1841,13 +1848,13 @@ static int get_txidle(MGSLPC_INFO * info, int __user *idle_mode) | |||
1841 | 1848 | ||
1842 | static int set_txidle(MGSLPC_INFO * info, int idle_mode) | 1849 | static int set_txidle(MGSLPC_INFO * info, int idle_mode) |
1843 | { | 1850 | { |
1844 | unsigned long flags; | 1851 | unsigned long flags; |
1845 | if (debug_level >= DEBUG_LEVEL_INFO) | 1852 | if (debug_level >= DEBUG_LEVEL_INFO) |
1846 | printk("set_txidle(%s,%d)\n", info->device_name, idle_mode); | 1853 | printk("set_txidle(%s,%d)\n", info->device_name, idle_mode); |
1847 | spin_lock_irqsave(&info->lock,flags); | 1854 | spin_lock_irqsave(&info->lock, flags); |
1848 | info->idle_mode = idle_mode; | 1855 | info->idle_mode = idle_mode; |
1849 | tx_set_idle(info); | 1856 | tx_set_idle(info); |
1850 | spin_unlock_irqrestore(&info->lock,flags); | 1857 | spin_unlock_irqrestore(&info->lock, flags); |
1851 | return 0; | 1858 | return 0; |
1852 | } | 1859 | } |
1853 | 1860 | ||
@@ -1864,11 +1871,11 @@ static int get_interface(MGSLPC_INFO * info, int __user *if_mode) | |||
1864 | 1871 | ||
1865 | static int set_interface(MGSLPC_INFO * info, int if_mode) | 1872 | static int set_interface(MGSLPC_INFO * info, int if_mode) |
1866 | { | 1873 | { |
1867 | unsigned long flags; | 1874 | unsigned long flags; |
1868 | unsigned char val; | 1875 | unsigned char val; |
1869 | if (debug_level >= DEBUG_LEVEL_INFO) | 1876 | if (debug_level >= DEBUG_LEVEL_INFO) |
1870 | printk("set_interface(%s,%d)\n", info->device_name, if_mode); | 1877 | printk("set_interface(%s,%d)\n", info->device_name, if_mode); |
1871 | spin_lock_irqsave(&info->lock,flags); | 1878 | spin_lock_irqsave(&info->lock, flags); |
1872 | info->if_mode = if_mode; | 1879 | info->if_mode = if_mode; |
1873 | 1880 | ||
1874 | val = read_reg(info, PVR) & 0x0f; | 1881 | val = read_reg(info, PVR) & 0x0f; |
@@ -1880,18 +1887,18 @@ static int set_interface(MGSLPC_INFO * info, int if_mode) | |||
1880 | } | 1887 | } |
1881 | write_reg(info, PVR, val); | 1888 | write_reg(info, PVR, val); |
1882 | 1889 | ||
1883 | spin_unlock_irqrestore(&info->lock,flags); | 1890 | spin_unlock_irqrestore(&info->lock, flags); |
1884 | return 0; | 1891 | return 0; |
1885 | } | 1892 | } |
1886 | 1893 | ||
1887 | static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty) | 1894 | static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty) |
1888 | { | 1895 | { |
1889 | unsigned long flags; | 1896 | unsigned long flags; |
1890 | 1897 | ||
1891 | if (debug_level >= DEBUG_LEVEL_INFO) | 1898 | if (debug_level >= DEBUG_LEVEL_INFO) |
1892 | printk("set_txenable(%s,%d)\n", info->device_name, enable); | 1899 | printk("set_txenable(%s,%d)\n", info->device_name, enable); |
1893 | 1900 | ||
1894 | spin_lock_irqsave(&info->lock,flags); | 1901 | spin_lock_irqsave(&info->lock, flags); |
1895 | if (enable) { | 1902 | if (enable) { |
1896 | if (!info->tx_enabled) | 1903 | if (!info->tx_enabled) |
1897 | tx_start(info, tty); | 1904 | tx_start(info, tty); |
@@ -1899,18 +1906,18 @@ static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty) | |||
1899 | if (info->tx_enabled) | 1906 | if (info->tx_enabled) |
1900 | tx_stop(info); | 1907 | tx_stop(info); |
1901 | } | 1908 | } |
1902 | spin_unlock_irqrestore(&info->lock,flags); | 1909 | spin_unlock_irqrestore(&info->lock, flags); |
1903 | return 0; | 1910 | return 0; |
1904 | } | 1911 | } |
1905 | 1912 | ||
1906 | static int tx_abort(MGSLPC_INFO * info) | 1913 | static int tx_abort(MGSLPC_INFO * info) |
1907 | { | 1914 | { |
1908 | unsigned long flags; | 1915 | unsigned long flags; |
1909 | 1916 | ||
1910 | if (debug_level >= DEBUG_LEVEL_INFO) | 1917 | if (debug_level >= DEBUG_LEVEL_INFO) |
1911 | printk("tx_abort(%s)\n", info->device_name); | 1918 | printk("tx_abort(%s)\n", info->device_name); |
1912 | 1919 | ||
1913 | spin_lock_irqsave(&info->lock,flags); | 1920 | spin_lock_irqsave(&info->lock, flags); |
1914 | if (info->tx_active && info->tx_count && | 1921 | if (info->tx_active && info->tx_count && |
1915 | info->params.mode == MGSL_MODE_HDLC) { | 1922 | info->params.mode == MGSL_MODE_HDLC) { |
1916 | /* clear data count so FIFO is not filled on next IRQ. | 1923 | /* clear data count so FIFO is not filled on next IRQ. |
@@ -1919,18 +1926,18 @@ static int tx_abort(MGSLPC_INFO * info) | |||
1919 | info->tx_count = info->tx_put = info->tx_get = 0; | 1926 | info->tx_count = info->tx_put = info->tx_get = 0; |
1920 | info->tx_aborting = true; | 1927 | info->tx_aborting = true; |
1921 | } | 1928 | } |
1922 | spin_unlock_irqrestore(&info->lock,flags); | 1929 | spin_unlock_irqrestore(&info->lock, flags); |
1923 | return 0; | 1930 | return 0; |
1924 | } | 1931 | } |
1925 | 1932 | ||
1926 | static int set_rxenable(MGSLPC_INFO * info, int enable) | 1933 | static int set_rxenable(MGSLPC_INFO * info, int enable) |
1927 | { | 1934 | { |
1928 | unsigned long flags; | 1935 | unsigned long flags; |
1929 | 1936 | ||
1930 | if (debug_level >= DEBUG_LEVEL_INFO) | 1937 | if (debug_level >= DEBUG_LEVEL_INFO) |
1931 | printk("set_rxenable(%s,%d)\n", info->device_name, enable); | 1938 | printk("set_rxenable(%s,%d)\n", info->device_name, enable); |
1932 | 1939 | ||
1933 | spin_lock_irqsave(&info->lock,flags); | 1940 | spin_lock_irqsave(&info->lock, flags); |
1934 | if (enable) { | 1941 | if (enable) { |
1935 | if (!info->rx_enabled) | 1942 | if (!info->rx_enabled) |
1936 | rx_start(info); | 1943 | rx_start(info); |
@@ -1938,21 +1945,21 @@ static int set_rxenable(MGSLPC_INFO * info, int enable) | |||
1938 | if (info->rx_enabled) | 1945 | if (info->rx_enabled) |
1939 | rx_stop(info); | 1946 | rx_stop(info); |
1940 | } | 1947 | } |
1941 | spin_unlock_irqrestore(&info->lock,flags); | 1948 | spin_unlock_irqrestore(&info->lock, flags); |
1942 | return 0; | 1949 | return 0; |
1943 | } | 1950 | } |
1944 | 1951 | ||
1945 | /* wait for specified event to occur | 1952 | /* wait for specified event to occur |
1946 | * | 1953 | * |
1947 | * Arguments: info pointer to device instance data | 1954 | * Arguments: info pointer to device instance data |
1948 | * mask pointer to bitmask of events to wait for | 1955 | * mask pointer to bitmask of events to wait for |
1949 | * Return Value: 0 if successful and bit mask updated with | 1956 | * Return Value: 0 if successful and bit mask updated with |
1950 | * of events triggerred, | 1957 | * of events triggerred, |
1951 | * otherwise error code | 1958 | * otherwise error code |
1952 | */ | 1959 | */ |
1953 | static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) | 1960 | static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) |
1954 | { | 1961 | { |
1955 | unsigned long flags; | 1962 | unsigned long flags; |
1956 | int s; | 1963 | int s; |
1957 | int rc=0; | 1964 | int rc=0; |
1958 | struct mgsl_icount cprev, cnow; | 1965 | struct mgsl_icount cprev, cnow; |
@@ -1968,18 +1975,18 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) | |||
1968 | if (debug_level >= DEBUG_LEVEL_INFO) | 1975 | if (debug_level >= DEBUG_LEVEL_INFO) |
1969 | printk("wait_events(%s,%d)\n", info->device_name, mask); | 1976 | printk("wait_events(%s,%d)\n", info->device_name, mask); |
1970 | 1977 | ||
1971 | spin_lock_irqsave(&info->lock,flags); | 1978 | spin_lock_irqsave(&info->lock, flags); |
1972 | 1979 | ||
1973 | /* return immediately if state matches requested events */ | 1980 | /* return immediately if state matches requested events */ |
1974 | get_signals(info); | 1981 | get_signals(info); |
1975 | s = info->serial_signals; | 1982 | s = info->serial_signals; |
1976 | events = mask & | 1983 | events = mask & |
1977 | ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) + | 1984 | ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) + |
1978 | ((s & SerialSignal_DCD) ? MgslEvent_DcdActive:MgslEvent_DcdInactive) + | 1985 | ((s & SerialSignal_DCD) ? MgslEvent_DcdActive:MgslEvent_DcdInactive) + |
1979 | ((s & SerialSignal_CTS) ? MgslEvent_CtsActive:MgslEvent_CtsInactive) + | 1986 | ((s & SerialSignal_CTS) ? MgslEvent_CtsActive:MgslEvent_CtsInactive) + |
1980 | ((s & SerialSignal_RI) ? MgslEvent_RiActive :MgslEvent_RiInactive) ); | 1987 | ((s & SerialSignal_RI) ? MgslEvent_RiActive :MgslEvent_RiInactive) ); |
1981 | if (events) { | 1988 | if (events) { |
1982 | spin_unlock_irqrestore(&info->lock,flags); | 1989 | spin_unlock_irqrestore(&info->lock, flags); |
1983 | goto exit; | 1990 | goto exit; |
1984 | } | 1991 | } |
1985 | 1992 | ||
@@ -1994,7 +2001,7 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) | |||
1994 | set_current_state(TASK_INTERRUPTIBLE); | 2001 | set_current_state(TASK_INTERRUPTIBLE); |
1995 | add_wait_queue(&info->event_wait_q, &wait); | 2002 | add_wait_queue(&info->event_wait_q, &wait); |
1996 | 2003 | ||
1997 | spin_unlock_irqrestore(&info->lock,flags); | 2004 | spin_unlock_irqrestore(&info->lock, flags); |
1998 | 2005 | ||
1999 | 2006 | ||
2000 | for(;;) { | 2007 | for(;;) { |
@@ -2005,11 +2012,11 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) | |||
2005 | } | 2012 | } |
2006 | 2013 | ||
2007 | /* get current irq counts */ | 2014 | /* get current irq counts */ |
2008 | spin_lock_irqsave(&info->lock,flags); | 2015 | spin_lock_irqsave(&info->lock, flags); |
2009 | cnow = info->icount; | 2016 | cnow = info->icount; |
2010 | newsigs = info->input_signal_events; | 2017 | newsigs = info->input_signal_events; |
2011 | set_current_state(TASK_INTERRUPTIBLE); | 2018 | set_current_state(TASK_INTERRUPTIBLE); |
2012 | spin_unlock_irqrestore(&info->lock,flags); | 2019 | spin_unlock_irqrestore(&info->lock, flags); |
2013 | 2020 | ||
2014 | /* if no change, wait aborted for some reason */ | 2021 | /* if no change, wait aborted for some reason */ |
2015 | if (newsigs.dsr_up == oldsigs.dsr_up && | 2022 | if (newsigs.dsr_up == oldsigs.dsr_up && |
@@ -2048,10 +2055,10 @@ static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) | |||
2048 | set_current_state(TASK_RUNNING); | 2055 | set_current_state(TASK_RUNNING); |
2049 | 2056 | ||
2050 | if (mask & MgslEvent_ExitHuntMode) { | 2057 | if (mask & MgslEvent_ExitHuntMode) { |
2051 | spin_lock_irqsave(&info->lock,flags); | 2058 | spin_lock_irqsave(&info->lock, flags); |
2052 | if (!waitqueue_active(&info->event_wait_q)) | 2059 | if (!waitqueue_active(&info->event_wait_q)) |
2053 | irq_disable(info, CHA, IRQ_EXITHUNT); | 2060 | irq_disable(info, CHA, IRQ_EXITHUNT); |
2054 | spin_unlock_irqrestore(&info->lock,flags); | 2061 | spin_unlock_irqrestore(&info->lock, flags); |
2055 | } | 2062 | } |
2056 | exit: | 2063 | exit: |
2057 | if (rc == 0) | 2064 | if (rc == 0) |
@@ -2061,17 +2068,17 @@ exit: | |||
2061 | 2068 | ||
2062 | static int modem_input_wait(MGSLPC_INFO *info,int arg) | 2069 | static int modem_input_wait(MGSLPC_INFO *info,int arg) |
2063 | { | 2070 | { |
2064 | unsigned long flags; | 2071 | unsigned long flags; |
2065 | int rc; | 2072 | int rc; |
2066 | struct mgsl_icount cprev, cnow; | 2073 | struct mgsl_icount cprev, cnow; |
2067 | DECLARE_WAITQUEUE(wait, current); | 2074 | DECLARE_WAITQUEUE(wait, current); |
2068 | 2075 | ||
2069 | /* save current irq counts */ | 2076 | /* save current irq counts */ |
2070 | spin_lock_irqsave(&info->lock,flags); | 2077 | spin_lock_irqsave(&info->lock, flags); |
2071 | cprev = info->icount; | 2078 | cprev = info->icount; |
2072 | add_wait_queue(&info->status_event_wait_q, &wait); | 2079 | add_wait_queue(&info->status_event_wait_q, &wait); |
2073 | set_current_state(TASK_INTERRUPTIBLE); | 2080 | set_current_state(TASK_INTERRUPTIBLE); |
2074 | spin_unlock_irqrestore(&info->lock,flags); | 2081 | spin_unlock_irqrestore(&info->lock, flags); |
2075 | 2082 | ||
2076 | for(;;) { | 2083 | for(;;) { |
2077 | schedule(); | 2084 | schedule(); |
@@ -2081,10 +2088,10 @@ static int modem_input_wait(MGSLPC_INFO *info,int arg) | |||
2081 | } | 2088 | } |
2082 | 2089 | ||
2083 | /* get new irq counts */ | 2090 | /* get new irq counts */ |
2084 | spin_lock_irqsave(&info->lock,flags); | 2091 | spin_lock_irqsave(&info->lock, flags); |
2085 | cnow = info->icount; | 2092 | cnow = info->icount; |
2086 | set_current_state(TASK_INTERRUPTIBLE); | 2093 | set_current_state(TASK_INTERRUPTIBLE); |
2087 | spin_unlock_irqrestore(&info->lock,flags); | 2094 | spin_unlock_irqrestore(&info->lock, flags); |
2088 | 2095 | ||
2089 | /* if no change, wait aborted for some reason */ | 2096 | /* if no change, wait aborted for some reason */ |
2090 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2097 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
@@ -2115,11 +2122,11 @@ static int tiocmget(struct tty_struct *tty) | |||
2115 | { | 2122 | { |
2116 | MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; | 2123 | MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; |
2117 | unsigned int result; | 2124 | unsigned int result; |
2118 | unsigned long flags; | 2125 | unsigned long flags; |
2119 | 2126 | ||
2120 | spin_lock_irqsave(&info->lock,flags); | 2127 | spin_lock_irqsave(&info->lock, flags); |
2121 | get_signals(info); | 2128 | get_signals(info); |
2122 | spin_unlock_irqrestore(&info->lock,flags); | 2129 | spin_unlock_irqrestore(&info->lock, flags); |
2123 | 2130 | ||
2124 | result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) + | 2131 | result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) + |
2125 | ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) + | 2132 | ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) + |
@@ -2130,7 +2137,7 @@ static int tiocmget(struct tty_struct *tty) | |||
2130 | 2137 | ||
2131 | if (debug_level >= DEBUG_LEVEL_INFO) | 2138 | if (debug_level >= DEBUG_LEVEL_INFO) |
2132 | printk("%s(%d):%s tiocmget() value=%08X\n", | 2139 | printk("%s(%d):%s tiocmget() value=%08X\n", |
2133 | __FILE__,__LINE__, info->device_name, result ); | 2140 | __FILE__, __LINE__, info->device_name, result); |
2134 | return result; | 2141 | return result; |
2135 | } | 2142 | } |
2136 | 2143 | ||
@@ -2140,11 +2147,11 @@ static int tiocmset(struct tty_struct *tty, | |||
2140 | unsigned int set, unsigned int clear) | 2147 | unsigned int set, unsigned int clear) |
2141 | { | 2148 | { |
2142 | MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; | 2149 | MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; |
2143 | unsigned long flags; | 2150 | unsigned long flags; |
2144 | 2151 | ||
2145 | if (debug_level >= DEBUG_LEVEL_INFO) | 2152 | if (debug_level >= DEBUG_LEVEL_INFO) |
2146 | printk("%s(%d):%s tiocmset(%x,%x)\n", | 2153 | printk("%s(%d):%s tiocmset(%x,%x)\n", |
2147 | __FILE__,__LINE__,info->device_name, set, clear); | 2154 | __FILE__, __LINE__, info->device_name, set, clear); |
2148 | 2155 | ||
2149 | if (set & TIOCM_RTS) | 2156 | if (set & TIOCM_RTS) |
2150 | info->serial_signals |= SerialSignal_RTS; | 2157 | info->serial_signals |= SerialSignal_RTS; |
@@ -2155,9 +2162,9 @@ static int tiocmset(struct tty_struct *tty, | |||
2155 | if (clear & TIOCM_DTR) | 2162 | if (clear & TIOCM_DTR) |
2156 | info->serial_signals &= ~SerialSignal_DTR; | 2163 | info->serial_signals &= ~SerialSignal_DTR; |
2157 | 2164 | ||
2158 | spin_lock_irqsave(&info->lock,flags); | 2165 | spin_lock_irqsave(&info->lock, flags); |
2159 | set_signals(info); | 2166 | set_signals(info); |
2160 | spin_unlock_irqrestore(&info->lock,flags); | 2167 | spin_unlock_irqrestore(&info->lock, flags); |
2161 | 2168 | ||
2162 | return 0; | 2169 | return 0; |
2163 | } | 2170 | } |
@@ -2174,17 +2181,17 @@ static int mgslpc_break(struct tty_struct *tty, int break_state) | |||
2174 | 2181 | ||
2175 | if (debug_level >= DEBUG_LEVEL_INFO) | 2182 | if (debug_level >= DEBUG_LEVEL_INFO) |
2176 | printk("%s(%d):mgslpc_break(%s,%d)\n", | 2183 | printk("%s(%d):mgslpc_break(%s,%d)\n", |
2177 | __FILE__,__LINE__, info->device_name, break_state); | 2184 | __FILE__, __LINE__, info->device_name, break_state); |
2178 | 2185 | ||
2179 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break")) | 2186 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break")) |
2180 | return -EINVAL; | 2187 | return -EINVAL; |
2181 | 2188 | ||
2182 | spin_lock_irqsave(&info->lock,flags); | 2189 | spin_lock_irqsave(&info->lock, flags); |
2183 | if (break_state == -1) | 2190 | if (break_state == -1) |
2184 | set_reg_bits(info, CHA+DAFO, BIT6); | 2191 | set_reg_bits(info, CHA+DAFO, BIT6); |
2185 | else | 2192 | else |
2186 | clear_reg_bits(info, CHA+DAFO, BIT6); | 2193 | clear_reg_bits(info, CHA+DAFO, BIT6); |
2187 | spin_unlock_irqrestore(&info->lock,flags); | 2194 | spin_unlock_irqrestore(&info->lock, flags); |
2188 | return 0; | 2195 | return 0; |
2189 | } | 2196 | } |
2190 | 2197 | ||
@@ -2195,9 +2202,9 @@ static int mgslpc_get_icount(struct tty_struct *tty, | |||
2195 | struct mgsl_icount cnow; /* kernel counter temps */ | 2202 | struct mgsl_icount cnow; /* kernel counter temps */ |
2196 | unsigned long flags; | 2203 | unsigned long flags; |
2197 | 2204 | ||
2198 | spin_lock_irqsave(&info->lock,flags); | 2205 | spin_lock_irqsave(&info->lock, flags); |
2199 | cnow = info->icount; | 2206 | cnow = info->icount; |
2200 | spin_unlock_irqrestore(&info->lock,flags); | 2207 | spin_unlock_irqrestore(&info->lock, flags); |
2201 | 2208 | ||
2202 | icount->cts = cnow.cts; | 2209 | icount->cts = cnow.cts; |
2203 | icount->dsr = cnow.dsr; | 2210 | icount->dsr = cnow.dsr; |
@@ -2218,9 +2225,9 @@ static int mgslpc_get_icount(struct tty_struct *tty, | |||
2218 | * | 2225 | * |
2219 | * Arguments: | 2226 | * Arguments: |
2220 | * | 2227 | * |
2221 | * tty pointer to tty instance data | 2228 | * tty pointer to tty instance data |
2222 | * cmd IOCTL command code | 2229 | * cmd IOCTL command code |
2223 | * arg command argument/context | 2230 | * arg command argument/context |
2224 | * | 2231 | * |
2225 | * Return Value: 0 if success, otherwise error code | 2232 | * Return Value: 0 if success, otherwise error code |
2226 | */ | 2233 | */ |
@@ -2231,8 +2238,8 @@ static int mgslpc_ioctl(struct tty_struct *tty, | |||
2231 | void __user *argp = (void __user *)arg; | 2238 | void __user *argp = (void __user *)arg; |
2232 | 2239 | ||
2233 | if (debug_level >= DEBUG_LEVEL_INFO) | 2240 | if (debug_level >= DEBUG_LEVEL_INFO) |
2234 | printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__, | 2241 | printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__, __LINE__, |
2235 | info->device_name, cmd ); | 2242 | info->device_name, cmd); |
2236 | 2243 | ||
2237 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl")) | 2244 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl")) |
2238 | return -ENODEV; | 2245 | return -ENODEV; |
@@ -2278,8 +2285,8 @@ static int mgslpc_ioctl(struct tty_struct *tty, | |||
2278 | * | 2285 | * |
2279 | * Arguments: | 2286 | * Arguments: |
2280 | * | 2287 | * |
2281 | * tty pointer to tty structure | 2288 | * tty pointer to tty structure |
2282 | * termios pointer to buffer to hold returned old termios | 2289 | * termios pointer to buffer to hold returned old termios |
2283 | */ | 2290 | */ |
2284 | static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | 2291 | static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
2285 | { | 2292 | { |
@@ -2287,8 +2294,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term | |||
2287 | unsigned long flags; | 2294 | unsigned long flags; |
2288 | 2295 | ||
2289 | if (debug_level >= DEBUG_LEVEL_INFO) | 2296 | if (debug_level >= DEBUG_LEVEL_INFO) |
2290 | printk("%s(%d):mgslpc_set_termios %s\n", __FILE__,__LINE__, | 2297 | printk("%s(%d):mgslpc_set_termios %s\n", __FILE__, __LINE__, |
2291 | tty->driver->name ); | 2298 | tty->driver->name); |
2292 | 2299 | ||
2293 | /* just return if nothing has changed */ | 2300 | /* just return if nothing has changed */ |
2294 | if ((tty->termios.c_cflag == old_termios->c_cflag) | 2301 | if ((tty->termios.c_cflag == old_termios->c_cflag) |
@@ -2302,22 +2309,22 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term | |||
2302 | if (old_termios->c_cflag & CBAUD && | 2309 | if (old_termios->c_cflag & CBAUD && |
2303 | !(tty->termios.c_cflag & CBAUD)) { | 2310 | !(tty->termios.c_cflag & CBAUD)) { |
2304 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); | 2311 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
2305 | spin_lock_irqsave(&info->lock,flags); | 2312 | spin_lock_irqsave(&info->lock, flags); |
2306 | set_signals(info); | 2313 | set_signals(info); |
2307 | spin_unlock_irqrestore(&info->lock,flags); | 2314 | spin_unlock_irqrestore(&info->lock, flags); |
2308 | } | 2315 | } |
2309 | 2316 | ||
2310 | /* Handle transition away from B0 status */ | 2317 | /* Handle transition away from B0 status */ |
2311 | if (!(old_termios->c_cflag & CBAUD) && | 2318 | if (!(old_termios->c_cflag & CBAUD) && |
2312 | tty->termios.c_cflag & CBAUD) { | 2319 | tty->termios.c_cflag & CBAUD) { |
2313 | info->serial_signals |= SerialSignal_DTR; | 2320 | info->serial_signals |= SerialSignal_DTR; |
2314 | if (!(tty->termios.c_cflag & CRTSCTS) || | 2321 | if (!(tty->termios.c_cflag & CRTSCTS) || |
2315 | !test_bit(TTY_THROTTLED, &tty->flags)) { | 2322 | !test_bit(TTY_THROTTLED, &tty->flags)) { |
2316 | info->serial_signals |= SerialSignal_RTS; | 2323 | info->serial_signals |= SerialSignal_RTS; |
2317 | } | 2324 | } |
2318 | spin_lock_irqsave(&info->lock,flags); | 2325 | spin_lock_irqsave(&info->lock, flags); |
2319 | set_signals(info); | 2326 | set_signals(info); |
2320 | spin_unlock_irqrestore(&info->lock,flags); | 2327 | spin_unlock_irqrestore(&info->lock, flags); |
2321 | } | 2328 | } |
2322 | 2329 | ||
2323 | /* Handle turning off CRTSCTS */ | 2330 | /* Handle turning off CRTSCTS */ |
@@ -2338,15 +2345,15 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp) | |||
2338 | 2345 | ||
2339 | if (debug_level >= DEBUG_LEVEL_INFO) | 2346 | if (debug_level >= DEBUG_LEVEL_INFO) |
2340 | printk("%s(%d):mgslpc_close(%s) entry, count=%d\n", | 2347 | printk("%s(%d):mgslpc_close(%s) entry, count=%d\n", |
2341 | __FILE__,__LINE__, info->device_name, port->count); | 2348 | __FILE__, __LINE__, info->device_name, port->count); |
2342 | 2349 | ||
2343 | WARN_ON(!port->count); | 2350 | WARN_ON(!port->count); |
2344 | 2351 | ||
2345 | if (tty_port_close_start(port, tty, filp) == 0) | 2352 | if (tty_port_close_start(port, tty, filp) == 0) |
2346 | goto cleanup; | 2353 | goto cleanup; |
2347 | 2354 | ||
2348 | if (port->flags & ASYNC_INITIALIZED) | 2355 | if (port->flags & ASYNC_INITIALIZED) |
2349 | mgslpc_wait_until_sent(tty, info->timeout); | 2356 | mgslpc_wait_until_sent(tty, info->timeout); |
2350 | 2357 | ||
2351 | mgslpc_flush_buffer(tty); | 2358 | mgslpc_flush_buffer(tty); |
2352 | 2359 | ||
@@ -2357,7 +2364,7 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp) | |||
2357 | tty_port_tty_set(port, NULL); | 2364 | tty_port_tty_set(port, NULL); |
2358 | cleanup: | 2365 | cleanup: |
2359 | if (debug_level >= DEBUG_LEVEL_INFO) | 2366 | if (debug_level >= DEBUG_LEVEL_INFO) |
2360 | printk("%s(%d):mgslpc_close(%s) exit, count=%d\n", __FILE__,__LINE__, | 2367 | printk("%s(%d):mgslpc_close(%s) exit, count=%d\n", __FILE__, __LINE__, |
2361 | tty->driver->name, port->count); | 2368 | tty->driver->name, port->count); |
2362 | } | 2369 | } |
2363 | 2370 | ||
@@ -2368,12 +2375,12 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout) | |||
2368 | MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; | 2375 | MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; |
2369 | unsigned long orig_jiffies, char_time; | 2376 | unsigned long orig_jiffies, char_time; |
2370 | 2377 | ||
2371 | if (!info ) | 2378 | if (!info) |
2372 | return; | 2379 | return; |
2373 | 2380 | ||
2374 | if (debug_level >= DEBUG_LEVEL_INFO) | 2381 | if (debug_level >= DEBUG_LEVEL_INFO) |
2375 | printk("%s(%d):mgslpc_wait_until_sent(%s) entry\n", | 2382 | printk("%s(%d):mgslpc_wait_until_sent(%s) entry\n", |
2376 | __FILE__,__LINE__, info->device_name ); | 2383 | __FILE__, __LINE__, info->device_name); |
2377 | 2384 | ||
2378 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent")) | 2385 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent")) |
2379 | return; | 2386 | return; |
@@ -2389,8 +2396,8 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout) | |||
2389 | * Note: use tight timings here to satisfy the NIST-PCTS. | 2396 | * Note: use tight timings here to satisfy the NIST-PCTS. |
2390 | */ | 2397 | */ |
2391 | 2398 | ||
2392 | if ( info->params.data_rate ) { | 2399 | if (info->params.data_rate) { |
2393 | char_time = info->timeout/(32 * 5); | 2400 | char_time = info->timeout/(32 * 5); |
2394 | if (!char_time) | 2401 | if (!char_time) |
2395 | char_time++; | 2402 | char_time++; |
2396 | } else | 2403 | } else |
@@ -2421,7 +2428,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout) | |||
2421 | exit: | 2428 | exit: |
2422 | if (debug_level >= DEBUG_LEVEL_INFO) | 2429 | if (debug_level >= DEBUG_LEVEL_INFO) |
2423 | printk("%s(%d):mgslpc_wait_until_sent(%s) exit\n", | 2430 | printk("%s(%d):mgslpc_wait_until_sent(%s) exit\n", |
2424 | __FILE__,__LINE__, info->device_name ); | 2431 | __FILE__, __LINE__, info->device_name); |
2425 | } | 2432 | } |
2426 | 2433 | ||
2427 | /* Called by tty_hangup() when a hangup is signaled. | 2434 | /* Called by tty_hangup() when a hangup is signaled. |
@@ -2433,7 +2440,7 @@ static void mgslpc_hangup(struct tty_struct *tty) | |||
2433 | 2440 | ||
2434 | if (debug_level >= DEBUG_LEVEL_INFO) | 2441 | if (debug_level >= DEBUG_LEVEL_INFO) |
2435 | printk("%s(%d):mgslpc_hangup(%s)\n", | 2442 | printk("%s(%d):mgslpc_hangup(%s)\n", |
2436 | __FILE__,__LINE__, info->device_name ); | 2443 | __FILE__, __LINE__, info->device_name); |
2437 | 2444 | ||
2438 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup")) | 2445 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup")) |
2439 | return; | 2446 | return; |
@@ -2448,9 +2455,9 @@ static int carrier_raised(struct tty_port *port) | |||
2448 | MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); | 2455 | MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); |
2449 | unsigned long flags; | 2456 | unsigned long flags; |
2450 | 2457 | ||
2451 | spin_lock_irqsave(&info->lock,flags); | 2458 | spin_lock_irqsave(&info->lock, flags); |
2452 | get_signals(info); | 2459 | get_signals(info); |
2453 | spin_unlock_irqrestore(&info->lock,flags); | 2460 | spin_unlock_irqrestore(&info->lock, flags); |
2454 | 2461 | ||
2455 | if (info->serial_signals & SerialSignal_DCD) | 2462 | if (info->serial_signals & SerialSignal_DCD) |
2456 | return 1; | 2463 | return 1; |
@@ -2462,13 +2469,13 @@ static void dtr_rts(struct tty_port *port, int onoff) | |||
2462 | MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); | 2469 | MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); |
2463 | unsigned long flags; | 2470 | unsigned long flags; |
2464 | 2471 | ||
2465 | spin_lock_irqsave(&info->lock,flags); | 2472 | spin_lock_irqsave(&info->lock, flags); |
2466 | if (onoff) | 2473 | if (onoff) |
2467 | info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; | 2474 | info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; |
2468 | else | 2475 | else |
2469 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); | 2476 | info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
2470 | set_signals(info); | 2477 | set_signals(info); |
2471 | spin_unlock_irqrestore(&info->lock,flags); | 2478 | spin_unlock_irqrestore(&info->lock, flags); |
2472 | } | 2479 | } |
2473 | 2480 | ||
2474 | 2481 | ||
@@ -2476,14 +2483,14 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp) | |||
2476 | { | 2483 | { |
2477 | MGSLPC_INFO *info; | 2484 | MGSLPC_INFO *info; |
2478 | struct tty_port *port; | 2485 | struct tty_port *port; |
2479 | int retval, line; | 2486 | int retval, line; |
2480 | unsigned long flags; | 2487 | unsigned long flags; |
2481 | 2488 | ||
2482 | /* verify range of specified line number */ | 2489 | /* verify range of specified line number */ |
2483 | line = tty->index; | 2490 | line = tty->index; |
2484 | if (line >= mgslpc_device_count) { | 2491 | if (line >= mgslpc_device_count) { |
2485 | printk("%s(%d):mgslpc_open with invalid line #%d.\n", | 2492 | printk("%s(%d):mgslpc_open with invalid line #%d.\n", |
2486 | __FILE__,__LINE__,line); | 2493 | __FILE__, __LINE__, line); |
2487 | return -ENODEV; | 2494 | return -ENODEV; |
2488 | } | 2495 | } |
2489 | 2496 | ||
@@ -2500,7 +2507,7 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp) | |||
2500 | 2507 | ||
2501 | if (debug_level >= DEBUG_LEVEL_INFO) | 2508 | if (debug_level >= DEBUG_LEVEL_INFO) |
2502 | printk("%s(%d):mgslpc_open(%s), old ref count = %d\n", | 2509 | printk("%s(%d):mgslpc_open(%s), old ref count = %d\n", |
2503 | __FILE__,__LINE__,tty->driver->name, port->count); | 2510 | __FILE__, __LINE__, tty->driver->name, port->count); |
2504 | 2511 | ||
2505 | /* If port is closing, signal caller to try again */ | 2512 | /* If port is closing, signal caller to try again */ |
2506 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING){ | 2513 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING){ |
@@ -2535,13 +2542,13 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp) | |||
2535 | if (retval) { | 2542 | if (retval) { |
2536 | if (debug_level >= DEBUG_LEVEL_INFO) | 2543 | if (debug_level >= DEBUG_LEVEL_INFO) |
2537 | printk("%s(%d):block_til_ready(%s) returned %d\n", | 2544 | printk("%s(%d):block_til_ready(%s) returned %d\n", |
2538 | __FILE__,__LINE__, info->device_name, retval); | 2545 | __FILE__, __LINE__, info->device_name, retval); |
2539 | goto cleanup; | 2546 | goto cleanup; |
2540 | } | 2547 | } |
2541 | 2548 | ||
2542 | if (debug_level >= DEBUG_LEVEL_INFO) | 2549 | if (debug_level >= DEBUG_LEVEL_INFO) |
2543 | printk("%s(%d):mgslpc_open(%s) success\n", | 2550 | printk("%s(%d):mgslpc_open(%s) success\n", |
2544 | __FILE__,__LINE__, info->device_name); | 2551 | __FILE__, __LINE__, info->device_name); |
2545 | retval = 0; | 2552 | retval = 0; |
2546 | 2553 | ||
2547 | cleanup: | 2554 | cleanup: |
@@ -2561,9 +2568,9 @@ static inline void line_info(struct seq_file *m, MGSLPC_INFO *info) | |||
2561 | info->device_name, info->io_base, info->irq_level); | 2568 | info->device_name, info->io_base, info->irq_level); |
2562 | 2569 | ||
2563 | /* output current serial signal states */ | 2570 | /* output current serial signal states */ |
2564 | spin_lock_irqsave(&info->lock,flags); | 2571 | spin_lock_irqsave(&info->lock, flags); |
2565 | get_signals(info); | 2572 | get_signals(info); |
2566 | spin_unlock_irqrestore(&info->lock,flags); | 2573 | spin_unlock_irqrestore(&info->lock, flags); |
2567 | 2574 | ||
2568 | stat_buf[0] = 0; | 2575 | stat_buf[0] = 0; |
2569 | stat_buf[1] = 0; | 2576 | stat_buf[1] = 0; |
@@ -2625,7 +2632,7 @@ static int mgslpc_proc_show(struct seq_file *m, void *v) | |||
2625 | seq_printf(m, "synclink driver:%s\n", driver_version); | 2632 | seq_printf(m, "synclink driver:%s\n", driver_version); |
2626 | 2633 | ||
2627 | info = mgslpc_device_list; | 2634 | info = mgslpc_device_list; |
2628 | while( info ) { | 2635 | while (info) { |
2629 | line_info(m, info); | 2636 | line_info(m, info); |
2630 | info = info->next_device; | 2637 | info = info->next_device; |
2631 | } | 2638 | } |
@@ -2686,8 +2693,8 @@ static void rx_free_buffers(MGSLPC_INFO *info) | |||
2686 | 2693 | ||
2687 | static int claim_resources(MGSLPC_INFO *info) | 2694 | static int claim_resources(MGSLPC_INFO *info) |
2688 | { | 2695 | { |
2689 | if (rx_alloc_buffers(info) < 0 ) { | 2696 | if (rx_alloc_buffers(info) < 0) { |
2690 | printk( "Can't allocate rx buffer %s\n", info->device_name); | 2697 | printk("Can't allocate rx buffer %s\n", info->device_name); |
2691 | release_resources(info); | 2698 | release_resources(info); |
2692 | return -ENODEV; | 2699 | return -ENODEV; |
2693 | } | 2700 | } |
@@ -2706,8 +2713,12 @@ static void release_resources(MGSLPC_INFO *info) | |||
2706 | * | 2713 | * |
2707 | * Arguments: info pointer to device instance data | 2714 | * Arguments: info pointer to device instance data |
2708 | */ | 2715 | */ |
2709 | static void mgslpc_add_device(MGSLPC_INFO *info) | 2716 | static int mgslpc_add_device(MGSLPC_INFO *info) |
2710 | { | 2717 | { |
2718 | MGSLPC_INFO *current_dev = NULL; | ||
2719 | struct device *tty_dev; | ||
2720 | int ret; | ||
2721 | |||
2711 | info->next_device = NULL; | 2722 | info->next_device = NULL; |
2712 | info->line = mgslpc_device_count; | 2723 | info->line = mgslpc_device_count; |
2713 | sprintf(info->device_name,"ttySLP%d",info->line); | 2724 | sprintf(info->device_name,"ttySLP%d",info->line); |
@@ -2722,8 +2733,8 @@ static void mgslpc_add_device(MGSLPC_INFO *info) | |||
2722 | if (!mgslpc_device_list) | 2733 | if (!mgslpc_device_list) |
2723 | mgslpc_device_list = info; | 2734 | mgslpc_device_list = info; |
2724 | else { | 2735 | else { |
2725 | MGSLPC_INFO *current_dev = mgslpc_device_list; | 2736 | current_dev = mgslpc_device_list; |
2726 | while( current_dev->next_device ) | 2737 | while (current_dev->next_device) |
2727 | current_dev = current_dev->next_device; | 2738 | current_dev = current_dev->next_device; |
2728 | current_dev->next_device = info; | 2739 | current_dev->next_device = info; |
2729 | } | 2740 | } |
@@ -2733,14 +2744,34 @@ static void mgslpc_add_device(MGSLPC_INFO *info) | |||
2733 | else if (info->max_frame_size > 65535) | 2744 | else if (info->max_frame_size > 65535) |
2734 | info->max_frame_size = 65535; | 2745 | info->max_frame_size = 65535; |
2735 | 2746 | ||
2736 | printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n", | 2747 | printk("SyncLink PC Card %s:IO=%04X IRQ=%d\n", |
2737 | info->device_name, info->io_base, info->irq_level); | 2748 | info->device_name, info->io_base, info->irq_level); |
2738 | 2749 | ||
2739 | #if SYNCLINK_GENERIC_HDLC | 2750 | #if SYNCLINK_GENERIC_HDLC |
2740 | hdlcdev_init(info); | 2751 | ret = hdlcdev_init(info); |
2752 | if (ret != 0) | ||
2753 | goto failed; | ||
2741 | #endif | 2754 | #endif |
2742 | tty_port_register_device(&info->port, serial_driver, info->line, | 2755 | |
2756 | tty_dev = tty_port_register_device(&info->port, serial_driver, info->line, | ||
2743 | &info->p_dev->dev); | 2757 | &info->p_dev->dev); |
2758 | if (IS_ERR(tty_dev)) { | ||
2759 | ret = PTR_ERR(tty_dev); | ||
2760 | #if SYNCLINK_GENERIC_HDLC | ||
2761 | hdlcdev_exit(info); | ||
2762 | #endif | ||
2763 | goto failed; | ||
2764 | } | ||
2765 | |||
2766 | return 0; | ||
2767 | |||
2768 | failed: | ||
2769 | if (current_dev) | ||
2770 | current_dev->next_device = NULL; | ||
2771 | else | ||
2772 | mgslpc_device_list = NULL; | ||
2773 | mgslpc_device_count--; | ||
2774 | return ret; | ||
2744 | } | 2775 | } |
2745 | 2776 | ||
2746 | static void mgslpc_remove_device(MGSLPC_INFO *remove_info) | 2777 | static void mgslpc_remove_device(MGSLPC_INFO *remove_info) |
@@ -3262,7 +3293,7 @@ static void rx_stop(MGSLPC_INFO *info) | |||
3262 | { | 3293 | { |
3263 | if (debug_level >= DEBUG_LEVEL_ISR) | 3294 | if (debug_level >= DEBUG_LEVEL_ISR) |
3264 | printk("%s(%d):rx_stop(%s)\n", | 3295 | printk("%s(%d):rx_stop(%s)\n", |
3265 | __FILE__,__LINE__, info->device_name ); | 3296 | __FILE__, __LINE__, info->device_name); |
3266 | 3297 | ||
3267 | /* MODE:03 RAC Receiver Active, 0=inactive */ | 3298 | /* MODE:03 RAC Receiver Active, 0=inactive */ |
3268 | clear_reg_bits(info, CHA + MODE, BIT3); | 3299 | clear_reg_bits(info, CHA + MODE, BIT3); |
@@ -3275,7 +3306,7 @@ static void rx_start(MGSLPC_INFO *info) | |||
3275 | { | 3306 | { |
3276 | if (debug_level >= DEBUG_LEVEL_ISR) | 3307 | if (debug_level >= DEBUG_LEVEL_ISR) |
3277 | printk("%s(%d):rx_start(%s)\n", | 3308 | printk("%s(%d):rx_start(%s)\n", |
3278 | __FILE__,__LINE__, info->device_name ); | 3309 | __FILE__, __LINE__, info->device_name); |
3279 | 3310 | ||
3280 | rx_reset_buffers(info); | 3311 | rx_reset_buffers(info); |
3281 | info->rx_enabled = false; | 3312 | info->rx_enabled = false; |
@@ -3291,7 +3322,7 @@ static void tx_start(MGSLPC_INFO *info, struct tty_struct *tty) | |||
3291 | { | 3322 | { |
3292 | if (debug_level >= DEBUG_LEVEL_ISR) | 3323 | if (debug_level >= DEBUG_LEVEL_ISR) |
3293 | printk("%s(%d):tx_start(%s)\n", | 3324 | printk("%s(%d):tx_start(%s)\n", |
3294 | __FILE__,__LINE__, info->device_name ); | 3325 | __FILE__, __LINE__, info->device_name); |
3295 | 3326 | ||
3296 | if (info->tx_count) { | 3327 | if (info->tx_count) { |
3297 | /* If auto RTS enabled and RTS is inactive, then assert */ | 3328 | /* If auto RTS enabled and RTS is inactive, then assert */ |
@@ -3329,7 +3360,7 @@ static void tx_stop(MGSLPC_INFO *info) | |||
3329 | { | 3360 | { |
3330 | if (debug_level >= DEBUG_LEVEL_ISR) | 3361 | if (debug_level >= DEBUG_LEVEL_ISR) |
3331 | printk("%s(%d):tx_stop(%s)\n", | 3362 | printk("%s(%d):tx_stop(%s)\n", |
3332 | __FILE__,__LINE__, info->device_name ); | 3363 | __FILE__, __LINE__, info->device_name); |
3333 | 3364 | ||
3334 | del_timer(&info->tx_timer); | 3365 | del_timer(&info->tx_timer); |
3335 | 3366 | ||
@@ -3681,7 +3712,7 @@ static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty) | |||
3681 | 3712 | ||
3682 | if (debug_level >= DEBUG_LEVEL_BH) | 3713 | if (debug_level >= DEBUG_LEVEL_BH) |
3683 | 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", |
3684 | __FILE__,__LINE__,info->device_name,status,framesize); | 3715 | __FILE__, __LINE__, info->device_name, status, framesize); |
3685 | 3716 | ||
3686 | if (debug_level >= DEBUG_LEVEL_DATA) | 3717 | if (debug_level >= DEBUG_LEVEL_DATA) |
3687 | trace_block(info, buf->data, framesize, 0); | 3718 | trace_block(info, buf->data, framesize, 0); |
@@ -3709,13 +3740,13 @@ static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty) | |||
3709 | } | 3740 | } |
3710 | } | 3741 | } |
3711 | 3742 | ||
3712 | spin_lock_irqsave(&info->lock,flags); | 3743 | spin_lock_irqsave(&info->lock, flags); |
3713 | buf->status = buf->count = 0; | 3744 | buf->status = buf->count = 0; |
3714 | info->rx_frame_count--; | 3745 | info->rx_frame_count--; |
3715 | info->rx_get++; | 3746 | info->rx_get++; |
3716 | if (info->rx_get >= info->rx_buf_count) | 3747 | if (info->rx_get >= info->rx_buf_count) |
3717 | info->rx_get = 0; | 3748 | info->rx_get = 0; |
3718 | spin_unlock_irqrestore(&info->lock,flags); | 3749 | spin_unlock_irqrestore(&info->lock, flags); |
3719 | 3750 | ||
3720 | return true; | 3751 | return true; |
3721 | } | 3752 | } |
@@ -3729,7 +3760,7 @@ static bool register_test(MGSLPC_INFO *info) | |||
3729 | bool rc = true; | 3760 | bool rc = true; |
3730 | unsigned long flags; | 3761 | unsigned long flags; |
3731 | 3762 | ||
3732 | spin_lock_irqsave(&info->lock,flags); | 3763 | spin_lock_irqsave(&info->lock, flags); |
3733 | reset_device(info); | 3764 | reset_device(info); |
3734 | 3765 | ||
3735 | for (i = 0; i < count; i++) { | 3766 | for (i = 0; i < count; i++) { |
@@ -3742,7 +3773,7 @@ static bool register_test(MGSLPC_INFO *info) | |||
3742 | } | 3773 | } |
3743 | } | 3774 | } |
3744 | 3775 | ||
3745 | spin_unlock_irqrestore(&info->lock,flags); | 3776 | spin_unlock_irqrestore(&info->lock, flags); |
3746 | return rc; | 3777 | return rc; |
3747 | } | 3778 | } |
3748 | 3779 | ||
@@ -3751,7 +3782,7 @@ static bool irq_test(MGSLPC_INFO *info) | |||
3751 | unsigned long end_time; | 3782 | unsigned long end_time; |
3752 | unsigned long flags; | 3783 | unsigned long flags; |
3753 | 3784 | ||
3754 | spin_lock_irqsave(&info->lock,flags); | 3785 | spin_lock_irqsave(&info->lock, flags); |
3755 | reset_device(info); | 3786 | reset_device(info); |
3756 | 3787 | ||
3757 | info->testing_irq = true; | 3788 | info->testing_irq = true; |
@@ -3765,7 +3796,7 @@ static bool irq_test(MGSLPC_INFO *info) | |||
3765 | write_reg(info, CHA + TIMR, 0); /* 512 cycles */ | 3796 | write_reg(info, CHA + TIMR, 0); /* 512 cycles */ |
3766 | issue_command(info, CHA, CMD_START_TIMER); | 3797 | issue_command(info, CHA, CMD_START_TIMER); |
3767 | 3798 | ||
3768 | spin_unlock_irqrestore(&info->lock,flags); | 3799 | spin_unlock_irqrestore(&info->lock, flags); |
3769 | 3800 | ||
3770 | end_time=100; | 3801 | end_time=100; |
3771 | while(end_time-- && !info->irq_occurred) { | 3802 | while(end_time-- && !info->irq_occurred) { |
@@ -3774,9 +3805,9 @@ static bool irq_test(MGSLPC_INFO *info) | |||
3774 | 3805 | ||
3775 | info->testing_irq = false; | 3806 | info->testing_irq = false; |
3776 | 3807 | ||
3777 | spin_lock_irqsave(&info->lock,flags); | 3808 | spin_lock_irqsave(&info->lock, flags); |
3778 | reset_device(info); | 3809 | reset_device(info); |
3779 | spin_unlock_irqrestore(&info->lock,flags); | 3810 | spin_unlock_irqrestore(&info->lock, flags); |
3780 | 3811 | ||
3781 | return info->irq_occurred; | 3812 | return info->irq_occurred; |
3782 | } | 3813 | } |
@@ -3785,21 +3816,21 @@ static int adapter_test(MGSLPC_INFO *info) | |||
3785 | { | 3816 | { |
3786 | if (!register_test(info)) { | 3817 | if (!register_test(info)) { |
3787 | info->init_error = DiagStatus_AddressFailure; | 3818 | info->init_error = DiagStatus_AddressFailure; |
3788 | 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", |
3789 | __FILE__,__LINE__,info->device_name, (unsigned short)(info->io_base) ); | 3820 | __FILE__, __LINE__, info->device_name, (unsigned short)(info->io_base)); |
3790 | return -ENODEV; | 3821 | return -ENODEV; |
3791 | } | 3822 | } |
3792 | 3823 | ||
3793 | if (!irq_test(info)) { | 3824 | if (!irq_test(info)) { |
3794 | info->init_error = DiagStatus_IrqFailure; | 3825 | info->init_error = DiagStatus_IrqFailure; |
3795 | 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", |
3796 | __FILE__,__LINE__,info->device_name, (unsigned short)(info->irq_level) ); | 3827 | __FILE__, __LINE__, info->device_name, (unsigned short)(info->irq_level)); |
3797 | return -ENODEV; | 3828 | return -ENODEV; |
3798 | } | 3829 | } |
3799 | 3830 | ||
3800 | if (debug_level >= DEBUG_LEVEL_INFO) | 3831 | if (debug_level >= DEBUG_LEVEL_INFO) |
3801 | printk("%s(%d):device %s passed diagnostics\n", | 3832 | printk("%s(%d):device %s passed diagnostics\n", |
3802 | __FILE__,__LINE__,info->device_name); | 3833 | __FILE__, __LINE__, info->device_name); |
3803 | return 0; | 3834 | return 0; |
3804 | } | 3835 | } |
3805 | 3836 | ||
@@ -3808,9 +3839,9 @@ static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit) | |||
3808 | int i; | 3839 | int i; |
3809 | int linecount; | 3840 | int linecount; |
3810 | if (xmit) | 3841 | if (xmit) |
3811 | printk("%s tx data:\n",info->device_name); | 3842 | printk("%s tx data:\n", info->device_name); |
3812 | else | 3843 | else |
3813 | printk("%s rx data:\n",info->device_name); | 3844 | printk("%s rx data:\n", info->device_name); |
3814 | 3845 | ||
3815 | while(count) { | 3846 | while(count) { |
3816 | if (count > 16) | 3847 | if (count > 16) |
@@ -3819,12 +3850,12 @@ static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit) | |||
3819 | linecount = count; | 3850 | linecount = count; |
3820 | 3851 | ||
3821 | for(i=0;i<linecount;i++) | 3852 | for(i=0;i<linecount;i++) |
3822 | printk("%02X ",(unsigned char)data[i]); | 3853 | printk("%02X ", (unsigned char)data[i]); |
3823 | for(;i<17;i++) | 3854 | for(;i<17;i++) |
3824 | printk(" "); | 3855 | printk(" "); |
3825 | for(i=0;i<linecount;i++) { | 3856 | for(i=0;i<linecount;i++) { |
3826 | if (data[i]>=040 && data[i]<=0176) | 3857 | if (data[i]>=040 && data[i]<=0176) |
3827 | printk("%c",data[i]); | 3858 | printk("%c", data[i]); |
3828 | else | 3859 | else |
3829 | printk("."); | 3860 | printk("."); |
3830 | } | 3861 | } |
@@ -3843,18 +3874,18 @@ static void tx_timeout(unsigned long context) | |||
3843 | MGSLPC_INFO *info = (MGSLPC_INFO*)context; | 3874 | MGSLPC_INFO *info = (MGSLPC_INFO*)context; |
3844 | unsigned long flags; | 3875 | unsigned long flags; |
3845 | 3876 | ||
3846 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 3877 | if (debug_level >= DEBUG_LEVEL_INFO) |
3847 | printk( "%s(%d):tx_timeout(%s)\n", | 3878 | printk("%s(%d):tx_timeout(%s)\n", |
3848 | __FILE__,__LINE__,info->device_name); | 3879 | __FILE__, __LINE__, info->device_name); |
3849 | if(info->tx_active && | 3880 | if (info->tx_active && |
3850 | info->params.mode == MGSL_MODE_HDLC) { | 3881 | info->params.mode == MGSL_MODE_HDLC) { |
3851 | info->icount.txtimeout++; | 3882 | info->icount.txtimeout++; |
3852 | } | 3883 | } |
3853 | spin_lock_irqsave(&info->lock,flags); | 3884 | spin_lock_irqsave(&info->lock, flags); |
3854 | info->tx_active = false; | 3885 | info->tx_active = false; |
3855 | info->tx_count = info->tx_put = info->tx_get = 0; | 3886 | info->tx_count = info->tx_put = info->tx_get = 0; |
3856 | 3887 | ||
3857 | spin_unlock_irqrestore(&info->lock,flags); | 3888 | spin_unlock_irqrestore(&info->lock, flags); |
3858 | 3889 | ||
3859 | #if SYNCLINK_GENERIC_HDLC | 3890 | #if SYNCLINK_GENERIC_HDLC |
3860 | if (info->netcount) | 3891 | if (info->netcount) |
@@ -3936,7 +3967,7 @@ static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb, | |||
3936 | unsigned long flags; | 3967 | unsigned long flags; |
3937 | 3968 | ||
3938 | if (debug_level >= DEBUG_LEVEL_INFO) | 3969 | if (debug_level >= DEBUG_LEVEL_INFO) |
3939 | printk(KERN_INFO "%s:hdlc_xmit(%s)\n",__FILE__,dev->name); | 3970 | printk(KERN_INFO "%s:hdlc_xmit(%s)\n", __FILE__, dev->name); |
3940 | 3971 | ||
3941 | /* stop sending until this frame completes */ | 3972 | /* stop sending until this frame completes */ |
3942 | netif_stop_queue(dev); | 3973 | netif_stop_queue(dev); |
@@ -3957,13 +3988,13 @@ static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb, | |||
3957 | dev->trans_start = jiffies; | 3988 | dev->trans_start = jiffies; |
3958 | 3989 | ||
3959 | /* start hardware transmitter if necessary */ | 3990 | /* start hardware transmitter if necessary */ |
3960 | spin_lock_irqsave(&info->lock,flags); | 3991 | spin_lock_irqsave(&info->lock, flags); |
3961 | if (!info->tx_active) { | 3992 | if (!info->tx_active) { |
3962 | struct tty_struct *tty = tty_port_tty_get(&info->port); | 3993 | struct tty_struct *tty = tty_port_tty_get(&info->port); |
3963 | tx_start(info, tty); | 3994 | tx_start(info, tty); |
3964 | tty_kref_put(tty); | 3995 | tty_kref_put(tty); |
3965 | } | 3996 | } |
3966 | spin_unlock_irqrestore(&info->lock,flags); | 3997 | spin_unlock_irqrestore(&info->lock, flags); |
3967 | 3998 | ||
3968 | return NETDEV_TX_OK; | 3999 | return NETDEV_TX_OK; |
3969 | } | 4000 | } |
@@ -3984,10 +4015,11 @@ static int hdlcdev_open(struct net_device *dev) | |||
3984 | unsigned long flags; | 4015 | unsigned long flags; |
3985 | 4016 | ||
3986 | if (debug_level >= DEBUG_LEVEL_INFO) | 4017 | if (debug_level >= DEBUG_LEVEL_INFO) |
3987 | printk("%s:hdlcdev_open(%s)\n",__FILE__,dev->name); | 4018 | printk("%s:hdlcdev_open(%s)\n", __FILE__, dev->name); |
3988 | 4019 | ||
3989 | /* generic HDLC layer open processing */ | 4020 | /* generic HDLC layer open processing */ |
3990 | if ((rc = hdlc_open(dev))) | 4021 | rc = hdlc_open(dev); |
4022 | if (rc != 0) | ||
3991 | return rc; | 4023 | return rc; |
3992 | 4024 | ||
3993 | /* arbitrate between network and tty opens */ | 4025 | /* arbitrate between network and tty opens */ |
@@ -4002,7 +4034,8 @@ static int hdlcdev_open(struct net_device *dev) | |||
4002 | 4034 | ||
4003 | tty = tty_port_tty_get(&info->port); | 4035 | tty = tty_port_tty_get(&info->port); |
4004 | /* claim resources and init adapter */ | 4036 | /* claim resources and init adapter */ |
4005 | if ((rc = startup(info, tty)) != 0) { | 4037 | rc = startup(info, tty); |
4038 | if (rc != 0) { | ||
4006 | tty_kref_put(tty); | 4039 | tty_kref_put(tty); |
4007 | spin_lock_irqsave(&info->netlock, flags); | 4040 | spin_lock_irqsave(&info->netlock, flags); |
4008 | info->netcount=0; | 4041 | info->netcount=0; |
@@ -4044,7 +4077,7 @@ static int hdlcdev_close(struct net_device *dev) | |||
4044 | unsigned long flags; | 4077 | unsigned long flags; |
4045 | 4078 | ||
4046 | if (debug_level >= DEBUG_LEVEL_INFO) | 4079 | if (debug_level >= DEBUG_LEVEL_INFO) |
4047 | printk("%s:hdlcdev_close(%s)\n",__FILE__,dev->name); | 4080 | printk("%s:hdlcdev_close(%s)\n", __FILE__, dev->name); |
4048 | 4081 | ||
4049 | netif_stop_queue(dev); | 4082 | netif_stop_queue(dev); |
4050 | 4083 | ||
@@ -4078,7 +4111,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
4078 | unsigned int flags; | 4111 | unsigned int flags; |
4079 | 4112 | ||
4080 | if (debug_level >= DEBUG_LEVEL_INFO) | 4113 | if (debug_level >= DEBUG_LEVEL_INFO) |
4081 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); | 4114 | printk("%s:hdlcdev_ioctl(%s)\n", __FILE__, dev->name); |
4082 | 4115 | ||
4083 | /* return error if TTY interface open */ | 4116 | /* return error if TTY interface open */ |
4084 | if (info->port.count) | 4117 | if (info->port.count) |
@@ -4179,14 +4212,14 @@ static void hdlcdev_tx_timeout(struct net_device *dev) | |||
4179 | unsigned long flags; | 4212 | unsigned long flags; |
4180 | 4213 | ||
4181 | if (debug_level >= DEBUG_LEVEL_INFO) | 4214 | if (debug_level >= DEBUG_LEVEL_INFO) |
4182 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); | 4215 | printk("hdlcdev_tx_timeout(%s)\n", dev->name); |
4183 | 4216 | ||
4184 | dev->stats.tx_errors++; | 4217 | dev->stats.tx_errors++; |
4185 | dev->stats.tx_aborted_errors++; | 4218 | dev->stats.tx_aborted_errors++; |
4186 | 4219 | ||
4187 | spin_lock_irqsave(&info->lock,flags); | 4220 | spin_lock_irqsave(&info->lock, flags); |
4188 | tx_stop(info); | 4221 | tx_stop(info); |
4189 | spin_unlock_irqrestore(&info->lock,flags); | 4222 | spin_unlock_irqrestore(&info->lock, flags); |
4190 | 4223 | ||
4191 | netif_wake_queue(dev); | 4224 | netif_wake_queue(dev); |
4192 | } | 4225 | } |
@@ -4217,7 +4250,7 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size) | |||
4217 | struct net_device *dev = info->netdev; | 4250 | struct net_device *dev = info->netdev; |
4218 | 4251 | ||
4219 | if (debug_level >= DEBUG_LEVEL_INFO) | 4252 | if (debug_level >= DEBUG_LEVEL_INFO) |
4220 | printk("hdlcdev_rx(%s)\n",dev->name); | 4253 | printk("hdlcdev_rx(%s)\n", dev->name); |
4221 | 4254 | ||
4222 | if (skb == NULL) { | 4255 | if (skb == NULL) { |
4223 | 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); |
@@ -4260,8 +4293,9 @@ static int hdlcdev_init(MGSLPC_INFO *info) | |||
4260 | 4293 | ||
4261 | /* allocate and initialize network and HDLC layer objects */ | 4294 | /* allocate and initialize network and HDLC layer objects */ |
4262 | 4295 | ||
4263 | if (!(dev = alloc_hdlcdev(info))) { | 4296 | dev = alloc_hdlcdev(info); |
4264 | 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__); | ||
4265 | return -ENOMEM; | 4299 | return -ENOMEM; |
4266 | } | 4300 | } |
4267 | 4301 | ||
@@ -4280,8 +4314,9 @@ static int hdlcdev_init(MGSLPC_INFO *info) | |||
4280 | hdlc->xmit = hdlcdev_xmit; | 4314 | hdlc->xmit = hdlcdev_xmit; |
4281 | 4315 | ||
4282 | /* register objects with HDLC layer */ | 4316 | /* register objects with HDLC layer */ |
4283 | if ((rc = register_hdlc_device(dev))) { | 4317 | rc = register_hdlc_device(dev); |
4284 | 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__); | ||
4285 | free_netdev(dev); | 4320 | free_netdev(dev); |
4286 | return rc; | 4321 | return rc; |
4287 | } | 4322 | } |