diff options
author | Phil Carmody <ext-phil.2.carmody@nokia.com> | 2009-12-18 08:34:20 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-23 14:23:43 -0500 |
commit | 66ecb92be9eb579df93add22d19843e7869f168e (patch) | |
tree | 60a8c4ecfd1ccb0743a137ecfbd972888dbd34ce | |
parent | 26579ab70aa0e0ea434e6e100279d2f67c094431 (diff) |
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: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/base/core.c | 6 | ||||
-rw-r--r-- | fs/sysfs/bin.c | 6 | ||||
-rw-r--r-- | include/linux/device.h | 6 | ||||
-rw-r--r-- | include/linux/sysfs.h | 9 |
4 files changed, 16 insertions, 11 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 2fd9e611f8a6..83afc8b8f27b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -472,7 +472,8 @@ void device_remove_file(struct device *dev, | |||
472 | * @dev: device. | 472 | * @dev: device. |
473 | * @attr: device binary attribute descriptor. | 473 | * @attr: device binary attribute descriptor. |
474 | */ | 474 | */ |
475 | int device_create_bin_file(struct device *dev, struct bin_attribute *attr) | 475 | int device_create_bin_file(struct device *dev, |
476 | const struct bin_attribute *attr) | ||
476 | { | 477 | { |
477 | int error = -EINVAL; | 478 | int error = -EINVAL; |
478 | if (dev) | 479 | if (dev) |
@@ -486,7 +487,8 @@ EXPORT_SYMBOL_GPL(device_create_bin_file); | |||
486 | * @dev: device. | 487 | * @dev: device. |
487 | * @attr: device binary attribute descriptor. | 488 | * @attr: device binary attribute descriptor. |
488 | */ | 489 | */ |
489 | void device_remove_bin_file(struct device *dev, struct bin_attribute *attr) | 490 | void device_remove_bin_file(struct device *dev, |
491 | const struct bin_attribute *attr) | ||
490 | { | 492 | { |
491 | if (dev) | 493 | if (dev) |
492 | sysfs_remove_bin_file(&dev->kobj, attr); | 494 | sysfs_remove_bin_file(&dev->kobj, attr); |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 60c702bc10ae..a0a500af24a1 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -483,7 +483,8 @@ void unmap_bin_file(struct sysfs_dirent *attr_sd) | |||
483 | * @attr: attribute descriptor. | 483 | * @attr: attribute descriptor. |
484 | */ | 484 | */ |
485 | 485 | ||
486 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) | 486 | int sysfs_create_bin_file(struct kobject *kobj, |
487 | const struct bin_attribute *attr) | ||
487 | { | 488 | { |
488 | BUG_ON(!kobj || !kobj->sd || !attr); | 489 | BUG_ON(!kobj || !kobj->sd || !attr); |
489 | 490 | ||
@@ -497,7 +498,8 @@ int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) | |||
497 | * @attr: attribute descriptor. | 498 | * @attr: attribute descriptor. |
498 | */ | 499 | */ |
499 | 500 | ||
500 | void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr) | 501 | void sysfs_remove_bin_file(struct kobject *kobj, |
502 | const struct bin_attribute *attr) | ||
501 | { | 503 | { |
502 | sysfs_hash_and_remove(kobj->sd, attr->attr.name); | 504 | sysfs_hash_and_remove(kobj->sd, attr->attr.name); |
503 | } | 505 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index aa5b3e66a147..10d74ce93a46 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -319,13 +319,13 @@ struct device_attribute { | |||
319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
320 | 320 | ||
321 | extern int __must_check device_create_file(struct device *device, | 321 | extern int __must_check device_create_file(struct device *device, |
322 | const struct device_attribute *entry); | 322 | const struct device_attribute *entry); |
323 | extern void device_remove_file(struct device *dev, | 323 | extern void device_remove_file(struct device *dev, |
324 | const struct device_attribute *attr); | 324 | const struct device_attribute *attr); |
325 | extern int __must_check device_create_bin_file(struct device *dev, | 325 | extern int __must_check device_create_bin_file(struct device *dev, |
326 | struct bin_attribute *attr); | 326 | const struct bin_attribute *attr); |
327 | extern void device_remove_bin_file(struct device *dev, | 327 | extern void device_remove_bin_file(struct device *dev, |
328 | struct bin_attribute *attr); | 328 | const struct bin_attribute *attr); |
329 | extern int device_schedule_callback_owner(struct device *dev, | 329 | extern int device_schedule_callback_owner(struct device *dev, |
330 | void (*func)(struct device *dev), struct module *owner); | 330 | void (*func)(struct device *dev), struct module *owner); |
331 | 331 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9d68fed50f11..cfa83083a2d4 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | |||
99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
100 | 100 | ||
101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
102 | struct bin_attribute *attr); | 102 | const struct bin_attribute *attr); |
103 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 103 | void sysfs_remove_bin_file(struct kobject *kobj, |
104 | const struct bin_attribute *attr); | ||
104 | 105 | ||
105 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 106 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
106 | const char *name); | 107 | const char *name); |
@@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj, | |||
175 | } | 176 | } |
176 | 177 | ||
177 | static inline int sysfs_create_bin_file(struct kobject *kobj, | 178 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
178 | struct bin_attribute *attr) | 179 | const struct bin_attribute *attr) |
179 | { | 180 | { |
180 | return 0; | 181 | return 0; |
181 | } | 182 | } |
182 | 183 | ||
183 | static inline void sysfs_remove_bin_file(struct kobject *kobj, | 184 | static inline void sysfs_remove_bin_file(struct kobject *kobj, |
184 | struct bin_attribute *attr) | 185 | const struct bin_attribute *attr) |
185 | { | 186 | { |
186 | } | 187 | } |
187 | 188 | ||