Skip to content

Commit e16d1de

Browse files
peterhurleygregkh
authored andcommitted
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>
1 parent fa1da24 commit e16d1de

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

‎drivers/staging/fwserial/fwserial.c‎

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,17 +1509,26 @@ static void fwtty_proc_show_port(struct seq_file *m, struct fwtty_port *port)
15091509
if (port->port.console)
15101510
(*port->fwcon_ops->stats)(&stats, port->con_data);
15111511

1512-
seq_printf(m, " tx:%d rx:%d", port->icount.tx + stats.xchars,
1513-
port->icount.rx);
1512+
seq_printf(m, " addr:%012llx tx:%d rx:%d", port->rx_handler.offset,
1513+
port->icount.tx + stats.xchars, port->icount.rx);
15141514
seq_printf(m, " cts:%d dsr:%d rng:%d dcd:%d", port->icount.cts,
15151515
port->icount.dsr, port->icount.rng, port->icount.dcd);
15161516
seq_printf(m, " fe:%d oe:%d pe:%d brk:%d", port->icount.frame,
15171517
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+
15181528
seq_printf(m, " dr:%d st:%d err:%d lost:%d", stats.dropped,
15191529
stats.tx_stall, stats.fifo_errs, stats.lost);
15201530
seq_printf(m, " pkts:%d thr:%d wtrmk:%d", stats.sent, stats.throttled,
15211531
stats.watermark);
1522-
seq_printf(m, " addr:%012llx", port->rx_handler.offset);
15231532

15241533
if (port->port.console) {
15251534
seq_printf(m, "\n ");
@@ -1529,7 +1538,7 @@ static void fwtty_proc_show_port(struct seq_file *m, struct fwtty_port *port)
15291538
dump_profile(m, &port->stats);
15301539
}
15311540

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)
15331542
{
15341543
int generation = peer->generation;
15351544

@@ -1538,21 +1547,14 @@ static void fwtty_proc_show_peer(struct seq_file *m, struct fwtty_peer *peer)
15381547
seq_printf(m, " node:%04x gen:%d", peer->node_id, generation);
15391548
seq_printf(m, " sp:%d max:%d guid:%016llx", peer->speed,
15401549
peer->max_payload, (unsigned long long) peer->guid);
1541-
1542-
if (capable(CAP_SYS_ADMIN)) {
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-
}
1550+
seq_printf(m, " mgmt:%012llx", (unsigned long long) peer->mgmt_addr);
1551+
seq_printf(m, " addr:%012llx", (unsigned long long) peer->status_addr);
15481552
seq_putc(m, '\n');
15491553
}
15501554

15511555
static int fwtty_proc_show(struct seq_file *m, void *v)
15521556
{
15531557
struct fwtty_port *port;
1554-
struct fw_serial *serial;
1555-
struct fwtty_peer *peer;
15561558
int i;
15571559

15581560
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)
15631565
fwtty_port_put(port);
15641566
seq_printf(m, "\n");
15651567
}
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();
15771568
return 0;
15781569
}
15791570

0 commit comments

Comments
 (0)