diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 417913974df8..a235085e343c 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -171,6 +171,27 @@ ssize_t device_show_int(struct device *dev, | |||
171 | } | 171 | } |
172 | EXPORT_SYMBOL_GPL(device_show_int); | 172 | EXPORT_SYMBOL_GPL(device_show_int); |
173 | 173 | ||
174 | ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, | ||
175 | const char *buf, size_t size) | ||
176 | { | ||
177 | struct dev_ext_attribute *ea = to_ext_attr(attr); | ||
178 | |||
179 | if (strtobool(buf, ea->var) < 0) | ||
180 | return -EINVAL; | ||
181 | |||
182 | return size; | ||
183 | } | ||
184 | EXPORT_SYMBOL_GPL(device_store_bool); | ||
185 | |||
186 | ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, | ||
187 | char *buf) | ||
188 | { | ||
189 | struct dev_ext_attribute *ea = to_ext_attr(attr); | ||
190 | |||
191 | return snprintf(buf, PAGE_SIZE, "%d\n", *(bool *)(ea->var)); | ||
192 | } | ||
193 | EXPORT_SYMBOL_GPL(device_show_bool); | ||
194 | |||
174 | /** | 195 | /** |
175 | * device_release - free device structure. | 196 | * device_release - free device structure. |
176 | * @kobj: device's kobject. | 197 | * @kobj: device's kobject. |