diff options
author | Jani Nikula <jani.nikula@intel.com> | 2018-10-04 10:37:49 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2018-12-03 11:18:19 -0500 |
commit | 9ee4685c9ac591b71af755657c3f6ce428ebcca4 (patch) | |
tree | 7e3067560c6c747811c47bb123af964fca8b2dde | |
parent | 46592892e1a60f9e9de3287719143a148fce93cf (diff) |
sysfs: constify sysfs create/remove files harder
Let the passed in array be const (and thus placed in rodata) instead of
a mutable array of const pointers.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181004143750.30880-1-jani.nikula@intel.com
-rw-r--r-- | fs/sysfs/file.c | 4 | ||||
-rw-r--r-- | include/linux/sysfs.h | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 0a7252aecfa5..bb71db63c99c 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -334,7 +334,7 @@ int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr, | |||
334 | } | 334 | } |
335 | EXPORT_SYMBOL_GPL(sysfs_create_file_ns); | 335 | EXPORT_SYMBOL_GPL(sysfs_create_file_ns); |
336 | 336 | ||
337 | int sysfs_create_files(struct kobject *kobj, const struct attribute **ptr) | 337 | int sysfs_create_files(struct kobject *kobj, const struct attribute * const *ptr) |
338 | { | 338 | { |
339 | int err = 0; | 339 | int err = 0; |
340 | int i; | 340 | int i; |
@@ -493,7 +493,7 @@ bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr) | |||
493 | return ret; | 493 | return ret; |
494 | } | 494 | } |
495 | 495 | ||
496 | void sysfs_remove_files(struct kobject *kobj, const struct attribute **ptr) | 496 | void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *ptr) |
497 | { | 497 | { |
498 | int i; | 498 | int i; |
499 | for (i = 0; ptr[i]; i++) | 499 | for (i = 0; ptr[i]; i++) |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 987cefa337de..786816cf4aa5 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -234,7 +234,7 @@ int __must_check sysfs_create_file_ns(struct kobject *kobj, | |||
234 | const struct attribute *attr, | 234 | const struct attribute *attr, |
235 | const void *ns); | 235 | const void *ns); |
236 | int __must_check sysfs_create_files(struct kobject *kobj, | 236 | int __must_check sysfs_create_files(struct kobject *kobj, |
237 | const struct attribute **attr); | 237 | const struct attribute * const *attr); |
238 | int __must_check sysfs_chmod_file(struct kobject *kobj, | 238 | int __must_check sysfs_chmod_file(struct kobject *kobj, |
239 | const struct attribute *attr, umode_t mode); | 239 | const struct attribute *attr, umode_t mode); |
240 | struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj, | 240 | struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj, |
@@ -243,7 +243,7 @@ void sysfs_unbreak_active_protection(struct kernfs_node *kn); | |||
243 | void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, | 243 | void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, |
244 | const void *ns); | 244 | const void *ns); |
245 | bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); | 245 | bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); |
246 | void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); | 246 | void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attr); |
247 | 247 | ||
248 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 248 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
249 | const struct bin_attribute *attr); | 249 | const struct bin_attribute *attr); |
@@ -342,7 +342,7 @@ static inline int sysfs_create_file_ns(struct kobject *kobj, | |||
342 | } | 342 | } |
343 | 343 | ||
344 | static inline int sysfs_create_files(struct kobject *kobj, | 344 | static inline int sysfs_create_files(struct kobject *kobj, |
345 | const struct attribute **attr) | 345 | const struct attribute * const *attr) |
346 | { | 346 | { |
347 | return 0; | 347 | return 0; |
348 | } | 348 | } |
@@ -377,7 +377,7 @@ static inline bool sysfs_remove_file_self(struct kobject *kobj, | |||
377 | } | 377 | } |
378 | 378 | ||
379 | static inline void sysfs_remove_files(struct kobject *kobj, | 379 | static inline void sysfs_remove_files(struct kobject *kobj, |
380 | const struct attribute **attr) | 380 | const struct attribute * const *attr) |
381 | { | 381 | { |
382 | } | 382 | } |
383 | 383 | ||