From 49c19400f60bbe362202d7e7b3e68cc66040d0fa Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 2 Jul 2010 16:54:05 +0200 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/file.c | 3 ++- include/linux/sysfs.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 1beaa739d0a..1b27b5688f6 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -593,7 +593,8 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_group); * @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; diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index f2694eb4dd3..8bf06b64487 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -136,8 +136,8 @@ int __must_check sysfs_create_file(struct kobject *kobj, 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(struct kobject *kobj, } static inline int sysfs_chmod_file(struct kobject *kobj, - struct attribute *attr, mode_t mode) + const struct attribute *attr, mode_t mode) { return 0; } -- 2.20.1