Date: Thu, 27 Jun 2019 15:07:07 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349459 - head/sys/sys Message-ID: <201906271507.x5RF775Q070616@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Thu Jun 27 15:07:06 2019 New Revision: 349459 URL: https://svnweb.freebsd.org/changeset/base/349459 Log: upgrade the warning printf-s in bus accessors to KASSERT-s After this change sys/bus.h includes sys/systm.h. Discussed with: cem, imp MFC after: 2 weeks Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Jun 27 14:26:57 2019 (r349458) +++ head/sys/sys/bus.h Thu Jun 27 15:07:06 2019 (r349459) @@ -35,6 +35,7 @@ #include <machine/_bus.h> #include <sys/_bus_dma.h> #include <sys/ioccom.h> +#include <sys/systm.h> /** * @defgroup NEWBUS newbus - a generic framework for managing devices @@ -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 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)); \ } /**
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906271507.x5RF775Q070616>