aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 12:59:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 12:59:59 -0500
commit2d9c8b5d6a5f5f7a6111cc68a050b5b44729376b (patch)
tree9382e643df9d4115637ca320822702bb06130c1f /drivers
parent17bc14b767cf0692420c43dbe5310ae98a5a7836 (diff)
parent003db633d6f2d3649ea18652a3c55ad17d4f0e47 (diff)
Merge branch 'x86-ras-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 RAS update from Ingo Molnar: "Rework all config variables used throughout the MCA code and collect them together into a mca_config struct. This keeps them tightly and neatly packed together instead of spilled all over the place. Then, convert those which are used as booleans into real booleans and save some space. These bits are exposed via /sys/devices/system/machinecheck/machinecheck*/" * 'x86-ras-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, MCA: Finish mca_config conversion x86, MCA: Convert the next three variables batch x86, MCA: Convert rip_msr, mce_bootlog, monarch_timeout x86, MCA: Convert dont_log_ce, banks and tolerant drivers/base: Add a DEVICE_BOOL_ATTR macro
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c21
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}
172EXPORT_SYMBOL_GPL(device_show_int); 172EXPORT_SYMBOL_GPL(device_show_int);
173 173
174ssize_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}
184EXPORT_SYMBOL_GPL(device_store_bool);
185
186ssize_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}
193EXPORT_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.