* [PATCH 02/16] TTY: synclink, remove superfluous check
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 03/16] TTY: do not warn about setting speed via SPD_* Jiri Slaby
` (13 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
info is obtained by container_of. It can never be NULL. So do not test
that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/synclink.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
index 8983276..72d6071 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
@@ -1058,9 +1058,6 @@ static void mgsl_bh_handler(struct work_struct *work)
container_of(work, struct mgsl_struct, task);
int action;
- if (!info)
- return;
-
if ( debug_level >= DEBUG_LEVEL_BH )
printk( "%s(%d):mgsl_bh_handler(%s) entry\n",
__FILE__,__LINE__,info->device_name);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 03/16] TTY: do not warn about setting speed via SPD_*
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
2013-03-07 12:12 ` [PATCH 02/16] TTY: synclink, " Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 04/16] TTY: msm_smd_tty, clean up activate/shutdown Jiri Slaby
` (12 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
The warning is there since 2.1.69 and we have not seen anybody
reporting it in the past decade. Remove the warning now.
tty_get_baud_rate can now be inline. This gives us one less
EXPORT_SYMBOL.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/tty_ioctl.c | 28 ----------------------------
include/linux/tty.h | 18 ++++++++++++++++--
2 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index d58b92c..20db217 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -415,34 +415,6 @@ void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud)
EXPORT_SYMBOL_GPL(tty_encode_baud_rate);
/**
- * tty_get_baud_rate - get tty bit rates
- * @tty: tty to query
- *
- * Returns the baud rate as an integer for this terminal. The
- * termios lock must be held by the caller and the terminal bit
- * flags may be updated.
- *
- * Locking: none
- */
-
-speed_t tty_get_baud_rate(struct tty_struct *tty)
-{
- speed_t baud = tty_termios_baud_rate(&tty->termios);
-
- if (baud == 38400 && tty->alt_speed) {
- if (!tty->warned) {
- printk(KERN_WARNING "Use of setserial/setrocket to "
- "set SPD_* flags is deprecated\n");
- tty->warned = 1;
- }
- baud = tty->alt_speed;
- }
-
- return baud;
-}
-EXPORT_SYMBOL(tty_get_baud_rate);
-
-/**
* tty_termios_copy_hw - copy hardware settings
* @new: New termios
* @old: Old termios
diff --git a/include/linux/tty.h b/include/linux/tty.h
index c75d886..4c6a079 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -255,7 +255,6 @@ struct tty_struct {
int count;
struct winsize winsize; /* termios mutex */
unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
- unsigned char warned:1;
unsigned char ctrl_status; /* ctrl_lock */
unsigned int receive_room; /* Bytes free for queue */
@@ -419,13 +418,28 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty);
extern void tty_buffer_free_all(struct tty_port *port);
extern void tty_buffer_flush(struct tty_struct *tty);
extern void tty_buffer_init(struct tty_port *port);
-extern speed_t tty_get_baud_rate(struct tty_struct *tty);
extern speed_t tty_termios_baud_rate(struct ktermios *termios);
extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
extern void tty_termios_encode_baud_rate(struct ktermios *termios,
speed_t ibaud, speed_t obaud);
extern void tty_encode_baud_rate(struct tty_struct *tty,
speed_t ibaud, speed_t obaud);
+
+/**
+ * tty_get_baud_rate - get tty bit rates
+ * @tty: tty to query
+ *
+ * Returns the baud rate as an integer for this terminal. The
+ * termios lock must be held by the caller and the terminal bit
+ * flags may be updated.
+ *
+ * Locking: none
+ */
+static inline speed_t tty_get_baud_rate(struct tty_struct *tty)
+{
+ return tty_termios_baud_rate(&tty->termios);
+}
+
extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 04/16] TTY: msm_smd_tty, clean up activate/shutdown
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
2013-03-07 12:12 ` [PATCH 02/16] TTY: synclink, " Jiri Slaby
2013-03-07 12:12 ` [PATCH 03/16] TTY: do not warn about setting speed via SPD_* Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 05/16] TTY: add tty_port_tty_wakeup helper Jiri Slaby
` (11 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
Do not dig struct smd_tty_info out of tty_struct using
tty_port_tty_get. It is unnecessarily too complicated, use simple
container_of instead.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/msm_smd_tty.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c
index e722ff1..1238ac3 100644
--- a/drivers/tty/serial/msm_smd_tty.c
+++ b/drivers/tty/serial/msm_smd_tty.c
@@ -90,13 +90,13 @@ static void smd_tty_notify(void *priv, unsigned event)
static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty)
{
+ struct smd_tty_info *info = container_of(tport, struct smd_tty_info,
+ port);
int i, res = 0;
- int n = tty->index;
const char *name = NULL;
- struct smd_tty_info *info = smd_tty + n;
for (i = 0; i < smd_tty_channels_len; i++) {
- if (smd_tty_channels[i].id == n) {
+ if (smd_tty_channels[i].id == tty->index) {
name = smd_tty_channels[i].name;
break;
}
@@ -117,17 +117,13 @@ static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty)
static void smd_tty_port_shutdown(struct tty_port *tport)
{
- struct smd_tty_info *info;
- struct tty_struct *tty = tty_port_tty_get(tport);
+ struct smd_tty_info *info = container_of(tport, struct smd_tty_info,
+ port);
- info = tty->driver_data;
if (info->ch) {
smd_close(info->ch);
info->ch = 0;
}
-
- tty->driver_data = 0;
- tty_kref_put(tty);
}
static int smd_tty_open(struct tty_struct *tty, struct file *f)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 05/16] TTY: add tty_port_tty_wakeup helper
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (2 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 04/16] TTY: msm_smd_tty, clean up activate/shutdown Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-08 15:02 ` Peter Hurley
2013-03-07 12:12 ` [PATCH 06/16] TTY: add tty_port_tty_hangup helper Jiri Slaby
` (10 subsequent siblings)
14 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
It allows for cleaning up on a considerable amount of places. They did
port_get, wakeup, kref_put. Now the only thing needed is to call
tty_port_tty_wakeup which does exactly that.
One exception is ifx6x60 where tty_wakeup was open-coded. We now call
tty_wakeup properly there.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/um/drivers/line.c | 8 +-------
drivers/isdn/capi/capi.c | 7 +------
drivers/isdn/gigaset/interface.c | 6 +-----
drivers/net/usb/hso.c | 13 ++-----------
drivers/s390/char/sclp_tty.c | 9 ++-------
drivers/s390/char/sclp_vt220.c | 8 +-------
drivers/staging/fwserial/fwserial.c | 10 ++--------
drivers/staging/serqt_usb2/serqt_usb2.c | 7 +------
drivers/tty/ehv_bytechan.c | 6 +-----
drivers/tty/hvc/hvsi.c | 7 +------
drivers/tty/nozomi.c | 6 +-----
drivers/tty/serial/ifx6x60.c | 33 ++-------------------------------
drivers/tty/tty_port.c | 16 ++++++++++++++++
drivers/usb/class/cdc-acm.c | 7 +------
drivers/usb/serial/digi_acceleport.c | 17 +++--------------
drivers/usb/serial/io_edgeport.c | 28 +++++-----------------------
drivers/usb/serial/keyspan_pda.c | 6 ++----
drivers/usb/serial/mos7720.c | 8 ++------
drivers/usb/serial/mos7840.c | 7 ++-----
drivers/usb/serial/ti_usb_3410_5052.c | 7 ++-----
drivers/usb/serial/usb-serial.c | 10 +---------
include/linux/tty.h | 1 +
22 files changed, 51 insertions(+), 176 deletions(-)
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index f1b3857..cc206ed 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -248,7 +248,6 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
{
struct chan *chan = data;
struct line *line = chan->line;
- struct tty_struct *tty;
int err;
/*
@@ -267,12 +266,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
}
spin_unlock(&line->lock);
- tty = tty_port_tty_get(&line->port);
- if (tty == NULL)
- return IRQ_NONE;
-
- tty_wakeup(tty);
- tty_kref_put(tty);
+ tty_port_tty_wakeup(&line->port);
return IRQ_HANDLED;
}
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 89562a8..ac6f72b 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -569,7 +569,6 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{
struct capidev *cdev = ap->private;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
- struct tty_struct *tty;
struct capiminor *mp;
u16 datahandle;
struct capincci *np;
@@ -627,11 +626,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2));
kfree_skb(skb);
capiminor_del_ack(mp, datahandle);
- tty = tty_port_tty_get(&mp->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&mp->port);
handle_minor_send(mp);
} else {
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index e2b5396..600c79b 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -487,12 +487,8 @@ static const struct tty_operations if_ops = {
static void if_wake(unsigned long data)
{
struct cardstate *cs = (struct cardstate *)data;
- struct tty_struct *tty = tty_port_tty_get(&cs->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&cs->port);
}
/*** interface to common ***/
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index e2dd324..a7714b4 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1925,7 +1925,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
{
struct hso_serial *serial = urb->context;
int status = urb->status;
- struct tty_struct *tty;
/* sanity check */
if (!serial) {
@@ -1941,11 +1940,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
return;
}
hso_put_activity(serial->parent);
- tty = tty_port_tty_get(&serial->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&serial->port);
hso_kick_transmit(serial);
D1(" ");
@@ -2008,12 +2003,8 @@ static void ctrl_callback(struct urb *urb)
put_rxbuf_data_and_resubmit_ctrl_urb(serial);
spin_unlock(&serial->serial_lock);
} else {
- struct tty_struct *tty = tty_port_tty_get(&serial->port);
hso_put_activity(serial->parent);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&serial->port);
/* response to a write command */
hso_kick_transmit(serial);
}
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c
index 14b4cb8..7ed7a59 100644
--- a/drivers/s390/char/sclp_tty.c
+++ b/drivers/s390/char/sclp_tty.c
@@ -107,7 +107,6 @@ sclp_tty_write_room (struct tty_struct *tty)
static void
sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
{
- struct tty_struct *tty;
unsigned long flags;
void *page;
@@ -125,12 +124,8 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
struct sclp_buffer, list);
spin_unlock_irqrestore(&sclp_tty_lock, flags);
} while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback));
- /* check if the tty needs a wake up call */
- tty = tty_port_tty_get(&sclp_port);
- if (tty != NULL) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+
+ tty_port_tty_wakeup(&sclp_port);
}
static inline void
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 6c92f62..5aaaa2e 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -114,7 +114,6 @@ static struct sclp_register sclp_vt220_register = {
static void
sclp_vt220_process_queue(struct sclp_vt220_request *request)
{
- struct tty_struct *tty;
unsigned long flags;
void *page;
@@ -139,12 +138,7 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request)
} while (__sclp_vt220_emit(request));
if (request == NULL && sclp_vt220_flush_later)
sclp_vt220_emit_current();
- /* Check if the tty needs a wake up call */
- tty = tty_port_tty_get(&sclp_vt220_port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&sclp_vt220_port);
}
#define SCLP_BUFFER_MAX_RETRY 1
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index 5a6fb44..5c64e3a 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -744,7 +744,6 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
struct fwtty_transaction *txn)
{
struct fwtty_port *port = txn->port;
- struct tty_struct *tty;
int len;
fwtty_dbg(port, "rcode: %d", rcode);
@@ -769,13 +768,8 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
port->stats.dropped += txn->dma_pended.len;
}
- if (len < WAKEUP_CHARS) {
- tty = tty_port_tty_get(&port->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
- }
+ if (len < WAKEUP_CHARS)
+ tty_port_tty_wakeup(&port->port);
}
static int fwtty_tx(struct fwtty_port *port, bool drain)
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
index b1bb1a6..8a6e5ea 100644
--- a/drivers/staging/serqt_usb2/serqt_usb2.c
+++ b/drivers/staging/serqt_usb2/serqt_usb2.c
@@ -264,7 +264,6 @@ static void ProcessRxChar(struct usb_serial_port *port, unsigned char data)
static void qt_write_bulk_callback(struct urb *urb)
{
- struct tty_struct *tty;
int status;
struct quatech_port *quatech_port;
@@ -278,11 +277,7 @@ static void qt_write_bulk_callback(struct urb *urb)
quatech_port = urb->context;
- tty = tty_port_tty_get(&quatech_port->port->port);
-
- if (tty)
- tty_wakeup(tty);
- tty_kref_put(tty);
+ tty_port_tty_wakeup(&quatech_port->port->port);
}
static void qt_interrupt_callback(struct urb *urb)
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index ed92622..6d0c27c 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -472,13 +472,9 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc)
static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data)
{
struct ehv_bc_data *bc = data;
- struct tty_struct *ttys = tty_port_tty_get(&bc->port);
ehv_bc_tx_dequeue(bc);
- if (ttys) {
- tty_wakeup(ttys);
- tty_kref_put(ttys);
- }
+ tty_port_tty_wakeup(&bc->port);
return IRQ_HANDLED;
}
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
index ef95a15..4190199 100644
--- a/drivers/tty/hvc/hvsi.c
+++ b/drivers/tty/hvc/hvsi.c
@@ -861,7 +861,6 @@ static void hvsi_write_worker(struct work_struct *work)
{
struct hvsi_struct *hp =
container_of(work, struct hvsi_struct, writer.work);
- struct tty_struct *tty;
unsigned long flags;
#ifdef DEBUG
static long start_j = 0;
@@ -895,11 +894,7 @@ static void hvsi_write_worker(struct work_struct *work)
start_j = 0;
#endif /* DEBUG */
wake_up_all(&hp->emptyq);
- tty = tty_port_tty_get(&hp->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&hp->port);
}
out:
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 2dff197..2e5bbdc 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -791,7 +791,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
const u8 toggle = port->toggle_ul;
void __iomem *addr = port->ul_addr[toggle];
const u32 ul_size = port->ul_size[toggle];
- struct tty_struct *tty = tty_port_tty_get(&port->port);
/* Get data from tty and place in buf for now */
size = kfifo_out(&port->fifo_ul, dc->send_buf,
@@ -799,7 +798,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
if (size == 0) {
DBG4("No more data to send, disable link:");
- tty_kref_put(tty);
return 0;
}
@@ -809,10 +807,8 @@ static int send_data(enum port_type index, struct nozomi *dc)
write_mem32(addr, (u32 *) &size, 4);
write_mem32(addr + 4, (u32 *) dc->send_buf, size);
- if (tty)
- tty_wakeup(tty);
+ tty_port_tty_wakeup(&port->port);
- tty_kref_put(tty);
return 1;
}
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 68d7ce9..d723d41 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -443,25 +443,6 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count,
}
/**
- * ifx_spi_wakeup_serial - SPI space made
- * @port_data: our SPI device
- *
- * We have emptied the FIFO enough that we want to get more data
- * queued into it. Poke the line discipline via tty_wakeup so that
- * it will feed us more bits
- */
-static void ifx_spi_wakeup_serial(struct ifx_spi_device *ifx_dev)
-{
- struct tty_struct *tty;
-
- tty = tty_port_tty_get(&ifx_dev->tty_port);
- if (!tty)
- return;
- tty_wakeup(tty);
- tty_kref_put(tty);
-}
-
-/**
* ifx_spi_prepare_tx_buffer - prepare transmit frame
* @ifx_dev: our SPI device
*
@@ -506,7 +487,7 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev)
tx_count += temp_count;
if (temp_count == queue_length)
/* poke port to get more data */
- ifx_spi_wakeup_serial(ifx_dev);
+ tty_port_tty_wakeup(&ifx_dev->tty_port);
else /* more data in port, use next SPI message */
ifx_dev->spi_more = 1;
}
@@ -683,8 +664,6 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
static void ifx_spi_complete(void *ctx)
{
struct ifx_spi_device *ifx_dev = ctx;
- struct tty_struct *tty;
- struct tty_ldisc *ldisc = NULL;
int length;
int actual_length;
unsigned char more;
@@ -762,15 +741,7 @@ complete_exit:
*/
ifx_spi_power_state_clear(ifx_dev,
IFX_SPI_POWER_DATA_PENDING);
- tty = tty_port_tty_get(&ifx_dev->tty_port);
- if (tty) {
- ldisc = tty_ldisc_ref(tty);
- if (ldisc) {
- ldisc->ops->write_wakeup(tty);
- tty_ldisc_deref(ldisc);
- }
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&ifx_dev->tty_port);
}
}
}
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index b7ff59d..8bb757c 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -233,6 +233,22 @@ void tty_port_hangup(struct tty_port *port)
EXPORT_SYMBOL(tty_port_hangup);
/**
+ * tty_port_tty_wakeup - helper to wake up a tty
+ *
+ * @port: tty port
+ */
+void tty_port_tty_wakeup(struct tty_port *port)
+{
+ struct tty_struct *tty = tty_port_tty_get(port);
+
+ if (tty) {
+ tty_wakeup(tty);
+ tty_kref_put(tty);
+ }
+}
+EXPORT_SYMBOL_GPL(tty_port_tty_wakeup);
+
+/**
* tty_port_carrier_raised - carrier raised check
* @port: tty port
*
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 8ac25ad..755766e 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -475,15 +475,10 @@ static void acm_write_bulk(struct urb *urb)
static void acm_softint(struct work_struct *work)
{
struct acm *acm = container_of(work, struct acm, work);
- struct tty_struct *tty;
dev_vdbg(&acm->data->dev, "%s\n", __func__);
- tty = tty_port_tty_get(&acm->port);
- if (!tty)
- return;
- tty_wakeup(tty);
- tty_kref_put(tty);
+ tty_port_tty_wakeup(&acm->port);
}
/*
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index ebe45fa..3119158 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -210,7 +210,6 @@ struct digi_port {
/* Local Function Declarations */
-static void digi_wakeup_write(struct usb_serial_port *port);
static void digi_wakeup_write_lock(struct work_struct *work);
static int digi_write_oob_command(struct usb_serial_port *port,
unsigned char *buf, int count, int interruptible);
@@ -374,20 +373,10 @@ static void digi_wakeup_write_lock(struct work_struct *work)
unsigned long flags;
spin_lock_irqsave(&priv->dp_port_lock, flags);
- digi_wakeup_write(port);
+ tty_port_tty_wakeup(&port->port);
spin_unlock_irqrestore(&priv->dp_port_lock, flags);
}
-static void digi_wakeup_write(struct usb_serial_port *port)
-{
- struct tty_struct *tty = tty_port_tty_get(&port->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
-}
-
-
/*
* Digi Write OOB Command
*
@@ -1044,7 +1033,7 @@ static void digi_write_bulk_callback(struct urb *urb)
}
}
/* wake up processes sleeping on writes immediately */
- digi_wakeup_write(port);
+ tty_port_tty_wakeup(&port->port);
/* also queue up a wakeup at scheduler time, in case we */
/* lost the race in write_chan(). */
schedule_work(&priv->dp_wakeup_work);
@@ -1522,7 +1511,7 @@ static int digi_read_oob_callback(struct urb *urb)
/* port must be open to use tty struct */
if (rts) {
tty->hw_stopped = 0;
- digi_wakeup_write(port);
+ tty_port_tty_wakeup(&port->port);
}
} else {
priv->dp_modem_signals &= ~TIOCM_CTS;
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index b00e5cb..44e5208 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -565,7 +565,6 @@ static void edge_interrupt_callback(struct urb *urb)
struct device *dev;
struct edgeport_port *edge_port;
struct usb_serial_port *port;
- struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
int length = urb->actual_length;
int bytes_avail;
@@ -644,12 +643,7 @@ static void edge_interrupt_callback(struct urb *urb)
/* tell the tty driver that something
has changed */
- tty = tty_port_tty_get(
- &edge_port->port->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_wakeup(&edge_port->port->port);
/* Since we have more credit, check
if more data can be sent */
send_more_port_data(edge_serial,
@@ -738,7 +732,6 @@ static void edge_bulk_in_callback(struct urb *urb)
static void edge_bulk_out_data_callback(struct urb *urb)
{
struct edgeport_port *edge_port = urb->context;
- struct tty_struct *tty;
int status = urb->status;
if (status) {
@@ -747,14 +740,8 @@ static void edge_bulk_out_data_callback(struct urb *urb)
__func__, status);
}
- tty = tty_port_tty_get(&edge_port->port->port);
-
- if (tty && edge_port->open) {
- /* let the tty driver wakeup if it has a special
- write_wakeup function */
- tty_wakeup(tty);
- }
- tty_kref_put(tty);
+ if (edge_port->open)
+ tty_port_tty_wakeup(&edge_port->port->port);
/* Release the Write URB */
edge_port->write_in_progress = false;
@@ -773,7 +760,6 @@ static void edge_bulk_out_data_callback(struct urb *urb)
static void edge_bulk_out_cmd_callback(struct urb *urb)
{
struct edgeport_port *edge_port = urb->context;
- struct tty_struct *tty;
int status = urb->status;
atomic_dec(&CmdUrbs);
@@ -794,13 +780,9 @@ static void edge_bulk_out_cmd_callback(struct urb *urb)
return;
}
- /* Get pointer to tty */
- tty = tty_port_tty_get(&edge_port->port->port);
-
/* tell the tty driver that something has changed */
- if (tty && edge_port->open)
- tty_wakeup(tty);
- tty_kref_put(tty);
+ if (edge_port->open)
+ tty_port_tty_wakeup(&edge_port->port->port);
/* we have completed the command */
edge_port->commandPending = false;
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 3b17d5d..2230223 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -104,10 +104,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work)
struct keyspan_pda_private *priv =
container_of(work, struct keyspan_pda_private, wakeup_work);
struct usb_serial_port *port = priv->port;
- struct tty_struct *tty = tty_port_tty_get(&port->port);
- if (tty)
- tty_wakeup(tty);
- tty_kref_put(tty);
+
+ tty_port_tty_wakeup(&port->port);
}
static void keyspan_pda_request_unthrottle(struct work_struct *work)
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index e0ebec3..e956eae 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -932,7 +932,6 @@ static void mos7720_bulk_in_callback(struct urb *urb)
static void mos7720_bulk_out_data_callback(struct urb *urb)
{
struct moschip_port *mos7720_port;
- struct tty_struct *tty;
int status = urb->status;
if (status) {
@@ -946,11 +945,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
return ;
}
- tty = tty_port_tty_get(&mos7720_port->port->port);
-
- if (tty && mos7720_port->open)
- tty_wakeup(tty);
- tty_kref_put(tty);
+ if (mos7720_port->open)
+ tty_port_tty_wakeup(&mos7720_port->port->port);
}
/*
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 809fb32..08284d2 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -814,7 +814,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
{
struct moschip_port *mos7840_port;
struct usb_serial_port *port;
- struct tty_struct *tty;
int status = urb->status;
int i;
@@ -837,10 +836,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
if (mos7840_port_paranoia_check(port, __func__))
return;
- tty = tty_port_tty_get(&port->port);
- if (tty && mos7840_port->open)
- tty_wakeup(tty);
- tty_kref_put(tty);
+ if (mos7840_port->open)
+ tty_port_tty_wakeup(&port->port);
}
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 39cb9b8..437f2d5 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1227,7 +1227,6 @@ static void ti_send(struct ti_port *tport)
{
int count, result;
struct usb_serial_port *port = tport->tp_port;
- struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */
unsigned long flags;
spin_lock_irqsave(&tport->tp_lock, flags);
@@ -1268,14 +1267,12 @@ static void ti_send(struct ti_port *tport)
}
/* more room in the buffer for new writes, wakeup */
- if (tty)
- tty_wakeup(tty);
- tty_kref_put(tty);
+ tty_port_tty_wakeup(&port->port);
+
wake_up_interruptible(&tport->tp_write_wait);
return;
unlock:
spin_unlock_irqrestore(&tport->tp_lock, flags);
- tty_kref_put(tty);
return;
}
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index a19ed74..2df8484 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -541,16 +541,8 @@ static void usb_serial_port_work(struct work_struct *work)
{
struct usb_serial_port *port =
container_of(work, struct usb_serial_port, work);
- struct tty_struct *tty;
- tty = tty_port_tty_get(&port->port);
- if (!tty)
- return;
-
- dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
-
- tty_wakeup(tty);
- tty_kref_put(tty);
+ tty_port_tty_wakeup(&port->port);
}
static void kill_traffic(struct usb_serial_port *port)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 4c6a079..fc056d4 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -516,6 +516,7 @@ extern int tty_port_carrier_raised(struct tty_port *port);
extern void tty_port_raise_dtr_rts(struct tty_port *port);
extern void tty_port_lower_dtr_rts(struct tty_port *port);
extern void tty_port_hangup(struct tty_port *port);
+extern void tty_port_tty_wakeup(struct tty_port *port);
extern int tty_port_block_til_ready(struct tty_port *port,
struct tty_struct *tty, struct file *filp);
extern int tty_port_close_start(struct tty_port *port,
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [PATCH 05/16] TTY: add tty_port_tty_wakeup helper
2013-03-07 12:12 ` [PATCH 05/16] TTY: add tty_port_tty_wakeup helper Jiri Slaby
@ 2013-03-08 15:02 ` Peter Hurley
2013-03-08 19:02 ` Jiri Slaby
0 siblings, 1 reply; 27+ messages in thread
From: Peter Hurley @ 2013-03-08 15:02 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, jirislaby, linux-kernel
On Thu, 2013-03-07 at 13:12 +0100, Jiri Slaby wrote:
> It allows for cleaning up on a considerable amount of places. They did
> port_get, wakeup, kref_put. Now the only thing needed is to call
> tty_port_tty_wakeup which does exactly that.
>
> One exception is ifx6x60 where tty_wakeup was open-coded. We now call
> tty_wakeup properly there.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> arch/um/drivers/line.c | 8 +-------
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
> drivers/isdn/capi/capi.c | 7 +------
Cc: Karsten Keil <isdn@linux-pingi.de>
> drivers/isdn/gigaset/interface.c | 6 +-----
Cc: Hansjoerg Lipp <hjlipp@web.de>
Cc: Tilman Schmidt <tilman@imap.cc>
Cc: gigaset307x-common@lists.sourceforge.net
Cc: netdev@vger.kernel.org
> drivers/net/usb/hso.c | 13 ++-----------
Cc: Jan Dumon <j.dumon@option.com>
Cc: linux-usb@vger.kernel.org
> drivers/s390/char/sclp_tty.c | 9 ++-------
> drivers/s390/char/sclp_vt220.c | 8 +-------
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
> drivers/staging/fwserial/fwserial.c | 10 ++--------
Cc: Me :)
> drivers/staging/serqt_usb2/serqt_usb2.c | 7 +------
Cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
Cc: Devendra Naga <devendra.aaru@gmail.com>
and so on...
Same for the other mega-patches.
> drivers/tty/ehv_bytechan.c | 6 +-----
> drivers/tty/hvc/hvsi.c | 7 +------
> drivers/tty/nozomi.c | 6 +-----
> drivers/tty/serial/ifx6x60.c | 33 ++-------------------------------
> drivers/tty/tty_port.c | 16 ++++++++++++++++
> drivers/usb/class/cdc-acm.c | 7 +------
> drivers/usb/serial/digi_acceleport.c | 17 +++--------------
> drivers/usb/serial/io_edgeport.c | 28 +++++-----------------------
> drivers/usb/serial/keyspan_pda.c | 6 ++----
> drivers/usb/serial/mos7720.c | 8 ++------
> drivers/usb/serial/mos7840.c | 7 ++-----
> drivers/usb/serial/ti_usb_3410_5052.c | 7 ++-----
> drivers/usb/serial/usb-serial.c | 10 +---------
> include/linux/tty.h | 1 +
> 22 files changed, 51 insertions(+), 176 deletions(-)
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/16] TTY: add tty_port_tty_wakeup helper
2013-03-08 15:02 ` Peter Hurley
@ 2013-03-08 19:02 ` Jiri Slaby
2013-03-18 23:16 ` Greg KH
0 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-08 19:02 UTC (permalink / raw)
To: Peter Hurley; +Cc: gregkh, jirislaby, linux-kernel
On 03/08/2013 04:02 PM, Peter Hurley wrote:
> On Thu, 2013-03-07 at 13:12 +0100, Jiri Slaby wrote:
>> It allows for cleaning up on a considerable amount of places. They did
>> port_get, wakeup, kref_put. Now the only thing needed is to call
>> tty_port_tty_wakeup which does exactly that.
>>
>> One exception is ifx6x60 where tty_wakeup was open-coded. We now call
>> tty_wakeup properly there.
>>
>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>> ---
>> arch/um/drivers/line.c | 8 +-------
>
> Cc: Jeff Dike <jdike@addtoit.com>
> Cc: Richard Weinberger <richard@nod.at>
>
>> drivers/isdn/capi/capi.c | 7 +------
>
> Cc: Karsten Keil <isdn@linux-pingi.de>
>
>> drivers/isdn/gigaset/interface.c | 6 +-----
>
> Cc: Hansjoerg Lipp <hjlipp@web.de>
> Cc: Tilman Schmidt <tilman@imap.cc>
> Cc: gigaset307x-common@lists.sourceforge.net
> Cc: netdev@vger.kernel.org
>
>> drivers/net/usb/hso.c | 13 ++-----------
>
> Cc: Jan Dumon <j.dumon@option.com>
> Cc: linux-usb@vger.kernel.org
>
>> drivers/s390/char/sclp_tty.c | 9 ++-------
>> drivers/s390/char/sclp_vt220.c | 8 +-------
>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: linux390@de.ibm.com
> Cc: linux-s390@vger.kernel.org
>
>> drivers/staging/fwserial/fwserial.c | 10 ++--------
>
> Cc: Me :)
>
>> drivers/staging/serqt_usb2/serqt_usb2.c | 7 +------
>
> Cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
> Cc: Devendra Naga <devendra.aaru@gmail.com>
>
> and so on...
>
> Same for the other mega-patches.
I'm not sure whether to CC all the people for such patches. I always
tended not to and instead rely on people reading LKML :P.
If this is the preferred way, I of course can do it next time.
--
js
suse labs
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/16] TTY: add tty_port_tty_wakeup helper
2013-03-08 19:02 ` Jiri Slaby
@ 2013-03-18 23:16 ` Greg KH
0 siblings, 0 replies; 27+ messages in thread
From: Greg KH @ 2013-03-18 23:16 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Peter Hurley, jirislaby, linux-kernel
On Fri, Mar 08, 2013 at 08:02:09PM +0100, Jiri Slaby wrote:
> On 03/08/2013 04:02 PM, Peter Hurley wrote:
> > On Thu, 2013-03-07 at 13:12 +0100, Jiri Slaby wrote:
> >> It allows for cleaning up on a considerable amount of places. They did
> >> port_get, wakeup, kref_put. Now the only thing needed is to call
> >> tty_port_tty_wakeup which does exactly that.
> >>
> >> One exception is ifx6x60 where tty_wakeup was open-coded. We now call
> >> tty_wakeup properly there.
> >>
> >> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> >> ---
> >> arch/um/drivers/line.c | 8 +-------
> >
> > Cc: Jeff Dike <jdike@addtoit.com>
> > Cc: Richard Weinberger <richard@nod.at>
> >
> >> drivers/isdn/capi/capi.c | 7 +------
> >
> > Cc: Karsten Keil <isdn@linux-pingi.de>
> >
> >> drivers/isdn/gigaset/interface.c | 6 +-----
> >
> > Cc: Hansjoerg Lipp <hjlipp@web.de>
> > Cc: Tilman Schmidt <tilman@imap.cc>
> > Cc: gigaset307x-common@lists.sourceforge.net
> > Cc: netdev@vger.kernel.org
> >
> >> drivers/net/usb/hso.c | 13 ++-----------
> >
> > Cc: Jan Dumon <j.dumon@option.com>
> > Cc: linux-usb@vger.kernel.org
> >
> >> drivers/s390/char/sclp_tty.c | 9 ++-------
> >> drivers/s390/char/sclp_vt220.c | 8 +-------
> >
> > Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> > Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> > Cc: linux390@de.ibm.com
> > Cc: linux-s390@vger.kernel.org
> >
> >> drivers/staging/fwserial/fwserial.c | 10 ++--------
> >
> > Cc: Me :)
> >
> >> drivers/staging/serqt_usb2/serqt_usb2.c | 7 +------
> >
> > Cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
> > Cc: Devendra Naga <devendra.aaru@gmail.com>
> >
> > and so on...
> >
> > Same for the other mega-patches.
>
> I'm not sure whether to CC all the people for such patches. I always
> tended not to and instead rely on people reading LKML :P.
>
> If this is the preferred way, I of course can do it next time.
It's nice to at least cc: driver maintainers if you can, you can script
get_maintainers.pl to do this for you. But don't worry about it this
time.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 06/16] TTY: add tty_port_tty_hangup helper
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (3 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 05/16] TTY: add tty_port_tty_wakeup helper Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 07/16] TTY: quatech2, remove unneeded is_open Jiri Slaby
` (9 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
It allows for cleaning up on a considerable amount of places. They did
port_get, hangup, kref_put. Now the only thing needed is to call
tty_port_tty_hangup which does exactly that. And they can also decide
whether to consider CLOCAL or completely ignore that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/um/drivers/chan_kern.c | 6 +-----
drivers/mmc/card/sdio_uart.c | 13 ++---------
drivers/net/usb/hso.c | 7 +-----
drivers/tty/cyclades.c | 10 ++-------
drivers/tty/moxa.c | 19 ++++++----------
drivers/tty/n_gsm.c | 6 +-----
drivers/tty/nozomi.c | 9 +++-----
drivers/tty/rocket.c | 7 +-----
drivers/tty/serial/ifx6x60.c | 21 ++----------------
drivers/tty/tty_port.c | 17 +++++++++++++++
drivers/usb/class/cdc-acm.c | 24 ++++++---------------
drivers/usb/serial/keyspan.c | 43 +++++++++----------------------------
drivers/usb/serial/option.c | 9 ++------
drivers/usb/serial/sierra.c | 8 ++-----
include/linux/tty.h | 1 +
net/irda/ircomm/ircomm_tty_attach.c | 6 +-----
16 files changed, 58 insertions(+), 148 deletions(-)
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 15c553c..bf42825 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -568,11 +568,7 @@ void chan_interrupt(struct line *line, int irq)
reactivate_fd(chan->fd, irq);
if (err == -EIO) {
if (chan->primary) {
- struct tty_struct *tty = tty_port_tty_get(&line->port);
- if (tty != NULL) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&line->port, false);
if (line->chan_out != chan)
close_one_chan(line->chan_out, 1);
}
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index c931dfe..f093cea 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -134,7 +134,6 @@ static void sdio_uart_port_put(struct sdio_uart_port *port)
static void sdio_uart_port_remove(struct sdio_uart_port *port)
{
struct sdio_func *func;
- struct tty_struct *tty;
BUG_ON(sdio_uart_table[port->index] != port);
@@ -155,12 +154,8 @@ static void sdio_uart_port_remove(struct sdio_uart_port *port)
sdio_claim_host(func);
port->func = NULL;
mutex_unlock(&port->func_lock);
- tty = tty_port_tty_get(&port->port);
/* tty_hangup is async so is this safe as is ?? */
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&port->port, false);
mutex_unlock(&port->port.mutex);
sdio_release_irq(func);
sdio_disable_func(func);
@@ -492,11 +487,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
wake_up_interruptible(&port->port.open_wait);
else {
/* DCD drop - hang up if tty attached */
- tty = tty_port_tty_get(&port->port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&port->port, false);
}
}
if (status & UART_MSR_DCTS) {
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index a7714b4..cba1d46 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -3124,18 +3124,13 @@ static void hso_serial_ref_free(struct kref *ref)
static void hso_free_interface(struct usb_interface *interface)
{
struct hso_serial *hso_dev;
- struct tty_struct *tty;
int i;
for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) {
if (serial_table[i] &&
(serial_table[i]->interface == interface)) {
hso_dev = dev2ser(serial_table[i]);
- tty = tty_port_tty_get(&hso_dev->port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&hso_dev->port, false);
mutex_lock(&hso_dev->parent->mutex);
hso_dev->parent->usb_gone = 1;
mutex_unlock(&hso_dev->parent->mutex);
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 345bd0e..33f83fe 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1124,14 +1124,8 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
readl(&info->u.cyz.ch_ctrl->rs_status);
if (dcd & C_RS_DCD)
wake_up_interruptible(&info->port.open_wait);
- else {
- struct tty_struct *tty;
- tty = tty_port_tty_get(&info->port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
- }
+ else
+ tty_port_tty_hangup(&info->port, false);
}
break;
case C_CM_MCTS:
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index adeac25..1deaca4 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -913,16 +913,12 @@ static void moxa_board_deinit(struct moxa_board_conf *brd)
/* pci hot-un-plug support */
for (a = 0; a < brd->numPorts; a++)
- if (brd->ports[a].port.flags & ASYNC_INITIALIZED) {
- struct tty_struct *tty = tty_port_tty_get(
- &brd->ports[a].port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
- }
+ if (brd->ports[a].port.flags & ASYNC_INITIALIZED)
+ tty_port_tty_hangup(&brd->ports[a].port, false);
+
for (a = 0; a < MAX_PORTS_PER_BOARD; a++)
tty_port_destroy(&brd->ports[a].port);
+
while (1) {
opened = 0;
for (a = 0; a < brd->numPorts; a++)
@@ -1365,7 +1361,6 @@ static void moxa_hangup(struct tty_struct *tty)
static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd)
{
- struct tty_struct *tty;
unsigned long flags;
dcd = !!dcd;
@@ -1373,10 +1368,8 @@ static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd)
if (dcd != p->DCDState) {
p->DCDState = dcd;
spin_unlock_irqrestore(&p->port.lock, flags);
- tty = tty_port_tty_get(&p->port);
- if (tty && !C_CLOCAL(tty) && !dcd)
- tty_hangup(tty);
- tty_kref_put(tty);
+ if (!dcd)
+ tty_port_tty_hangup(&p->port, true);
}
else
spin_unlock_irqrestore(&p->port.lock, flags);
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 4a43ef5d7..74d9a02 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1418,11 +1418,7 @@ static void gsm_dlci_close(struct gsm_dlci *dlci)
pr_debug("DLCI %d goes closed.\n", dlci->addr);
dlci->state = DLCI_CLOSED;
if (dlci->addr != 0) {
- struct tty_struct *tty = tty_port_tty_get(&dlci->port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&dlci->port, false);
kfifo_reset(dlci->fifo);
} else
dlci->gsm->dead = 1;
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 2e5bbdc..d6080c3 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1501,12 +1501,9 @@ static void tty_exit(struct nozomi *dc)
DBG1(" ");
- for (i = 0; i < MAX_PORT; ++i) {
- struct tty_struct *tty = tty_port_tty_get(&dc->port[i].port);
- if (tty && list_empty(&tty->hangup_work.entry))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ for (i = 0; i < MAX_PORT; ++i)
+ tty_port_tty_hangup(&dc->port[i].port, false);
+
/* Racy below - surely should wait for scheduled work to be done or
complete off a hangup method ? */
while (dc->open_ttys)
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 1d27003..bbffd7a 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -521,15 +521,10 @@ static void rp_handle_port(struct r_port *info)
(ChanStatus & CD_ACT) ? "on" : "off");
#endif
if (!(ChanStatus & CD_ACT) && info->cd_status) {
- struct tty_struct *tty;
#ifdef ROCKET_DEBUG_HANGUP
printk(KERN_INFO "CD drop, calling hangup.\n");
#endif
- tty = tty_port_tty_get(&info->port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&info->port, false);
}
info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0;
wake_up_interruptible(&info->port.open_wait);
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index d723d41..2c77fed 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -270,23 +270,6 @@ static void mrdy_assert(struct ifx_spi_device *ifx_dev)
}
/**
- * ifx_spi_hangup - hang up an IFX device
- * @ifx_dev: our SPI device
- *
- * Hang up the tty attached to the IFX device if one is currently
- * open. If not take no action
- */
-static void ifx_spi_ttyhangup(struct ifx_spi_device *ifx_dev)
-{
- struct tty_port *pport = &ifx_dev->tty_port;
- struct tty_struct *tty = tty_port_tty_get(pport);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
-}
-
-/**
* ifx_spi_timeout - SPI timeout
* @arg: our SPI device
*
@@ -298,7 +281,7 @@ static void ifx_spi_timeout(unsigned long arg)
struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *)arg;
dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***");
- ifx_spi_ttyhangup(ifx_dev);
+ tty_port_tty_hangup(&ifx_dev->tty_port, false);
mrdy_set_low(ifx_dev);
clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
}
@@ -933,7 +916,7 @@ static irqreturn_t ifx_spi_reset_interrupt(int irq, void *dev)
set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state);
if (!solreset) {
/* unsolicited reset */
- ifx_spi_ttyhangup(ifx_dev);
+ tty_port_tty_hangup(&ifx_dev->tty_port, false);
}
} else {
/* exited reset */
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 8bb757c..7f38eea 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -233,6 +233,23 @@ void tty_port_hangup(struct tty_port *port)
EXPORT_SYMBOL(tty_port_hangup);
/**
+ * tty_port_tty_hangup - helper to hang up a tty
+ *
+ * @port: tty port
+ * @check_clocal: hang only ttys with CLOCAL unset?
+ */
+void tty_port_tty_hangup(struct tty_port *port, bool check_clocal)
+{
+ struct tty_struct *tty = tty_port_tty_get(port);
+
+ if (tty && (!check_clocal || !C_CLOCAL(tty))) {
+ tty_hangup(tty);
+ tty_kref_put(tty);
+ }
+}
+EXPORT_SYMBOL_GPL(tty_port_tty_hangup);
+
+/**
* tty_port_tty_wakeup - helper to wake up a tty
*
* @port: tty port
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 755766e..27a1874 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -292,7 +292,6 @@ static void acm_ctrl_irq(struct urb *urb)
{
struct acm *acm = urb->context;
struct usb_cdc_notification *dr = urb->transfer_buffer;
- struct tty_struct *tty;
unsigned char *data;
int newctrl;
int retval;
@@ -327,17 +326,12 @@ static void acm_ctrl_irq(struct urb *urb)
break;
case USB_CDC_NOTIFY_SERIAL_STATE:
- tty = tty_port_tty_get(&acm->port);
newctrl = get_unaligned_le16(data);
- if (tty) {
- if (!acm->clocal &&
- (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
- dev_dbg(&acm->control->dev,
- "%s - calling hangup\n", __func__);
- tty_hangup(tty);
- }
- tty_kref_put(tty);
+ if (!acm->clocal && (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
+ dev_dbg(&acm->control->dev, "%s - calling hangup\n",
+ __func__);
+ tty_port_tty_hangup(&acm->port, false);
}
acm->ctrlin = newctrl;
@@ -1498,15 +1492,9 @@ err_out:
static int acm_reset_resume(struct usb_interface *intf)
{
struct acm *acm = usb_get_intfdata(intf);
- struct tty_struct *tty;
- if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) {
- tty = tty_port_tty_get(&acm->port);
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
- }
+ if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags))
+ tty_port_tty_hangup(&acm->port, false);
return acm_resume(intf);
}
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 1fd1935..b011478 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -378,7 +378,6 @@ static void usa26_instat_callback(struct urb *urb)
struct usb_serial *serial;
struct usb_serial_port *port;
struct keyspan_port_private *p_priv;
- struct tty_struct *tty;
int old_dcd_state, err;
int status = urb->status;
@@ -421,12 +420,8 @@ static void usa26_instat_callback(struct urb *urb)
p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0);
p_priv->ri_state = ((msg->ri) ? 1 : 0);
- if (old_dcd_state != p_priv->dcd_state) {
- tty = tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ if (old_dcd_state != p_priv->dcd_state)
+ tty_port_tty_hangup(&port->port, true);
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -510,7 +505,6 @@ static void usa28_instat_callback(struct urb *urb)
struct usb_serial *serial;
struct usb_serial_port *port;
struct keyspan_port_private *p_priv;
- struct tty_struct *tty;
int old_dcd_state;
int status = urb->status;
@@ -551,12 +545,8 @@ static void usa28_instat_callback(struct urb *urb)
p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
p_priv->ri_state = ((msg->ri) ? 1 : 0);
- if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
- tty = tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
+ tty_port_tty_hangup(&port->port, true);
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -642,12 +632,8 @@ static void usa49_instat_callback(struct urb *urb)
p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
p_priv->ri_state = ((msg->ri) ? 1 : 0);
- if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
- struct tty_struct *tty = tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
+ tty_port_tty_hangup(&port->port, true);
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -851,7 +837,6 @@ static void usa90_instat_callback(struct urb *urb)
struct usb_serial *serial;
struct usb_serial_port *port;
struct keyspan_port_private *p_priv;
- struct tty_struct *tty;
int old_dcd_state, err;
int status = urb->status;
@@ -880,12 +865,8 @@ static void usa90_instat_callback(struct urb *urb)
p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
p_priv->ri_state = ((msg->ri) ? 1 : 0);
- if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
- tty = tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
+ tty_port_tty_hangup(&port->port, true);
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -953,12 +934,8 @@ static void usa67_instat_callback(struct urb *urb)
p_priv->cts_state = ((msg->hskia_cts) ? 1 : 0);
p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0);
- if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
- struct tty_struct *tty = tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ if (old_dcd_state != p_priv->dcd_state && old_dcd_state)
+ tty_port_tty_hangup(&port->port, true);
/* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f7d339d..602d1f3 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1532,13 +1532,8 @@ static void option_instat_callback(struct urb *urb)
portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
portdata->ri_state = ((signals & 0x08) ? 1 : 0);
- if (old_dcd_state && !portdata->dcd_state) {
- struct tty_struct *tty =
- tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty))
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ if (old_dcd_state && !portdata->dcd_state)
+ tty_port_tty_hangup(&port->port, true);
} else {
dev_dbg(dev, "%s: type %x req %x\n", __func__,
req_pkt->bRequestType, req_pkt->bRequest);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index c13f6e7..d66148a 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -628,7 +628,6 @@ static void sierra_instat_callback(struct urb *urb)
unsigned char signals = *((unsigned char *)
urb->transfer_buffer +
sizeof(struct usb_ctrlrequest));
- struct tty_struct *tty;
dev_dbg(&port->dev, "%s: signal x%x\n", __func__,
signals);
@@ -639,11 +638,8 @@ static void sierra_instat_callback(struct urb *urb)
portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
portdata->ri_state = ((signals & 0x08) ? 1 : 0);
- tty = tty_port_tty_get(&port->port);
- if (tty && !C_CLOCAL(tty) &&
- old_dcd_state && !portdata->dcd_state)
- tty_hangup(tty);
- tty_kref_put(tty);
+ if (old_dcd_state && !portdata->dcd_state)
+ tty_port_tty_hangup(&port->port, true);
} else {
dev_dbg(&port->dev, "%s: type %x req %x\n",
__func__, req_pkt->bRequestType,
diff --git a/include/linux/tty.h b/include/linux/tty.h
index fc056d4..d9b96ff 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -516,6 +516,7 @@ extern int tty_port_carrier_raised(struct tty_port *port);
extern void tty_port_raise_dtr_rts(struct tty_port *port);
extern void tty_port_lower_dtr_rts(struct tty_port *port);
extern void tty_port_hangup(struct tty_port *port);
+extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal);
extern void tty_port_tty_wakeup(struct tty_port *port);
extern int tty_port_block_til_ready(struct tty_port *port,
struct tty_struct *tty, struct file *filp);
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index edab393..a2a508f 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -997,12 +997,8 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self,
self->settings.dce = IRCOMM_DELTA_CD;
ircomm_tty_check_modem_status(self);
} else {
- struct tty_struct *tty = tty_port_tty_get(&self->port);
IRDA_DEBUG(0, "%s(), hanging up!\n", __func__ );
- if (tty) {
- tty_hangup(tty);
- tty_kref_put(tty);
- }
+ tty_port_tty_hangup(&self->port, false);
}
break;
default:
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 07/16] TTY: quatech2, remove unneeded is_open
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (4 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 06/16] TTY: add tty_port_tty_hangup helper Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-13 13:46 ` Bill Pemberton
2013-03-07 12:12 ` [PATCH 08/16] TTY: serial/bfin_uart, unbreak build with KGDB enabled Jiri Slaby
` (8 subsequent siblings)
14 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel, Bill Pemberton
tty->ops->break_ctl cannot be called outside the gap between open and
close. So there is no need to check whether the port is open in
break_ctl in quatech2. Remove the check and also that member
completely.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Bill Pemberton <wfp5p@virginia.edu>
---
drivers/usb/serial/quatech2.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 00e6c9b..d853104 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -116,7 +116,6 @@ struct qt2_serial_private {
};
struct qt2_port_private {
- bool is_open;
u8 device_port;
spinlock_t urb_lock;
@@ -398,7 +397,6 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
return status;
}
- port_priv->is_open = true;
port_priv->device_port = (u8) device_port;
if (tty)
@@ -418,8 +416,6 @@ static void qt2_close(struct usb_serial_port *port)
serial = port->serial;
port_priv = usb_get_serial_port_data(port);
- port_priv->is_open = false;
-
spin_lock_irqsave(&port_priv->urb_lock, flags);
usb_kill_urb(port_priv->write_urb);
port_priv->urb_in_use = false;
@@ -905,12 +901,6 @@ static void qt2_break_ctl(struct tty_struct *tty, int break_state)
port_priv = usb_get_serial_port_data(port);
- if (!port_priv->is_open) {
- dev_err(&port->dev,
- "%s - port is not open\n", __func__);
- return;
- }
-
val = (break_state == -1) ? 1 : 0;
status = qt2_control_msg(port->serial->dev, QT2_BREAK_CONTROL,
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [PATCH 07/16] TTY: quatech2, remove unneeded is_open
2013-03-07 12:12 ` [PATCH 07/16] TTY: quatech2, remove unneeded is_open Jiri Slaby
@ 2013-03-13 13:46 ` Bill Pemberton
2013-03-13 14:17 ` Jiri Slaby
0 siblings, 1 reply; 27+ messages in thread
From: Bill Pemberton @ 2013-03-13 13:46 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, peter, jirislaby, linux-kernel
Jiri Slaby writes:
>
> tty->ops->break_ctl cannot be called outside the gap between open and
> close. So there is no need to check whether the port is open in
> break_ctl in quatech2. Remove the check and also that member
> completely.
>
We can't get rid of is_open. The devices use 1 read urb for all ports
and will send various things about ports that haven't actually been
opened. So the driver needs to know if a port has actually been
opened or not. In fact, I was about to send a patch that fixes a
warning caused by commit 2e124b4a390ca85325fae75764bef92f0547fa25
causing the driver to try to write to ttys that weren't actually
opened.
The guard in qt2_break_ctl() can still be removed.
--
Bill
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 07/16] TTY: quatech2, remove unneeded is_open
2013-03-13 13:46 ` Bill Pemberton
@ 2013-03-13 14:17 ` Jiri Slaby
2013-03-13 14:27 ` Bill Pemberton
0 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-13 14:17 UTC (permalink / raw)
To: Bill Pemberton; +Cc: gregkh, peter, jirislaby, linux-kernel
On 03/13/2013 02:46 PM, Bill Pemberton wrote:
> Jiri Slaby writes:
>>
>> tty->ops->break_ctl cannot be called outside the gap between open and
>> close. So there is no need to check whether the port is open in
>> break_ctl in quatech2. Remove the check and also that member
>> completely.
>>
>
> We can't get rid of is_open. The devices use 1 read urb for all ports
> and will send various things about ports that haven't actually been
> opened. So the driver needs to know if a port has actually been
> opened or not. In fact, I was about to send a patch that fixes a
> warning caused by commit 2e124b4a390ca85325fae75764bef92f0547fa25
> causing the driver to try to write to ttys that weren't actually
> opened.
As long as tty_port exists for the port, calling tty buffer functions is
OK. The warning you mention is now bogus and there is a patch flying
around to disable that at the moment.
It is also that is_open was completely racy, right?
> The guard in qt2_break_ctl() can still be removed.
Ok.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 07/16] TTY: quatech2, remove unneeded is_open
2013-03-13 14:17 ` Jiri Slaby
@ 2013-03-13 14:27 ` Bill Pemberton
0 siblings, 0 replies; 27+ messages in thread
From: Bill Pemberton @ 2013-03-13 14:27 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, peter, jirislaby, linux-kernel
Jiri Slaby writes:
>
> On 03/13/2013 02:46 PM, Bill Pemberton wrote:
> > Jiri Slaby writes:
> >>
> >> tty->ops->break_ctl cannot be called outside the gap between open and
> >> close. So there is no need to check whether the port is open in
> >> break_ctl in quatech2. Remove the check and also that member
> >> completely.
> >>
> >
> > We can't get rid of is_open. The devices use 1 read urb for all ports
> > and will send various things about ports that haven't actually been
> > opened. So the driver needs to know if a port has actually been
> > opened or not. In fact, I was about to send a patch that fixes a
> > warning caused by commit 2e124b4a390ca85325fae75764bef92f0547fa25
> > causing the driver to try to write to ttys that weren't actually
> > opened.
>
> As long as tty_port exists for the port, calling tty buffer functions is
> OK. The warning you mention is now bogus and there is a patch flying
> around to disable that at the moment.
>
Ah, ok, I assumed the warning was telling me the driver was doing
something stupid by calling tty_flip_buffer_push() on a port that
wasn't opened (which did sound like a stupid thing to do to me). If
that's actually harmless, then yes, the is_open stuff can be dropped
and my recent patch to check is_open before calling
tty_flip_buffer_push() can be ignored.
> It is also that is_open was completely racy, right?
>
Does it simply need a lock around it or is there something else I'm
missing? In any event, if it can go, that's great -- it's only used
for the above "don't call tty_flip_buffer_push() on an unopened port"
logic.
--
Bill
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 08/16] TTY: serial/bfin_uart, unbreak build with KGDB enabled
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (5 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 07/16] TTY: quatech2, remove unneeded is_open Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-08 7:59 ` Sonic Zhang
2013-03-07 12:12 ` [PATCH 09/16] TTY: serial/msm_serial_hs, remove unused tty Jiri Slaby
` (7 subsequent siblings)
14 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel, Sonic Zhang, uclinux-dist-devel
There are no (and never were any) kgdb fields in uart_ops. Setting
them produces a build error:
drivers/tty/serial/bfin_uart.c:1054:2: error: unknown field 'kgdboc_port_startup' specified in initializer
drivers/tty/serial/bfin_uart.c:1054:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/tty/serial/bfin_uart.c:1054:2: warning: (near initialization for 'bfin_serial_pops.ioctl') [enabled by default]
drivers/tty/serial/bfin_uart.c:1055:2: error: unknown field 'kgdboc_port_shutdown' specified in initializer
drivers/tty/serial/bfin_uart.c:1055:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/tty/serial/bfin_uart.c:1055:2: warning: (near initialization for 'bfin_serial_pops.poll_init') [enabled by default]
Remove them.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---
drivers/tty/serial/bfin_uart.c | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index 12dceda..26a3be7 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -1011,24 +1011,6 @@ static int bfin_serial_poll_get_char(struct uart_port *port)
}
#endif
-#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
- defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
-static void bfin_kgdboc_port_shutdown(struct uart_port *port)
-{
- if (kgdboc_break_enabled) {
- kgdboc_break_enabled = 0;
- bfin_serial_shutdown(port);
- }
-}
-
-static int bfin_kgdboc_port_startup(struct uart_port *port)
-{
- kgdboc_port_line = port->line;
- kgdboc_break_enabled = !bfin_serial_startup(port);
- return 0;
-}
-#endif
-
static struct uart_ops bfin_serial_pops = {
.tx_empty = bfin_serial_tx_empty,
.set_mctrl = bfin_serial_set_mctrl,
@@ -1047,11 +1029,6 @@ static struct uart_ops bfin_serial_pops = {
.request_port = bfin_serial_request_port,
.config_port = bfin_serial_config_port,
.verify_port = bfin_serial_verify_port,
-#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
- defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
- .kgdboc_port_startup = bfin_kgdboc_port_startup,
- .kgdboc_port_shutdown = bfin_kgdboc_port_shutdown,
-#endif
#ifdef CONFIG_CONSOLE_POLL
.poll_put_char = bfin_serial_poll_put_char,
.poll_get_char = bfin_serial_poll_get_char,
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [PATCH 08/16] TTY: serial/bfin_uart, unbreak build with KGDB enabled
2013-03-07 12:12 ` [PATCH 08/16] TTY: serial/bfin_uart, unbreak build with KGDB enabled Jiri Slaby
@ 2013-03-08 7:59 ` Sonic Zhang
0 siblings, 0 replies; 27+ messages in thread
From: Sonic Zhang @ 2013-03-08 7:59 UTC (permalink / raw)
To: Jiri Slaby
Cc: gregkh, peter, jirislaby, linux-kernel, Sonic Zhang,
uclinux-dist-devel
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
On Thu, Mar 7, 2013 at 8:12 PM, Jiri Slaby <jslaby@suse.cz> wrote:
> There are no (and never were any) kgdb fields in uart_ops. Setting
> them produces a build error:
> drivers/tty/serial/bfin_uart.c:1054:2: error: unknown field 'kgdboc_port_startup' specified in initializer
> drivers/tty/serial/bfin_uart.c:1054:2: warning: initialization from incompatible pointer type [enabled by default]
> drivers/tty/serial/bfin_uart.c:1054:2: warning: (near initialization for 'bfin_serial_pops.ioctl') [enabled by default]
> drivers/tty/serial/bfin_uart.c:1055:2: error: unknown field 'kgdboc_port_shutdown' specified in initializer
> drivers/tty/serial/bfin_uart.c:1055:2: warning: initialization from incompatible pointer type [enabled by default]
> drivers/tty/serial/bfin_uart.c:1055:2: warning: (near initialization for 'bfin_serial_pops.poll_init') [enabled by default]
>
> Remove them.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Sonic Zhang <sonic.zhang@analog.com>
> Cc: uclinux-dist-devel@blackfin.uclinux.org
> ---
> drivers/tty/serial/bfin_uart.c | 23 -----------------------
> 1 file changed, 23 deletions(-)
>
> diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
> index 12dceda..26a3be7 100644
> --- a/drivers/tty/serial/bfin_uart.c
> +++ b/drivers/tty/serial/bfin_uart.c
> @@ -1011,24 +1011,6 @@ static int bfin_serial_poll_get_char(struct uart_port *port)
> }
> #endif
>
> -#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
> - defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
> -static void bfin_kgdboc_port_shutdown(struct uart_port *port)
> -{
> - if (kgdboc_break_enabled) {
> - kgdboc_break_enabled = 0;
> - bfin_serial_shutdown(port);
> - }
> -}
> -
> -static int bfin_kgdboc_port_startup(struct uart_port *port)
> -{
> - kgdboc_port_line = port->line;
> - kgdboc_break_enabled = !bfin_serial_startup(port);
> - return 0;
> -}
> -#endif
> -
> static struct uart_ops bfin_serial_pops = {
> .tx_empty = bfin_serial_tx_empty,
> .set_mctrl = bfin_serial_set_mctrl,
> @@ -1047,11 +1029,6 @@ static struct uart_ops bfin_serial_pops = {
> .request_port = bfin_serial_request_port,
> .config_port = bfin_serial_config_port,
> .verify_port = bfin_serial_verify_port,
> -#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
> - defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
> - .kgdboc_port_startup = bfin_kgdboc_port_startup,
> - .kgdboc_port_shutdown = bfin_kgdboc_port_shutdown,
> -#endif
> #ifdef CONFIG_CONSOLE_POLL
> .poll_put_char = bfin_serial_poll_put_char,
> .poll_get_char = bfin_serial_poll_get_char,
> --
> 1.8.1.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 09/16] TTY: serial/msm_serial_hs, remove unused tty
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (6 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 08/16] TTY: serial/bfin_uart, unbreak build with KGDB enabled Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 10/16] TTY: cleanup tty->hw_stopped uses Jiri Slaby
` (6 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/msm_serial_hs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
index 4a942c7..4ca2f64 100644
--- a/drivers/tty/serial/msm_serial_hs.c
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -907,7 +907,6 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr,
unsigned int error_f = 0;
unsigned long flags;
unsigned int flush;
- struct tty_struct *tty;
struct tty_port *port;
struct uart_port *uport;
struct msm_hs_port *msm_uport;
@@ -919,7 +918,6 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr,
clk_enable(msm_uport->clk);
port = &uport->state->port;
- tty = port->tty;
msm_hs_write(uport, UARTDM_CR_ADDR, STALE_EVENT_DISABLE);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 10/16] TTY: cleanup tty->hw_stopped uses
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (7 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 09/16] TTY: serial/msm_serial_hs, remove unused tty Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-08 14:39 ` Peter Hurley
2013-03-07 12:12 ` [PATCH 11/16] crisv10: stop returning info from handle_ser_rx_interrupt Jiri Slaby
` (5 subsequent siblings)
14 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
tty->hw_stopped is set only by drivers to remember HW state. If it is
never set to 1 in a particular driver, there is no need to check it in
the driver at all. Remove such checks.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/ia64/hp/sim/simserial.c | 16 +++-------------
drivers/isdn/i4l/isdn_tty.c | 3 ---
drivers/net/caif/caif_serial.c | 1 -
drivers/tty/rocket.c | 19 ++++++++-----------
drivers/tty/serial/68328serial.c | 9 +++------
drivers/tty/serial/arc_uart.c | 2 +-
drivers/tty/serial/crisv10.c | 12 ++----------
7 files changed, 17 insertions(+), 45 deletions(-)
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index da2f319..e70cade 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -142,8 +142,7 @@ static void transmit_chars(struct tty_struct *tty, struct serial_state *info,
goto out;
}
- if (info->xmit.head == info->xmit.tail || tty->stopped ||
- tty->hw_stopped) {
+ if (info->xmit.head == info->xmit.tail || tty->stopped) {
#ifdef SIMSERIAL_DEBUG
printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
info->xmit.head, info->xmit.tail, tty->stopped);
@@ -181,7 +180,7 @@ static void rs_flush_chars(struct tty_struct *tty)
struct serial_state *info = tty->driver_data;
if (info->xmit.head == info->xmit.tail || tty->stopped ||
- tty->hw_stopped || !info->xmit.buf)
+ !info->xmit.buf)
return;
transmit_chars(tty, info, NULL);
@@ -217,7 +216,7 @@ static int rs_write(struct tty_struct * tty,
* Hey, we transmit directly from here in our case
*/
if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) &&
- !tty->stopped && !tty->hw_stopped)
+ !tty->stopped)
transmit_chars(tty, info, NULL);
return ret;
@@ -325,14 +324,6 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
-static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
-{
- /* Handle turning off CRTSCTS */
- if ((old_termios->c_cflag & CRTSCTS) &&
- !(tty->termios.c_cflag & CRTSCTS)) {
- tty->hw_stopped = 0;
- }
-}
/*
* This routine will shutdown a serial port; interrupts are disabled, and
* DTR is dropped if the hangup on close termio flag is on.
@@ -481,7 +472,6 @@ static const struct tty_operations hp_ops = {
.throttle = rs_throttle,
.unthrottle = rs_unthrottle,
.send_xchar = rs_send_xchar,
- .set_termios = rs_set_termios,
.hangup = rs_hangup,
.proc_fops = &rs_proc_fops,
};
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index d8a7d83..2210766 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1470,9 +1470,6 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
tty->termios.c_ospeed == old_termios->c_ospeed)
return;
isdn_tty_change_speed(info);
- if ((old_termios->c_cflag & CRTSCTS) &&
- !(tty->termios.c_cflag & CRTSCTS))
- tty->hw_stopped = 0;
}
}
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 666891a..d1bf0ff 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -88,7 +88,6 @@ static inline void update_tty_status(struct ser_device *ser)
{
ser->tty_status =
ser->tty->stopped << 5 |
- ser->tty->hw_stopped << 4 |
ser->tty->flow_stopped << 3 |
ser->tty->packet << 2 |
ser->tty->port->low_latency << 1 |
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index bbffd7a..f5abc28 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -449,7 +449,7 @@ static void rp_do_transmit(struct r_port *info)
/* Loop sending data to FIFO until done or FIFO full */
while (1) {
- if (tty->stopped || tty->hw_stopped)
+ if (tty->stopped)
break;
c = min(info->xmit_fifo_room, info->xmit_cnt);
c = min(c, XMIT_BUF_SIZE - info->xmit_tail);
@@ -1106,15 +1106,12 @@ static void rp_set_termios(struct tty_struct *tty,
/* Handle transition away from B0 status */
if (!(old_termios->c_cflag & CBAUD) && (tty->termios.c_cflag & CBAUD)) {
- if (!tty->hw_stopped || !(tty->termios.c_cflag & CRTSCTS))
- sSetRTS(cp);
+ sSetRTS(cp);
sSetDTR(cp);
}
- if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS)) {
- tty->hw_stopped = 0;
+ if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS))
rp_start(tty);
- }
}
static int rp_break(struct tty_struct *tty, int break_state)
@@ -1570,10 +1567,10 @@ static int rp_put_char(struct tty_struct *tty, unsigned char ch)
spin_lock_irqsave(&info->slock, flags);
cp = &info->channel;
- if (!tty->stopped && !tty->hw_stopped && info->xmit_fifo_room == 0)
+ if (!tty->stopped && info->xmit_fifo_room == 0)
info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
- if (tty->stopped || tty->hw_stopped || info->xmit_fifo_room == 0 || info->xmit_cnt != 0) {
+ if (tty->stopped || info->xmit_fifo_room == 0 || info->xmit_cnt != 0) {
info->xmit_buf[info->xmit_head++] = ch;
info->xmit_head &= XMIT_BUF_SIZE - 1;
info->xmit_cnt++;
@@ -1614,14 +1611,14 @@ static int rp_write(struct tty_struct *tty,
#endif
cp = &info->channel;
- if (!tty->stopped && !tty->hw_stopped && info->xmit_fifo_room < count)
+ if (!tty->stopped && info->xmit_fifo_room < count)
info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
/*
* If the write queue for the port is empty, and there is FIFO space, stuff bytes
* into FIFO. Use the write queue for temp storage.
*/
- if (!tty->stopped && !tty->hw_stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
+ if (!tty->stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
c = min(count, info->xmit_fifo_room);
b = buf;
@@ -1669,7 +1666,7 @@ static int rp_write(struct tty_struct *tty,
retval += c;
}
- if ((retval > 0) && !tty->stopped && !tty->hw_stopped)
+ if ((retval > 0) && !tty->stopped)
set_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
end:
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index 4939947..ef2e08e 100644
--- a/drivers/tty/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
@@ -630,8 +630,7 @@ static void rs_flush_chars(struct tty_struct *tty)
/* Enable transmitter */
local_irq_save(flags);
- if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
- !info->xmit_buf) {
+ if (info->xmit_cnt <= 0 || tty->stopped || !info->xmit_buf) {
local_irq_restore(flags);
return;
}
@@ -697,7 +696,7 @@ static int rs_write(struct tty_struct * tty,
total += c;
}
- if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
+ if (info->xmit_cnt && !tty->stopped) {
/* Enable transmitter */
local_irq_disable();
#ifndef USE_INTS
@@ -978,10 +977,8 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
change_speed(info, tty);
if ((old_termios->c_cflag & CRTSCTS) &&
- !(tty->termios.c_cflag & CRTSCTS)) {
- tty->hw_stopped = 0;
+ !(tty->termios.c_cflag & CRTSCTS))
rs_start(tty);
- }
}
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index d97e194..cbf1d15 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -162,7 +162,7 @@ static unsigned int arc_serial_tx_empty(struct uart_port *port)
/*
* Driver internal routine, used by both tty(serial core) as well as tx-isr
* -Called under spinlock in either cases
- * -also tty->stopped / tty->hw_stopped has already been checked
+ * -also tty->stopped has already been checked
* = by uart_start( ) before calling us
* = tx_ist checks that too before calling
*/
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 5f37c31..50f56f3 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -2534,8 +2534,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
}
/* Normal char-by-char interrupt */
if (info->xmit.head == info->xmit.tail
- || info->port.tty->stopped
- || info->port.tty->hw_stopped) {
+ || info->port.tty->stopped) {
DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n",
info->port.tty->stopped));
e100_disable_serial_tx_ready_irq(info);
@@ -3098,7 +3097,6 @@ rs_flush_chars(struct tty_struct *tty)
if (info->tr_running ||
info->xmit.head == info->xmit.tail ||
tty->stopped ||
- tty->hw_stopped ||
!info->xmit.buf)
return;
@@ -3176,7 +3174,6 @@ static int rs_raw_write(struct tty_struct *tty,
if (info->xmit.head != info->xmit.tail &&
!tty->stopped &&
- !tty->hw_stopped &&
!info->tr_running) {
start_transmit(info);
}
@@ -3733,10 +3730,8 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
/* Handle turning off CRTSCTS */
if ((old_termios->c_cflag & CRTSCTS) &&
- !(tty->termios.c_cflag & CRTSCTS)) {
- tty->hw_stopped = 0;
+ !(tty->termios.c_cflag & CRTSCTS))
rs_start(tty);
- }
}
@@ -4256,9 +4251,6 @@ static void seq_line_info(struct seq_file *m, struct e100_serial *info)
if (info->port.tty->stopped)
seq_printf(m, " stopped:%i",
(int)info->port.tty->stopped);
- if (info->port.tty->hw_stopped)
- seq_printf(m, " hw_stopped:%i",
- (int)info->port.tty->hw_stopped);
}
{
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* Re: [PATCH 10/16] TTY: cleanup tty->hw_stopped uses
2013-03-07 12:12 ` [PATCH 10/16] TTY: cleanup tty->hw_stopped uses Jiri Slaby
@ 2013-03-08 14:39 ` Peter Hurley
2013-03-08 14:46 ` Jiri Slaby
0 siblings, 1 reply; 27+ messages in thread
From: Peter Hurley @ 2013-03-08 14:39 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, jirislaby, linux-kernel
On Thu, 2013-03-07 at 13:12 +0100, Jiri Slaby wrote:
> tty->hw_stopped is set only by drivers to remember HW state. If it is
> never set to 1 in a particular driver, there is no need to check it in
> the driver at all. Remove such checks.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> arch/ia64/hp/sim/simserial.c | 16 +++-------------
> drivers/isdn/i4l/isdn_tty.c | 3 ---
> drivers/net/caif/caif_serial.c | 1 -
> drivers/tty/rocket.c | 19 ++++++++-----------
> drivers/tty/serial/68328serial.c | 9 +++------
> drivers/tty/serial/arc_uart.c | 2 +-
> drivers/tty/serial/crisv10.c | 12 ++----------
> 7 files changed, 17 insertions(+), 45 deletions(-)
>
> diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
> index da2f319..e70cade 100644
> --- a/arch/ia64/hp/sim/simserial.c
> +++ b/arch/ia64/hp/sim/simserial.c
> @@ -142,8 +142,7 @@ static void transmit_chars(struct tty_struct *tty, struct serial_state *info,
> goto out;
> }
>
> - if (info->xmit.head == info->xmit.tail || tty->stopped ||
> - tty->hw_stopped) {
> + if (info->xmit.head == info->xmit.tail || tty->stopped) {
> #ifdef SIMSERIAL_DEBUG
> printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
> info->xmit.head, info->xmit.tail, tty->stopped);
> @@ -181,7 +180,7 @@ static void rs_flush_chars(struct tty_struct *tty)
> struct serial_state *info = tty->driver_data;
>
> if (info->xmit.head == info->xmit.tail || tty->stopped ||
> - tty->hw_stopped || !info->xmit.buf)
> + !info->xmit.buf)
> return;
>
> transmit_chars(tty, info, NULL);
> @@ -217,7 +216,7 @@ static int rs_write(struct tty_struct * tty,
> * Hey, we transmit directly from here in our case
> */
> if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) &&
> - !tty->stopped && !tty->hw_stopped)
> + !tty->stopped)
> transmit_chars(tty, info, NULL);
>
> return ret;
> @@ -325,14 +324,6 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
>
> #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
>
> -static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
> -{
> - /* Handle turning off CRTSCTS */
> - if ((old_termios->c_cflag & CRTSCTS) &&
> - !(tty->termios.c_cflag & CRTSCTS)) {
> - tty->hw_stopped = 0;
> - }
> -}
> /*
> * This routine will shutdown a serial port; interrupts are disabled, and
> * DTR is dropped if the hangup on close termio flag is on.
> @@ -481,7 +472,6 @@ static const struct tty_operations hp_ops = {
> .throttle = rs_throttle,
> .unthrottle = rs_unthrottle,
> .send_xchar = rs_send_xchar,
> - .set_termios = rs_set_termios,
> .hangup = rs_hangup,
> .proc_fops = &rs_proc_fops,
> };
> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
> index d8a7d83..2210766 100644
> --- a/drivers/isdn/i4l/isdn_tty.c
> +++ b/drivers/isdn/i4l/isdn_tty.c
> @@ -1470,9 +1470,6 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
> tty->termios.c_ospeed == old_termios->c_ospeed)
> return;
> isdn_tty_change_speed(info);
> - if ((old_termios->c_cflag & CRTSCTS) &&
> - !(tty->termios.c_cflag & CRTSCTS))
> - tty->hw_stopped = 0;
> }
> }
>
> diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
> index 666891a..d1bf0ff 100644
> --- a/drivers/net/caif/caif_serial.c
> +++ b/drivers/net/caif/caif_serial.c
> @@ -88,7 +88,6 @@ static inline void update_tty_status(struct ser_device *ser)
> {
> ser->tty_status =
> ser->tty->stopped << 5 |
> - ser->tty->hw_stopped << 4 |
> ser->tty->flow_stopped << 3 |
> ser->tty->packet << 2 |
> ser->tty->port->low_latency << 1 |
I would maybe leave this with a code comment instead.
ser->tty->hw_stopped << 4 | /* hw_stopped is not used by tty layer */
> diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
> index bbffd7a..f5abc28 100644
> --- a/drivers/tty/rocket.c
> +++ b/drivers/tty/rocket.c
> @@ -449,7 +449,7 @@ static void rp_do_transmit(struct r_port *info)
>
> /* Loop sending data to FIFO until done or FIFO full */
> while (1) {
> - if (tty->stopped || tty->hw_stopped)
> + if (tty->stopped)
> break;
> c = min(info->xmit_fifo_room, info->xmit_cnt);
> c = min(c, XMIT_BUF_SIZE - info->xmit_tail);
> @@ -1106,15 +1106,12 @@ static void rp_set_termios(struct tty_struct *tty,
>
> /* Handle transition away from B0 status */
> if (!(old_termios->c_cflag & CBAUD) && (tty->termios.c_cflag & CBAUD)) {
> - if (!tty->hw_stopped || !(tty->termios.c_cflag & CRTSCTS))
> - sSetRTS(cp);
> + sSetRTS(cp);
Terrible original logic there.
> sSetDTR(cp);
> }
>
> - if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS)) {
> - tty->hw_stopped = 0;
> + if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS))
> rp_start(tty);
> - }
> }
>
> static int rp_break(struct tty_struct *tty, int break_state)
> @@ -1570,10 +1567,10 @@ static int rp_put_char(struct tty_struct *tty, unsigned char ch)
> spin_lock_irqsave(&info->slock, flags);
> cp = &info->channel;
>
> - if (!tty->stopped && !tty->hw_stopped && info->xmit_fifo_room == 0)
> + if (!tty->stopped && info->xmit_fifo_room == 0)
> info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
>
> - if (tty->stopped || tty->hw_stopped || info->xmit_fifo_room == 0 || info->xmit_cnt != 0) {
> + if (tty->stopped || info->xmit_fifo_room == 0 || info->xmit_cnt != 0) {
> info->xmit_buf[info->xmit_head++] = ch;
> info->xmit_head &= XMIT_BUF_SIZE - 1;
> info->xmit_cnt++;
> @@ -1614,14 +1611,14 @@ static int rp_write(struct tty_struct *tty,
> #endif
> cp = &info->channel;
>
> - if (!tty->stopped && !tty->hw_stopped && info->xmit_fifo_room < count)
> + if (!tty->stopped && info->xmit_fifo_room < count)
> info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
>
> /*
> * If the write queue for the port is empty, and there is FIFO space, stuff bytes
> * into FIFO. Use the write queue for temp storage.
> */
> - if (!tty->stopped && !tty->hw_stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
> + if (!tty->stopped && info->xmit_cnt == 0 && info->xmit_fifo_room > 0) {
> c = min(count, info->xmit_fifo_room);
> b = buf;
>
> @@ -1669,7 +1666,7 @@ static int rp_write(struct tty_struct *tty,
> retval += c;
> }
>
> - if ((retval > 0) && !tty->stopped && !tty->hw_stopped)
> + if ((retval > 0) && !tty->stopped)
> set_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
>
> end:
> diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
> index 4939947..ef2e08e 100644
> --- a/drivers/tty/serial/68328serial.c
> +++ b/drivers/tty/serial/68328serial.c
> @@ -630,8 +630,7 @@ static void rs_flush_chars(struct tty_struct *tty)
> /* Enable transmitter */
> local_irq_save(flags);
>
> - if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
> - !info->xmit_buf) {
> + if (info->xmit_cnt <= 0 || tty->stopped || !info->xmit_buf) {
> local_irq_restore(flags);
> return;
> }
> @@ -697,7 +696,7 @@ static int rs_write(struct tty_struct * tty,
> total += c;
> }
>
> - if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
> + if (info->xmit_cnt && !tty->stopped) {
> /* Enable transmitter */
> local_irq_disable();
> #ifndef USE_INTS
> @@ -978,10 +977,8 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
> change_speed(info, tty);
>
> if ((old_termios->c_cflag & CRTSCTS) &&
> - !(tty->termios.c_cflag & CRTSCTS)) {
> - tty->hw_stopped = 0;
> + !(tty->termios.c_cflag & CRTSCTS))
> rs_start(tty);
> - }
>
> }
>
> diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
> index d97e194..cbf1d15 100644
> --- a/drivers/tty/serial/arc_uart.c
> +++ b/drivers/tty/serial/arc_uart.c
> @@ -162,7 +162,7 @@ static unsigned int arc_serial_tx_empty(struct uart_port *port)
> /*
> * Driver internal routine, used by both tty(serial core) as well as tx-isr
> * -Called under spinlock in either cases
> - * -also tty->stopped / tty->hw_stopped has already been checked
> + * -also tty->stopped has already been checked
> * = by uart_start( ) before calling us
> * = tx_ist checks that too before calling
> */
> diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
> index 5f37c31..50f56f3 100644
> --- a/drivers/tty/serial/crisv10.c
> +++ b/drivers/tty/serial/crisv10.c
> @@ -2534,8 +2534,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
> }
> /* Normal char-by-char interrupt */
> if (info->xmit.head == info->xmit.tail
> - || info->port.tty->stopped
> - || info->port.tty->hw_stopped) {
> + || info->port.tty->stopped) {
> DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n",
> info->port.tty->stopped));
> e100_disable_serial_tx_ready_irq(info);
> @@ -3098,7 +3097,6 @@ rs_flush_chars(struct tty_struct *tty)
> if (info->tr_running ||
> info->xmit.head == info->xmit.tail ||
> tty->stopped ||
> - tty->hw_stopped ||
> !info->xmit.buf)
> return;
>
> @@ -3176,7 +3174,6 @@ static int rs_raw_write(struct tty_struct *tty,
>
> if (info->xmit.head != info->xmit.tail &&
> !tty->stopped &&
> - !tty->hw_stopped &&
> !info->tr_running) {
> start_transmit(info);
> }
> @@ -3733,10 +3730,8 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
>
> /* Handle turning off CRTSCTS */
> if ((old_termios->c_cflag & CRTSCTS) &&
> - !(tty->termios.c_cflag & CRTSCTS)) {
> - tty->hw_stopped = 0;
> + !(tty->termios.c_cflag & CRTSCTS))
> rs_start(tty);
> - }
>
> }
>
> @@ -4256,9 +4251,6 @@ static void seq_line_info(struct seq_file *m, struct e100_serial *info)
> if (info->port.tty->stopped)
> seq_printf(m, " stopped:%i",
> (int)info->port.tty->stopped);
> - if (info->port.tty->hw_stopped)
> - seq_printf(m, " hw_stopped:%i",
> - (int)info->port.tty->hw_stopped);
User-space visible. Tool may expect this field.
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH 10/16] TTY: cleanup tty->hw_stopped uses
2013-03-08 14:39 ` Peter Hurley
@ 2013-03-08 14:46 ` Jiri Slaby
2013-03-08 14:55 ` Peter Hurley
0 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-08 14:46 UTC (permalink / raw)
To: Peter Hurley; +Cc: Jiri Slaby, gregkh, linux-kernel
On 03/08/2013 03:39 PM, Peter Hurley wrote:
> On Thu, 2013-03-07 at 13:12 +0100, Jiri Slaby wrote:
>> --- a/drivers/net/caif/caif_serial.c
>> +++ b/drivers/net/caif/caif_serial.c
>> @@ -88,7 +88,6 @@ static inline void update_tty_status(struct ser_device *ser)
>> {
>> ser->tty_status =
>> ser->tty->stopped << 5 |
>> - ser->tty->hw_stopped << 4 |
>> ser->tty->flow_stopped << 3 |
>> ser->tty->packet << 2 |
>> ser->tty->port->low_latency << 1 |
>
> I would maybe leave this with a code comment instead.
>
> ser->tty->hw_stopped << 4 | /* hw_stopped is not used by tty layer */
Yeah, maybe...
>> @@ -4256,9 +4251,6 @@ static void seq_line_info(struct seq_file *m, struct e100_serial *info)
>> if (info->port.tty->stopped)
>> seq_printf(m, " stopped:%i",
>> (int)info->port.tty->stopped);
>> - if (info->port.tty->hw_stopped)
>> - seq_printf(m, " hw_stopped:%i",
>> - (int)info->port.tty->hw_stopped);
>
> User-space visible. Tool may expect this field.
I thought that on the first glance too. But look what does that whole
seq_printf depend on.
--
js
suse labs
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH 10/16] TTY: cleanup tty->hw_stopped uses
2013-03-08 14:46 ` Jiri Slaby
@ 2013-03-08 14:55 ` Peter Hurley
0 siblings, 0 replies; 27+ messages in thread
From: Peter Hurley @ 2013-03-08 14:55 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Jiri Slaby, gregkh, linux-kernel
On Fri, 2013-03-08 at 15:46 +0100, Jiri Slaby wrote:
> On 03/08/2013 03:39 PM, Peter Hurley wrote:
> > On Thu, 2013-03-07 at 13:12 +0100, Jiri Slaby wrote:
> >> --- a/drivers/net/caif/caif_serial.c
> >> +++ b/drivers/net/caif/caif_serial.c
> >> @@ -88,7 +88,6 @@ static inline void update_tty_status(struct ser_device *ser)
> >> {
> >> ser->tty_status =
> >> ser->tty->stopped << 5 |
> >> - ser->tty->hw_stopped << 4 |
> >> ser->tty->flow_stopped << 3 |
> >> ser->tty->packet << 2 |
> >> ser->tty->port->low_latency << 1 |
> >
> > I would maybe leave this with a code comment instead.
> >
> > ser->tty->hw_stopped << 4 | /* hw_stopped is not used by tty layer */
>
> Yeah, maybe...
Plus this is documented in Documentation/networking/caif/README
> >> @@ -4256,9 +4251,6 @@ static void seq_line_info(struct seq_file *m, struct e100_serial *info)
> >> if (info->port.tty->stopped)
> >> seq_printf(m, " stopped:%i",
> >> (int)info->port.tty->stopped);
> >> - if (info->port.tty->hw_stopped)
> >> - seq_printf(m, " hw_stopped:%i",
> >> - (int)info->port.tty->hw_stopped);
> >
> > User-space visible. Tool may expect this field.
>
> I thought that on the first glance too. But look what does that whole
> seq_printf depend on.
Oh, right, duh. That field's never been printed :)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 11/16] crisv10: stop returning info from handle_ser_rx_interrupt
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (8 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 10/16] TTY: cleanup tty->hw_stopped uses Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-08 15:06 ` Peter Hurley
2013-03-07 12:12 ` [PATCH 12/16] crisv10: use flags from tty_port Jiri Slaby
` (4 subsequent siblings)
14 siblings, 1 reply; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
The return value is not used anywhere, so no need to return anything.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/crisv10.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 50f56f3..1ace22c 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -2263,8 +2263,7 @@ TODO: The break will be delayed until an F or V character is received.
*/
-static
-struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
+static void handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
{
unsigned long data_read;
@@ -2370,10 +2369,9 @@ more_data:
}
tty_flip_buffer_push(&info->port);
- return info;
}
-static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
+static void handle_ser_rx_interrupt(struct e100_serial *info)
{
unsigned char rstat;
@@ -2382,7 +2380,8 @@ static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
#endif
/* DEBUG_LOG(info->line, "ser_interrupt stat %03X\n", rstat | (i << 8)); */
if (!info->uses_dma_in) {
- return handle_ser_rx_interrupt_no_dma(info);
+ handle_ser_rx_interrupt_no_dma(info);
+ return;
}
/* DMA is used */
rstat = info->ioport[REG_STATUS];
@@ -2489,7 +2488,6 @@ static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
/* Restarting the DMA never hurts */
*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, restart);
START_FLUSH_FAST_TIMER(info, "ser_int");
- return info;
} /* handle_ser_rx_interrupt */
static void handle_ser_tx_interrupt(struct e100_serial *info)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 12/16] crisv10: use flags from tty_port
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (9 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 11/16] crisv10: stop returning info from handle_ser_rx_interrupt Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 13/16] crisv10: remove unused members Jiri Slaby
` (3 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
First, remove STD_FLAGS as the value, or its subvalues
(ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) is not tested anywhere --
there is no point to initialize flags to that. Second, use flags
member from tty_port when we have it now. So that we do not waste
space.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/crisv10.c | 64 ++++++++++++++++++++------------------------
drivers/tty/serial/crisv10.h | 2 --
2 files changed, 29 insertions(+), 37 deletions(-)
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 1ace22c..ec2dcc7 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -169,7 +169,6 @@ static int get_lsr_info(struct e100_serial *info, unsigned int *value);
#define DEF_BAUD 115200 /* 115.2 kbit/s */
-#define STD_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
#define DEF_RX 0x20 /* or SERIAL_CTRL_W >> 8 */
/* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */
#define DEF_TX 0x80 /* or SERIAL_CTRL_B */
@@ -246,7 +245,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH7_FIRST,
.icmdadr = R_DMA_CH7_CMD,
.idescradr = R_DMA_CH7_DESCR,
- .flags = STD_FLAGS,
.rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX,
.iseteop = 2,
@@ -300,7 +298,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH9_FIRST,
.icmdadr = R_DMA_CH9_CMD,
.idescradr = R_DMA_CH9_DESCR,
- .flags = STD_FLAGS,
.rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX,
.iseteop = 3,
@@ -356,7 +353,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH3_FIRST,
.icmdadr = R_DMA_CH3_CMD,
.idescradr = R_DMA_CH3_DESCR,
- .flags = STD_FLAGS,
.rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX,
.iseteop = 0,
@@ -410,7 +406,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH5_FIRST,
.icmdadr = R_DMA_CH5_CMD,
.idescradr = R_DMA_CH5_DESCR,
- .flags = STD_FLAGS,
.rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX,
.iseteop = 1,
@@ -2719,7 +2714,7 @@ startup(struct e100_serial * info)
/* if it was already initialized, skip this */
- if (info->flags & ASYNC_INITIALIZED) {
+ if (info->port.flags & ASYNC_INITIALIZED) {
local_irq_restore(flags);
free_page(xmit_page);
return 0;
@@ -2844,7 +2839,7 @@ startup(struct e100_serial * info)
#endif /* CONFIG_SVINTO_SIM */
- info->flags |= ASYNC_INITIALIZED;
+ info->port.flags |= ASYNC_INITIALIZED;
local_irq_restore(flags);
return 0;
@@ -2889,7 +2884,7 @@ shutdown(struct e100_serial * info)
#endif /* CONFIG_SVINTO_SIM */
- if (!(info->flags & ASYNC_INITIALIZED))
+ if (!(info->port.flags & ASYNC_INITIALIZED))
return;
#ifdef SERIAL_DEBUG_OPEN
@@ -2920,7 +2915,7 @@ shutdown(struct e100_serial * info)
if (info->port.tty)
set_bit(TTY_IO_ERROR, &info->port.tty->flags);
- info->flags &= ~ASYNC_INITIALIZED;
+ info->port.flags &= ~ASYNC_INITIALIZED;
local_irq_restore(flags);
}
@@ -2945,7 +2940,7 @@ change_speed(struct e100_serial *info)
/* possibly, the tx/rx should be disabled first to do this safely */
/* change baud-rate and write it to the hardware */
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
/* Special baudrate */
u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
unsigned long alt_source =
@@ -3395,7 +3390,7 @@ get_serial_info(struct e100_serial * info,
tmp.line = info->line;
tmp.port = (int)info->ioport;
tmp.irq = info->irq;
- tmp.flags = info->flags;
+ tmp.flags = info->port.flags;
tmp.baud_base = info->baud_base;
tmp.close_delay = info->close_delay;
tmp.closing_wait = info->closing_wait;
@@ -3422,9 +3417,9 @@ set_serial_info(struct e100_serial *info,
if ((new_serial.type != info->type) ||
(new_serial.close_delay != info->close_delay) ||
((new_serial.flags & ~ASYNC_USR_MASK) !=
- (info->flags & ~ASYNC_USR_MASK)))
+ (info->port.flags & ~ASYNC_USR_MASK)))
return -EPERM;
- info->flags = ((info->flags & ~ASYNC_USR_MASK) |
+ info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
(new_serial.flags & ASYNC_USR_MASK));
goto check_and_exit;
}
@@ -3438,16 +3433,16 @@ set_serial_info(struct e100_serial *info,
*/
info->baud_base = new_serial.baud_base;
- info->flags = ((info->flags & ~ASYNC_FLAGS) |
+ info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
(new_serial.flags & ASYNC_FLAGS));
info->custom_divisor = new_serial.custom_divisor;
info->type = new_serial.type;
info->close_delay = new_serial.close_delay;
info->closing_wait = new_serial.closing_wait;
- info->port.low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+ info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
check_and_exit:
- if (info->flags & ASYNC_INITIALIZED) {
+ if (info->port.flags & ASYNC_INITIALIZED) {
change_speed(info);
} else
retval = startup(info);
@@ -3787,12 +3782,12 @@ rs_close(struct tty_struct *tty, struct file * filp)
local_irq_restore(flags);
return;
}
- info->flags |= ASYNC_CLOSING;
+ info->port.flags |= ASYNC_CLOSING;
/*
* Save the termios structure, since this port may have
* separate termios for callout and dialin.
*/
- if (info->flags & ASYNC_NORMAL_ACTIVE)
+ if (info->port.flags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = tty->termios;
/*
* Now we wait for the transmit buffer to clear; and we notify
@@ -3813,7 +3808,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
e100_disable_rx(info);
e100_disable_rx_irq(info);
- if (info->flags & ASYNC_INITIALIZED) {
+ if (info->port.flags & ASYNC_INITIALIZED) {
/*
* Before we drop DTR, make sure the UART transmitter
* has completely drained; this is especially
@@ -3834,7 +3829,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
schedule_timeout_interruptible(info->close_delay);
wake_up_interruptible(&info->open_wait);
}
- info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
+ info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
local_irq_restore(flags);
@@ -3929,7 +3924,7 @@ rs_hangup(struct tty_struct *tty)
shutdown(info);
info->event = 0;
info->count = 0;
- info->flags &= ~ASYNC_NORMAL_ACTIVE;
+ info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
wake_up_interruptible(&info->open_wait);
}
@@ -3953,11 +3948,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
* until it's done, and then try again.
*/
if (tty_hung_up_p(filp) ||
- (info->flags & ASYNC_CLOSING)) {
+ (info->port.flags & ASYNC_CLOSING)) {
wait_event_interruptible_tty(tty, info->close_wait,
- !(info->flags & ASYNC_CLOSING));
+ !(info->port.flags & ASYNC_CLOSING));
#ifdef SERIAL_DO_RESTART
- if (info->flags & ASYNC_HUP_NOTIFY)
+ if (info->port.flags & ASYNC_HUP_NOTIFY)
return -EAGAIN;
else
return -ERESTARTSYS;
@@ -3972,7 +3967,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
*/
if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) {
- info->flags |= ASYNC_NORMAL_ACTIVE;
+ info->port.flags |= ASYNC_NORMAL_ACTIVE;
return 0;
}
@@ -4008,9 +4003,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
local_irq_restore(flags);
set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) ||
- !(info->flags & ASYNC_INITIALIZED)) {
+ !(info->port.flags & ASYNC_INITIALIZED)) {
#ifdef SERIAL_DO_RESTART
- if (info->flags & ASYNC_HUP_NOTIFY)
+ if (info->port.flags & ASYNC_HUP_NOTIFY)
retval = -EAGAIN;
else
retval = -ERESTARTSYS;
@@ -4019,7 +4014,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
#endif
break;
}
- if (!(info->flags & ASYNC_CLOSING) && do_clocal)
+ if (!(info->port.flags & ASYNC_CLOSING) && do_clocal)
/* && (do_clocal || DCD_IS_ASSERTED) */
break;
if (signal_pending(current)) {
@@ -4045,7 +4040,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
#endif
if (retval)
return retval;
- info->flags |= ASYNC_NORMAL_ACTIVE;
+ info->port.flags |= ASYNC_NORMAL_ACTIVE;
return 0;
}
@@ -4086,17 +4081,17 @@ rs_open(struct tty_struct *tty, struct file * filp)
tty->driver_data = info;
info->port.tty = tty;
- info->port.low_latency = !!(info->flags & ASYNC_LOW_LATENCY);
+ info->port.low_latency = !!(info->port.flags & ASYNC_LOW_LATENCY);
/*
* If the port is in the middle of closing, bail out now
*/
if (tty_hung_up_p(filp) ||
- (info->flags & ASYNC_CLOSING)) {
+ (info->port.flags & ASYNC_CLOSING)) {
wait_event_interruptible_tty(tty, info->close_wait,
- !(info->flags & ASYNC_CLOSING));
+ !(info->port.flags & ASYNC_CLOSING));
#ifdef SERIAL_DO_RESTART
- return ((info->flags & ASYNC_HUP_NOTIFY) ?
+ return ((info->port.flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
#else
return -EAGAIN;
@@ -4196,7 +4191,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
return retval;
}
- if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
+ if ((info->count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) {
tty->termios = info->normal_termios;
change_speed(info);
}
@@ -4445,7 +4440,6 @@ static int __init rs_init(void)
info->forced_eop = 0;
info->baud_base = DEF_BAUD_BASE;
info->custom_divisor = 0;
- info->flags = 0;
info->close_delay = 5*HZ/10;
info->closing_wait = 30*HZ;
info->x_char = 0;
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index ea0beb4..7146ed2 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -53,8 +53,6 @@ struct e100_serial {
volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */
- int flags; /* defined in tty.h */
-
u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
u8 iseteop; /* bit number for R_SET_EOP for the input dma */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 13/16] crisv10: remove unused members
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (10 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 12/16] crisv10: use flags from tty_port Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 14/16] crisv10: use close delays from tty_port Jiri Slaby
` (2 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
Well, all those are unused. They were perhaps copied from generic
serial structure ages ago. Remove them for good.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/crisv10.h | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index 7146ed2..59f70c4 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -86,15 +86,10 @@ struct e100_serial {
volatile int tr_running; /* 1 if output is running */
- struct tty_struct *tty;
- int read_status_mask;
- int ignore_status_mask;
int x_char; /* xon/xoff character */
int close_delay;
unsigned short closing_wait;
- unsigned short closing_wait2;
unsigned long event;
- unsigned long last_active;
int line;
int type; /* PORT_ETRAX */
int count; /* # of fd on device */
@@ -108,7 +103,6 @@ struct e100_serial {
struct work_struct work;
struct async_icount icount; /* error-statistics etc.*/
struct ktermios normal_termios;
- struct ktermios callout_termios;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 14/16] crisv10: use close delays from tty_port
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (11 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 13/16] crisv10: remove unused members Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 15/16] crisv10: use *_wait " Jiri Slaby
2013-03-07 12:12 ` [PATCH 16/16] crisv10: use counts " Jiri Slaby
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
The same as flags, convert to using close delays from tty_port.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/crisv10.c | 20 +++++++++-----------
drivers/tty/serial/crisv10.h | 2 --
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index ec2dcc7..0e75ec33 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -3392,8 +3392,8 @@ get_serial_info(struct e100_serial * info,
tmp.irq = info->irq;
tmp.flags = info->port.flags;
tmp.baud_base = info->baud_base;
- tmp.close_delay = info->close_delay;
- tmp.closing_wait = info->closing_wait;
+ tmp.close_delay = info->port.close_delay;
+ tmp.closing_wait = info->port.closing_wait;
tmp.custom_divisor = info->custom_divisor;
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return -EFAULT;
@@ -3415,7 +3415,7 @@ set_serial_info(struct e100_serial *info,
if (!capable(CAP_SYS_ADMIN)) {
if ((new_serial.type != info->type) ||
- (new_serial.close_delay != info->close_delay) ||
+ (new_serial.close_delay != info->port.close_delay) ||
((new_serial.flags & ~ASYNC_USR_MASK) !=
(info->port.flags & ~ASYNC_USR_MASK)))
return -EPERM;
@@ -3437,8 +3437,8 @@ set_serial_info(struct e100_serial *info,
(new_serial.flags & ASYNC_FLAGS));
info->custom_divisor = new_serial.custom_divisor;
info->type = new_serial.type;
- info->close_delay = new_serial.close_delay;
- info->closing_wait = new_serial.closing_wait;
+ info->port.close_delay = new_serial.close_delay;
+ info->port.closing_wait = new_serial.closing_wait;
info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
check_and_exit:
@@ -3794,8 +3794,8 @@ rs_close(struct tty_struct *tty, struct file * filp)
* the line discipline to only process XON/XOFF characters.
*/
tty->closing = 1;
- if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE)
- tty_wait_until_sent(tty, info->closing_wait);
+ if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
+ tty_wait_until_sent(tty, info->port.closing_wait);
/*
* At this point we stop accepting input. To do this, we
* disable the serial receiver and the DMA receive interrupt.
@@ -3825,8 +3825,8 @@ rs_close(struct tty_struct *tty, struct file * filp)
info->event = 0;
info->port.tty = NULL;
if (info->blocked_open) {
- if (info->close_delay)
- schedule_timeout_interruptible(info->close_delay);
+ if (info->port.close_delay)
+ schedule_timeout_interruptible(info->port.close_delay);
wake_up_interruptible(&info->open_wait);
}
info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
@@ -4440,8 +4440,6 @@ static int __init rs_init(void)
info->forced_eop = 0;
info->baud_base = DEF_BAUD_BASE;
info->custom_divisor = 0;
- info->close_delay = 5*HZ/10;
- info->closing_wait = 30*HZ;
info->x_char = 0;
info->event = 0;
info->count = 0;
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index 59f70c4..a05c36b 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -87,8 +87,6 @@ struct e100_serial {
volatile int tr_running; /* 1 if output is running */
int x_char; /* xon/xoff character */
- int close_delay;
- unsigned short closing_wait;
unsigned long event;
int line;
int type; /* PORT_ETRAX */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 15/16] crisv10: use *_wait from tty_port
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (12 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 14/16] crisv10: use close delays from tty_port Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
2013-03-07 12:12 ` [PATCH 16/16] crisv10: use counts " Jiri Slaby
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
The same as flags, convert to using *_wait queues from tty_port.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/crisv10.c | 16 +++++++---------
drivers/tty/serial/crisv10.h | 2 --
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 0e75ec33..ef5bca1 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -3827,10 +3827,10 @@ rs_close(struct tty_struct *tty, struct file * filp)
if (info->blocked_open) {
if (info->port.close_delay)
schedule_timeout_interruptible(info->port.close_delay);
- wake_up_interruptible(&info->open_wait);
+ wake_up_interruptible(&info->port.open_wait);
}
info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
- wake_up_interruptible(&info->close_wait);
+ wake_up_interruptible(&info->port.close_wait);
local_irq_restore(flags);
/* port closed */
@@ -3926,7 +3926,7 @@ rs_hangup(struct tty_struct *tty)
info->count = 0;
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
- wake_up_interruptible(&info->open_wait);
+ wake_up_interruptible(&info->port.open_wait);
}
/*
@@ -3949,7 +3949,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
*/
if (tty_hung_up_p(filp) ||
(info->port.flags & ASYNC_CLOSING)) {
- wait_event_interruptible_tty(tty, info->close_wait,
+ wait_event_interruptible_tty(tty, info->port.close_wait,
!(info->port.flags & ASYNC_CLOSING));
#ifdef SERIAL_DO_RESTART
if (info->port.flags & ASYNC_HUP_NOTIFY)
@@ -3983,7 +3983,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
* exit, either normal or abnormal.
*/
retval = 0;
- add_wait_queue(&info->open_wait, &wait);
+ add_wait_queue(&info->port.open_wait, &wait);
#ifdef SERIAL_DEBUG_OPEN
printk("block_til_ready before block: ttyS%d, count = %d\n",
info->line, info->count);
@@ -4030,7 +4030,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
tty_lock(tty);
}
set_current_state(TASK_RUNNING);
- remove_wait_queue(&info->open_wait, &wait);
+ remove_wait_queue(&info->port.open_wait, &wait);
if (extra_count)
info->count++;
info->blocked_open--;
@@ -4088,7 +4088,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
*/
if (tty_hung_up_p(filp) ||
(info->port.flags & ASYNC_CLOSING)) {
- wait_event_interruptible_tty(tty, info->close_wait,
+ wait_event_interruptible_tty(tty, info->port.close_wait,
!(info->port.flags & ASYNC_CLOSING));
#ifdef SERIAL_DO_RESTART
return ((info->port.flags & ASYNC_HUP_NOTIFY) ?
@@ -4445,8 +4445,6 @@ static int __init rs_init(void)
info->count = 0;
info->blocked_open = 0;
info->normal_termios = driver->init_termios;
- init_waitqueue_head(&info->open_wait);
- init_waitqueue_head(&info->close_wait);
info->xmit.buf = NULL;
info->xmit.tail = info->xmit.head = 0;
info->first_recv_buffer = info->last_recv_buffer = NULL;
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index a05c36b..1cd2299 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -101,8 +101,6 @@ struct e100_serial {
struct work_struct work;
struct async_icount icount; /* error-statistics etc.*/
struct ktermios normal_termios;
- wait_queue_head_t open_wait;
- wait_queue_head_t close_wait;
unsigned long char_time_usec; /* The time for 1 char, in usecs */
unsigned long flush_time_usec; /* How often we should flush */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH 16/16] crisv10: use counts from tty_port
2013-03-07 12:12 [PATCH 01/16] TTY: jsm, remove superfluous check Jiri Slaby
` (13 preceding siblings ...)
2013-03-07 12:12 ` [PATCH 15/16] crisv10: use *_wait " Jiri Slaby
@ 2013-03-07 12:12 ` Jiri Slaby
14 siblings, 0 replies; 27+ messages in thread
From: Jiri Slaby @ 2013-03-07 12:12 UTC (permalink / raw)
To: gregkh; +Cc: peter, jirislaby, linux-kernel
The same as flags, convert to using open/close counts from tty_port.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/crisv10.c | 48 +++++++++++++++++++++-----------------------
drivers/tty/serial/crisv10.h | 2 --
2 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index ef5bca1..477f22f 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -3424,7 +3424,7 @@ set_serial_info(struct e100_serial *info,
goto check_and_exit;
}
- if (info->count > 1)
+ if (info->port.count > 1)
return -EBUSY;
/*
@@ -3760,7 +3760,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
printk("[%d] rs_close ttyS%d, count = %d\n", current->pid,
info->line, info->count);
#endif
- if ((tty->count == 1) && (info->count != 1)) {
+ if ((tty->count == 1) && (info->port.count != 1)) {
/*
* Uh, oh. tty->count is 1, which means that the tty
* structure will be freed. Info->count should always
@@ -3770,15 +3770,15 @@ rs_close(struct tty_struct *tty, struct file * filp)
*/
printk(KERN_ERR
"rs_close: bad serial port count; tty->count is 1, "
- "info->count is %d\n", info->count);
- info->count = 1;
+ "info->count is %d\n", info->port.count);
+ info->port.count = 1;
}
- if (--info->count < 0) {
+ if (--info->port.count < 0) {
printk(KERN_ERR "rs_close: bad serial port count for ttyS%d: %d\n",
- info->line, info->count);
- info->count = 0;
+ info->line, info->port.count);
+ info->port.count = 0;
}
- if (info->count) {
+ if (info->port.count) {
local_irq_restore(flags);
return;
}
@@ -3824,7 +3824,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
tty->closing = 0;
info->event = 0;
info->port.tty = NULL;
- if (info->blocked_open) {
+ if (info->port.blocked_open) {
if (info->port.close_delay)
schedule_timeout_interruptible(info->port.close_delay);
wake_up_interruptible(&info->port.open_wait);
@@ -3923,7 +3923,7 @@ rs_hangup(struct tty_struct *tty)
rs_flush_buffer(tty);
shutdown(info);
info->event = 0;
- info->count = 0;
+ info->port.count = 0;
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
wake_up_interruptible(&info->port.open_wait);
@@ -3978,7 +3978,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
/*
* Block waiting for the carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
- * this loop, info->count is dropped by one, so that
+ * this loop, info->port.count is dropped by one, so that
* rs_close() knows when to free things. We restore it upon
* exit, either normal or abnormal.
*/
@@ -3986,15 +3986,15 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
add_wait_queue(&info->port.open_wait, &wait);
#ifdef SERIAL_DEBUG_OPEN
printk("block_til_ready before block: ttyS%d, count = %d\n",
- info->line, info->count);
+ info->line, info->port.count);
#endif
local_irq_save(flags);
if (!tty_hung_up_p(filp)) {
extra_count++;
- info->count--;
+ info->port.count--;
}
local_irq_restore(flags);
- info->blocked_open++;
+ info->port.blocked_open++;
while (1) {
local_irq_save(flags);
/* assert RTS and DTR */
@@ -4023,7 +4023,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
}
#ifdef SERIAL_DEBUG_OPEN
printk("block_til_ready blocking: ttyS%d, count = %d\n",
- info->line, info->count);
+ info->line, info->port.count);
#endif
tty_unlock(tty);
schedule();
@@ -4032,11 +4032,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
set_current_state(TASK_RUNNING);
remove_wait_queue(&info->port.open_wait, &wait);
if (extra_count)
- info->count++;
- info->blocked_open--;
+ info->port.count++;
+ info->port.blocked_open--;
#ifdef SERIAL_DEBUG_OPEN
printk("block_til_ready after blocking: ttyS%d, count = %d\n",
- info->line, info->count);
+ info->line, info->port.count);
#endif
if (retval)
return retval;
@@ -4074,10 +4074,10 @@ rs_open(struct tty_struct *tty, struct file * filp)
#ifdef SERIAL_DEBUG_OPEN
printk("[%d] rs_open %s, count = %d\n", current->pid, tty->name,
- info->count);
+ info->port.count);
#endif
- info->count++;
+ info->port.count++;
tty->driver_data = info;
info->port.tty = tty;
@@ -4101,7 +4101,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
/*
* If DMA is enabled try to allocate the irq's.
*/
- if (info->count == 1) {
+ if (info->port.count == 1) {
allocated_resources = 1;
if (info->dma_in_enabled) {
if (request_irq(info->dma_in_irq_nbr,
@@ -4174,7 +4174,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
if (allocated_resources)
deinit_port(info);
- /* FIXME Decrease count info->count here too? */
+ /* FIXME Decrease count info->port.count here too? */
return retval;
}
@@ -4191,7 +4191,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
return retval;
}
- if ((info->count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) {
+ if ((info->port.count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) {
tty->termios = info->normal_termios;
change_speed(info);
}
@@ -4442,8 +4442,6 @@ static int __init rs_init(void)
info->custom_divisor = 0;
info->x_char = 0;
info->event = 0;
- info->count = 0;
- info->blocked_open = 0;
info->normal_termios = driver->init_termios;
info->xmit.buf = NULL;
info->xmit.tail = info->xmit.head = 0;
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index 1cd2299..7599014 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -90,8 +90,6 @@ struct e100_serial {
unsigned long event;
int line;
int type; /* PORT_ETRAX */
- int count; /* # of fd on device */
- int blocked_open; /* # of blocked opens */
struct circ_buf xmit;
struct etrax_recv_buffer *first_recv_buffer;
struct etrax_recv_buffer *last_recv_buffer;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 27+ messages in thread