Skip to content

Commit

Permalink
serial: move delta_msr_wait into the tty_port
Browse files Browse the repository at this point in the history
This is used by various drivers not just serial and can be extracted
as commonality

Signed-off-by: Alan Cox <alan@linux.intel.com>
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent a2bceae commit bdc04e3
Show file tree
Hide file tree
Showing 32 changed files with 54 additions and 54 deletions.
9 changes: 4 additions & 5 deletions drivers/char/cyclades.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
if (mdm_change & CyRI)
info->icount.rng++;

wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);
}

if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) {
Expand Down Expand Up @@ -1197,7 +1197,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
break;
}
if (delta_count)
wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);
if (special_count)
tty_schedule_flip(tty);
tty_kref_put(tty);
Expand Down Expand Up @@ -1464,7 +1464,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
spin_lock_irqsave(&card->card_lock, flags);

/* Clear delta_msr_wait queue to avoid mem leaks. */
wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);

if (info->port.xmit_buf) {
unsigned char *temp;
Expand Down Expand Up @@ -2788,7 +2788,7 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
/* note the counters on entry */
cnow = info->icount;
spin_unlock_irqrestore(&info->card->card_lock, flags);
ret_val = wait_event_interruptible(info->delta_msr_wait,
ret_val = wait_event_interruptible(info->port.delta_msr_wait,
cy_cflags_changed(info, arg, &cnow));
break;

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

if (cy_is_Z(cinfo)) {
struct FIRM_ID *firm_id = cinfo->base_addr + ID_ADDRESS;
Expand Down
7 changes: 3 additions & 4 deletions drivers/char/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ static void check_modem_status(struct esp_struct *info)
info->icount.dcd++;
if (status & UART_MSR_DCTS)
info->icount.cts++;
wake_up_interruptible(&info->delta_msr_wait);
wake_up_interruptible(&info->port.delta_msr_wait);
}

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

/* stop a DMA transfer on the port being closed */
Expand Down Expand Up @@ -1800,7 +1800,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file *file,
spin_unlock_irqrestore(&info->lock, flags);
while (1) {
/* FIXME: convert to new style wakeup */
interruptible_sleep_on(&info->delta_msr_wait);
interruptible_sleep_on(&info->port.delta_msr_wait);
/* see if a signal did it */
if (signal_pending(current))
return -ERESTARTSYS;
Expand Down Expand Up @@ -2452,7 +2452,6 @@ static int __init espserial_init(void)
info->config.flow_off = flow_off;
info->config.pio_threshold = pio_threshold;
info->next_port = ports;
init_waitqueue_head(&info->delta_msr_wait);
init_waitqueue_head(&info->break_wait);
ports = info;
printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
Expand Down
8 changes: 3 additions & 5 deletions drivers/char/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ struct mxser_port {
struct mxser_mon mon_data;

spinlock_t slock;
wait_queue_head_t delta_msr_wait;
};

struct mxser_board {
Expand Down Expand Up @@ -818,7 +817,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
if (status & UART_MSR_DCTS)
port->icount.cts++;
port->mon_data.modem_status = status;
wake_up_interruptible(&port->delta_msr_wait);
wake_up_interruptible(&port->port.delta_msr_wait);

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

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

return wait_event_interruptible(info->delta_msr_wait,
return wait_event_interruptible(info->port.delta_msr_wait,
mxser_cflags_changed(info, arg, &cnow));
/*
* Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
Expand Down Expand Up @@ -2414,7 +2413,6 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
info->port.close_delay = 5 * HZ / 10;
info->port.closing_wait = 30 * HZ;
info->normal_termios = mxvar_sdriver->init_termios;
init_waitqueue_head(&info->delta_msr_wait);
memset(&info->mon_data, 0, sizeof(struct mxser_mon));
info->err_shadow = 0;
spin_lock_init(&info->slock);
Expand Down
2 changes: 2 additions & 0 deletions drivers/char/tty_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void tty_port_init(struct tty_port *port)
memset(port, 0, sizeof(*port));
init_waitqueue_head(&port->open_wait);
init_waitqueue_head(&port->close_wait);
init_waitqueue_head(&port->delta_msr_wait);
mutex_init(&port->mutex);
spin_lock_init(&port->lock);
port->close_delay = (50 * HZ) / 100;
Expand Down Expand Up @@ -124,6 +125,7 @@ void tty_port_hangup(struct tty_port *port)
port->tty = NULL;
spin_unlock_irqrestore(&port->lock, flags);
wake_up_interruptible(&port->open_wait);
wake_up_interruptible(&port->delta_msr_wait);
tty_port_shutdown(port);
}
EXPORT_SYMBOL(tty_port_hangup);
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
if (status & UART_MSR_DCTS)
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);

wake_up_interruptible(&up->port.state->delta_msr_wait);
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
}

return status;
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/amba-pl010.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void pl010_modem_status(struct uart_amba_port *uap)
if (delta & UART01x_FR_CTS)
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);

wake_up_interruptible(&uap->port.state->delta_msr_wait);
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
}

static irqreturn_t pl010_int(int irq, void *dev_id)
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void pl011_modem_status(struct uart_amba_port *uap)
if (delta & UART01x_FR_CTS)
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);

wake_up_interruptible(&uap->port.state->delta_msr_wait);
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
}

static irqreturn_t pl011_int(int irq, void *dev_id)
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ static void atmel_tasklet_func(unsigned long data)
if (status_change & ATMEL_US_CTS)
uart_handle_cts_change(port, !(status & ATMEL_US_CTS));

wake_up_interruptible(&port->state->delta_msr_wait);
wake_up_interruptible(&port->state->port.delta_msr_wait);

atmel_port->irq_status_prev = status;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/icom.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ static inline void check_modem_status(struct icom_port *icom_port)
delta_status & ICOM_CTS);

wake_up_interruptible(&icom_port->uart_port.state->
delta_msr_wait);
port.delta_msr_wait);
old_status = status;
}
spin_unlock(&icom_port->uart_port.lock);
Expand Down
4 changes: 2 additions & 2 deletions drivers/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void imx_mctrl_check(struct imx_port *sport)
if (changed & TIOCM_CTS)
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);

wake_up_interruptible(&sport->port.state->delta_msr_wait);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
}

/*
Expand Down Expand Up @@ -388,7 +388,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)

writel(USR1_RTSD, sport->port.membase + USR1);
uart_handle_cts_change(&sport->port, !!val);
wake_up_interruptible(&sport->port.state->delta_msr_wait);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);

spin_unlock_irqrestore(&sport->port.lock, flags);
return IRQ_HANDLED;
Expand Down
8 changes: 4 additions & 4 deletions drivers/serial/ioc3_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
(port->ip_port, 0);
wake_up_interruptible
(&the_port->state->
delta_msr_wait);
port.delta_msr_wait);
}

/* If we had any data to return, we
Expand Down Expand Up @@ -1491,7 +1491,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
uart_handle_dcd_change(the_port,
shadow & SHADOW_DCD);
wake_up_interruptible
(&the_port->state->delta_msr_wait);
(&the_port->state->port.delta_msr_wait);
} else if ((port->ip_notify & N_DDCD)
&& !(shadow & SHADOW_DCD)) {
/* Flag delta DCD/no DCD */
Expand All @@ -1511,7 +1511,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
uart_handle_cts_change(the_port, shadow
& SHADOW_CTS);
wake_up_interruptible
(&the_port->state->delta_msr_wait);
(&the_port->state->port.delta_msr_wait);
}
}

Expand Down Expand Up @@ -1728,7 +1728,7 @@ static void ic3_shutdown(struct uart_port *the_port)
return;

state = the_port->state;
wake_up_interruptible(&state->delta_msr_wait);
wake_up_interruptible(&state->port.delta_msr_wait);

spin_lock_irqsave(&the_port->lock, port_flags);
set_notification(port, N_ALL, 0);
Expand Down
8 changes: 4 additions & 4 deletions drivers/serial/ioc4_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
the_port = port->ip_port;
the_port->icount.dcd = 1;
wake_up_interruptible
(&the_port->state->delta_msr_wait);
(&the_port->state->port.delta_msr_wait);
} else if ((port->ip_notify & N_DDCD)
&& !(shadow & IOC4_SHADOW_DCD)) {
/* Flag delta DCD/no DCD */
Expand All @@ -1904,7 +1904,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
the_port->icount.cts =
(shadow & IOC4_SHADOW_CTS) ? 1 : 0;
wake_up_interruptible
(&the_port->state->delta_msr_wait);
(&the_port->state->port.delta_msr_wait);
}
}

Expand Down Expand Up @@ -2237,7 +2237,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
the_port->icount.dcd = 0;
wake_up_interruptible
(&the_port->state->
delta_msr_wait);
port.delta_msr_wait);
}

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

wake_up_interruptible(&state->delta_msr_wait);
wake_up_interruptible(&state->port.delta_msr_wait);

if (state->port.tty)
set_bit(TTY_IO_ERROR, &state->port.tty->flags);
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/ip22zilog.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
uart_handle_cts_change(&up->port,
(status & CTS));

wake_up_interruptible(&up->port.state->delta_msr_wait);
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
}

up->prev_status = status;
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/msm_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static void handle_delta_cts(struct uart_port *port)
{
msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
port->icount.cts++;
wake_up_interruptible(&port->state->delta_msr_wait);
wake_up_interruptible(&port->state->port.delta_msr_wait);
}

static irqreturn_t msm_irq(int irq, void *dev_id)
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/pmac_zilog.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static void pmz_status_handle(struct uart_pmac_port *uap)
uart_handle_cts_change(&uap->port,
!(status & CTS));

wake_up_interruptible(&uap->port.state->delta_msr_wait);
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
}

if (status & BRK_ABRT)
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/pnx8xxx_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
if (changed & TIOCM_CTS)
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);

wake_up_interruptible(&sport->port.state->delta_msr_wait);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static inline void check_modem_status(struct uart_pxa_port *up)
if (status & UART_MSR_DCTS)
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);

wake_up_interruptible(&up->port.state->delta_msr_wait);
wake_up_interruptible(&up->port.state->port.delta_msr_wait);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/sa1100.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static void sa1100_mctrl_check(struct sa1100_port *sport)
if (changed & TIOCM_CTS)
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);

wake_up_interruptible(&sport->port.state->delta_msr_wait);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/sb1250-duart.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static void sbd_status_handle(struct sbd_port *sport)

if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) <<
S_DUART_IN_PIN_CHNG))
wake_up_interruptible(&uport->state->delta_msr_wait);
wake_up_interruptible(&uport->state->port.delta_msr_wait);
}

static irqreturn_t sbd_interrupt(int irq, void *dev_id)
Expand Down
Loading

0 comments on commit bdc04e3

Please sign in to comment.