summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-27 11:57:24 +0100
committerTakashi Iwai <tiwai@suse.de>2014-02-27 11:57:24 +0100
commitb2e34e1ea7640f0be1774a14688d918a6a815134 (patch)
treee61857372c1766af1168022a6ccfab31b076b090
parent11c3b4fd24bb68e8382de983bd28d416e363c67e (diff)
downloadalsa-driver-build-unstable-b2e34e1ea7640f0be1774a14688d918a6a815134.tar.gz
Add __ATTR_RO(), DEVICE_ATTR_RO(), and co for much older kernels
We need almost complete definitions in adriver.h for older kernels. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--alsa/include/adriver.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/alsa/include/adriver.h b/alsa/include/adriver.h
index ab96510e7..a0a1f6cc9 100644
--- a/alsa/include/adriver.h
+++ b/alsa/include/adriver.h
@@ -1802,6 +1802,23 @@ static inline int sysfs_create_groups(struct kobject *kobj,
return 0;
}
+#ifndef __ATTR
+#define __ATTR(_name, _mode, _show, _store) { \
+ .attr = {.name = __stringify(_name), .mode = _mode }, \
+ .show = _show, \
+ .store = _store, \
+}
+#endif
+#ifndef __ATTR_RW
+#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
+ _name##_show, _name##_store)
+#endif
+#ifndef __ATTR_RO
+#define __ATTR_RO(_name) { \
+ .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
+ .show = _name##_show, \
+}
+#endif
#ifndef __ATTR_WO
#define __ATTR_WO(_name) { \
.attr = { .name = __stringify(_name), .mode = S_IWUSR }, \
@@ -1809,10 +1826,19 @@ static inline int sysfs_create_groups(struct kobject *kobj,
}
#endif
+#ifndef DEVICE_ATTR_RW
+#define DEVICE_ATTR_RW(_name) \
+ struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
+#endif
+#ifndef DEVICE_ATTR_RO
+#define DEVICE_ATTR_RO(_name) \
+ struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
+#endif
#ifndef DEVICE_ATTR_WO
#define DEVICE_ATTR_WO(_name) \
struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
#endif
+
#endif /* < 3.12 */
#endif /* __SOUND_LOCAL_DRIVER_H */