aboutsummaryrefslogtreecommitdiffstats
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
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>
-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
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/amba-pl010.c2
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/icom.c2
-rw-r--r--drivers/serial/imx.c4
-rw-r--r--drivers/serial/ioc3_serial.c8
-rw-r--r--drivers/serial/ioc4_serial.c8
-rw-r--r--drivers/serial/ip22zilog.c2
-rw-r--r--drivers/serial/msm_serial.c2
-rw-r--r--drivers/serial/pmac_zilog.c2
-rw-r--r--drivers/serial/pnx8xxx_uart.c2
-rw-r--r--drivers/serial/pxa.c2
-rw-r--r--drivers/serial/sa1100.c2
-rw-r--r--drivers/serial/sb1250-duart.c2
-rw-r--r--drivers/serial/serial_core.c18
-rw-r--r--drivers/serial/serial_ks8695.c2
-rw-r--r--drivers/serial/serial_lh7a40x.c2
-rw-r--r--drivers/serial/sunsab.c2
-rw-r--r--drivers/serial/sunsu.c2
-rw-r--r--drivers/serial/sunzilog.c2
-rw-r--r--drivers/serial/timbuart.c2
-rw-r--r--drivers/serial/vr41xx_siu.c2
-rw-r--r--drivers/serial/zs.c2
-rw-r--r--include/linux/cyclades.h1
-rw-r--r--include/linux/hayesesp.h1
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/tty.h1
32 files changed, 54 insertions, 54 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);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index e415c5eca599..2209620d2349 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1510,7 +1510,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1510 if (status & UART_MSR_DCTS) 1510 if (status & UART_MSR_DCTS)
1511 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); 1511 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
1512 1512
1513 wake_up_interruptible(&up->port.state->delta_msr_wait); 1513 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
1514 } 1514 }
1515 1515
1516 return status; 1516 return status;
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 39032413d4a1..429a8ae86933 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -225,7 +225,7 @@ static void pl010_modem_status(struct uart_amba_port *uap)
225 if (delta & UART01x_FR_CTS) 225 if (delta & UART01x_FR_CTS)
226 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS); 226 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
227 227
228 wake_up_interruptible(&uap->port.state->delta_msr_wait); 228 wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
229} 229}
230 230
231static irqreturn_t pl010_int(int irq, void *dev_id) 231static irqreturn_t pl010_int(int irq, void *dev_id)
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index ef82a34baf0f..ef7adc8135dd 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -226,7 +226,7 @@ static void pl011_modem_status(struct uart_amba_port *uap)
226 if (delta & UART01x_FR_CTS) 226 if (delta & UART01x_FR_CTS)
227 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS); 227 uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
228 228
229 wake_up_interruptible(&uap->port.state->delta_msr_wait); 229 wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
230} 230}
231 231
232static irqreturn_t pl011_int(int irq, void *dev_id) 232static irqreturn_t pl011_int(int irq, void *dev_id)
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 963e3c12af41..3551c5cb7094 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -776,7 +776,7 @@ static void atmel_tasklet_func(unsigned long data)
776 if (status_change & ATMEL_US_CTS) 776 if (status_change & ATMEL_US_CTS)
777 uart_handle_cts_change(port, !(status & ATMEL_US_CTS)); 777 uart_handle_cts_change(port, !(status & ATMEL_US_CTS));
778 778
779 wake_up_interruptible(&port->state->delta_msr_wait); 779 wake_up_interruptible(&port->state->port.delta_msr_wait);
780 780
781 atmel_port->irq_status_prev = status; 781 atmel_port->irq_status_prev = status;
782 } 782 }
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index f86c47e08a06..2d7feecaf492 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -695,7 +695,7 @@ static inline void check_modem_status(struct icom_port *icom_port)
695 delta_status & ICOM_CTS); 695 delta_status & ICOM_CTS);
696 696
697 wake_up_interruptible(&icom_port->uart_port.state-> 697 wake_up_interruptible(&icom_port->uart_port.state->
698 delta_msr_wait); 698 port.delta_msr_wait);
699 old_status = status; 699 old_status = status;
700 } 700 }
701 spin_unlock(&icom_port->uart_port.lock); 701 spin_unlock(&icom_port->uart_port.lock);
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 1febeafcb97a..18130f11238e 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -224,7 +224,7 @@ static void imx_mctrl_check(struct imx_port *sport)
224 if (changed & TIOCM_CTS) 224 if (changed & TIOCM_CTS)
225 uart_handle_cts_change(&sport->port, status & TIOCM_CTS); 225 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
226 226
227 wake_up_interruptible(&sport->port.state->delta_msr_wait); 227 wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
228} 228}
229 229
230/* 230/*
@@ -388,7 +388,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)
388 388
389 writel(USR1_RTSD, sport->port.membase + USR1); 389 writel(USR1_RTSD, sport->port.membase + USR1);
390 uart_handle_cts_change(&sport->port, !!val); 390 uart_handle_cts_change(&sport->port, !!val);
391 wake_up_interruptible(&sport->port.state->delta_msr_wait); 391 wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
392 392
393 spin_unlock_irqrestore(&sport->port.lock, flags); 393 spin_unlock_irqrestore(&sport->port.lock, flags);
394 return IRQ_HANDLED; 394 return IRQ_HANDLED;
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index de4ab1bfee8d..d8983dd5c4b2 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -1287,7 +1287,7 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
1287 (port->ip_port, 0); 1287 (port->ip_port, 0);
1288 wake_up_interruptible 1288 wake_up_interruptible
1289 (&the_port->state-> 1289 (&the_port->state->
1290 delta_msr_wait); 1290 port.delta_msr_wait);
1291 } 1291 }
1292 1292
1293 /* If we had any data to return, we 1293 /* If we had any data to return, we
@@ -1491,7 +1491,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
1491 uart_handle_dcd_change(the_port, 1491 uart_handle_dcd_change(the_port,
1492 shadow & SHADOW_DCD); 1492 shadow & SHADOW_DCD);
1493 wake_up_interruptible 1493 wake_up_interruptible
1494 (&the_port->state->delta_msr_wait); 1494 (&the_port->state->port.delta_msr_wait);
1495 } else if ((port->ip_notify & N_DDCD) 1495 } else if ((port->ip_notify & N_DDCD)
1496 && !(shadow & SHADOW_DCD)) { 1496 && !(shadow & SHADOW_DCD)) {
1497 /* Flag delta DCD/no DCD */ 1497 /* Flag delta DCD/no DCD */
@@ -1511,7 +1511,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
1511 uart_handle_cts_change(the_port, shadow 1511 uart_handle_cts_change(the_port, shadow
1512 & SHADOW_CTS); 1512 & SHADOW_CTS);
1513 wake_up_interruptible 1513 wake_up_interruptible
1514 (&the_port->state->delta_msr_wait); 1514 (&the_port->state->port.delta_msr_wait);
1515 } 1515 }
1516 } 1516 }
1517 1517
@@ -1728,7 +1728,7 @@ static void ic3_shutdown(struct uart_port *the_port)
1728 return; 1728 return;
1729 1729
1730 state = the_port->state; 1730 state = the_port->state;
1731 wake_up_interruptible(&state->delta_msr_wait); 1731 wake_up_interruptible(&state->port.delta_msr_wait);
1732 1732
1733 spin_lock_irqsave(&the_port->lock, port_flags); 1733 spin_lock_irqsave(&the_port->lock, port_flags);
1734 set_notification(port, N_ALL, 0); 1734 set_notification(port, N_ALL, 0);
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 2055d323f15f..2e02c3026d24 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1882,7 +1882,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1882 the_port = port->ip_port; 1882 the_port = port->ip_port;
1883 the_port->icount.dcd = 1; 1883 the_port->icount.dcd = 1;
1884 wake_up_interruptible 1884 wake_up_interruptible
1885 (&the_port->state->delta_msr_wait); 1885 (&the_port->state->port.delta_msr_wait);
1886 } else if ((port->ip_notify & N_DDCD) 1886 } else if ((port->ip_notify & N_DDCD)
1887 && !(shadow & IOC4_SHADOW_DCD)) { 1887 && !(shadow & IOC4_SHADOW_DCD)) {
1888 /* Flag delta DCD/no DCD */ 1888 /* Flag delta DCD/no DCD */
@@ -1904,7 +1904,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
1904 the_port->icount.cts = 1904 the_port->icount.cts =
1905 (shadow & IOC4_SHADOW_CTS) ? 1 : 0; 1905 (shadow & IOC4_SHADOW_CTS) ? 1 : 0;
1906 wake_up_interruptible 1906 wake_up_interruptible
1907 (&the_port->state->delta_msr_wait); 1907 (&the_port->state->port.delta_msr_wait);
1908 } 1908 }
1909 } 1909 }
1910 1910
@@ -2237,7 +2237,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
2237 the_port->icount.dcd = 0; 2237 the_port->icount.dcd = 0;
2238 wake_up_interruptible 2238 wake_up_interruptible
2239 (&the_port->state-> 2239 (&the_port->state->
2240 delta_msr_wait); 2240 port.delta_msr_wait);
2241 } 2241 }
2242 2242
2243 /* If we had any data to return, we 2243 /* If we had any data to return, we
@@ -2439,7 +2439,7 @@ static void ic4_shutdown(struct uart_port *the_port)
2439 state = the_port->state; 2439 state = the_port->state;
2440 port->ip_port = NULL; 2440 port->ip_port = NULL;
2441 2441
2442 wake_up_interruptible(&state->delta_msr_wait); 2442 wake_up_interruptible(&state->port.delta_msr_wait);
2443 2443
2444 if (state->port.tty) 2444 if (state->port.tty)
2445 set_bit(TTY_IO_ERROR, &state->port.tty->flags); 2445 set_bit(TTY_IO_ERROR, &state->port.tty->flags);
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 2e847deb41dc..ebff4a1d4bcc 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -354,7 +354,7 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
354 uart_handle_cts_change(&up->port, 354 uart_handle_cts_change(&up->port,
355 (status & CTS)); 355 (status & CTS));
356 356
357 wake_up_interruptible(&up->port.state->delta_msr_wait); 357 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
358 } 358 }
359 359
360 up->prev_status = status; 360 up->prev_status = status;
diff --git a/drivers/serial/msm_serial.c b/drivers/serial/msm_serial.c
index ff18d50c99c1..b05c5aa02cb4 100644
--- a/drivers/serial/msm_serial.c
+++ b/drivers/serial/msm_serial.c
@@ -169,7 +169,7 @@ static void handle_delta_cts(struct uart_port *port)
169{ 169{
170 msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR); 170 msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
171 port->icount.cts++; 171 port->icount.cts++;
172 wake_up_interruptible(&port->state->delta_msr_wait); 172 wake_up_interruptible(&port->state->port.delta_msr_wait);
173} 173}
174 174
175static irqreturn_t msm_irq(int irq, void *dev_id) 175static irqreturn_t msm_irq(int irq, void *dev_id)
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 0dc786835dca..0700cd10b97c 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -369,7 +369,7 @@ static void pmz_status_handle(struct uart_pmac_port *uap)
369 uart_handle_cts_change(&uap->port, 369 uart_handle_cts_change(&uap->port,
370 !(status & CTS)); 370 !(status & CTS));
371 371
372 wake_up_interruptible(&uap->port.state->delta_msr_wait); 372 wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
373 } 373 }
374 374
375 if (status & BRK_ABRT) 375 if (status & BRK_ABRT)
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 2da747635275..0aa75a97531c 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -100,7 +100,7 @@ static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
100 if (changed & TIOCM_CTS) 100 if (changed & TIOCM_CTS)
101 uart_handle_cts_change(&sport->port, status & TIOCM_CTS); 101 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
102 102
103 wake_up_interruptible(&sport->port.state->delta_msr_wait); 103 wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
104} 104}
105 105
106/* 106/*
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index ad48919c0415..6443b7ff274a 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -220,7 +220,7 @@ static inline void check_modem_status(struct uart_pxa_port *up)
220 if (status & UART_MSR_DCTS) 220 if (status & UART_MSR_DCTS)
221 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); 221 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
222 222
223 wake_up_interruptible(&up->port.state->delta_msr_wait); 223 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
224} 224}
225 225
226/* 226/*
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 61ef3ae24927..7f5e26873220 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -117,7 +117,7 @@ static void sa1100_mctrl_check(struct sa1100_port *sport)
117 if (changed & TIOCM_CTS) 117 if (changed & TIOCM_CTS)
118 uart_handle_cts_change(&sport->port, status & TIOCM_CTS); 118 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
119 119
120 wake_up_interruptible(&sport->port.state->delta_msr_wait); 120 wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
121} 121}
122 122
123/* 123/*
diff --git a/drivers/serial/sb1250-duart.c b/drivers/serial/sb1250-duart.c
index fa5f303b36d3..a2f2b3254499 100644
--- a/drivers/serial/sb1250-duart.c
+++ b/drivers/serial/sb1250-duart.c
@@ -440,7 +440,7 @@ static void sbd_status_handle(struct sbd_port *sport)
440 440
441 if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) << 441 if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) <<
442 S_DUART_IN_PIN_CHNG)) 442 S_DUART_IN_PIN_CHNG))
443 wake_up_interruptible(&uport->state->delta_msr_wait); 443 wake_up_interruptible(&uport->state->port.delta_msr_wait);
444} 444}
445 445
446static irqreturn_t sbd_interrupt(int irq, void *dev_id) 446static irqreturn_t sbd_interrupt(int irq, void *dev_id)
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 9d42e57e1971..e16d15343dfd 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -215,7 +215,8 @@ static int uart_startup(struct uart_state *state, int init_hw)
215static void uart_shutdown(struct uart_state *state) 215static void uart_shutdown(struct uart_state *state)
216{ 216{
217 struct uart_port *uport = state->uart_port; 217 struct uart_port *uport = state->uart_port;
218 struct tty_struct *tty = state->port.tty; 218 struct tty_port *port = &state->port;
219 struct tty_struct *tty = port->tty;
219 220
220 /* 221 /*
221 * Set the TTY IO error marker 222 * Set the TTY IO error marker
@@ -223,7 +224,7 @@ static void uart_shutdown(struct uart_state *state)
223 if (tty) 224 if (tty)
224 set_bit(TTY_IO_ERROR, &tty->flags); 225 set_bit(TTY_IO_ERROR, &tty->flags);
225 226
226 if (test_and_clear_bit(ASYNCB_INITIALIZED, &state->port.flags)) { 227 if (test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) {
227 /* 228 /*
228 * Turn off DTR and RTS early. 229 * Turn off DTR and RTS early.
229 */ 230 */
@@ -237,7 +238,7 @@ static void uart_shutdown(struct uart_state *state)
237 * any outstanding file descriptors should be pointing at 238 * any outstanding file descriptors should be pointing at
238 * hung_up_tty_fops now. 239 * hung_up_tty_fops now.
239 */ 240 */
240 wake_up_interruptible(&state->delta_msr_wait); 241 wake_up_interruptible(&port->delta_msr_wait);
241 242
242 /* 243 /*
243 * Free the IRQ and disable the port. 244 * Free the IRQ and disable the port.
@@ -1004,11 +1005,15 @@ static int uart_do_autoconfig(struct uart_state *state)
1004 * - mask passed in arg for lines of interest 1005 * - mask passed in arg for lines of interest
1005 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 1006 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
1006 * Caller should use TIOCGICOUNT to see which one it was 1007 * Caller should use TIOCGICOUNT to see which one it was
1008 *
1009 * FIXME: This wants extracting into a common all driver implementation
1010 * of TIOCMWAIT using tty_port.
1007 */ 1011 */
1008static int 1012static int
1009uart_wait_modem_status(struct uart_state *state, unsigned long arg) 1013uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1010{ 1014{
1011 struct uart_port *uport = state->uart_port; 1015 struct uart_port *uport = state->uart_port;
1016 struct tty_port *port = &state->port;
1012 DECLARE_WAITQUEUE(wait, current); 1017 DECLARE_WAITQUEUE(wait, current);
1013 struct uart_icount cprev, cnow; 1018 struct uart_icount cprev, cnow;
1014 int ret; 1019 int ret;
@@ -1025,7 +1030,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1025 uport->ops->enable_ms(uport); 1030 uport->ops->enable_ms(uport);
1026 spin_unlock_irq(&uport->lock); 1031 spin_unlock_irq(&uport->lock);
1027 1032
1028 add_wait_queue(&state->delta_msr_wait, &wait); 1033 add_wait_queue(&port->delta_msr_wait, &wait);
1029 for (;;) { 1034 for (;;) {
1030 spin_lock_irq(&uport->lock); 1035 spin_lock_irq(&uport->lock);
1031 memcpy(&cnow, &uport->icount, sizeof(struct uart_icount)); 1036 memcpy(&cnow, &uport->icount, sizeof(struct uart_icount));
@@ -1053,7 +1058,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1053 } 1058 }
1054 1059
1055 current->state = TASK_RUNNING; 1060 current->state = TASK_RUNNING;
1056 remove_wait_queue(&state->delta_msr_wait, &wait); 1061 remove_wait_queue(&port->delta_msr_wait, &wait);
1057 1062
1058 return ret; 1063 return ret;
1059} 1064}
@@ -1430,7 +1435,7 @@ static void uart_hangup(struct tty_struct *tty)
1430 clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); 1435 clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags);
1431 port->tty = NULL; 1436 port->tty = NULL;
1432 wake_up_interruptible(&port->open_wait); 1437 wake_up_interruptible(&port->open_wait);
1433 wake_up_interruptible(&state->delta_msr_wait); 1438 wake_up_interruptible(&port->delta_msr_wait);
1434 } 1439 }
1435 mutex_unlock(&port->mutex); 1440 mutex_unlock(&port->mutex);
1436} 1441}
@@ -2378,7 +2383,6 @@ int uart_register_driver(struct uart_driver *drv)
2378 tty_port_init(port); 2383 tty_port_init(port);
2379 port->close_delay = 500; /* .5 seconds */ 2384 port->close_delay = 500; /* .5 seconds */
2380 port->closing_wait = 30000; /* 30 seconds */ 2385 port->closing_wait = 30000; /* 30 seconds */
2381 init_waitqueue_head(&state->delta_msr_wait);
2382 tasklet_init(&state->tlet, uart_tasklet_action, 2386 tasklet_init(&state->tlet, uart_tasklet_action,
2383 (unsigned long)state); 2387 (unsigned long)state);
2384 } 2388 }
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 4560b2e70685..2e71bbc04dac 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -266,7 +266,7 @@ static irqreturn_t ks8695uart_modem_status(int irq, void *dev_id)
266 if (status & URMS_URTERI) 266 if (status & URMS_URTERI)
267 port->icount.rng++; 267 port->icount.rng++;
268 268
269 wake_up_interruptible(&port->state->delta_msr_wait); 269 wake_up_interruptible(&port->state->port.delta_msr_wait);
270 270
271 return IRQ_HANDLED; 271 return IRQ_HANDLED;
272} 272}
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 057fc5e8cc8d..ea744707c4d6 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -241,7 +241,7 @@ static void lh7a40xuart_modem_status (struct uart_port* port)
241 if (delta & CTS) 241 if (delta & CTS)
242 uart_handle_cts_change (port, status & CTS); 242 uart_handle_cts_change (port, status & CTS);
243 243
244 wake_up_interruptible (&port->state->delta_msr_wait); 244 wake_up_interruptible (&port->state->port.delta_msr_wait);
245} 245}
246 246
247static irqreturn_t lh7a40xuart_int (int irq, void* dev_id) 247static irqreturn_t lh7a40xuart_int (int irq, void* dev_id)
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 7c4f2fe8e246..d1ad34128635 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -297,7 +297,7 @@ static void check_status(struct uart_sunsab_port *up,
297 up->port.icount.dsr++; 297 up->port.icount.dsr++;
298 } 298 }
299 299
300 wake_up_interruptible(&up->port.state->delta_msr_wait); 300 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
301} 301}
302 302
303static irqreturn_t sunsab_interrupt(int irq, void *dev_id) 303static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 5a32365b58ad..68d262b15749 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -441,7 +441,7 @@ static void check_modem_status(struct uart_sunsu_port *up)
441 if (status & UART_MSR_DCTS) 441 if (status & UART_MSR_DCTS)
442 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); 442 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
443 443
444 wake_up_interruptible(&up->port.state->delta_msr_wait); 444 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
445} 445}
446 446
447static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id) 447static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id)
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 055034d12b1c..ef693ae22e7f 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -451,7 +451,7 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up,
451 uart_handle_cts_change(&up->port, 451 uart_handle_cts_change(&up->port,
452 (status & CTS)); 452 (status & CTS));
453 453
454 wake_up_interruptible(&up->port.state->delta_msr_wait); 454 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
455 } 455 }
456 456
457 up->prev_status = status; 457 up->prev_status = status;
diff --git a/drivers/serial/timbuart.c b/drivers/serial/timbuart.c
index 3d40be6f389f..34b31da01d09 100644
--- a/drivers/serial/timbuart.c
+++ b/drivers/serial/timbuart.c
@@ -231,7 +231,7 @@ static void timbuart_mctrl_check(struct uart_port *port, u32 isr, u32 *ier)
231 iowrite32(CTS_DELTA, port->membase + TIMBUART_ISR); 231 iowrite32(CTS_DELTA, port->membase + TIMBUART_ISR);
232 cts = timbuart_get_mctrl(port); 232 cts = timbuart_get_mctrl(port);
233 uart_handle_cts_change(port, cts & TIOCM_CTS); 233 uart_handle_cts_change(port, cts & TIOCM_CTS);
234 wake_up_interruptible(&port->state->delta_msr_wait); 234 wake_up_interruptible(&port->state->port.delta_msr_wait);
235 } 235 }
236 236
237 *ier |= CTS_DELTA; 237 *ier |= CTS_DELTA;
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index cf4410e6d53b..3beb6ab4fa68 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -386,7 +386,7 @@ static inline void check_modem_status(struct uart_port *port)
386 if (msr & UART_MSR_DCTS) 386 if (msr & UART_MSR_DCTS)
387 uart_handle_cts_change(port, msr & UART_MSR_CTS); 387 uart_handle_cts_change(port, msr & UART_MSR_CTS);
388 388
389 wake_up_interruptible(&port->state->delta_msr_wait); 389 wake_up_interruptible(&port->state->port.delta_msr_wait);
390} 390}
391 391
392static inline void transmit_chars(struct uart_port *port) 392static inline void transmit_chars(struct uart_port *port)
diff --git a/drivers/serial/zs.c b/drivers/serial/zs.c
index b9c9fb9198d6..1a7fd3e70315 100644
--- a/drivers/serial/zs.c
+++ b/drivers/serial/zs.c
@@ -686,7 +686,7 @@ static void zs_status_handle(struct zs_port *zport, struct zs_port *zport_a)
686 uport->icount.rng++; 686 uport->icount.rng++;
687 687
688 if (delta) 688 if (delta)
689 wake_up_interruptible(&uport->state->delta_msr_wait); 689 wake_up_interruptible(&uport->state->port.delta_msr_wait);
690 690
691 spin_lock(&scc->zlock); 691 spin_lock(&scc->zlock);
692 } 692 }
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index bbebef7713b3..a5049eaf782d 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -578,7 +578,6 @@ struct cyclades_port {
578 struct cyclades_idle_stats idle_stats; 578 struct cyclades_idle_stats idle_stats;
579 struct cyclades_icount icount; 579 struct cyclades_icount icount;
580 struct completion shutdown_wait; 580 struct completion shutdown_wait;
581 wait_queue_head_t delta_msr_wait;
582 int throttle; 581 int throttle;
583}; 582};
584 583
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index 940aeb51d53f..92b08cfe4a75 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -96,7 +96,6 @@ struct esp_struct {
96 int xmit_head; 96 int xmit_head;
97 int xmit_tail; 97 int xmit_tail;
98 int xmit_cnt; 98 int xmit_cnt;
99 wait_queue_head_t delta_msr_wait;
100 wait_queue_head_t break_wait; 99 wait_queue_head_t break_wait;
101 struct async_icount icount; /* kernel counters for the 4 input interrupts */ 100 struct async_icount icount; /* kernel counters for the 4 input interrupts */
102 struct hayes_esp_config config; /* port configuration */ 101 struct hayes_esp_config config; /* port configuration */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 27767ea5fa29..bcafecd3b7c1 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -349,7 +349,6 @@ struct uart_state {
349 struct circ_buf xmit; 349 struct circ_buf xmit;
350 350
351 struct tasklet_struct tlet; 351 struct tasklet_struct tlet;
352 wait_queue_head_t delta_msr_wait;
353 struct uart_port *uart_port; 352 struct uart_port *uart_port;
354}; 353};
355 354
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 9fdc3d84baad..0daa8a72b176 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -203,6 +203,7 @@ struct tty_port {
203 int count; /* Usage count */ 203 int count; /* Usage count */
204 wait_queue_head_t open_wait; /* Open waiters */ 204 wait_queue_head_t open_wait; /* Open waiters */
205 wait_queue_head_t close_wait; /* Close waiters */ 205 wait_queue_head_t close_wait; /* Close waiters */
206 wait_queue_head_t delta_msr_wait; /* Modem status change */
206 unsigned long flags; /* TTY flags ASY_*/ 207 unsigned long flags; /* TTY flags ASY_*/
207 struct mutex mutex; /* Locking */ 208 struct mutex mutex; /* Locking */
208 unsigned char *xmit_buf; /* Optional buffer */ 209 unsigned char *xmit_buf; /* Optional buffer */