mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
hfi1: get rid of redundant debugfs_file_{get,put}()
All files in question are created via debugfs_create_file(), so exclusion with removals is provided by debugfs wrappers; as the matter of fact, hfi1-private wrappers had been redundant at least since 2017... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://lore.kernel.org/r/20250702211508.GB3406663@ZenIV Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
327a206c0e
commit
2b4b80cfcf
|
|
@ -22,34 +22,6 @@
|
|||
|
||||
static struct dentry *hfi1_dbg_root;
|
||||
|
||||
/* wrappers to enforce srcu in seq file */
|
||||
ssize_t hfi1_seq_read(struct file *file, char __user *buf, size_t size,
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct dentry *d = file->f_path.dentry;
|
||||
ssize_t r;
|
||||
|
||||
r = debugfs_file_get(d);
|
||||
if (unlikely(r))
|
||||
return r;
|
||||
r = seq_read(file, buf, size, ppos);
|
||||
debugfs_file_put(d);
|
||||
return r;
|
||||
}
|
||||
|
||||
loff_t hfi1_seq_lseek(struct file *file, loff_t offset, int whence)
|
||||
{
|
||||
struct dentry *d = file->f_path.dentry;
|
||||
loff_t r;
|
||||
|
||||
r = debugfs_file_get(d);
|
||||
if (unlikely(r))
|
||||
return r;
|
||||
r = seq_lseek(file, offset, whence);
|
||||
debugfs_file_put(d);
|
||||
return r;
|
||||
}
|
||||
|
||||
#define private2dd(file) (file_inode(file)->i_private)
|
||||
#define private2ppd(file) (file_inode(file)->i_private)
|
||||
|
||||
|
|
|
|||
|
|
@ -33,16 +33,11 @@ static int _##name##_open(struct inode *inode, struct file *s) \
|
|||
static const struct file_operations _##name##_file_ops = { \
|
||||
.owner = THIS_MODULE, \
|
||||
.open = _##name##_open, \
|
||||
.read = hfi1_seq_read, \
|
||||
.llseek = hfi1_seq_lseek, \
|
||||
.read = seq_read, \
|
||||
.llseek = seq_lseek, \
|
||||
.release = seq_release \
|
||||
}
|
||||
|
||||
|
||||
ssize_t hfi1_seq_read(struct file *file, char __user *buf, size_t size,
|
||||
loff_t *ppos);
|
||||
loff_t hfi1_seq_lseek(struct file *file, loff_t offset, int whence);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd);
|
||||
void hfi1_dbg_ibdev_exit(struct hfi1_ibdev *ibd);
|
||||
|
|
|
|||
|
|
@ -104,9 +104,6 @@ static ssize_t fault_opcodes_write(struct file *file, const char __user *buf,
|
|||
goto free_data;
|
||||
}
|
||||
|
||||
ret = debugfs_file_get(file->f_path.dentry);
|
||||
if (unlikely(ret))
|
||||
goto free_data;
|
||||
ptr = data;
|
||||
token = ptr;
|
||||
for (ptr = data; *ptr; ptr = end + 1, token = ptr) {
|
||||
|
|
@ -154,7 +151,6 @@ static ssize_t fault_opcodes_write(struct file *file, const char __user *buf,
|
|||
}
|
||||
ret = len;
|
||||
|
||||
debugfs_file_put(file->f_path.dentry);
|
||||
free_data:
|
||||
kfree(data);
|
||||
return ret;
|
||||
|
|
@ -173,9 +169,6 @@ static ssize_t fault_opcodes_read(struct file *file, char __user *buf,
|
|||
data = kcalloc(datalen, sizeof(*data), GFP_KERNEL);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
ret = debugfs_file_get(file->f_path.dentry);
|
||||
if (unlikely(ret))
|
||||
goto free_data;
|
||||
bit = find_first_bit(fault->opcodes, bitsize);
|
||||
while (bit < bitsize) {
|
||||
zero = find_next_zero_bit(fault->opcodes, bitsize, bit);
|
||||
|
|
@ -189,11 +182,9 @@ static ssize_t fault_opcodes_read(struct file *file, char __user *buf,
|
|||
bit);
|
||||
bit = find_next_bit(fault->opcodes, bitsize, zero);
|
||||
}
|
||||
debugfs_file_put(file->f_path.dentry);
|
||||
data[size - 1] = '\n';
|
||||
data[size] = '\0';
|
||||
ret = simple_read_from_buffer(buf, len, pos, data, size);
|
||||
free_data:
|
||||
kfree(data);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user