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

sysfs: sysfs_chmod_file's attr can be const

sysfs_chmod_file doesn't change the attribute it operates on, so this
attribute can be marked const.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Jean Delvare and committed by
Greg Kroah-Hartman
49c19400 3317fad5

+5 -4
+2 -1
fs/sysfs/file.c
··· 593 593 * @mode: file permissions. 594 594 * 595 595 */ 596 - int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) 596 + int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, 597 + mode_t mode) 597 598 { 598 599 struct sysfs_dirent *sd; 599 600 struct iattr newattrs;
+3 -3
include/linux/sysfs.h
··· 136 136 const struct attribute *attr); 137 137 int __must_check sysfs_create_files(struct kobject *kobj, 138 138 const struct attribute **attr); 139 - int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 140 - mode_t mode); 139 + int __must_check sysfs_chmod_file(struct kobject *kobj, 140 + const struct attribute *attr, mode_t mode); 141 141 void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 142 142 void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 143 143 ··· 225 225 } 226 226 227 227 static inline int sysfs_chmod_file(struct kobject *kobj, 228 - struct attribute *attr, mode_t mode) 228 + const struct attribute *attr, mode_t mode) 229 229 { 230 230 return 0; 231 231 }