Skip to contentSkip to conversation

sysfs: Make dir and name args to sysfs_notify() const

PATCH New Trent Piepho 1 participant 1 message Sep 25, 2008 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysfs: Make dir and name args to sysfs_notify() const

Because they can be, and because code like this produces a warning if they're not:

struct device_attribute dev_attr;

sysfs_notify(&kobj, NULL, dev_attr.attr.name);

---
 fs/sysfs/file.c       |    2 +-
 include/linux/sysfs.h |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
fs/sysfs/file.c +1 -1
index c9e4e50..cabfd0f 100644
@@ -440,7 +440,7 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
 	return POLLERR|POLLPRI;
 }
 
-void sysfs_notify(struct kobject *k, char *dir, char *attr)
+void sysfs_notify(struct kobject *k, const char *dir, const char *attr)
 {
 	struct sysfs_dirent *sd = k->sd;
 
include/linux/sysfs.h +3 -2
index 37fa241..94e835f 100644
@@ -117,7 +117,7 @@ int sysfs_add_file_to_group(struct kobject *kobj,
 void sysfs_remove_file_from_group(struct kobject *kobj,
 			const struct attribute *attr, const char *group);
 
-void sysfs_notify(struct kobject *kobj, char *dir, char *attr);
+void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
 
 extern int __must_check sysfs_init(void);
 
@@ -222,7 +222,8 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj,
 {
 }
 
-static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr)
+static inline void sysfs_notify(struct kobject *kobj, const char *dir,
+				const char *attr)
 {
 }
 
Signature · 1 line
1.5.4.1