Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
1d6249c1 292cb391

+5 -21
+5 -17
fs/sysfs/file.c
··· 97 97 count = size - pos; 98 98 } 99 99 100 - if (!battr->read && !battr->read_new) 100 + if (!battr->read) 101 101 return -EIO; 102 - 103 - if (battr->read_new) 104 - return battr->read_new(of->file, kobj, battr, buf, pos, count); 105 102 106 103 return battr->read(of->file, kobj, battr, buf, pos, count); 107 104 } ··· 158 161 if (!count) 159 162 return 0; 160 163 161 - if (!battr->write && !battr->write_new) 164 + if (!battr->write) 162 165 return -EIO; 163 - 164 - if (battr->write_new) 165 - return battr->write_new(of->file, kobj, battr, buf, pos, count); 166 166 167 167 return battr->write(of->file, kobj, battr, buf, pos, count); 168 168 } ··· 329 335 const struct kernfs_ops *ops; 330 336 struct kernfs_node *kn; 331 337 332 - if (battr->read && battr->read_new) 333 - return -EINVAL; 334 - 335 - if (battr->write && battr->write_new) 336 - return -EINVAL; 337 - 338 338 if (battr->mmap) 339 339 ops = &sysfs_bin_kfops_mmap; 340 - else if ((battr->read || battr->read_new) && (battr->write || battr->write_new)) 340 + else if (battr->read && battr->write) 341 341 ops = &sysfs_bin_kfops_rw; 342 - else if (battr->read || battr->read_new) 342 + else if (battr->read) 343 343 ops = &sysfs_bin_kfops_ro; 344 - else if (battr->write || battr->write_new) 344 + else if (battr->write) 345 345 ops = &sysfs_bin_kfops_wo; 346 346 else 347 347 ops = &sysfs_file_kfops_empty;
-4
include/linux/sysfs.h
··· 308 308 struct address_space *(*f_mapping)(void); 309 309 ssize_t (*read)(struct file *, struct kobject *, const struct bin_attribute *, 310 310 char *, loff_t, size_t); 311 - ssize_t (*read_new)(struct file *, struct kobject *, const struct bin_attribute *, 312 - char *, loff_t, size_t); 313 311 ssize_t (*write)(struct file *, struct kobject *, const struct bin_attribute *, 314 312 char *, loff_t, size_t); 315 - ssize_t (*write_new)(struct file *, struct kobject *, 316 - const struct bin_attribute *, char *, loff_t, size_t); 317 313 loff_t (*llseek)(struct file *, struct kobject *, const struct bin_attribute *, 318 314 loff_t, int); 319 315 int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr,