From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@linuxfoundation.org
Cc: alan@linux.intel.com, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, jirislaby@gmail.com,
Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>
Subject: [PATCH 45/68] TTY: simserial, define local tty_port pointer
Date: Mon, 5 Mar 2012 14:52:32 +0100 [thread overview]
Message-ID: <1330955575-26641-46-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1330955575-26641-1-git-send-email-jslaby@suse.cz>
And use it to make the code more readable.
Since tport doesn't conflict with port anymore and there are not many
tport accessors left, do also s/\<tport\>/port/g.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
---
arch/ia64/hp/sim/simserial.c | 84 ++++++++++++++++++++++--------------------
1 file changed, 44 insertions(+), 40 deletions(-)
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 120aad4..909357e 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -47,7 +47,7 @@
#define NR_PORTS 1 /* only one port for now */
struct serial_state {
- struct tty_port tport;
+ struct tty_port port;
struct circ_buf xmit;
int irq;
int x_char;
@@ -132,8 +132,9 @@ static void receive_chars(struct tty_struct *tty)
static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
{
struct serial_state *info = dev_id;
+ struct tty_struct *tty = info->port.tty;
- if (!info->tport.tty) {
+ if (!tty) {
printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
return IRQ_NONE;
}
@@ -141,7 +142,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
* pretty simple in our case, because we only get interrupts
* on inbound traffic
*/
- receive_chars(info->tport.tty);
+ receive_chars(tty);
return IRQ_HANDLED;
}
@@ -416,7 +417,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
{
unsigned long flags;
- if (!(info->tport.flags & ASYNC_INITIALIZED))
+ if (!(info->port.flags & ASYNC_INITIALIZED))
return;
#ifdef SIMSERIAL_DEBUG
@@ -436,7 +437,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
set_bit(TTY_IO_ERROR, &tty->flags);
- info->tport.flags &= ~ASYNC_INITIALIZED;
+ info->port.flags &= ~ASYNC_INITIALIZED;
}
local_irq_restore(flags);
}
@@ -454,6 +455,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
static void rs_close(struct tty_struct *tty, struct file * filp)
{
struct serial_state *info = tty->driver_data;
+ struct tty_port *port = &info->port;
unsigned long flags;
if (!info)
@@ -468,30 +470,30 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
return;
}
#ifdef SIMSERIAL_DEBUG
- printk("rs_close ttys%d, count = %d\n", info->line, info->tport.count);
+ printk("rs_close ttys%d, count = %d\n", info->line, port->count);
#endif
- if ((tty->count == 1) && (info->tport.count != 1)) {
+ if ((tty->count == 1) && (port->count != 1)) {
/*
* Uh, oh. tty->count is 1, which means that the tty
- * structure will be freed. info->tport.count should always
+ * structure will be freed. port->count should always
* be one in these conditions. If it's greater than
* one, we've got real problems, since it means the
* serial port won't be shutdown.
*/
printk(KERN_ERR "rs_close: bad serial port count; tty->count is 1, "
- "info->tport.count is %d\n", info->tport.count);
- info->tport.count = 1;
+ "port->count is %d\n", port->count);
+ port->count = 1;
}
- if (--info->tport.count < 0) {
+ if (--port->count < 0) {
printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n",
- tty->index, info->tport.count);
- info->tport.count = 0;
+ tty->index, port->count);
+ port->count = 0;
}
- if (info->tport.count) {
+ if (port->count) {
local_irq_restore(flags);
return;
}
- info->tport.flags |= ASYNC_CLOSING;
+ port->flags |= ASYNC_CLOSING;
local_irq_restore(flags);
/*
@@ -501,14 +503,14 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
shutdown(tty, info);
rs_flush_buffer(tty);
tty_ldisc_flush(tty);
- info->tport.tty = NULL;
- if (info->tport.blocked_open) {
- if (info->tport.close_delay)
- schedule_timeout_interruptible(info->tport.close_delay);
- wake_up_interruptible(&info->tport.open_wait);
+ port->tty = NULL;
+ if (port->blocked_open) {
+ if (port->close_delay)
+ schedule_timeout_interruptible(port->close_delay);
+ wake_up_interruptible(&port->open_wait);
}
- info->tport.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
- wake_up_interruptible(&info->tport.close_wait);
+ port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
+ wake_up_interruptible(&port->close_wait);
}
/*
@@ -525,26 +527,27 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
static void rs_hangup(struct tty_struct *tty)
{
struct serial_state *info = tty->driver_data;
+ struct tty_port *port = &info->port;
#ifdef SIMSERIAL_DEBUG
printk("rs_hangup: called\n");
#endif
rs_flush_buffer(tty);
- if (info->tport.flags & ASYNC_CLOSING)
+ if (port->flags & ASYNC_CLOSING)
return;
shutdown(tty, info);
- info->tport.count = 0;
- info->tport.flags &= ~ASYNC_NORMAL_ACTIVE;
- info->tport.tty = NULL;
- wake_up_interruptible(&info->tport.open_wait);
+ port->count = 0;
+ port->flags &= ~ASYNC_NORMAL_ACTIVE;
+ port->tty = NULL;
+ wake_up_interruptible(&port->open_wait);
}
static int startup(struct tty_struct *tty, struct serial_state *state)
{
- struct tty_port *port = &state->tport;
+ struct tty_port *port = &state->port;
unsigned long flags;
int retval=0;
unsigned long page;
@@ -622,26 +625,27 @@ errout:
static int rs_open(struct tty_struct *tty, struct file * filp)
{
struct serial_state *info = rs_table + tty->index;
- int retval;
+ struct tty_port *port = &info->port;
+ int retval;
- info->tport.count++;
- info->tport.tty = tty;
+ port->count++;
+ port->tty = tty;
tty->driver_data = info;
- tty->port = &info->tport;
+ tty->port = port;
#ifdef SIMSERIAL_DEBUG
- printk("rs_open %s, count = %d\n", tty->name, info->tport.count);
+ printk("rs_open %s, count = %d\n", tty->name, port->count);
#endif
- tty->low_latency = (info->tport.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+ tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
/*
* If the port is the middle of closing, bail out now
*/
- if (tty_hung_up_p(filp) || (info->tport.flags & ASYNC_CLOSING)) {
- if (info->tport.flags & ASYNC_CLOSING)
- interruptible_sleep_on(&info->tport.close_wait);
+ if (tty_hung_up_p(filp) || (port->flags & ASYNC_CLOSING)) {
+ if (port->flags & ASYNC_CLOSING)
+ interruptible_sleep_on(&port->close_wait);
#ifdef SERIAL_DO_RESTART
- return ((info->tport.flags & ASYNC_HUP_NOTIFY) ?
+ return ((port->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
#else
return -EAGAIN;
@@ -774,8 +778,8 @@ static int __init simrs_init(void)
* Let's have a little bit of fun !
*/
state = rs_table;
- tty_port_init(&state->tport);
- state->tport.close_delay = 0; /* XXX really 0? */
+ tty_port_init(&state->port);
+ state->port.close_delay = 0; /* XXX really 0? */
retval = hpsim_get_irq(KEYBOARD_INTR);
if (retval < 0) {
--
1.7.9.2
next prev parent reply other threads:[~2012-03-05 14:06 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 13:51 [PATCH 00/68] TTY buffer in tty_port -- prep no. 1 Jiri Slaby
2012-03-05 13:51 ` [PATCH 01/68] USB: cdc-acm, use tty_standard_install Jiri Slaby
2012-03-05 14:03 ` Jiri Slaby
2012-03-05 14:14 ` Oliver Neukum
2012-03-05 23:39 ` Alan Cox
2012-03-05 13:51 ` [PATCH 02/68] TTY: tty_io, remove buffer re-assignments Jiri Slaby
2012-03-05 13:51 ` [PATCH 03/68] TTY: let alloc_tty_driver deduce the owner automatically Jiri Slaby
2012-03-05 13:51 ` [PATCH 04/68] TTY: remove minor_num from tty_driver Jiri Slaby
2012-03-05 13:51 ` [PATCH 05/68] TTY: remove re-assignments to tty_driver members Jiri Slaby
2012-03-06 23:49 ` Tilman Schmidt
2012-03-05 13:51 ` [PATCH 06/68] TTY: simplify tty_driver_lookup_tty a bit Jiri Slaby
2012-03-05 13:51 ` [PATCH 07/68] TTY: remove tty driver re-set from tty_reopen Jiri Slaby
2012-03-05 13:51 ` [PATCH 08/68] TTY: serial, simplify ASYNC_USR_MASK Jiri Slaby
2012-03-05 13:51 ` [PATCH 09/68] TTY: tty_driver, document tty->ops->shutdown limitation Jiri Slaby
2012-03-05 13:51 ` [PATCH 10/68] ALPHA: srmcons, use timer functions Jiri Slaby
2012-03-05 13:51 ` [PATCH 11/68] ALPHA: srmcons, fix racy singleton structure Jiri Slaby
2012-03-05 13:51 ` [PATCH 12/68] TTY: srmcons, convert to use tty_port Jiri Slaby
2012-03-05 13:52 ` [PATCH 13/68] TTY: serialP, remove DECLARE_WAITQUEUE check Jiri Slaby
2012-03-05 13:52 ` [PATCH 14/68] TTY: remove unneeded tty->index checks Jiri Slaby
2012-03-05 13:52 ` [PATCH 15/68] TTY: ipwireless, fix tty->index handling Jiri Slaby
2012-03-05 14:03 ` Jiri Kosina
2012-03-05 13:52 ` [PATCH 16/68] NET: pc300, do not zero global variables Jiri Slaby
2012-03-05 13:52 ` [PATCH 17/68] NET: pc300, show version info from module init Jiri Slaby
2012-03-05 13:52 ` [PATCH 18/68] XTENSA: iss/console, use setup_timer Jiri Slaby
2012-03-05 13:52 ` [PATCH 19/68] XTENSA: iss/console, fix potential deadlock Jiri Slaby
2012-03-05 13:52 ` [PATCH 20/68] TTY: iss/console, use tty_port Jiri Slaby
2012-03-05 13:52 ` [PATCH 21/68] TTY: serial, use atomic_inc_return in ioc4_serial Jiri Slaby
2012-03-05 13:52 ` [PATCH 22/68] TTY: serial, include pci.h in m32r_sio Jiri Slaby
2012-03-05 13:52 ` [PATCH 23/68] TTY: remove serialP.h inclusion from some files Jiri Slaby
2012-03-05 13:52 ` [PATCH 24/68] TTY: speakup, do not use serialP Jiri Slaby
2012-03-05 13:52 ` [PATCH 25/68] TTY: serialP, remove unused material Jiri Slaby
2012-03-05 13:52 ` [PATCH 26/68] TTY: amiserial, remove tasklet for tty_wakeup Jiri Slaby
2012-03-05 13:52 ` [PATCH 27/68] TTY: amiserial, use only one copy of async flags Jiri Slaby
2012-03-05 13:52 ` [PATCH 28/68] TTY: simserial, " Jiri Slaby
2012-03-05 13:52 ` [PATCH 29/68] TTY: simserial/amiserial, use one instance of other members Jiri Slaby
2012-03-05 13:52 ` [PATCH 30/68] TTY: simserial, remove support of shared interrupts Jiri Slaby
2012-03-05 13:52 ` [PATCH 31/68] TTY: simserial, remove IRQ_T Jiri Slaby
2012-03-05 13:52 ` [PATCH 32/68] TTY: amiserial, remove IRQ_ports Jiri Slaby
2012-03-05 13:52 ` [PATCH 33/68] TTY: serialP, merge serial_state and async_struct Jiri Slaby
2012-03-05 13:52 ` [PATCH 34/68] TTY: amiserial, simplify set_serial_info Jiri Slaby
2012-03-05 13:52 ` [PATCH 35/68] TTY: amiserial, pass tty down to functions Jiri Slaby
2012-03-05 13:52 ` [PATCH 36/68] TTY: simserial, " Jiri Slaby
2012-03-05 13:52 ` [PATCH 37/68] TTY: amiserial/simserial, use tty_port Jiri Slaby
2012-03-05 13:52 ` [PATCH 38/68] TTY: amiserial/simserial, use close delays from tty_port Jiri Slaby
2012-03-05 13:52 ` [PATCH 39/68] TTY: amiserial/simserial, use count " Jiri Slaby
2012-03-05 13:52 ` [PATCH 40/68] TTY: amiserial/simserial, use flags " Jiri Slaby
2012-03-05 13:52 ` [PATCH 41/68] TTY: simserial, remove static initialization Jiri Slaby
2012-03-05 13:52 ` [PATCH 42/68] TTY: simserial, remove tmp_buf Jiri Slaby
2012-03-05 13:52 ` [PATCH 43/68] TTY: simserial, stop using serial_state->{line,icount} Jiri Slaby
2012-03-05 13:52 ` [PATCH 44/68] TTY: simserial no longer needs serialP Jiri Slaby
2012-03-05 13:52 ` Jiri Slaby [this message]
2012-03-05 13:52 ` [PATCH 46/68] TTY: simserial, remove some tty ops Jiri Slaby
2012-03-05 13:52 ` [PATCH 48/68] TTY: simserial, use tty_port_close_start Jiri Slaby
2012-03-05 13:52 ` [PATCH 49/68] TTY: simserial, properly refcount tty_port->tty Jiri Slaby
2012-03-05 13:52 ` [PATCH 50/68] TTY: simserial, use tty_port_open Jiri Slaby
2012-03-05 13:52 ` [PATCH 51/68] TTY: simserial, use tty_port_hangup Jiri Slaby
2012-03-05 13:52 ` [PATCH 52/68] TTY: simserial, remove useless comments Jiri Slaby
2012-03-05 13:52 ` [PATCH 53/68] TTY: simserial, fix includes Jiri Slaby
2012-03-05 13:52 ` [PATCH 54/68] TTY: simserial, reindent some code Jiri Slaby
2012-03-05 13:52 ` [PATCH 55/68] TTY: simserial, final cleanup Jiri Slaby
2012-03-05 13:52 ` [PATCH 56/68] TTY: amiserial, define local tty_port pointer Jiri Slaby
2012-03-05 13:52 ` [PATCH 57/68] TTY: amiserial, stop using serial_state->{irq,type,line} Jiri Slaby
2012-03-05 13:52 ` [PATCH 58/68] TTY: amiserial no longer needs serialP Jiri Slaby
2012-03-05 13:52 ` [PATCH 59/68] TTY: amiserial, provide carrier helpers Jiri Slaby
2012-03-05 13:52 ` [PATCH 60/68] TTY: amiserial, use tty_port_block_til_ready Jiri Slaby
2012-03-05 13:52 ` [PATCH 61/68] TTY: amiserial, use tty_port_close_end Jiri Slaby
2012-03-05 13:52 ` [PATCH 62/68] TTY: amiserial, use tty_port_close_start Jiri Slaby
2012-03-05 13:52 ` [PATCH 63/68] TTY: pdc_cons, fix racy tty test Jiri Slaby
2012-03-05 13:52 ` [PATCH 64/68] TTY: pdc_cons, fix open vs timer race Jiri Slaby
2012-03-05 13:52 ` [PATCH 65/68] TTY: pdc_cons, fix open vs pdc_console_tty_driver race Jiri Slaby
2012-03-05 13:52 ` [PATCH 66/68] TTY: pdc_cons, use tty_port Jiri Slaby
2012-03-05 13:52 ` [PATCH 67/68] TTY: isdn/gigaset, do not set tty->driver_data to NULL Jiri Slaby
2012-03-05 17:05 ` Tilman Schmidt
2012-03-05 17:12 ` Jiri Slaby
2012-03-05 13:52 ` [PATCH 68/68] TTY: isdn/gigaset, use tty_port Jiri Slaby
2012-03-05 17:08 ` Tilman Schmidt
2012-03-08 19:50 ` [PATCH 00/68] TTY buffer in tty_port -- prep no. 1 Greg KH
2012-03-08 20:01 ` [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu Jiri Slaby
2012-03-08 20:01 ` [PATCH 2/4] [IA64] simserial, include some headers Jiri Slaby
2012-03-08 20:01 ` [PATCH 3/4] [IA64] hpsim, initialize chip for assigned irqs Jiri Slaby
2012-03-08 20:01 ` [PATCH 4/4] [IA64] simserial, bail out when request_irq fails Jiri Slaby
2012-03-08 20:29 ` [PATCH 1/4] [IA64] hpsim, fix SAL handling in fw-emu Greg KH
2012-03-08 20:51 ` [PATCH 00/68] TTY buffer in tty_port -- prep no. 1 Greg KH
2012-03-18 8:56 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330955575-26641-46-git-send-email-jslaby@suse.cz \
--to=jslaby@suse.cz \
--cc=alan@linux.intel.com \
--cc=fenghua.yu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®