From 0337fbac37572c6cbcda2409a58619ad10f624d8 Mon Sep 17 00:00:00 2001 From: mrg Date: Fri, 12 May 2006 01:25:00 +0000 Subject: [PATCH] make [OU]READ[124]() real inline functions instead of macros. --- sys/dev/usb/ohci.c | 30 +++++++++++++++++++++++++----- sys/dev/usb/uhci.c | 30 +++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 963c558b2554..83dfa13e92d9 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.173 2006/04/15 01:07:51 christos Exp $ */ +/* $NetBSD: ohci.c,v 1.174 2006/05/12 01:25:00 mrg Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ /* @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.173 2006/04/15 01:07:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.174 2006/05/12 01:25:00 mrg Exp $"); #include #include @@ -233,9 +233,29 @@ Static void ohci_dump_itds(ohci_softc_t *, ohci_soft_itd_t *); do { OBARR(sc); bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x)); } while (0) #define OWRITE4(sc, r, x) \ do { OBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); } while (0) -#define OREAD1(sc, r) (OBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r))) -#define OREAD2(sc, r) (OBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r))) -#define OREAD4(sc, r) (OBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r))) +static __inline uint8_t +OREAD1(ohci_softc_t *sc, bus_size_t r) +{ + + OBARR(sc); + return bus_space_read_1(sc->iot, sc->ioh, r); +} + +static __inline uint16_t +OREAD2(ohci_softc_t *sc, bus_size_t r) +{ + + OBARR(sc); + return bus_space_read_2(sc->iot, sc->ioh, r); +} + +static __inline uint32_t +OREAD4(ohci_softc_t *sc, bus_size_t r) +{ + + OBARR(sc); + return bus_space_read_4(sc->iot, sc->ioh, r); +} /* Reverse the bits in a value 0 .. 31 */ Static u_int8_t revbits[OHCI_NO_INTRS] = diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 41402c0a9f33..91a1561551ab 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.195 2006/04/14 16:31:27 christos Exp $ */ +/* $NetBSD: uhci.c,v 1.196 2006/05/12 01:25:00 mrg Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.195 2006/04/14 16:31:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.196 2006/05/12 01:25:00 mrg Exp $"); #include #include @@ -286,9 +286,29 @@ void uhci_dump(void); #define UWRITE4(sc, r, x) \ do { UBARR(sc); bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x)); \ } while (/*CONSTCOND*/0) -#define UREAD1(sc, r) (UBARR(sc), bus_space_read_1((sc)->iot, (sc)->ioh, (r))) -#define UREAD2(sc, r) (UBARR(sc), bus_space_read_2((sc)->iot, (sc)->ioh, (r))) -#define UREAD4(sc, r) (UBARR(sc), bus_space_read_4((sc)->iot, (sc)->ioh, (r))) +static __inline uint8_t +UREAD1(uhci_softc_t *sc, bus_size_t r) +{ + + UBARR(sc); + return bus_space_read_1(sc->iot, sc->ioh, r); +} + +static __inline uint16_t +UREAD2(uhci_softc_t *sc, bus_size_t r) +{ + + UBARR(sc); + return bus_space_read_2(sc->iot, sc->ioh, r); +} + +static __inline uint32_t +UREAD4(uhci_softc_t *sc, bus_size_t r) +{ + + UBARR(sc); + return bus_space_read_4(sc->iot, sc->ioh, r); +} #define UHCICMD(sc, cmd) UWRITE2(sc, UHCI_CMD, cmd) #define UHCISTS(sc) UREAD2(sc, UHCI_STS)