aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/bus.h
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-07-01 06:22:41 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-07-01 06:22:41 +0000
commit3e7bae08210e094df725c4b86c412c9e44b04e22 (patch)
tree5cd851b40a2f37e3c2d071a3e6c8bb3929c6bdca /sys/sys/bus.h
parent23cfb1b256e56849a0685f7a1dbd901f4998a91d (diff)
downloadsrc-3e7bae08210e094df725c4b86c412c9e44b04e22.tar.gz
src-3e7bae08210e094df725c4b86c412c9e44b04e22.zip
upgrade the warning printf-s in bus accessors to KASSERT-s, take 2
After this change sys/bus.h includes sys/systm.h when _KERNEL is defined. This brings back r349459 but with systm.h hidden from userland. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=349571
Diffstat (limited to 'sys/sys/bus.h')
-rw-r--r--sys/sys/bus.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 9fb4a6d4c38e..f9c38e48fa64 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -152,6 +152,7 @@ struct devreq {
#include <sys/_eventhandler.h>
#include <sys/kobj.h>
+#include <sys/systm.h>
/**
* devctl hooks. Typically one should use the devctl_notify
@@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t 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); \
- } \
+ KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \
+ __func__, device_get_nameunit(dev), \
+ device_get_nameunit(device_get_parent(dev)), e)); \
return ((type) v); \
} \
\
@@ -828,12 +826,9 @@ static __inline void varp ## _set_ ## var(device_t dev, type t) \
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); \
- } \
+ KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \
+ __func__, device_get_nameunit(dev), \
+ device_get_nameunit(device_get_parent(dev)), e)); \
}
/**