Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1624235

[RFC PATCH 5/9] IB/hfi1: convert to debugfs_file_get() and -put()

From Nicolai Stange <nicstange@gmail.com>
Newsgroups linux.kernel
Subject [RFC PATCH 5/9] IB/hfi1: convert to debugfs_file_get() and -put()
Date 2017-04-16 12:00 +0200
Message-ID <twP8m-25W-9@gated-at.bofh.it> (permalink)
References <tr0Jc-2AS-45@gated-at.bofh.it> <twP8l-25W-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Convert all calls to the now obsolete debugfs_use_file_start() and
debugfs_use_file_finish() to the new debugfs_file_get() and
debugfs_file_put() API.

Fixes: 49d200deaa68 ("debugfs: prevent access to removed files' private
                      data")
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
---
 drivers/infiniband/hw/hfi1/debugfs.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c
index dc2c1c993f04..ec78fe678179 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.c
+++ b/drivers/infiniband/hw/hfi1/debugfs.c
@@ -72,13 +72,13 @@ static ssize_t hfi1_seq_read(
 	loff_t *ppos)
 {
 	struct dentry *d = file->f_path.dentry;
-	int srcu_idx;
 	ssize_t r;
 
-	r = debugfs_use_file_start(d, &srcu_idx);
-	if (likely(!r))
-		r = seq_read(file, buf, size, ppos);
-	debugfs_use_file_finish(srcu_idx);
+	r = debugfs_file_get(d);
+	if (unlikely(r))
+		return r;
+	r = seq_read(file, buf, size, ppos);
+	debugfs_file_put(d);
 	return r;
 }
 
@@ -88,13 +88,13 @@ static loff_t hfi1_seq_lseek(
 	int whence)
 {
 	struct dentry *d = file->f_path.dentry;
-	int srcu_idx;
 	loff_t r;
 
-	r = debugfs_use_file_start(d, &srcu_idx);
-	if (likely(!r))
-		r = seq_lseek(file, offset, whence);
-	debugfs_use_file_finish(srcu_idx);
+	r = debugfs_file_get(d);
+	if (unlikely(r))
+		return r;
+	r = seq_lseek(file, offset, whence);
+	debugfs_file_put(d);
 	return r;
 }
 
-- 
2.12.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/9] debugfs: per-file removal protection Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 4/9] debugfs: convert to debugfs_file_get() and -put() Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 2/9] debugfs: implement per-file removal protection Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 5/9] IB/hfi1: convert to debugfs_file_get() and -put() Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 8/9] debugfs: defer debugfs_fsdata allocation to first usage Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
    Re: [RFC PATCH 8/9] debugfs: defer debugfs_fsdata allocation to  first usage Johannes Berg <johannes@sipsolutions.net> - 2017-04-18 11:40 +0200
  [RFC PATCH 6/9] debugfs: purge obsolete SRCU based removal protection Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
    Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-17 18:10 +0200
      Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances Johannes Berg <johannes@sipsolutions.net> - 2017-04-18 11:50 +0200
        Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-18 15:40 +0200
          Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances Johannes Berg <johannes@sipsolutions.net> - 2017-04-18 15:50 +0200
            Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-18 17:20 +0200
              Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances Johannes Berg <johannes@sipsolutions.net> - 2017-04-18 17:30 +0200
                Re: [RFC PATCH 9/9] debugfs: free debugfs_fsdata instances "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-18 19:20 +0200
  [RFC PATCH 1/9] debugfs: add support for more elaborate ->d_fsdata Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 3/9] debugfs: debugfs_real_fops(): drop __must_hold sparse annotation Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200
  [RFC PATCH 7/9] debugfs: call debugfs_real_fops() only after debugfs_file_get() Nicolai Stange <nicstange@gmail.com> - 2017-04-16 12:00 +0200

csiph-web