From: Jean Delvare <khali@linux-fr.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH] sysfs_chmod_file's attr can be const
Date: Fri, 2 Jul 2010 16:54:05 +0200 [thread overview]
Message-ID: <20100702165405.0a903769@hyperion.delvare> (raw)
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>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/file.c | 3 ++-
include/linux/sysfs.h | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
--- linux-2.6.35-rc3.orig/fs/sysfs/file.c 2010-05-31 09:59:55.000000000 +0200
+++ linux-2.6.35-rc3/fs/sysfs/file.c 2010-07-02 14:09:45.000000000 +0200
@@ -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;
--- linux-2.6.35-rc3.orig/include/linux/sysfs.h 2010-05-31 09:59:56.000000000 +0200
+++ linux-2.6.35-rc3/include/linux/sysfs.h 2010-07-02 16:52:21.000000000 +0200
@@ -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;
}
--
Jean Delvare
reply other threads:[~2010-07-02 14:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100702165405.0a903769@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox