From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Stefan Richter <stefanr@s5r6.in-berlin.de>,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 05/11] staging/fwserial: Cleanup /proc/tty/driver/ file
Date: Mon, 28 Jan 2013 22:34:39 -0500 [thread overview]
Message-ID: <1359430485-5301-5-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1359430485-5301-1-git-send-email-peter@hurleysoftware.com>
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>
---
drivers/staging/fwserial/fwserial.c | 39 ++++++++++++++-----------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index e143b7a..ba8ffa2 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -1500,17 +1500,26 @@ static void fwtty_proc_show_port(struct seq_file *m, struct fwtty_port *port)
if (port->port.console)
(*port->fwcon_ops->stats)(&stats, port->con_data);
- seq_printf(m, " tx:%d rx:%d", port->icount.tx + stats.xchars,
- port->icount.rx);
+ seq_printf(m, " addr:%012llx tx:%d rx:%d", port->rx_handler.offset,
+ port->icount.tx + stats.xchars, port->icount.rx);
seq_printf(m, " cts:%d dsr:%d rng:%d dcd:%d", port->icount.cts,
port->icount.dsr, port->icount.rng, port->icount.dcd);
seq_printf(m, " fe:%d oe:%d pe:%d brk:%d", port->icount.frame,
port->icount.overrun, port->icount.parity, port->icount.brk);
+}
+
+static void fwtty_debugfs_show_port(struct seq_file *m, struct fwtty_port *port)
+{
+ struct stats stats;
+
+ memcpy(&stats, &port->stats, sizeof(stats));
+ if (port->port.console)
+ (*port->fwcon_ops->stats)(&stats, port->con_data);
+
seq_printf(m, " dr:%d st:%d err:%d lost:%d", stats.dropped,
stats.tx_stall, stats.fifo_errs, stats.lost);
seq_printf(m, " pkts:%d thr:%d wtrmk:%d", stats.sent, stats.throttled,
stats.watermark);
- seq_printf(m, " addr:%012llx", port->rx_handler.offset);
if (port->port.console) {
seq_printf(m, "\n ");
@@ -1520,7 +1529,7 @@ static void fwtty_proc_show_port(struct seq_file *m, struct fwtty_port *port)
dump_profile(m, &port->stats);
}
-static void fwtty_proc_show_peer(struct seq_file *m, struct fwtty_peer *peer)
+static void fwtty_debugfs_show_peer(struct seq_file *m, struct fwtty_peer *peer)
{
int generation = peer->generation;
@@ -1529,21 +1538,14 @@ static void fwtty_proc_show_peer(struct seq_file *m, struct fwtty_peer *peer)
seq_printf(m, " node:%04x gen:%d", peer->node_id, generation);
seq_printf(m, " sp:%d max:%d guid:%016llx", peer->speed,
peer->max_payload, (unsigned long long) peer->guid);
-
- if (capable(CAP_SYS_ADMIN)) {
- seq_printf(m, " mgmt:%012llx",
- (unsigned long long) peer->mgmt_addr);
- seq_printf(m, " addr:%012llx",
- (unsigned long long) peer->status_addr);
- }
+ seq_printf(m, " mgmt:%012llx", (unsigned long long) peer->mgmt_addr);
+ seq_printf(m, " addr:%012llx", (unsigned long long) peer->status_addr);
seq_putc(m, '\n');
}
static int fwtty_proc_show(struct seq_file *m, void *v)
{
struct fwtty_port *port;
- struct fw_serial *serial;
- struct fwtty_peer *peer;
int i;
seq_puts(m, "fwserinfo: 1.0 driver: 1.0\n");
@@ -1554,17 +1556,6 @@ static int fwtty_proc_show(struct seq_file *m, void *v)
fwtty_port_put(port);
seq_printf(m, "\n");
}
- seq_putc(m, '\n');
-
- rcu_read_lock();
- list_for_each_entry_rcu(serial, &fwserial_list, list) {
- seq_printf(m, "card: %s guid: %016llx\n",
- dev_name(serial->card->device),
- (unsigned long long) serial->card->guid);
- list_for_each_entry_rcu(peer, &serial->peer_list, list)
- fwtty_proc_show_peer(m, peer);
- }
- rcu_read_unlock();
return 0;
}
--
1.8.1.1
next prev parent reply other threads:[~2013-01-29 3:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 3:34 [PATCH 01/11] staging/fwserial: Only reset port status for attached peers Peter Hurley
2013-01-29 3:34 ` [PATCH 02/11] staging/fwserial: Release port regardless of unplug response code Peter Hurley
2013-01-29 3:34 ` [PATCH 03/11] staging/fwserial: Fix sparse build warnings Peter Hurley
2013-01-29 3:34 ` [PATCH 04/11] staging/fwserial: Create loop device the 'tty' way Peter Hurley
2013-01-29 3:34 ` Peter Hurley [this message]
2013-01-29 3:34 ` [PATCH 06/11] staging/fwserial: Factor unstable stats/debug/status info to debugfs Peter Hurley
2013-01-29 3:34 ` [PATCH 07/11] staging/fwserial: Don't use deprecated alloc_tty_driver() Peter Hurley
2013-01-29 3:34 ` [PATCH 08/11] staging/fwserial: Remove reference to removed constant Peter Hurley
2013-01-29 3:34 ` [PATCH 09/11] staging/fwserial: add diagnostic for buffer overflow Peter Hurley
2013-01-29 3:34 ` [PATCH 10/11] staging/fwserial: Fix premature unthrottle Peter Hurley
2013-01-30 4:29 ` Greg Kroah-Hartman
2013-01-30 13:11 ` Peter Hurley
2013-01-30 13:32 ` Greg Kroah-Hartman
2013-01-30 13:37 ` Peter Hurley
2013-01-30 16:25 ` Greg Kroah-Hartman
2013-01-29 3:34 ` [PATCH 11/11] staging/fwserial: Remove unneeded push work Peter Hurley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359430485-5301-5-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=stefanr@s5r6.in-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.