Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2013 05:39:20 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253756 - head/sys/dev/wi
Message-ID:  <201307290539.r6T5dKsE054386@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307290539.r6T5dKsE054386>