summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-07-26 13:00:29 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-07-26 13:00:29 +0000
commitcb06cc132ba61ad3618695715996267d0966be83 (patch)
tree2408a9c5b95d0fe8e4855ee0f5e5c9e2430e49f7
parent635a0733afddf26b12fb5bedc7c7dfbeaec51123 (diff)
Fix byteswap errors in rtwn(4) and urtwn(4) introduced by me on June 17.
Repairs urtwn(4) on macppc. Problem reported by juanfra@. ok millert@ deraadt@
-rw-r--r--sys/dev/ic/rtwn.c12
-rw-r--r--sys/dev/pci/if_rtwn.c10
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/ic/rtwn.c b/sys/dev/ic/rtwn.c
index 314819aae1e..ee4e5b37f46 100644
--- a/sys/dev/ic/rtwn.c
+++ b/sys/dev/ic/rtwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtwn.c,v 1.9 2016/06/17 10:53:55 stsp Exp $ */
+/* $OpenBSD: rtwn.c,v 1.10 2016/07/26 13:00:28 stsp Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -297,14 +297,12 @@ rtwn_write_1(struct rtwn_softc *sc, uint16_t addr, uint8_t val)
void
rtwn_write_2(struct rtwn_softc *sc, uint16_t addr, uint16_t val)
{
- val = htole16(val);
sc->sc_ops.write_2(sc->sc_ops.cookie, addr, val);
}
void
rtwn_write_4(struct rtwn_softc *sc, uint16_t addr, uint32_t val)
{
- val = htole32(val);
sc->sc_ops.write_4(sc->sc_ops.cookie, addr, val);
}
@@ -687,13 +685,11 @@ rtwn_ra_init(struct rtwn_softc *sc)
/* Configure Automatic Rate Fallback Register. */
if (ic->ic_curmode == IEEE80211_MODE_11B) {
if (rates & 0x0c)
- rtwn_write_4(sc, R92C_ARFR(0),
- htole32(rates & 0x0d));
+ rtwn_write_4(sc, R92C_ARFR(0), rates & 0x0d);
else
- rtwn_write_4(sc, R92C_ARFR(0),
- htole32(rates & 0x0f));
+ rtwn_write_4(sc, R92C_ARFR(0), rates & 0x0f);
} else
- rtwn_write_4(sc, R92C_ARFR(0), htole32(rates & 0x0ff5));
+ rtwn_write_4(sc, R92C_ARFR(0), rates & 0x0ff5);
}
if (sc->chip & RTWN_CHIP_88E)
diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c
index a50eec59b52..93d6abec640 100644
--- a/sys/dev/pci/if_rtwn.c
+++ b/sys/dev/pci/if_rtwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rtwn.c,v 1.23 2016/07/21 08:38:33 stsp Exp $ */
+/* $OpenBSD: if_rtwn.c,v 1.24 2016/07/26 13:00:28 stsp Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -742,16 +742,20 @@ uint16_t
rtwn_pci_read_2(void *cookie, uint16_t addr)
{
struct rtwn_pci_softc *sc = cookie;
+ uint16_t val;
- return bus_space_read_2(sc->sc_st, sc->sc_sh, addr);
+ val = bus_space_read_2(sc->sc_st, sc->sc_sh, addr);
+ return le16toh(val);
}
uint32_t
rtwn_pci_read_4(void *cookie, uint16_t addr)
{
struct rtwn_pci_softc *sc = cookie;
+ uint32_t val;
- return bus_space_read_4(sc->sc_st, sc->sc_sh, addr);
+ val = bus_space_read_4(sc->sc_st, sc->sc_sh, addr);
+ return le32toh(val);
}
void