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

sysfs: constify internal references to 'struct bin_attribute'

The sysfs core handles 'const struct bin_attribute *'.

Adapt the internal references.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20250530-sysfs-const-bin_attr-final-v3-2-724bfcf05b99@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Greg Kroah-Hartman
340d8e66 2841ef8d

+5 -5
+5 -5
fs/sysfs/file.c
··· 83 83 static ssize_t sysfs_kf_bin_read(struct kernfs_open_file *of, char *buf, 84 84 size_t count, loff_t pos) 85 85 { 86 - struct bin_attribute *battr = of->kn->priv; 86 + const struct bin_attribute *battr = of->kn->priv; 87 87 struct kobject *kobj = sysfs_file_kobj(of->kn); 88 88 loff_t size = file_inode(of->file)->i_size; 89 89 ··· 149 149 static ssize_t sysfs_kf_bin_write(struct kernfs_open_file *of, char *buf, 150 150 size_t count, loff_t pos) 151 151 { 152 - struct bin_attribute *battr = of->kn->priv; 152 + const struct bin_attribute *battr = of->kn->priv; 153 153 struct kobject *kobj = sysfs_file_kobj(of->kn); 154 154 loff_t size = file_inode(of->file)->i_size; 155 155 ··· 173 173 static int sysfs_kf_bin_mmap(struct kernfs_open_file *of, 174 174 struct vm_area_struct *vma) 175 175 { 176 - struct bin_attribute *battr = of->kn->priv; 176 + const struct bin_attribute *battr = of->kn->priv; 177 177 struct kobject *kobj = sysfs_file_kobj(of->kn); 178 178 179 179 return battr->mmap(of->file, kobj, battr, vma); ··· 182 182 static loff_t sysfs_kf_bin_llseek(struct kernfs_open_file *of, loff_t offset, 183 183 int whence) 184 184 { 185 - struct bin_attribute *battr = of->kn->priv; 185 + const struct bin_attribute *battr = of->kn->priv; 186 186 struct kobject *kobj = sysfs_file_kobj(of->kn); 187 187 188 188 if (battr->llseek) ··· 193 193 194 194 static int sysfs_kf_bin_open(struct kernfs_open_file *of) 195 195 { 196 - struct bin_attribute *battr = of->kn->priv; 196 + const struct bin_attribute *battr = of->kn->priv; 197 197 198 198 if (battr->f_mapping) 199 199 of->file->f_mapping = battr->f_mapping();