Skip to content

Commit

Permalink
sysfs: sysfs_chmod_file's attr can be const
Browse files Browse the repository at this point in the history
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]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Jean Delvare authored and gregkh committed Aug 5, 2010
1 parent 3317fad commit 49c1940
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion fs/sysfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions include/linux/sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 49c1940

Please sign in to comment.