diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/base/class.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r-- | drivers/base/class.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 161746deab4b..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 | ||
@@ -59,9 +59,11 @@ static void class_release(struct kobject *kobj) | |||
59 | else | 59 | else |
60 | pr_debug("class '%s' does not have a release() function, " | 60 | pr_debug("class '%s' does not have a release() function, " |
61 | "be careful\n", class->name); | 61 | "be careful\n", class->name); |
62 | |||
63 | kfree(cp); | ||
62 | } | 64 | } |
63 | 65 | ||
64 | static struct sysfs_ops class_sysfs_ops = { | 66 | static const struct sysfs_ops class_sysfs_ops = { |
65 | .show = class_attr_show, | 67 | .show = class_attr_show, |
66 | .store = class_attr_store, | 68 | .store = class_attr_store, |
67 | }; | 69 | }; |
@@ -217,6 +219,8 @@ static void class_create_release(struct class *cls) | |||
217 | * 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 |
218 | * in calls to device_create(). | 220 | * in calls to device_create(). |
219 | * | 221 | * |
222 | * Returns &struct class pointer on success, or ERR_PTR() on error. | ||
223 | * | ||
220 | * 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 |
221 | * making a call to class_destroy(). | 225 | * making a call to class_destroy(). |
222 | */ | 226 | */ |
@@ -488,6 +492,16 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
488 | class_put(parent); | 492 | class_put(parent); |
489 | } | 493 | } |
490 | 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 | |||
491 | struct class_compat { | 505 | struct class_compat { |
492 | struct kobject *kobj; | 506 | struct kobject *kobj; |
493 | }; | 507 | }; |