Module Name:    src
Committed By:   christos
Date:           Fri Nov 20 14:56:56 UTC 2015

Modified Files:
        src/sys/dev/pci: if_ipw.c

Log Message:
use copyout instead of suword.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/if_ipw.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.58 src/sys/dev/pci/if_ipw.c:1.59
--- src/sys/dev/pci/if_ipw.c:1.58	Wed Jan  7 02:05:48 2015
+++ src/sys/dev/pci/if_ipw.c	Fri Nov 20 09:56:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.58 2015/01/07 07:05:48 ozaki-r Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.59 2015/11/20 14:56:56 christos Exp $	*/
 /*	FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp 	*/
 
 /*-
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.58 2015/01/07 07:05:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.59 2015/11/20 14:56:56 christos Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -1541,7 +1541,8 @@ ipw_watchdog(struct ifnet *ifp)
 static int
 ipw_get_table1(struct ipw_softc *sc, uint32_t *tbl)
 {
-	uint32_t addr, size, i;
+	uint32_t addr, size, data, i;
+	int error;
 
 	if (!(sc->flags & IPW_FLAG_FW_INITED))
 		return ENOTTY;
@@ -1549,13 +1550,14 @@ ipw_get_table1(struct ipw_softc *sc, uin
 	CSR_WRITE_4(sc, IPW_CSR_AUTOINC_ADDR, sc->table1_base);
 
 	size = CSR_READ_4(sc, IPW_CSR_AUTOINC_DATA);
-	if (suword(tbl, size) != 0)
-		return EFAULT;
+	if ((error = copyout(&size, tbl, sizeof(size))) != 0)
+		return error;
 
 	for (i = 1, ++tbl; i < size; i++, tbl++) {
 		addr = CSR_READ_4(sc, IPW_CSR_AUTOINC_DATA);
-		if (suword(tbl, MEM_READ_4(sc, addr)) != 0)
-			return EFAULT;
+		data = MEM_READ_4(sc, addr);
+		if ((error = copyout(&data, tbl, sizeof(data))) != 0)
+			return error;
 	}
 	return 0;
 }
@@ -1563,23 +1565,20 @@ ipw_get_table1(struct ipw_softc *sc, uin
 static int
 ipw_get_radio(struct ipw_softc *sc, int *ret)
 {
-	uint32_t addr;
+	uint32_t addr, data;
 
 	if (!(sc->flags & IPW_FLAG_FW_INITED))
 		return ENOTTY;
 
 	addr = ipw_read_table1(sc, IPW_INFO_EEPROM_ADDRESS);
-	if ((MEM_READ_4(sc, addr + 32) >> 24) & 1) {
-		suword(ret, -1);
-		return 0;
-	}
-
-	if (CSR_READ_4(sc, IPW_CSR_IO) & IPW_IO_RADIO_DISABLED)
-		suword(ret, 0);
+	if ((MEM_READ_4(sc, addr + 32) >> 24) & 1)
+		data = -1;
+	else if (CSR_READ_4(sc, IPW_CSR_IO) & IPW_IO_RADIO_DISABLED)
+		data = 0;
 	else
-		suword(ret, 1);
+		data = 1;
 
-	return 0;
+	return copyout(&data, ret, sizeof(data));
 }
 
 static int

Reply via email to