diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-01-28 22:34:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-29 23:28:45 -0500 |
commit | e16d1ded85b9ceddbf8092d239646ee520353e47 (patch) | |
tree | 241fd9774c4183fd9799281ebeb3d5406811823c | |
parent | fa1da242c3d24801ae946f4664406f679865388f (diff) |
staging/fwserial: Cleanup /proc/tty/driver/ file
Factor out extra stats, data profiles, debugging info and peer info
from procfs file in preparation for using debugfs instead.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/fwserial/fwserial.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 3f2d26e7a008..fb00a8a7bb8c 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c | |||
@@ -1509,17 +1509,26 @@ static void fwtty_proc_show_port(struct seq_file *m, struct fwtty_port *port) | |||
1509 | if (port->port.console) | 1509 | if (port->port.console) |
1510 | (*port->fwcon_ops->stats)(&stats, port->con_data); | 1510 | (*port->fwcon_ops->stats)(&stats, port->con_data); |
1511 | 1511 | ||
1512 | seq_printf(m, " tx:%d rx:%d", port->icount.tx + stats.xchars, | 1512 | seq_printf(m, " addr:%012llx tx:%d rx:%d", port->rx_handler.offset, |
1513 | port->icount.rx); | 1513 | port->icount.tx + stats.xchars, port->icount.rx); |
1514 | seq_printf(m, " cts:%d dsr:%d rng:%d dcd:%d", port->icount.cts, | 1514 | seq_printf(m, " cts:%d dsr:%d rng:%d dcd:%d", port->icount.cts, |
1515 | port->icount.dsr, port->icount.rng, port->icount.dcd); | 1515 | port->icount.dsr, port->icount.rng, port->icount.dcd); |
1516 | seq_printf(m, " fe:%d oe:%d pe:%d brk:%d", port->icount.frame, | 1516 | seq_printf(m, " fe:%d oe:%d pe:%d brk:%d", port->icount.frame, |
1517 | port->icount.overrun, port->icount.parity, port->icount.brk); | 1517 | port->icount.overrun, port->icount.parity, port->icount.brk); |
1518 | } | ||
1519 | |||
1520 | static void fwtty_debugfs_show_port(struct seq_file *m, struct fwtty_port *port) | ||
1521 | { | ||
1522 | struct stats stats; | ||
1523 | |||
1524 | memcpy(&stats, &port->stats, sizeof(stats)); | ||
1525 | if (port->port.console) | ||
1526 | (*port->fwcon_ops->stats)(&stats, port->con_data); | ||
1527 | |||
1518 | seq_printf(m, " dr:%d st:%d err:%d lost:%d", stats.dropped, | 1528 | seq_printf(m, " dr:%d st:%d err:%d lost:%d", stats.dropped, |
1519 | stats.tx_stall, stats.fifo_errs, stats.lost); | 1529 | stats.tx_stall, stats.fifo_errs, stats.lost); |
1520 | seq_printf(m, " pkts:%d thr:%d wtrmk:%d", stats.sent, stats.throttled, | 1530 | seq_printf(m, " pkts:%d thr:%d wtrmk:%d", stats.sent, stats.throttled, |
1521 | stats.watermark); | 1531 | stats.watermark); |
1522 | seq_printf(m, " addr:%012llx", port->rx_handler.offset); | ||
1523 | 1532 | ||
1524 | if (port->port.console) { | 1533 | if (port->port.console) { |
1525 | seq_printf(m, "\n "); | 1534 | seq_printf(m, "\n "); |
@@ -1529,7 +1538,7 @@ static void fwtty_proc_show_port(struct seq_file *m, struct fwtty_port *port) | |||
1529 | dump_profile(m, &port->stats); | 1538 | dump_profile(m, &port->stats); |
1530 | } | 1539 | } |
1531 | 1540 | ||
1532 | static void fwtty_proc_show_peer(struct seq_file *m, struct fwtty_peer *peer) | 1541 | static void fwtty_debugfs_show_peer(struct seq_file *m, struct fwtty_peer *peer) |
1533 | { | 1542 | { |
1534 | int generation = peer->generation; | 1543 | int generation = peer->generation; |
1535 | 1544 | ||
@@ -1538,21 +1547,14 @@ static void fwtty_proc_show_peer(struct seq_file *m, struct fwtty_peer *peer) | |||
1538 | seq_printf(m, " node:%04x gen:%d", peer->node_id, generation); | 1547 | seq_printf(m, " node:%04x gen:%d", peer->node_id, generation); |
1539 | seq_printf(m, " sp:%d max:%d guid:%016llx", peer->speed, | 1548 | seq_printf(m, " sp:%d max:%d guid:%016llx", peer->speed, |
1540 | peer->max_payload, (unsigned long long) peer->guid); | 1549 | peer->max_payload, (unsigned long long) peer->guid); |
1541 | 1550 | seq_printf(m, " mgmt:%012llx", (unsigned long long) peer->mgmt_addr); | |
1542 | if (capable(CAP_SYS_ADMIN)) { | 1551 | seq_printf(m, " addr:%012llx", (unsigned long long) peer->status_addr); |
1543 | seq_printf(m, " mgmt:%012llx", | ||
1544 | (unsigned long long) peer->mgmt_addr); | ||
1545 | seq_printf(m, " addr:%012llx", | ||
1546 | (unsigned long long) peer->status_addr); | ||
1547 | } | ||
1548 | seq_putc(m, '\n'); | 1552 | seq_putc(m, '\n'); |
1549 | } | 1553 | } |
1550 | 1554 | ||
1551 | static int fwtty_proc_show(struct seq_file *m, void *v) | 1555 | static int fwtty_proc_show(struct seq_file *m, void *v) |
1552 | { | 1556 | { |
1553 | struct fwtty_port *port; | 1557 | struct fwtty_port *port; |
1554 | struct fw_serial *serial; | ||
1555 | struct fwtty_peer *peer; | ||
1556 | int i; | 1558 | int i; |
1557 | 1559 | ||
1558 | seq_puts(m, "fwserinfo: 1.0 driver: 1.0\n"); | 1560 | seq_puts(m, "fwserinfo: 1.0 driver: 1.0\n"); |
@@ -1563,17 +1565,6 @@ static int fwtty_proc_show(struct seq_file *m, void *v) | |||
1563 | fwtty_port_put(port); | 1565 | fwtty_port_put(port); |
1564 | seq_printf(m, "\n"); | 1566 | seq_printf(m, "\n"); |
1565 | } | 1567 | } |
1566 | seq_putc(m, '\n'); | ||
1567 | |||
1568 | rcu_read_lock(); | ||
1569 | list_for_each_entry_rcu(serial, &fwserial_list, list) { | ||
1570 | seq_printf(m, "card: %s guid: %016llx\n", | ||
1571 | dev_name(serial->card->device), | ||
1572 | (unsigned long long) serial->card->guid); | ||
1573 | list_for_each_entry_rcu(peer, &serial->peer_list, list) | ||
1574 | fwtty_proc_show_peer(m, peer); | ||
1575 | } | ||
1576 | rcu_read_unlock(); | ||
1577 | return 0; | 1568 | return 0; |
1578 | } | 1569 | } |
1579 | 1570 | ||