Commit 66ecb92b authored by Phil Carmody's avatar Phil Carmody Committed by Greg Kroah-Hartman

Driver core: bin_attribute parameters can often be const*

Many struct bin_attribute descriptors are purely read-only
structures, and there's no need to change them. Therefore
make the promise not to, which will let those descriptors
be put in a ro section.
Signed-off-by: default avatarPhil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 26579ab7
...@@ -472,7 +472,8 @@ void device_remove_file(struct device *dev, ...@@ -472,7 +472,8 @@ void device_remove_file(struct device *dev,
* @dev: device. * @dev: device.
* @attr: device binary attribute descriptor. * @attr: device binary attribute descriptor.
*/ */
int device_create_bin_file(struct device *dev, struct bin_attribute *attr) int device_create_bin_file(struct device *dev,
const struct bin_attribute *attr)
{ {
int error = -EINVAL; int error = -EINVAL;
if (dev) if (dev)
...@@ -486,7 +487,8 @@ EXPORT_SYMBOL_GPL(device_create_bin_file); ...@@ -486,7 +487,8 @@ EXPORT_SYMBOL_GPL(device_create_bin_file);
* @dev: device. * @dev: device.
* @attr: device binary attribute descriptor. * @attr: device binary attribute descriptor.
*/ */
void device_remove_bin_file(struct device *dev, struct bin_attribute *attr) void device_remove_bin_file(struct device *dev,
const struct bin_attribute *attr)
{ {
if (dev) if (dev)
sysfs_remove_bin_file(&dev->kobj, attr); sysfs_remove_bin_file(&dev->kobj, attr);
......
...@@ -483,7 +483,8 @@ void unmap_bin_file(struct sysfs_dirent *attr_sd) ...@@ -483,7 +483,8 @@ void unmap_bin_file(struct sysfs_dirent *attr_sd)
* @attr: attribute descriptor. * @attr: attribute descriptor.
*/ */
int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) int sysfs_create_bin_file(struct kobject *kobj,
const struct bin_attribute *attr)
{ {
BUG_ON(!kobj || !kobj->sd || !attr); BUG_ON(!kobj || !kobj->sd || !attr);
...@@ -497,7 +498,8 @@ int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) ...@@ -497,7 +498,8 @@ int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
* @attr: attribute descriptor. * @attr: attribute descriptor.
*/ */
void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr) void sysfs_remove_bin_file(struct kobject *kobj,
const struct bin_attribute *attr)
{ {
sysfs_hash_and_remove(kobj->sd, attr->attr.name); sysfs_hash_and_remove(kobj->sd, attr->attr.name);
} }
......
...@@ -323,9 +323,9 @@ extern int __must_check device_create_file(struct device *device, ...@@ -323,9 +323,9 @@ extern int __must_check device_create_file(struct device *device,
extern void device_remove_file(struct device *dev, extern void device_remove_file(struct device *dev,
const struct device_attribute *attr); const struct device_attribute *attr);
extern int __must_check device_create_bin_file(struct device *dev, extern int __must_check device_create_bin_file(struct device *dev,
struct bin_attribute *attr); const struct bin_attribute *attr);
extern void device_remove_bin_file(struct device *dev, extern void device_remove_bin_file(struct device *dev,
struct bin_attribute *attr); const struct bin_attribute *attr);
extern int device_schedule_callback_owner(struct device *dev, extern int device_schedule_callback_owner(struct device *dev,
void (*func)(struct device *dev), struct module *owner); void (*func)(struct device *dev), struct module *owner);
......
...@@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, ...@@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
int __must_check sysfs_create_bin_file(struct kobject *kobj, int __must_check sysfs_create_bin_file(struct kobject *kobj,
struct bin_attribute *attr); const struct bin_attribute *attr);
void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); void sysfs_remove_bin_file(struct kobject *kobj,
const struct bin_attribute *attr);
int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
const char *name); const char *name);
...@@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj, ...@@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj,
} }
static inline int sysfs_create_bin_file(struct kobject *kobj, static inline int sysfs_create_bin_file(struct kobject *kobj,
struct bin_attribute *attr) const struct bin_attribute *attr)
{ {
return 0; return 0;
} }
static inline void sysfs_remove_bin_file(struct kobject *kobj, static inline void sysfs_remove_bin_file(struct kobject *kobj,
struct bin_attribute *attr) const struct bin_attribute *attr)
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment