mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 00:38:39 +08:00
freebsd/bus: Check return value of bus_accessor.
This commit is contained in:

committed by
Sebastian Huber

parent
ec29b2a0c2
commit
e7f3260886
@@ -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
|
||||
|
Reference in New Issue
Block a user