diff options
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r-- | drivers/base/class.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 6e2c3b064f53..9c6a0d6408e7 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -31,7 +31,7 @@ static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr, | |||
31 | ssize_t ret = -EIO; | 31 | ssize_t ret = -EIO; |
32 | 32 | ||
33 | if (class_attr->show) | 33 | if (class_attr->show) |
34 | ret = class_attr->show(cp->class, buf); | 34 | ret = class_attr->show(cp->class, class_attr, buf); |
35 | return ret; | 35 | return ret; |
36 | } | 36 | } |
37 | 37 | ||
@@ -43,7 +43,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
43 | ssize_t ret = -EIO; | 43 | ssize_t ret = -EIO; |
44 | 44 | ||
45 | if (class_attr->store) | 45 | if (class_attr->store) |
46 | ret = class_attr->store(cp->class, buf, count); | 46 | ret = class_attr->store(cp->class, class_attr, buf, count); |
47 | return ret; | 47 | return ret; |
48 | } | 48 | } |
49 | 49 | ||
@@ -63,7 +63,7 @@ static void class_release(struct kobject *kobj) | |||
63 | kfree(cp); | 63 | kfree(cp); |
64 | } | 64 | } |
65 | 65 | ||
66 | static struct sysfs_ops class_sysfs_ops = { | 66 | static const struct sysfs_ops class_sysfs_ops = { |
67 | .show = class_attr_show, | 67 | .show = class_attr_show, |
68 | .store = class_attr_store, | 68 | .store = class_attr_store, |
69 | }; | 69 | }; |
@@ -219,6 +219,8 @@ static void class_create_release(struct class *cls) | |||
219 | * This is used to create a struct class pointer that can then be used | 219 | * This is used to create a struct class pointer that can then be used |
220 | * in calls to device_create(). | 220 | * in calls to device_create(). |
221 | * | 221 | * |
222 | * Returns &struct class pointer on success, or ERR_PTR() on error. | ||
223 | * | ||
222 | * Note, the pointer created here is to be destroyed when finished by | 224 | * Note, the pointer created here is to be destroyed when finished by |
223 | * making a call to class_destroy(). | 225 | * making a call to class_destroy(). |
224 | */ | 226 | */ |
@@ -490,6 +492,16 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
490 | class_put(parent); | 492 | class_put(parent); |
491 | } | 493 | } |
492 | 494 | ||
495 | ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, | ||
496 | char *buf) | ||
497 | { | ||
498 | struct class_attribute_string *cs; | ||
499 | cs = container_of(attr, struct class_attribute_string, attr); | ||
500 | return snprintf(buf, PAGE_SIZE, "%s\n", cs->str); | ||
501 | } | ||
502 | |||
503 | EXPORT_SYMBOL_GPL(show_class_attr_string); | ||
504 | |||
493 | struct class_compat { | 505 | struct class_compat { |
494 | struct kobject *kobj; | 506 | struct kobject *kobj; |
495 | }; | 507 | }; |