svn commit: r253756 - head/sys/dev/wi

Justin Hibbits jhibbits at FreeBSD.org
Mon Jul 29 05:39:21 UTC 2013


Author: jhibbits
Date: Mon Jul 29 05:39:20 2013
New Revision: 253756
URL: http://svnweb.freebsd.org/changeset/base/253756

Log:
  Use the streaming functions for reading/writing the BAP fields on wi(4).  This
  fixes wi(4) device access on big endian architectures.
  
  PR:		kern/164499
  Reviewed by:	adrian
  Obtained from:	NetBSD

Modified:
  head/sys/dev/wi/if_wi.c

Modified: head/sys/dev/wi/if_wi.c
==============================================================================
--- head/sys/dev/wi/if_wi.c	Sun Jul 28 20:11:31 2013	(r253755)
+++ head/sys/dev/wi/if_wi.c	Mon Jul 29 05:39:20 2013	(r253756)
@@ -1905,8 +1905,7 @@ wi_seek_bap(struct wi_softc *sc, int id,
 static int
 wi_read_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
 {
-	u_int16_t *ptr;
-	int i, error, cnt;
+	int error, cnt;
 
 	if (buflen == 0)
 		return 0;
@@ -1915,9 +1914,7 @@ wi_read_bap(struct wi_softc *sc, int id,
 			return error;
 	}
 	cnt = (buflen + 1) / 2;
-	ptr = (u_int16_t *)buf;
-	for (i = 0; i < cnt; i++)
-		*ptr++ = CSR_READ_2(sc, WI_DATA0);
+	CSR_READ_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt);
 	sc->sc_bap_off += cnt * 2;
 	return 0;
 }
@@ -1925,8 +1922,7 @@ wi_read_bap(struct wi_softc *sc, int id,
 static int
 wi_write_bap(struct wi_softc *sc, int id, int off, void *buf, int buflen)
 {
-	u_int16_t *ptr;
-	int i, error, cnt;
+	int error, cnt;
 
 	if (buflen == 0)
 		return 0;
@@ -1936,9 +1932,7 @@ wi_write_bap(struct wi_softc *sc, int id
 			return error;
 	}
 	cnt = (buflen + 1) / 2;
-	ptr = (u_int16_t *)buf;
-	for (i = 0; i < cnt; i++)
-		CSR_WRITE_2(sc, WI_DATA0, ptr[i]);
+	CSR_WRITE_MULTI_STREAM_2(sc, WI_DATA0, (u_int16_t *)buf, cnt);
 	sc->sc_bap_off += cnt * 2;
 
 	return 0;


More information about the svn-src-head mailing list