diff options
author | Borislav Petkov <bp@alien8.de> | 2012-10-09 13:52:05 -0400 |
---|---|---|
committer | Borislav Petkov <bp@alien8.de> | 2012-10-26 08:37:55 -0400 |
commit | 91872392f08486f692887d2f06a333f512648f22 (patch) | |
tree | 24f82690f04c3282c36bc81d60763687badf33c6 /include/linux/device.h | |
parent | 6f0c0580b70c89094b3422ba81118c7b959c7556 (diff) |
drivers/base: Add a DEVICE_BOOL_ATTR macro
... which, analogous to DEVICE_INT_ATTR provides functionality to
set/clear bools. Its purpose is to be used where values need to be used
as booleans in configuration context.
Next patch uses this.
Signed-off-by: Borislav Petkov <bp@alien8.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 86ef6ab553b1..50c85a26b003 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -496,6 +496,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr, | |||
496 | char *buf); | 496 | char *buf); |
497 | ssize_t device_store_int(struct device *dev, struct device_attribute *attr, | 497 | ssize_t device_store_int(struct device *dev, struct device_attribute *attr, |
498 | const char *buf, size_t count); | 498 | const char *buf, size_t count); |
499 | ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, | ||
500 | char *buf); | ||
501 | ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, | ||
502 | const char *buf, size_t count); | ||
499 | 503 | ||
500 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ | 504 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ |
501 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 505 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
@@ -505,6 +509,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr, | |||
505 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ | 509 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ |
506 | struct dev_ext_attribute dev_attr_##_name = \ | 510 | struct dev_ext_attribute dev_attr_##_name = \ |
507 | { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } | 511 | { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } |
512 | #define DEVICE_BOOL_ATTR(_name, _mode, _var) \ | ||
513 | struct dev_ext_attribute dev_attr_##_name = \ | ||
514 | { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } | ||
508 | #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ | 515 | #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ |
509 | struct device_attribute dev_attr_##_name = \ | 516 | struct device_attribute dev_attr_##_name = \ |
510 | __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) | 517 | __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) |