public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghua.yu@intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC 2/5] ia64/sn/hwperf: use seq_open_data
Date: Thu, 01 Mar 2018 23:37:21 +0000	[thread overview]
Message-ID: <20180301233724.20440-2-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20180301233724.20440-1-linux@rasmusvillemoes.dk>

This code should check the return value of seq_open(); if it failed,
file->private_data is NULL. But we can avoid the issue entirely and
simplify the code by letting seq_open_data() set the ->private member
to objbuf.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 arch/ia64/sn/kernel/sn2/sn_hwperf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 55febd65911a..fba7f3ad99f4 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -941,14 +941,11 @@ static int sn_hwperf_init(void)
 int sn_topology_open(struct inode *inode, struct file *file)
 {
 	int e;
-	struct seq_file *seq;
 	struct sn_hwperf_object_info *objbuf;
 	int nobj;
 
 	if ((e = sn_hwperf_enum_objects(&nobj, &objbuf)) = 0) {
-		e = seq_open(file, &sn_topology_seq_ops);
-		seq = file->private_data;
-		seq->private = objbuf;
+		e = seq_open_data(file, &sn_topology_seq_ops, objbuf);
 	}
 
 	return e;
-- 
2.15.1


  reply	other threads:[~2018-03-01 23:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01 23:37 [RFC 1/5] seq_file: introduce seq_open_data helper Rasmus Villemoes
2018-03-01 23:37 ` Rasmus Villemoes [this message]
2018-03-02  8:22   ` [RFC 2/5] ia64/sn/hwperf: use seq_open_data Rasmus Villemoes
2018-03-01 23:44 ` [RFC 1/5] seq_file: introduce seq_open_data helper Andreas Dilger

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=20180301233724.20440-2-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=fenghua.yu@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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