aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/mpsc.c
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2014-10-05 13:01:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-05 22:20:52 -0500
commit22d4d44c4ce3a860377aaaeeb4a7b8b907ab66bc (patch)
tree230a7d188fe575c51d2034cb692c0679052dd7c5 /drivers/tty/serial/mpsc.c
parent2413b320625f0c8d5292f417923326177691b09b (diff)
serial: mpsc: use container_of to resolve mpsc_port_info 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/mpsc.c')
-rw-r--r--drivers/tty/serial/mpsc.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index ae49856ef6c7..5d5499bedba0 100644
--- a/drivers/tty/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
@@ -1246,7 +1246,8 @@ static irqreturn_t mpsc_sdma_intr(int irq, void *dev_id)
1246 */ 1246 */
1247static uint mpsc_tx_empty(struct uart_port *port) 1247static uint mpsc_tx_empty(struct uart_port *port)
1248{ 1248{
1249 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1249 struct mpsc_port_info *pi =
1250 container_of(port, struct mpsc_port_info, port);
1250 ulong iflags; 1251 ulong iflags;
1251 uint rc; 1252 uint rc;
1252 1253
@@ -1264,7 +1265,8 @@ static void mpsc_set_mctrl(struct uart_port *port, uint mctrl)
1264 1265
1265static uint mpsc_get_mctrl(struct uart_port *port) 1266static uint mpsc_get_mctrl(struct uart_port *port)
1266{ 1267{
1267 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1268 struct mpsc_port_info *pi =
1269 container_of(port, struct mpsc_port_info, port);
1268 u32 mflags, status; 1270 u32 mflags, status;
1269 1271
1270 status = (pi->mirror_regs) ? pi->MPSC_CHR_10_m 1272 status = (pi->mirror_regs) ? pi->MPSC_CHR_10_m
@@ -1281,7 +1283,8 @@ static uint mpsc_get_mctrl(struct uart_port *port)
1281 1283
1282static void mpsc_stop_tx(struct uart_port *port) 1284static void mpsc_stop_tx(struct uart_port *port)
1283{ 1285{
1284 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1286 struct mpsc_port_info *pi =
1287 container_of(port, struct mpsc_port_info, port);
1285 1288
1286 pr_debug("mpsc_stop_tx[%d]\n", port->line); 1289 pr_debug("mpsc_stop_tx[%d]\n", port->line);
1287 1290
@@ -1290,7 +1293,8 @@ static void mpsc_stop_tx(struct uart_port *port)
1290 1293
1291static void mpsc_start_tx(struct uart_port *port) 1294static void mpsc_start_tx(struct uart_port *port)
1292{ 1295{
1293 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1296 struct mpsc_port_info *pi =
1297 container_of(port, struct mpsc_port_info, port);
1294 unsigned long iflags; 1298 unsigned long iflags;
1295 1299
1296 spin_lock_irqsave(&pi->tx_lock, iflags); 1300 spin_lock_irqsave(&pi->tx_lock, iflags);
@@ -1316,7 +1320,8 @@ static void mpsc_start_rx(struct mpsc_port_info *pi)
1316 1320
1317static void mpsc_stop_rx(struct uart_port *port) 1321static void mpsc_stop_rx(struct uart_port *port)
1318{ 1322{
1319 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1323 struct mpsc_port_info *pi =
1324 container_of(port, struct mpsc_port_info, port);
1320 1325
1321 pr_debug("mpsc_stop_rx[%d]: Stopping...\n", port->line); 1326 pr_debug("mpsc_stop_rx[%d]: Stopping...\n", port->line);
1322 1327
@@ -1338,7 +1343,8 @@ static void mpsc_stop_rx(struct uart_port *port)
1338 1343
1339static void mpsc_break_ctl(struct uart_port *port, int ctl) 1344static void mpsc_break_ctl(struct uart_port *port, int ctl)
1340{ 1345{
1341 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1346 struct mpsc_port_info *pi =
1347 container_of(port, struct mpsc_port_info, port);
1342 ulong flags; 1348 ulong flags;
1343 u32 v; 1349 u32 v;
1344 1350
@@ -1353,7 +1359,8 @@ static void mpsc_break_ctl(struct uart_port *port, int ctl)
1353 1359
1354static int mpsc_startup(struct uart_port *port) 1360static int mpsc_startup(struct uart_port *port)
1355{ 1361{
1356 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1362 struct mpsc_port_info *pi =
1363 container_of(port, struct mpsc_port_info, port);
1357 u32 flag = 0; 1364 u32 flag = 0;
1358 int rc; 1365 int rc;
1359 1366
@@ -1383,7 +1390,8 @@ static int mpsc_startup(struct uart_port *port)
1383 1390
1384static void mpsc_shutdown(struct uart_port *port) 1391static void mpsc_shutdown(struct uart_port *port)
1385{ 1392{
1386 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1393 struct mpsc_port_info *pi =
1394 container_of(port, struct mpsc_port_info, port);
1387 1395
1388 pr_debug("mpsc_shutdown[%d]: Shutting down MPSC\n", port->line); 1396 pr_debug("mpsc_shutdown[%d]: Shutting down MPSC\n", port->line);
1389 1397
@@ -1394,7 +1402,8 @@ static void mpsc_shutdown(struct uart_port *port)
1394static void mpsc_set_termios(struct uart_port *port, struct ktermios *termios, 1402static void mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
1395 struct ktermios *old) 1403 struct ktermios *old)
1396{ 1404{
1397 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1405 struct mpsc_port_info *pi =
1406 container_of(port, struct mpsc_port_info, port);
1398 u32 baud; 1407 u32 baud;
1399 ulong flags; 1408 ulong flags;
1400 u32 chr_bits, stop_bits, par; 1409 u32 chr_bits, stop_bits, par;
@@ -1498,7 +1507,8 @@ static int mpsc_request_port(struct uart_port *port)
1498 1507
1499static void mpsc_release_port(struct uart_port *port) 1508static void mpsc_release_port(struct uart_port *port)
1500{ 1509{
1501 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1510 struct mpsc_port_info *pi =
1511 container_of(port, struct mpsc_port_info, port);
1502 1512
1503 if (pi->ready) { 1513 if (pi->ready) {
1504 mpsc_uninit_rings(pi); 1514 mpsc_uninit_rings(pi);
@@ -1513,7 +1523,8 @@ static void mpsc_config_port(struct uart_port *port, int flags)
1513 1523
1514static int mpsc_verify_port(struct uart_port *port, struct serial_struct *ser) 1524static int mpsc_verify_port(struct uart_port *port, struct serial_struct *ser)
1515{ 1525{
1516 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1526 struct mpsc_port_info *pi =
1527 container_of(port, struct mpsc_port_info, port);
1517 int rc = 0; 1528 int rc = 0;
1518 1529
1519 pr_debug("mpsc_verify_port[%d]: Verifying port data\n", pi->port.line); 1530 pr_debug("mpsc_verify_port[%d]: Verifying port data\n", pi->port.line);
@@ -1548,7 +1559,8 @@ static void mpsc_put_poll_char(struct uart_port *port,
1548 1559
1549static int mpsc_get_poll_char(struct uart_port *port) 1560static int mpsc_get_poll_char(struct uart_port *port)
1550{ 1561{
1551 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1562 struct mpsc_port_info *pi =
1563 container_of(port, struct mpsc_port_info, port);
1552 struct mpsc_rx_desc *rxre; 1564 struct mpsc_rx_desc *rxre;
1553 u32 cmdstat, bytes_in, i; 1565 u32 cmdstat, bytes_in, i;
1554 u8 *bp; 1566 u8 *bp;
@@ -1648,7 +1660,8 @@ static int mpsc_get_poll_char(struct uart_port *port)
1648static void mpsc_put_poll_char(struct uart_port *port, 1660static void mpsc_put_poll_char(struct uart_port *port,
1649 unsigned char c) 1661 unsigned char c)
1650{ 1662{
1651 struct mpsc_port_info *pi = (struct mpsc_port_info *)port; 1663 struct mpsc_port_info *pi =
1664 container_of(port, struct mpsc_port_info, port);
1652 u32 data; 1665 u32 data;
1653 1666
1654 data = readl(pi->mpsc_base + MPSC_MPCR); 1667 data = readl(pi->mpsc_base + MPSC_MPCR);