sysfs_chmod_file's attr can be const
PATCH 1/1 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 <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
--- fs/sysfs/file.c | 3 ++- include/linux/sysfs.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-)
fs/sysfs/file.c +2 -1
@@ -593,7 +593,8 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_grou* @mode: file permissions. * */ -int sysfs_chmod_file (struct kobject *kobj,struct attribute *attr,mode_t mode) +int sysfs_chmod_file (struct kobject *kobj,const struct attribute *attr, +mode_t mode) {struct sysfs_dirent *sd;struct iattr newattrs;
include/linux/sysfs.h +3 -3
@@ -136,8 +136,8 @@ int __must_check sysfs_create_file(struc const struct attribute *attr);int __must_check sysfs_create_files (struct kobject *kobj,const struct attribute **attr); -int __must_check sysfs_chmod_file (struct kobject *kobj,struct attribute *attr, -mode_t mode); +int __must_check sysfs_chmod_file (struct kobject *kobj, +const struct attribute *attr,mode_t mode);void sysfs_remove_file (struct kobject *kobj,const struct attribute *attr);void sysfs_remove_files (struct kobject *kobj,const struct attribute **attr);
@@ -225,7 +225,7 @@ static inline int sysfs_create_files(str }static inline int sysfs_chmod_file (struct kobject *kobj, -struct attribute *attr,mode_t mode) +const struct attribute *attr,mode_t mode) {return 0 ; }
Signature · 1 line
Jean Delvare