[PATCH 13/28] sysfs: sysfs_chmod_file's attr can be const

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg Kroah-Hartman
Date: Thursday, August 5, 2010 - 3:24 pm

From: Jean Delvare <khali@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@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] driver core patches for .36, Greg KH, (Thu Aug 5, 2:33 pm)
[PATCH 01/28] uio: Remove IRQF_DISABLED flag from uio_pdrv ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 02/28] uio: Remove IRQF_DISABLED from uio_sercos3.c, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 03/28] uio: Remove IRQF_DISABLED flag from uio_cif.c, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 04/28] hotplug: Support kernel/hotplug sysctl varia ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 05/28] Driver core: internal struct dma_coherent_me ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 06/28] Driver core: Drop __must_check from bus_for_ ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 07/28] firmware loader: use statically initialized ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 08/28] firmware loader: embed device into firmware_ ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 09/28] Driver core: use kmemdup in platform_device_ ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 10/28] Driver core: reduce duplicated code for plat ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 11/28] Driver core: move platform device creation h ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 12/28] firmware: Update hotplug script, Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 13/28] sysfs: sysfs_chmod_file's attr can be const, Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 14/28] dmi-id: fix a memory leak in dmi_id_init err ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 15/28] dcdbas: remove a redundant smi_data_buf_free ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 16/28] sysfs: fix discrepancies between implementat ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 17/28] sysfs: Fix one more signature discrepancy be ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 18/28] debugfs: no longer needs to depend on SYSFS, Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 19/28] driver core: fix memory leak on one error pa ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 20/28] Driver core: Add BUS_NOTIFY_BIND_DRIVER, Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 21/28] cgroupfs: create /sys/fs/cgroup to mount cgr ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 22/28] scsi: Remove owner field from attribute init ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 23/28] scsi: Remove owner field from attribute init ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 24/28] leds: Remove owner field from attribute init ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 25/28] regulator: Remove owner field from attribute ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 26/28] powerpc/pci: Remove owner field from attribu ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 27/28] sysfs: Remove owner field from sysfs struct ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)
[PATCH 28/28] driver core: device_rename's new_name can be ..., Greg Kroah-Hartman, (Thu Aug 5, 3:24 pm)