[PATCH 3/4] freebsd/bus: Check return value of bus_accessor.
Christian Mauderer
christian.mauderer at embedded-brains.de
Wed Nov 8 12:36:59 UTC 2017
From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>
---
freebsd/sys/sys/bus.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/freebsd/sys/sys/bus.h b/freebsd/sys/sys/bus.h
index 61cb5b9cabf..e882823d402 100644
--- a/freebsd/sys/sys/bus.h
+++ b/freebsd/sys/sys/bus.h
@@ -781,6 +781,7 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \
/**
* Generic ivar accessor generation macros for bus drivers
*/
+#ifndef __rtems__
#define __BUS_ACCESSOR(varp, var, ivarp, ivar, type) \
\
static __inline type varp ## _get_ ## var(device_t dev) \
@@ -797,6 +798,28 @@ static __inline void varp ## _set_ ## var(device_t dev, type t) \
BUS_WRITE_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, v); \
}
+#else /* __rtems__ */
+#define __BUS_ACCESSOR(varp, var, ivarp, ivar, type) \
+ \
+static __inline type varp ## _get_ ## var(device_t dev) \
+{ \
+ uintptr_t v; \
+ int err; \
+ err = BUS_READ_IVAR(device_get_parent(dev), dev, \
+ ivarp ## _IVAR_ ## ivar, &v); \
+ BSD_ASSERT(err == 0); \
+ return ((type) v); \
+} \
+ \
+static __inline void varp ## _set_ ## var(device_t dev, type t) \
+{ \
+ uintptr_t v = (uintptr_t) t; \
+ int err; \
+ BUS_WRITE_IVAR(device_get_parent(dev), dev, \
+ ivarp ## _IVAR_ ## ivar, v); \
+ BSD_ASSERT(err == 0); \
+}
+#endif /* __rtems__ */
/**
* Shorthand macros, taking resource argument
--
2.12.3
More information about the devel
mailing list