[PATCH 4/6] driver core: add DEVICE_ATTR_RW and DEVICE_ATTR_RO macros

From: Greg Kroah-Hartman
Date: Wed Jul 10 2013 - 16:06:48 EST


Make it easier to create attributes without having to always audit the
mode settings.

Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
include/linux/device.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index bcf8c0d..1d546a0 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -512,6 +512,10 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,

#define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+#define DEVICE_ATTR_RW(_name) \
+ struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
+#define DEVICE_ATTR_RO(_name) \
+ struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
struct dev_ext_attribute dev_attr_##_name = \
{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
--
1.8.3.rc0.20.gb99dd2e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/