summaryrefslogtreecommitdiff
path: root/patches.tizen/1112-driver-core-device.h-add-RW-and-RO-attribute-macros.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches.tizen/1112-driver-core-device.h-add-RW-and-RO-attribute-macros.patch')
-rw-r--r--patches.tizen/1112-driver-core-device.h-add-RW-and-RO-attribute-macros.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/patches.tizen/1112-driver-core-device.h-add-RW-and-RO-attribute-macros.patch b/patches.tizen/1112-driver-core-device.h-add-RW-and-RO-attribute-macros.patch
new file mode 100644
index 00000000000..2a30ac84024
--- /dev/null
+++ b/patches.tizen/1112-driver-core-device.h-add-RW-and-RO-attribute-macros.patch
@@ -0,0 +1,87 @@
+From 6d19f18a24062c075bec45cc2c5608c46f2632f1 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Sun, 14 Jul 2013 16:05:54 -0700
+Subject: [PATCH 1112/1302] driver core: device.h: add RW and RO attribute
+ macros
+
+Make it easier to create attributes without having to always audit the
+mode settings.
+
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Tested-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+---
+ include/linux/device.h | 28 +++++++++++++++++++++-------
+ 1 file changed, 21 insertions(+), 7 deletions(-)
+
+diff --git a/include/linux/device.h b/include/linux/device.h
+index 1ce409f..9510baf 100644
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -47,7 +47,11 @@ struct bus_attribute {
+ };
+
+ #define BUS_ATTR(_name, _mode, _show, _store) \
+-struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
++ struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
++#define BUS_ATTR_RW(_name) \
++ struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
++#define BUS_ATTR_RO(_name) \
++ struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
+
+ extern int __must_check bus_create_file(struct bus_type *,
+ struct bus_attribute *);
+@@ -255,9 +259,12 @@ struct driver_attribute {
+ size_t count);
+ };
+
+-#define DRIVER_ATTR(_name, _mode, _show, _store) \
+-struct driver_attribute driver_attr_##_name = \
+- __ATTR(_name, _mode, _show, _store)
++#define DRIVER_ATTR(_name, _mode, _show, _store) \
++ struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
++#define DRIVER_ATTR_RW(_name) \
++ struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
++#define DRIVER_ATTR_RO(_name) \
++ struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
+
+ extern int __must_check driver_create_file(struct device_driver *driver,
+ const struct driver_attribute *attr);
+@@ -408,8 +415,12 @@ struct class_attribute {
+ const struct class_attribute *attr);
+ };
+
+-#define CLASS_ATTR(_name, _mode, _show, _store) \
+-struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
++#define CLASS_ATTR(_name, _mode, _show, _store) \
++ struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
++#define CLASS_ATTR_RW(_name) \
++ struct class_attribute class_attr_##_name = __ATTR_RW(_name)
++#define CLASS_ATTR_RO(_name) \
++ struct class_attribute class_attr_##_name = __ATTR_RO(_name)
+
+ extern int __must_check class_create_file(struct class *class,
+ const struct class_attribute *attr);
+@@ -417,7 +428,6 @@ extern void class_remove_file(struct class *class,
+ const struct class_attribute *attr);
+
+ /* Simple class attribute that is just a static string */
+-
+ struct class_attribute_string {
+ struct class_attribute attr;
+ char *str;
+@@ -506,6 +516,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.2
+