diff options
author | mux <mux@FreeBSD.org> | 2002-08-20 13:50:17 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-08-20 13:50:17 +0000 |
commit | 2373503eaf44103e42274ecc8f3859ff11dbff49 (patch) | |
tree | 9abd1e5532534b8a8e07a4578e959f064072bc73 | |
parent | 4c934d6757f554929a29beba924356eb964c1329 (diff) | |
download | FreeBSD-src-2373503eaf44103e42274ecc8f3859ff11dbff49.zip FreeBSD-src-2373503eaf44103e42274ecc8f3859ff11dbff49.tar.gz |
Use the __BUS_ACCESSOR macro for NEXUS_ACCESSOR
instead of rolling our own implementation.
Reviewed by: tmm
-rw-r--r-- | sys/amd64/include/legacyvar.h | 16 | ||||
-rw-r--r-- | sys/i386/include/legacyvar.h | 16 | ||||
-rw-r--r-- | sys/i386/include/nexusvar.h | 16 |
3 files changed, 6 insertions, 42 deletions
diff --git a/sys/amd64/include/legacyvar.h b/sys/amd64/include/legacyvar.h index c9dcf1c..be38f33 100644 --- a/sys/amd64/include/legacyvar.h +++ b/sys/amd64/include/legacyvar.h @@ -33,20 +33,8 @@ enum nexus_device_ivars { NEXUS_IVAR_PCIBUS }; -#define NEXUS_ACCESSOR(A, B, T) \ - \ -static __inline T nexus_get_ ## A(device_t dev) \ -{ \ - uintptr_t v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, NEXUS_IVAR_ ## B, &v); \ - return (T) v; \ -} \ - \ -static __inline void nexus_set_ ## A(device_t dev, T t) \ -{ \ - uintptr_t v = (uintptr_t) t; \ - BUS_WRITE_IVAR(device_get_parent(dev), dev, NEXUS_IVAR_ ## B, v); \ -} +#define NEXUS_ACCESSOR(var, ivar, type) \ + __BUS_ACCESSOR(nexus, var, NEXUS, ivar, type) NEXUS_ACCESSOR(pcibus, PCIBUS, u_int32_t) diff --git a/sys/i386/include/legacyvar.h b/sys/i386/include/legacyvar.h index c9dcf1c..be38f33 100644 --- a/sys/i386/include/legacyvar.h +++ b/sys/i386/include/legacyvar.h @@ -33,20 +33,8 @@ enum nexus_device_ivars { NEXUS_IVAR_PCIBUS }; -#define NEXUS_ACCESSOR(A, B, T) \ - \ -static __inline T nexus_get_ ## A(device_t dev) \ -{ \ - uintptr_t v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, NEXUS_IVAR_ ## B, &v); \ - return (T) v; \ -} \ - \ -static __inline void nexus_set_ ## A(device_t dev, T t) \ -{ \ - uintptr_t v = (uintptr_t) t; \ - BUS_WRITE_IVAR(device_get_parent(dev), dev, NEXUS_IVAR_ ## B, v); \ -} +#define NEXUS_ACCESSOR(var, ivar, type) \ + __BUS_ACCESSOR(nexus, var, NEXUS, ivar, type) NEXUS_ACCESSOR(pcibus, PCIBUS, u_int32_t) diff --git a/sys/i386/include/nexusvar.h b/sys/i386/include/nexusvar.h index c9dcf1c..be38f33 100644 --- a/sys/i386/include/nexusvar.h +++ b/sys/i386/include/nexusvar.h @@ -33,20 +33,8 @@ enum nexus_device_ivars { NEXUS_IVAR_PCIBUS }; -#define NEXUS_ACCESSOR(A, B, T) \ - \ -static __inline T nexus_get_ ## A(device_t dev) \ -{ \ - uintptr_t v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, NEXUS_IVAR_ ## B, &v); \ - return (T) v; \ -} \ - \ -static __inline void nexus_set_ ## A(device_t dev, T t) \ -{ \ - uintptr_t v = (uintptr_t) t; \ - BUS_WRITE_IVAR(device_get_parent(dev), dev, NEXUS_IVAR_ ## B, v); \ -} +#define NEXUS_ACCESSOR(var, ivar, type) \ + __BUS_ACCESSOR(nexus, var, NEXUS, ivar, type) NEXUS_ACCESSOR(pcibus, PCIBUS, u_int32_t) |