mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
sysfs: remove bin_attribute::read_new/write_new()
These transitional fields are now unused and unnecessary. Remove them and their logic in the sysfs core. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20250811-sysfs-const-bin_attr-final-v4-1-7b6053fd58bb@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
292cb39147
commit
1d6249c1ce
@@ -97,12 +97,9 @@ static ssize_t sysfs_kf_bin_read(struct kernfs_open_file *of, char *buf,
|
||||
count = size - pos;
|
||||
}
|
||||
|
||||
if (!battr->read && !battr->read_new)
|
||||
if (!battr->read)
|
||||
return -EIO;
|
||||
|
||||
if (battr->read_new)
|
||||
return battr->read_new(of->file, kobj, battr, buf, pos, count);
|
||||
|
||||
return battr->read(of->file, kobj, battr, buf, pos, count);
|
||||
}
|
||||
|
||||
@@ -161,12 +158,9 @@ static ssize_t sysfs_kf_bin_write(struct kernfs_open_file *of, char *buf,
|
||||
if (!count)
|
||||
return 0;
|
||||
|
||||
if (!battr->write && !battr->write_new)
|
||||
if (!battr->write)
|
||||
return -EIO;
|
||||
|
||||
if (battr->write_new)
|
||||
return battr->write_new(of->file, kobj, battr, buf, pos, count);
|
||||
|
||||
return battr->write(of->file, kobj, battr, buf, pos, count);
|
||||
}
|
||||
|
||||
@@ -335,19 +329,13 @@ int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent,
|
||||
const struct kernfs_ops *ops;
|
||||
struct kernfs_node *kn;
|
||||
|
||||
if (battr->read && battr->read_new)
|
||||
return -EINVAL;
|
||||
|
||||
if (battr->write && battr->write_new)
|
||||
return -EINVAL;
|
||||
|
||||
if (battr->mmap)
|
||||
ops = &sysfs_bin_kfops_mmap;
|
||||
else if ((battr->read || battr->read_new) && (battr->write || battr->write_new))
|
||||
else if (battr->read && battr->write)
|
||||
ops = &sysfs_bin_kfops_rw;
|
||||
else if (battr->read || battr->read_new)
|
||||
else if (battr->read)
|
||||
ops = &sysfs_bin_kfops_ro;
|
||||
else if (battr->write || battr->write_new)
|
||||
else if (battr->write)
|
||||
ops = &sysfs_bin_kfops_wo;
|
||||
else
|
||||
ops = &sysfs_file_kfops_empty;
|
||||
|
||||
@@ -308,12 +308,8 @@ struct bin_attribute {
|
||||
struct address_space *(*f_mapping)(void);
|
||||
ssize_t (*read)(struct file *, struct kobject *, const struct bin_attribute *,
|
||||
char *, loff_t, size_t);
|
||||
ssize_t (*read_new)(struct file *, struct kobject *, const struct bin_attribute *,
|
||||
char *, loff_t, size_t);
|
||||
ssize_t (*write)(struct file *, struct kobject *, const struct bin_attribute *,
|
||||
char *, loff_t, size_t);
|
||||
ssize_t (*write_new)(struct file *, struct kobject *,
|
||||
const struct bin_attribute *, char *, loff_t, size_t);
|
||||
loff_t (*llseek)(struct file *, struct kobject *, const struct bin_attribute *,
|
||||
loff_t, int);
|
||||
int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr,
|
||||
|
||||
Reference in New Issue
Block a user