linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: cluster-devel@redhat.com
Cc: linux-kernel@vger.kernel.org,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH v2 6/8] dlm: use seq_open_data in table_openN functions
Date: Sat, 18 Aug 2018 15:24:32 +0200	[thread overview]
Message-ID: <20180818132434.9515-6-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20180818132434.9515-1-linux@rasmusvillemoes.dk>

Using the seq_open_data helper simplifies these to oneliners.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
Depends on 1/8 introducing seq_open_data.

fs/dlm/debug_fs.c | 44 ++++----------------------------------------
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index fa08448e35dd..02892bca05b4 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -608,58 +608,22 @@ static const struct file_operations format4_fops;
 
 static int table_open1(struct inode *inode, struct file *file)
 {
-	struct seq_file *seq;
-	int ret;
-
-	ret = seq_open(file, &format1_seq_ops);
-	if (ret)
-		return ret;
-
-	seq = file->private_data;
-	seq->private = inode->i_private; /* the dlm_ls */
-	return 0;
+	return seq_open_data(file, &format1_seq_ops, inode->i_private);
 }
 
 static int table_open2(struct inode *inode, struct file *file)
 {
-	struct seq_file *seq;
-	int ret;
-
-	ret = seq_open(file, &format2_seq_ops);
-	if (ret)
-		return ret;
-
-	seq = file->private_data;
-	seq->private = inode->i_private; /* the dlm_ls */
-	return 0;
+	return seq_open_data(file, &format2_seq_ops, inode->i_private);
 }
 
 static int table_open3(struct inode *inode, struct file *file)
 {
-	struct seq_file *seq;
-	int ret;
-
-	ret = seq_open(file, &format3_seq_ops);
-	if (ret)
-		return ret;
-
-	seq = file->private_data;
-	seq->private = inode->i_private; /* the dlm_ls */
-	return 0;
+	return seq_open_data(file, &format3_seq_ops, inode->i_private);
 }
 
 static int table_open4(struct inode *inode, struct file *file)
 {
-	struct seq_file *seq;
-	int ret;
-
-	ret = seq_open(file, &format4_seq_ops);
-	if (ret)
-		return ret;
-
-	seq = file->private_data;
-	seq->private = inode->i_private; /* the dlm_ls */
-	return 0;
+	return seq_open_data(file, &format4_seq_ops, inode->i_private);
 }
 
 static const struct file_operations format1_fops = {
-- 
2.16.4


  parent reply	other threads:[~2018-08-18 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-18 13:24 [PATCH v2 1/8] seq_file: introduce seq_open_data helper Rasmus Villemoes
2018-08-18 13:24 ` [PATCH v2 2/8] seq_file: use seq_open_data in single_open Rasmus Villemoes
2018-08-18 13:24 ` [PATCH v2 3/8] seq_file: use seq_open_data in __seq_open_private Rasmus Villemoes
2018-08-18 13:24 ` [PATCH v2 4/8] proc: use seq_open_data() in proc_id_map_open() Rasmus Villemoes
2018-08-18 13:24 ` [PATCH v2 5/8] nfsd: use seq_open_data() in exports_net_open() Rasmus Villemoes
2018-08-18 13:24 ` Rasmus Villemoes [this message]
2018-08-18 13:24 ` [PATCH v2 7/8] powerpc/pseries: use seq_open_data in hcall_inst_seq_open Rasmus Villemoes
2018-08-18 13:24 ` [PATCH v2 8/8] PCI: tegra: use seq_open_data Rasmus Villemoes
2018-08-19 12:21 ` [PATCH v2 1/8] seq_file: introduce seq_open_data helper Andy Shevchenko

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=20180818132434.9515-6-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).