aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/jsm
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2014-10-05 13:01:07 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-05 22:20:52 -0500
commita15ad34834b1b29459ae87b0f04489d0765259e8 (patch)
treec66c34e889c08b87b94cb0c062479da9d8dd8a36 /drivers/tty/serial/jsm
parente789d2688720dba26079aac3e008eb6e78937753 (diff)
TTY: jsm: use container_of to resolve jsm_channel from uart_port
Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/jsm')
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 3e5c1563afe2..8814680630a4 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -77,7 +77,8 @@ static unsigned int jsm_tty_tx_empty(struct uart_port *port)
77static unsigned int jsm_tty_get_mctrl(struct uart_port *port) 77static unsigned int jsm_tty_get_mctrl(struct uart_port *port)
78{ 78{
79 int result; 79 int result;
80 struct jsm_channel *channel = (struct jsm_channel *)port; 80 struct jsm_channel *channel =
81 container_of(port, struct jsm_channel, uart_port);
81 82
82 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n"); 83 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n");
83 84
@@ -98,7 +99,8 @@ static unsigned int jsm_tty_get_mctrl(struct uart_port *port)
98 */ 99 */
99static void jsm_tty_set_mctrl(struct uart_port *port, unsigned int mctrl) 100static void jsm_tty_set_mctrl(struct uart_port *port, unsigned int mctrl)
100{ 101{
101 struct jsm_channel *channel = (struct jsm_channel *)port; 102 struct jsm_channel *channel =
103 container_of(port, struct jsm_channel, uart_port);
102 104
103 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n"); 105 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n");
104 106
@@ -133,7 +135,8 @@ static void jsm_tty_write(struct uart_port *port)
133 135
134static void jsm_tty_start_tx(struct uart_port *port) 136static void jsm_tty_start_tx(struct uart_port *port)
135{ 137{
136 struct jsm_channel *channel = (struct jsm_channel *)port; 138 struct jsm_channel *channel =
139 container_of(port, struct jsm_channel, uart_port);
137 140
138 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n"); 141 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n");
139 142
@@ -145,7 +148,8 @@ static void jsm_tty_start_tx(struct uart_port *port)
145 148
146static void jsm_tty_stop_tx(struct uart_port *port) 149static void jsm_tty_stop_tx(struct uart_port *port)
147{ 150{
148 struct jsm_channel *channel = (struct jsm_channel *)port; 151 struct jsm_channel *channel =
152 container_of(port, struct jsm_channel, uart_port);
149 153
150 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n"); 154 jsm_dbg(IOCTL, &channel->ch_bd->pci_dev, "start\n");
151 155
@@ -157,7 +161,8 @@ static void jsm_tty_stop_tx(struct uart_port *port)
157static void jsm_tty_send_xchar(struct uart_port *port, char ch) 161static void jsm_tty_send_xchar(struct uart_port *port, char ch)
158{ 162{
159 unsigned long lock_flags; 163 unsigned long lock_flags;
160 struct jsm_channel *channel = (struct jsm_channel *)port; 164 struct jsm_channel *channel =
165 container_of(port, struct jsm_channel, uart_port);
161 struct ktermios *termios; 166 struct ktermios *termios;
162 167
163 spin_lock_irqsave(&port->lock, lock_flags); 168 spin_lock_irqsave(&port->lock, lock_flags);
@@ -172,7 +177,8 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
172 177
173static void jsm_tty_stop_rx(struct uart_port *port) 178static void jsm_tty_stop_rx(struct uart_port *port)
174{ 179{
175 struct jsm_channel *channel = (struct jsm_channel *)port; 180 struct jsm_channel *channel =
181 container_of(port, struct jsm_channel, uart_port);
176 182
177 channel->ch_bd->bd_ops->disable_receiver(channel); 183 channel->ch_bd->bd_ops->disable_receiver(channel);
178} 184}
@@ -180,7 +186,8 @@ static void jsm_tty_stop_rx(struct uart_port *port)
180static void jsm_tty_break(struct uart_port *port, int break_state) 186static void jsm_tty_break(struct uart_port *port, int break_state)
181{ 187{
182 unsigned long lock_flags; 188 unsigned long lock_flags;
183 struct jsm_channel *channel = (struct jsm_channel *)port; 189 struct jsm_channel *channel =
190 container_of(port, struct jsm_channel, uart_port);
184 191
185 spin_lock_irqsave(&port->lock, lock_flags); 192 spin_lock_irqsave(&port->lock, lock_flags);
186 if (break_state == -1) 193 if (break_state == -1)
@@ -194,7 +201,8 @@ static void jsm_tty_break(struct uart_port *port, int break_state)
194static int jsm_tty_open(struct uart_port *port) 201static int jsm_tty_open(struct uart_port *port)
195{ 202{
196 struct jsm_board *brd; 203 struct jsm_board *brd;
197 struct jsm_channel *channel = (struct jsm_channel *)port; 204 struct jsm_channel *channel =
205 container_of(port, struct jsm_channel, uart_port);
198 struct ktermios *termios; 206 struct ktermios *termios;
199 207
200 /* Get board pointer from our array of majors we have allocated */ 208 /* Get board pointer from our array of majors we have allocated */
@@ -273,7 +281,8 @@ static void jsm_tty_close(struct uart_port *port)
273{ 281{
274 struct jsm_board *bd; 282 struct jsm_board *bd;
275 struct ktermios *ts; 283 struct ktermios *ts;
276 struct jsm_channel *channel = (struct jsm_channel *)port; 284 struct jsm_channel *channel =
285 container_of(port, struct jsm_channel, uart_port);
277 286
278 jsm_dbg(CLOSE, &channel->ch_bd->pci_dev, "start\n"); 287 jsm_dbg(CLOSE, &channel->ch_bd->pci_dev, "start\n");
279 288
@@ -307,7 +316,8 @@ static void jsm_tty_set_termios(struct uart_port *port,
307 struct ktermios *old_termios) 316 struct ktermios *old_termios)
308{ 317{
309 unsigned long lock_flags; 318 unsigned long lock_flags;
310 struct jsm_channel *channel = (struct jsm_channel *)port; 319 struct jsm_channel *channel =
320 container_of(port, struct jsm_channel, uart_port);
311 321
312 spin_lock_irqsave(&port->lock, lock_flags); 322 spin_lock_irqsave(&port->lock, lock_flags);
313 channel->ch_c_cflag = termios->c_cflag; 323 channel->ch_c_cflag = termios->c_cflag;