linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rob Jones <rob.jones@codethink.co.uk>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, jbaron@akamai.com, cl@linux-foundation.org,
	penberg@kernel.org, mpm@selenic.com, akpm@linux-foundation.org,
	linux-kernel@codethink.co.uk, rob.jones@codethink.co.uk
Subject: [PATCH 4/4] lib: Use seq_open_private() instead of seq_open()
Date: Fri, 29 Aug 2014 17:06:40 +0100	[thread overview]
Message-ID: <1409328400-18212-5-git-send-email-rob.jones@codethink.co.uk> (raw)
In-Reply-To: <1409328400-18212-1-git-send-email-rob.jones@codethink.co.uk>

Using seq_open_private() removes boilerplate code from ddebug_proc_open()

The resultant code is shorter and easier to follow.

This patch does not change any functionality.

Signed-off-by: Rob Jones <rob.jones@codethink.co.uk>
---
 lib/dynamic_debug.c |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 7288e38..e067fb5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -827,22 +827,9 @@ static const struct seq_operations ddebug_proc_seqops = {
  */
 static int ddebug_proc_open(struct inode *inode, struct file *file)
 {
-	struct ddebug_iter *iter;
-	int err;
-
 	vpr_info("called\n");
-
-	iter = kzalloc(sizeof(*iter), GFP_KERNEL);
-	if (iter == NULL)
-		return -ENOMEM;
-
-	err = seq_open(file, &ddebug_proc_seqops);
-	if (err) {
-		kfree(iter);
-		return err;
-	}
-	((struct seq_file *)file->private_data)->private = iter;
-	return 0;
+	return seq_open_private(file, &ddebug_proc_seqops,
+				sizeof(struct ddebug_iter));
 }
 
 static const struct file_operations ddebug_proc_fops = {
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2014-08-29 16:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-29 16:06 [PATCH 0/4] Tidy up of modules using seq_open() Rob Jones
2014-08-29 16:06 ` [PATCH 1/4] ipc: Use __seq_open_private() instead of seq_open() Rob Jones
2014-08-29 16:06 ` [PATCH 2/4] mm: Use seq_open_private() " Rob Jones
2014-08-29 16:06 ` [PATCH 3/4] mm: Use __seq_open_private() " Rob Jones
2014-08-29 16:24   ` Christoph Lameter
2014-08-29 16:06 ` Rob Jones [this message]
2014-08-29 19:18   ` [PATCH 4/4] lib: Use seq_open_private() " Jason Baron
2014-08-29 19:14 ` [PATCH 0/4] Tidy up of modules using seq_open() Andrew Morton
2014-09-01 12:47   ` Rob Jones

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=1409328400-18212-5-git-send-email-rob.jones@codethink.co.uk \
    --to=rob.jones@codethink.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=jbaron@akamai.com \
    --cc=linux-kernel@codethink.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@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).