diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-03-07 07:12:28 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-18 19:19:44 -0400 |
commit | 6982a398426a22166eaf049b79544536fdd6429f (patch) | |
tree | a59f9fb6d2560f3d6714a79389626a2ac3339853 /drivers/tty | |
parent | 6865ff222ccab371c04afce17aec1f7d70b17dbc (diff) |
TTY: msm_smd_tty, clean up activate/shutdown
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/msm_smd_tty.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c index e722ff163d91..1238ac370bff 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) | |||
90 | 90 | ||
91 | static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty) | 91 | static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty) |
92 | { | 92 | { |
93 | struct smd_tty_info *info = container_of(tport, struct smd_tty_info, | ||
94 | port); | ||
93 | int i, res = 0; | 95 | int i, res = 0; |
94 | int n = tty->index; | ||
95 | const char *name = NULL; | 96 | const char *name = NULL; |
96 | struct smd_tty_info *info = smd_tty + n; | ||
97 | 97 | ||
98 | for (i = 0; i < smd_tty_channels_len; i++) { | 98 | for (i = 0; i < smd_tty_channels_len; i++) { |
99 | if (smd_tty_channels[i].id == n) { | 99 | if (smd_tty_channels[i].id == tty->index) { |
100 | name = smd_tty_channels[i].name; | 100 | name = smd_tty_channels[i].name; |
101 | break; | 101 | break; |
102 | } | 102 | } |
@@ -117,17 +117,13 @@ static int smd_tty_port_activate(struct tty_port *tport, struct tty_struct *tty) | |||
117 | 117 | ||
118 | static void smd_tty_port_shutdown(struct tty_port *tport) | 118 | static void smd_tty_port_shutdown(struct tty_port *tport) |
119 | { | 119 | { |
120 | struct smd_tty_info *info; | 120 | struct smd_tty_info *info = container_of(tport, struct smd_tty_info, |
121 | struct tty_struct *tty = tty_port_tty_get(tport); | 121 | port); |
122 | 122 | ||
123 | info = tty->driver_data; | ||
124 | if (info->ch) { | 123 | if (info->ch) { |
125 | smd_close(info->ch); | 124 | smd_close(info->ch); |
126 | info->ch = 0; | 125 | info->ch = 0; |
127 | } | 126 | } |
128 | |||
129 | tty->driver_data = 0; | ||
130 | tty_kref_put(tty); | ||
131 | } | 127 | } |
132 | 128 | ||
133 | static int smd_tty_open(struct tty_struct *tty, struct file *f) | 129 | static int smd_tty_open(struct tty_struct *tty, struct file *f) |