Prev: [PATCH 06/67] max3110 sanity check a register
Next: [PATCH 06/28] Driver core: Drop __must_check from bus_for_each_drv()
From: Greg Kroah-Hartman on 5 Aug 2010 18:30 From: Jean Delvare <khali(a)linux-fr.org> sysfs_chmod_file doesn't change the attribute it operates on, so this attribute can be marked const. Signed-off-by: Jean Delvare <khali(a)linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh(a)suse.de> --- 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 1beaa73..1b27b56 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 f2694eb..8bf06b6 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; } -- 1.7.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |