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
This commit is contained in:
@@ -334,7 +334,7 @@ int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(sysfs_create_file_ns);
|
EXPORT_SYMBOL_GPL(sysfs_create_file_ns);
|
||||||
|
|
||||||
int sysfs_create_files(struct kobject *kobj, const struct attribute **ptr)
|
int sysfs_create_files(struct kobject *kobj, const struct attribute * const *ptr)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -493,7 +493,7 @@ bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sysfs_remove_files(struct kobject *kobj, const struct attribute **ptr)
|
void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *ptr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; ptr[i]; i++)
|
for (i = 0; ptr[i]; i++)
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ int __must_check sysfs_create_file_ns(struct kobject *kobj,
|
|||||||
const struct attribute *attr,
|
const struct attribute *attr,
|
||||||
const void *ns);
|
const void *ns);
|
||||||
int __must_check sysfs_create_files(struct kobject *kobj,
|
int __must_check sysfs_create_files(struct kobject *kobj,
|
||||||
const struct attribute **attr);
|
const struct attribute * const *attr);
|
||||||
int __must_check sysfs_chmod_file(struct kobject *kobj,
|
int __must_check sysfs_chmod_file(struct kobject *kobj,
|
||||||
const struct attribute *attr, umode_t mode);
|
const struct attribute *attr, umode_t mode);
|
||||||
struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
|
struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
|
||||||
@@ -243,7 +243,7 @@ void sysfs_unbreak_active_protection(struct kernfs_node *kn);
|
|||||||
void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
|
void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
|
||||||
const void *ns);
|
const void *ns);
|
||||||
bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
|
bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
|
||||||
void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
|
void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attr);
|
||||||
|
|
||||||
int __must_check sysfs_create_bin_file(struct kobject *kobj,
|
int __must_check sysfs_create_bin_file(struct kobject *kobj,
|
||||||
const struct bin_attribute *attr);
|
const struct bin_attribute *attr);
|
||||||
@@ -342,7 +342,7 @@ static inline int sysfs_create_file_ns(struct kobject *kobj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int sysfs_create_files(struct kobject *kobj,
|
static inline int sysfs_create_files(struct kobject *kobj,
|
||||||
const struct attribute **attr)
|
const struct attribute * const *attr)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -377,7 +377,7 @@ static inline bool sysfs_remove_file_self(struct kobject *kobj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void sysfs_remove_files(struct kobject *kobj,
|
static inline void sysfs_remove_files(struct kobject *kobj,
|
||||||
const struct attribute **attr)
|
const struct attribute * const *attr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user