aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/bus.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/sys/bus.h')
-rw-r--r--sys/sys/bus.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 76ac60498205..9fb4a6d4c38e 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -810,16 +810,30 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \
static __inline type varp ## _get_ ## var(device_t dev) \
{ \
uintptr_t v; \
- BUS_READ_IVAR(device_get_parent(dev), dev, \
+ int e; \
+ e = BUS_READ_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, &v); \
+ if (e != 0) { \
+ device_printf(dev, "failed to read ivar " \
+ __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
+ "error = %d\n", \
+ device_get_nameunit(device_get_parent(dev)), e); \
+ } \
return ((type) v); \
} \
\
static __inline void varp ## _set_ ## var(device_t dev, type t) \
{ \
uintptr_t v = (uintptr_t) t; \
- BUS_WRITE_IVAR(device_get_parent(dev), dev, \
+ int e; \
+ e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, v); \
+ if (e != 0) { \
+ device_printf(dev, "failed to write ivar " \
+ __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
+ "error = %d\n", \
+ device_get_nameunit(device_get_parent(dev)), e); \
+ } \
}
/**