Skip to content

Commit bdc04e3

Browse files
Alan CoxLive-CD User
authored andcommitted
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>
1 parent a2bceae commit bdc04e3

32 files changed

+54
-54
lines changed

drivers/char/cyclades.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
729729
if (mdm_change & CyRI)
730730
info->icount.rng++;
731731

732-
wake_up_interruptible(&info->delta_msr_wait);
732+
wake_up_interruptible(&info->port.delta_msr_wait);
733733
}
734734

735735
if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) {
@@ -1197,7 +1197,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
11971197
break;
11981198
}
11991199
if (delta_count)
1200-
wake_up_interruptible(&info->delta_msr_wait);
1200+
wake_up_interruptible(&info->port.delta_msr_wait);
12011201
if (special_count)
12021202
tty_schedule_flip(tty);
12031203
tty_kref_put(tty);
@@ -1464,7 +1464,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
14641464
spin_lock_irqsave(&card->card_lock, flags);
14651465

14661466
/* 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);
14681468

14691469
if (info->port.xmit_buf) {
14701470
unsigned char *temp;
@@ -2788,7 +2788,7 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
27882788
/* note the counters on entry */
27892789
cnow = info->icount;
27902790
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,
27922792
cy_cflags_changed(info, arg, &cnow));
27932793
break;
27942794

@@ -3153,7 +3153,6 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
31533153
info->port.close_delay = 5 * HZ / 10;
31543154
info->port.flags = STD_COM_FLAGS;
31553155
init_completion(&info->shutdown_wait);
3156-
init_waitqueue_head(&info->delta_msr_wait);
31573156

31583157
if (cy_is_Z(cinfo)) {
31593158
struct FIRM_ID *firm_id = cinfo->base_addr + ID_ADDRESS;

drivers/char/esp.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static void check_modem_status(struct esp_struct *info)
572572
info->icount.dcd++;
573573
if (status & UART_MSR_DCTS)
574574
info->icount.cts++;
575-
wake_up_interruptible(&info->delta_msr_wait);
575+
wake_up_interruptible(&info->port.delta_msr_wait);
576576
}
577577

578578
if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
@@ -927,7 +927,7 @@ static void shutdown(struct esp_struct *info)
927927
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq
928928
* here so the queue might never be waken up
929929
*/
930-
wake_up_interruptible(&info->delta_msr_wait);
930+
wake_up_interruptible(&info->port.delta_msr_wait);
931931
wake_up_interruptible(&info->break_wait);
932932

933933
/* stop a DMA transfer on the port being closed */
@@ -1800,7 +1800,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file *file,
18001800
spin_unlock_irqrestore(&info->lock, flags);
18011801
while (1) {
18021802
/* FIXME: convert to new style wakeup */
1803-
interruptible_sleep_on(&info->delta_msr_wait);
1803+
interruptible_sleep_on(&info->port.delta_msr_wait);
18041804
/* see if a signal did it */
18051805
if (signal_pending(current))
18061806
return -ERESTARTSYS;
@@ -2452,7 +2452,6 @@ static int __init espserial_init(void)
24522452
info->config.flow_off = flow_off;
24532453
info->config.pio_threshold = pio_threshold;
24542454
info->next_port = ports;
2455-
init_waitqueue_head(&info->delta_msr_wait);
24562455
init_waitqueue_head(&info->break_wait);
24572456
ports = info;
24582457
printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",

drivers/char/mxser.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ struct mxser_port {
258258
struct mxser_mon mon_data;
259259

260260
spinlock_t slock;
261-
wait_queue_head_t delta_msr_wait;
262261
};
263262

264263
struct mxser_board {
@@ -818,7 +817,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
818817
if (status & UART_MSR_DCTS)
819818
port->icount.cts++;
820819
port->mon_data.modem_status = status;
821-
wake_up_interruptible(&port->delta_msr_wait);
820+
wake_up_interruptible(&port->port.delta_msr_wait);
822821

823822
if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
824823
if (status & UART_MSR_DCD)
@@ -973,7 +972,7 @@ static void mxser_shutdown(struct tty_struct *tty)
973972
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq
974973
* here so the queue might never be waken up
975974
*/
976-
wake_up_interruptible(&info->delta_msr_wait);
975+
wake_up_interruptible(&info->port.delta_msr_wait);
977976

978977
/*
979978
* Free the IRQ, if necessary
@@ -1762,7 +1761,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
17621761
cnow = info->icount; /* note the counters on entry */
17631762
spin_unlock_irqrestore(&info->slock, flags);
17641763

1765-
return wait_event_interruptible(info->delta_msr_wait,
1764+
return wait_event_interruptible(info->port.delta_msr_wait,
17661765
mxser_cflags_changed(info, arg, &cnow));
17671766
/*
17681767
* Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
@@ -2414,7 +2413,6 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
24142413
info->port.close_delay = 5 * HZ / 10;
24152414
info->port.closing_wait = 30 * HZ;
24162415
info->normal_termios = mxvar_sdriver->init_termios;
2417-
init_waitqueue_head(&info->delta_msr_wait);
24182416
memset(&info->mon_data, 0, sizeof(struct mxser_mon));
24192417
info->err_shadow = 0;
24202418
spin_lock_init(&info->slock);

drivers/char/tty_port.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void tty_port_init(struct tty_port *port)
2323
memset(port, 0, sizeof(*port));
2424
init_waitqueue_head(&port->open_wait);
2525
init_waitqueue_head(&port->close_wait);
26+
init_waitqueue_head(&port->delta_msr_wait);
2627
mutex_init(&port->mutex);
2728
spin_lock_init(&port->lock);
2829
port->close_delay = (50 * HZ) / 100;
@@ -124,6 +125,7 @@ void tty_port_hangup(struct tty_port *port)
124125
port->tty = NULL;
125126
spin_unlock_irqrestore(&port->lock, flags);
126127
wake_up_interruptible(&port->open_wait);
128+
wake_up_interruptible(&port->delta_msr_wait);
127129
tty_port_shutdown(port);
128130
}
129131
EXPORT_SYMBOL(tty_port_hangup);

drivers/serial/8250.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
15101510
if (status & UART_MSR_DCTS)
15111511
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
15121512

1513-
wake_up_interruptible(&up->port.state->delta_msr_wait);
1513+
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
15141514
}
15151515

15161516
return status;

drivers/serial/amba-pl010.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static void pl010_modem_status(struct uart_amba_port *uap)
225225
if (delta & UART01x_FR_CTS)
226226
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
227227

228-
wake_up_interruptible(&uap->port.state->delta_msr_wait);
228+
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
229229
}
230230

231231
static irqreturn_t pl010_int(int irq, void *dev_id)

drivers/serial/amba-pl011.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void pl011_modem_status(struct uart_amba_port *uap)
226226
if (delta & UART01x_FR_CTS)
227227
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
228228

229-
wake_up_interruptible(&uap->port.state->delta_msr_wait);
229+
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
230230
}
231231

232232
static irqreturn_t pl011_int(int irq, void *dev_id)

drivers/serial/atmel_serial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ static void atmel_tasklet_func(unsigned long data)
776776
if (status_change & ATMEL_US_CTS)
777777
uart_handle_cts_change(port, !(status & ATMEL_US_CTS));
778778

779-
wake_up_interruptible(&port->state->delta_msr_wait);
779+
wake_up_interruptible(&port->state->port.delta_msr_wait);
780780

781781
atmel_port->irq_status_prev = status;
782782
}

drivers/serial/icom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ static inline void check_modem_status(struct icom_port *icom_port)
695695
delta_status & ICOM_CTS);
696696

697697
wake_up_interruptible(&icom_port->uart_port.state->
698-
delta_msr_wait);
698+
port.delta_msr_wait);
699699
old_status = status;
700700
}
701701
spin_unlock(&icom_port->uart_port.lock);

drivers/serial/imx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static void imx_mctrl_check(struct imx_port *sport)
224224
if (changed & TIOCM_CTS)
225225
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
226226

227-
wake_up_interruptible(&sport->port.state->delta_msr_wait);
227+
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
228228
}
229229

230230
/*
@@ -388,7 +388,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)
388388

389389
writel(USR1_RTSD, sport->port.membase + USR1);
390390
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);
392392

393393
spin_unlock_irqrestore(&sport->port.lock, flags);
394394
return IRQ_HANDLED;

drivers/serial/ioc3_serial.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
12871287
(port->ip_port, 0);
12881288
wake_up_interruptible
12891289
(&the_port->state->
1290-
delta_msr_wait);
1290+
port.delta_msr_wait);
12911291
}
12921292

12931293
/* If we had any data to return, we
@@ -1491,7 +1491,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
14911491
uart_handle_dcd_change(the_port,
14921492
shadow & SHADOW_DCD);
14931493
wake_up_interruptible
1494-
(&the_port->state->delta_msr_wait);
1494+
(&the_port->state->port.delta_msr_wait);
14951495
} else if ((port->ip_notify & N_DDCD)
14961496
&& !(shadow & SHADOW_DCD)) {
14971497
/* Flag delta DCD/no DCD */
@@ -1511,7 +1511,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
15111511
uart_handle_cts_change(the_port, shadow
15121512
& SHADOW_CTS);
15131513
wake_up_interruptible
1514-
(&the_port->state->delta_msr_wait);
1514+
(&the_port->state->port.delta_msr_wait);
15151515
}
15161516
}
15171517

@@ -1728,7 +1728,7 @@ static void ic3_shutdown(struct uart_port *the_port)
17281728
return;
17291729

17301730
state = the_port->state;
1731-
wake_up_interruptible(&state->delta_msr_wait);
1731+
wake_up_interruptible(&state->port.delta_msr_wait);
17321732

17331733
spin_lock_irqsave(&the_port->lock, port_flags);
17341734
set_notification(port, N_ALL, 0);

drivers/serial/ioc4_serial.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
18821882
the_port = port->ip_port;
18831883
the_port->icount.dcd = 1;
18841884
wake_up_interruptible
1885-
(&the_port->state->delta_msr_wait);
1885+
(&the_port->state->port.delta_msr_wait);
18861886
} else if ((port->ip_notify & N_DDCD)
18871887
&& !(shadow & IOC4_SHADOW_DCD)) {
18881888
/* Flag delta DCD/no DCD */
@@ -1904,7 +1904,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
19041904
the_port->icount.cts =
19051905
(shadow & IOC4_SHADOW_CTS) ? 1 : 0;
19061906
wake_up_interruptible
1907-
(&the_port->state->delta_msr_wait);
1907+
(&the_port->state->port.delta_msr_wait);
19081908
}
19091909
}
19101910

@@ -2237,7 +2237,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
22372237
the_port->icount.dcd = 0;
22382238
wake_up_interruptible
22392239
(&the_port->state->
2240-
delta_msr_wait);
2240+
port.delta_msr_wait);
22412241
}
22422242

22432243
/* If we had any data to return, we
@@ -2439,7 +2439,7 @@ static void ic4_shutdown(struct uart_port *the_port)
24392439
state = the_port->state;
24402440
port->ip_port = NULL;
24412441

2442-
wake_up_interruptible(&state->delta_msr_wait);
2442+
wake_up_interruptible(&state->port.delta_msr_wait);
24432443

24442444
if (state->port.tty)
24452445
set_bit(TTY_IO_ERROR, &state->port.tty->flags);

drivers/serial/ip22zilog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
354354
uart_handle_cts_change(&up->port,
355355
(status & CTS));
356356

357-
wake_up_interruptible(&up->port.state->delta_msr_wait);
357+
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
358358
}
359359

360360
up->prev_status = status;

drivers/serial/msm_serial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void handle_delta_cts(struct uart_port *port)
169169
{
170170
msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
171171
port->icount.cts++;
172-
wake_up_interruptible(&port->state->delta_msr_wait);
172+
wake_up_interruptible(&port->state->port.delta_msr_wait);
173173
}
174174

175175
static irqreturn_t msm_irq(int irq, void *dev_id)

drivers/serial/pmac_zilog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void pmz_status_handle(struct uart_pmac_port *uap)
369369
uart_handle_cts_change(&uap->port,
370370
!(status & CTS));
371371

372-
wake_up_interruptible(&uap->port.state->delta_msr_wait);
372+
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
373373
}
374374

375375
if (status & BRK_ABRT)

drivers/serial/pnx8xxx_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
100100
if (changed & TIOCM_CTS)
101101
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
102102

103-
wake_up_interruptible(&sport->port.state->delta_msr_wait);
103+
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
104104
}
105105

106106
/*

drivers/serial/pxa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static inline void check_modem_status(struct uart_pxa_port *up)
220220
if (status & UART_MSR_DCTS)
221221
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
222222

223-
wake_up_interruptible(&up->port.state->delta_msr_wait);
223+
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
224224
}
225225

226226
/*

drivers/serial/sa1100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static void sa1100_mctrl_check(struct sa1100_port *sport)
117117
if (changed & TIOCM_CTS)
118118
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
119119

120-
wake_up_interruptible(&sport->port.state->delta_msr_wait);
120+
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
121121
}
122122

123123
/*

drivers/serial/sb1250-duart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static void sbd_status_handle(struct sbd_port *sport)
440440

441441
if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) <<
442442
S_DUART_IN_PIN_CHNG))
443-
wake_up_interruptible(&uport->state->delta_msr_wait);
443+
wake_up_interruptible(&uport->state->port.delta_msr_wait);
444444
}
445445

446446
static irqreturn_t sbd_interrupt(int irq, void *dev_id)

0 commit comments

Comments
 (0)