aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-09-19 16:13:31 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:31 -0400
commitbdc04e3174e18f475289fa8f4144f66686326b7e (patch)
treec0bf03c8d6df1629bfa26b686fe65ffb0c87aeb7 /drivers/char
parenta2bceae065ed8c4f552b35c4dde4cc2db05ce9e3 (diff)
serial: move delta_msr_wait into the tty_port
This is used by various drivers not just serial and can be extracted as commonality Signed-off-by: Alan Cox <alan@linux.intel.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/cyclades.c9
-rw-r--r--drivers/char/esp.c7
-rw-r--r--drivers/char/mxser.c8
-rw-r--r--drivers/char/tty_port.c2
4 files changed, 12 insertions, 14 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 70bd61b2a7d7..df5038bbcbc2 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -729,7 +729,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
729 if (mdm_change & CyRI) 729 if (mdm_change & CyRI)
730 info->icount.rng++; 730 info->icount.rng++;
731 731
732 wake_up_interruptible(&info->delta_msr_wait); 732 wake_up_interruptible(&info->port.delta_msr_wait);
733 } 733 }
734 734
735 if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) { 735 if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) {
@@ -1197,7 +1197,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1197 break; 1197 break;
1198 } 1198 }
1199 if (delta_count) 1199 if (delta_count)
1200 wake_up_interruptible(&info->delta_msr_wait); 1200 wake_up_interruptible(&info->port.delta_msr_wait);
1201 if (special_count) 1201 if (special_count)
1202 tty_schedule_flip(tty); 1202 tty_schedule_flip(tty);
1203 tty_kref_put(tty); 1203 tty_kref_put(tty);
@@ -1464,7 +1464,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1464 spin_lock_irqsave(&card->card_lock, flags); 1464 spin_lock_irqsave(&card->card_lock, flags);
1465 1465
1466 /* Clear delta_msr_wait queue to avoid mem leaks. */ 1466 /* Clear delta_msr_wait queue to avoid mem leaks. */
1467 wake_up_interruptible(&info->delta_msr_wait); 1467 wake_up_interruptible(&info->port.delta_msr_wait);
1468 1468
1469 if (info->port.xmit_buf) { 1469 if (info->port.xmit_buf) {
1470 unsigned char *temp; 1470 unsigned char *temp;
@@ -2788,7 +2788,7 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
2788 /* note the counters on entry */ 2788 /* note the counters on entry */
2789 cnow = info->icount; 2789 cnow = info->icount;
2790 spin_unlock_irqrestore(&info->card->card_lock, flags); 2790 spin_unlock_irqrestore(&info->card->card_lock, flags);
2791 ret_val = wait_event_interruptible(info->delta_msr_wait, 2791 ret_val = wait_event_interruptible(info->port.delta_msr_wait,
2792 cy_cflags_changed(info, arg, &cnow)); 2792 cy_cflags_changed(info, arg, &cnow));
2793 break; 2793 break;
2794 2794
@@ -3153,7 +3153,6 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
3153 info->port.close_delay = 5 * HZ / 10; 3153 info->port.close_delay = 5 * HZ / 10;
3154 info->port.flags = STD_COM_FLAGS; 3154 info->port.flags = STD_COM_FLAGS;
3155 init_completion(&info->shutdown_wait); 3155 init_completion(&info->shutdown_wait);
3156 init_waitqueue_head(&info->delta_msr_wait);
3157 3156
3158 if (cy_is_Z(cinfo)) { 3157 if (cy_is_Z(cinfo)) {
3159 struct FIRM_ID *firm_id = cinfo->base_addr + ID_ADDRESS; 3158 struct FIRM_ID *firm_id = cinfo->base_addr + ID_ADDRESS;
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index a5c59fc2b0ff..b19d43cd9542 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -572,7 +572,7 @@ static void check_modem_status(struct esp_struct *info)
572 info->icount.dcd++; 572 info->icount.dcd++;
573 if (status & UART_MSR_DCTS) 573 if (status & UART_MSR_DCTS)
574 info->icount.cts++; 574 info->icount.cts++;
575 wake_up_interruptible(&info->delta_msr_wait); 575 wake_up_interruptible(&info->port.delta_msr_wait);
576 } 576 }
577 577
578 if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { 578 if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
@@ -927,7 +927,7 @@ static void shutdown(struct esp_struct *info)
927 * clear delta_msr_wait queue to avoid mem leaks: we may free the irq 927 * clear delta_msr_wait queue to avoid mem leaks: we may free the irq
928 * here so the queue might never be waken up 928 * here so the queue might never be waken up
929 */ 929 */
930 wake_up_interruptible(&info->delta_msr_wait); 930 wake_up_interruptible(&info->port.delta_msr_wait);
931 wake_up_interruptible(&info->break_wait); 931 wake_up_interruptible(&info->break_wait);
932 932
933 /* stop a DMA transfer on the port being closed */ 933 /* stop a DMA transfer on the port being closed */
@@ -1800,7 +1800,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file *file,
1800 spin_unlock_irqrestore(&info->lock, flags); 1800 spin_unlock_irqrestore(&info->lock, flags);
1801 while (1) { 1801 while (1) {
1802 /* FIXME: convert to new style wakeup */ 1802 /* FIXME: convert to new style wakeup */
1803 interruptible_sleep_on(&info->delta_msr_wait); 1803 interruptible_sleep_on(&info->port.delta_msr_wait);
1804 /* see if a signal did it */ 1804 /* see if a signal did it */
1805 if (signal_pending(current)) 1805 if (signal_pending(current))
1806 return -ERESTARTSYS; 1806 return -ERESTARTSYS;
@@ -2452,7 +2452,6 @@ static int __init espserial_init(void)
2452 info->config.flow_off = flow_off; 2452 info->config.flow_off = flow_off;
2453 info->config.pio_threshold = pio_threshold; 2453 info->config.pio_threshold = pio_threshold;
2454 info->next_port = ports; 2454 info->next_port = ports;
2455 init_waitqueue_head(&info->delta_msr_wait);
2456 init_waitqueue_head(&info->break_wait); 2455 init_waitqueue_head(&info->break_wait);
2457 ports = info; 2456 ports = info;
2458 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", 2457 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 30544ca5e956..37058ff7da7d 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -258,7 +258,6 @@ struct mxser_port {
258 struct mxser_mon mon_data; 258 struct mxser_mon mon_data;
259 259
260 spinlock_t slock; 260 spinlock_t slock;
261 wait_queue_head_t delta_msr_wait;
262}; 261};
263 262
264struct mxser_board { 263struct mxser_board {
@@ -818,7 +817,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
818 if (status & UART_MSR_DCTS) 817 if (status & UART_MSR_DCTS)
819 port->icount.cts++; 818 port->icount.cts++;
820 port->mon_data.modem_status = status; 819 port->mon_data.modem_status = status;
821 wake_up_interruptible(&port->delta_msr_wait); 820 wake_up_interruptible(&port->port.delta_msr_wait);
822 821
823 if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { 822 if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
824 if (status & UART_MSR_DCD) 823 if (status & UART_MSR_DCD)
@@ -973,7 +972,7 @@ static void mxser_shutdown(struct tty_struct *tty)
973 * clear delta_msr_wait queue to avoid mem leaks: we may free the irq 972 * clear delta_msr_wait queue to avoid mem leaks: we may free the irq
974 * here so the queue might never be waken up 973 * here so the queue might never be waken up
975 */ 974 */
976 wake_up_interruptible(&info->delta_msr_wait); 975 wake_up_interruptible(&info->port.delta_msr_wait);
977 976
978 /* 977 /*
979 * Free the IRQ, if necessary 978 * Free the IRQ, if necessary
@@ -1762,7 +1761,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1762 cnow = info->icount; /* note the counters on entry */ 1761 cnow = info->icount; /* note the counters on entry */
1763 spin_unlock_irqrestore(&info->slock, flags); 1762 spin_unlock_irqrestore(&info->slock, flags);
1764 1763
1765 return wait_event_interruptible(info->delta_msr_wait, 1764 return wait_event_interruptible(info->port.delta_msr_wait,
1766 mxser_cflags_changed(info, arg, &cnow)); 1765 mxser_cflags_changed(info, arg, &cnow));
1767 /* 1766 /*
1768 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1767 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
@@ -2414,7 +2413,6 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2414 info->port.close_delay = 5 * HZ / 10; 2413 info->port.close_delay = 5 * HZ / 10;
2415 info->port.closing_wait = 30 * HZ; 2414 info->port.closing_wait = 30 * HZ;
2416 info->normal_termios = mxvar_sdriver->init_termios; 2415 info->normal_termios = mxvar_sdriver->init_termios;
2417 init_waitqueue_head(&info->delta_msr_wait);
2418 memset(&info->mon_data, 0, sizeof(struct mxser_mon)); 2416 memset(&info->mon_data, 0, sizeof(struct mxser_mon));
2419 info->err_shadow = 0; 2417 info->err_shadow = 0;
2420 spin_lock_init(&info->slock); 2418 spin_lock_init(&info->slock);
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index 549bd0fa8bb6..c767e30a1425 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -23,6 +23,7 @@ void tty_port_init(struct tty_port *port)
23 memset(port, 0, sizeof(*port)); 23 memset(port, 0, sizeof(*port));
24 init_waitqueue_head(&port->open_wait); 24 init_waitqueue_head(&port->open_wait);
25 init_waitqueue_head(&port->close_wait); 25 init_waitqueue_head(&port->close_wait);
26 init_waitqueue_head(&port->delta_msr_wait);
26 mutex_init(&port->mutex); 27 mutex_init(&port->mutex);
27 spin_lock_init(&port->lock); 28 spin_lock_init(&port->lock);
28 port->close_delay = (50 * HZ) / 100; 29 port->close_delay = (50 * HZ) / 100;
@@ -124,6 +125,7 @@ void tty_port_hangup(struct tty_port *port)
124 port->tty = NULL; 125 port->tty = NULL;
125 spin_unlock_irqrestore(&port->lock, flags); 126 spin_unlock_irqrestore(&port->lock, flags);
126 wake_up_interruptible(&port->open_wait); 127 wake_up_interruptible(&port->open_wait);
128 wake_up_interruptible(&port->delta_msr_wait);
127 tty_port_shutdown(port); 129 tty_port_shutdown(port);
128} 130}
129EXPORT_SYMBOL(tty_port_hangup); 131EXPORT_SYMBOL(tty_port_hangup);