]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netronome: don't bother with debugfs_real_fops()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 2 Jul 2025 21:22:05 +0000 (22:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2025 11:30:28 +0000 (13:30 +0200)
Just turn nfp_tx_q_show() into a wrapper for helper that gets
told whether it's tx or xdp via an explicit argument and have
nfp_xdp_q_show() call the underlying helper instead.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Link: https://lore.kernel.org/r/20250702212205.GF3406663@ZenIV
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c

index d8b735ccf8995d51166f738ee84d58b17f07fc37..d843d1e19715dddff67f29c54c6b4518891d89f7 100644 (file)
@@ -77,7 +77,7 @@ DEFINE_SHOW_ATTRIBUTE(nfp_rx_q);
 static int nfp_tx_q_show(struct seq_file *file, void *data);
 DEFINE_SHOW_ATTRIBUTE(nfp_tx_q);
 
-static int nfp_tx_q_show(struct seq_file *file, void *data)
+static int __nfp_tx_q_show(struct seq_file *file, void *data, bool is_xdp)
 {
        struct nfp_net_r_vector *r_vec = file->private;
        struct nfp_net_tx_ring *tx_ring;
@@ -86,10 +86,10 @@ static int nfp_tx_q_show(struct seq_file *file, void *data)
 
        rtnl_lock();
 
-       if (debugfs_real_fops(file->file) == &nfp_tx_q_fops)
-               tx_ring = r_vec->tx_ring;
-       else
+       if (is_xdp)
                tx_ring = r_vec->xdp_ring;
+       else
+               tx_ring = r_vec->tx_ring;
        if (!r_vec->nfp_net || !tx_ring)
                goto out;
        nn = r_vec->nfp_net;
@@ -115,9 +115,14 @@ out:
        return 0;
 }
 
+static int nfp_tx_q_show(struct seq_file *file, void *data)
+{
+       return __nfp_tx_q_show(file, data, false);
+}
+
 static int nfp_xdp_q_show(struct seq_file *file, void *data)
 {
-       return nfp_tx_q_show(file, data);
+       return __nfp_tx_q_show(file, data, true);
 }
 DEFINE_SHOW_ATTRIBUTE(nfp_xdp_q);