CVS commit: src/sys/net

2016-02-14 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 15 01:11:41 UTC 2016

Modified Files:
src/sys/net: bridgestp.c if_bridge.c if_bridgevar.h

Log Message:
Simplify bridge(4)

Thanks to introducing softint-based if_input, the entire bridge code now
never run in hardware interrupt context. So we can simplify the code.

- Remove spin mutexes
  - They were needed because some code of bridge could run in
hardware interrupt context
  - We now need only an adaptive mutex for each shared object
(a member list and a forwarding table)
- Remove pktqueue
  - bridge_input is already in softint, using another softint
(for bridge_forward) is useless
  - Packet distribution should be down at device drivers


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/net/bridgestp.c
cvs rdiff -u -r1.107 -r1.108 src/sys/net/if_bridge.c
cvs rdiff -u -r1.25 -r1.26 src/sys/net/if_bridgevar.h

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

Modified files:

Index: src/sys/net/bridgestp.c
diff -u src/sys/net/bridgestp.c:1.18 src/sys/net/bridgestp.c:1.19
--- src/sys/net/bridgestp.c:1.18	Wed Dec 31 17:36:24 2014
+++ src/sys/net/bridgestp.c	Mon Feb 15 01:11:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bridgestp.c,v 1.18 2014/12/31 17:36:24 ozaki-r Exp $	*/
+/*	$NetBSD: bridgestp.c,v 1.19 2016/02/15 01:11:41 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2000 Jason L. Wright (ja...@thought.net)
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.18 2014/12/31 17:36:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.19 2016/02/15 01:11:41 ozaki-r Exp $");
 
 #include 
 #include 
@@ -221,7 +221,7 @@ bstp_send_config_bpdu(struct bridge_soft
 	struct bstp_cbpdu bpdu;
 	int s;
 
-	KASSERT(BRIDGE_INTR_LOCKED(sc));
+	KASSERT(BRIDGE_LOCKED(sc));
 
 	ifp = bif->bif_ifp;
 
@@ -276,11 +276,11 @@ bstp_send_config_bpdu(struct bridge_soft
 
 	memcpy(mtod(m, char *) + sizeof(*eh), , sizeof(bpdu));
 
-	BRIDGE_INTR_UNLOCK(sc);
+	BRIDGE_UNLOCK(sc);
 	s = splnet();
 	bridge_enqueue(sc, ifp, m, 0);
 	splx(s);
-	BRIDGE_INTR_LOCK(sc);
+	BRIDGE_LOCK(sc);
 }
 
 static int
@@ -367,7 +367,7 @@ bstp_transmit_tcn(struct bridge_softc *s
 	struct mbuf *m;
 	int s;
 
-	KASSERT(BRIDGE_INTR_LOCKED(sc));
+	KASSERT(BRIDGE_LOCKED(sc));
 
 	KASSERT(bif != NULL);
 	ifp = bif->bif_ifp;
@@ -396,11 +396,11 @@ bstp_transmit_tcn(struct bridge_softc *s
 
 	memcpy(mtod(m, char *) + sizeof(*eh), , sizeof(bpdu));
 
-	BRIDGE_INTR_UNLOCK(sc);
+	BRIDGE_UNLOCK(sc);
 	s = splnet();
 	bridge_enqueue(sc, ifp, m, 0);
 	splx(s);
-	BRIDGE_INTR_LOCK(sc);
+	BRIDGE_LOCK(sc);
 }
 
 static void
@@ -634,9 +634,9 @@ bstp_input(struct bridge_softc *sc, stru
 	case BSTP_MSGTYPE_TCN:
 		tu.tu_message_type = tpdu.tbu_bpdutype;
 
-		BRIDGE_INTR_LOCK(sc);
+		BRIDGE_LOCK(sc);
 		bstp_received_tcn_bpdu(sc, bif, );
-		BRIDGE_INTR_UNLOCK(sc);
+		BRIDGE_UNLOCK(sc);
 
 		break;
 	case BSTP_MSGTYPE_CFG:
@@ -675,9 +675,9 @@ bstp_input(struct bridge_softc *sc, stru
 		cu.cu_topology_change =
 		(cpdu.cbu_flags & BSTP_FLAG_TC) ? 1 : 0;
 
-		BRIDGE_INTR_LOCK(sc);
+		BRIDGE_LOCK(sc);
 		bstp_received_config_bpdu(sc, bif, );
-		BRIDGE_INTR_UNLOCK(sc);
+		BRIDGE_UNLOCK(sc);
 
 		break;
 	default:
@@ -826,7 +826,7 @@ bstp_initialization(struct bridge_softc 
 
 	mif = NULL;
 
-	BRIDGE_INTR_LOCK(sc);
+	BRIDGE_LOCK(sc);
 
 	LIST_FOREACH(bif, >sc_iflist, bif_next) {
 		if ((bif->bif_flags & IFBIF_STP) == 0)
@@ -848,7 +848,7 @@ bstp_initialization(struct bridge_softc 
 	}
 
 	if (mif == NULL) {
-		BRIDGE_INTR_UNLOCK(sc);
+		BRIDGE_UNLOCK(sc);
 		bstp_stop(sc);
 		return;
 	}
@@ -862,7 +862,7 @@ bstp_initialization(struct bridge_softc 
 	(((uint64_t)(uint8_t)CLLADDR(mif->bif_ifp->if_sadl)[4]) << 8) |
 	(((uint64_t)(uint8_t)CLLADDR(mif->bif_ifp->if_sadl)[5]) << 0);
 
-	BRIDGE_INTR_UNLOCK(sc);
+	BRIDGE_UNLOCK(sc);
 
 	sc->sc_designated_root = sc->sc_bridge_id;
 	sc->sc_root_path_cost = 0;
@@ -880,7 +880,7 @@ bstp_initialization(struct bridge_softc 
 		callout_reset(>sc_bstpcallout, hz,
 		bstp_tick, sc);
 
-	BRIDGE_INTR_LOCK(sc);
+	BRIDGE_LOCK(sc);
 
 	LIST_FOREACH(bif, >sc_iflist, bif_next) {
 		if (bif->bif_flags & IFBIF_STP)
@@ -893,7 +893,7 @@ bstp_initialization(struct bridge_softc 
 	bstp_config_bpdu_generation(sc);
 	bstp_timer_start(>sc_hello_timer, 0);
 
-	BRIDGE_INTR_UNLOCK(sc);
+	BRIDGE_UNLOCK(sc);
 }
 
 void
@@ -901,14 +901,14 @@ bstp_stop(struct bridge_softc *sc)
 {
 	struct bridge_iflist *bif;
 
-	BRIDGE_INTR_LOCK(sc);
+	BRIDGE_LOCK(sc);
 	LIST_FOREACH(bif, >sc_iflist, bif_next) {
 		bstp_set_port_state(bif, BSTP_IFSTATE_DISABLED);
 		bstp_timer_stop(>bif_hold_timer);
 		bstp_timer_stop(>bif_message_age_timer);
 		bstp_timer_stop(>bif_forward_delay_timer);
 	}
-	BRIDGE_INTR_UNLOCK(sc);
+	BRIDGE_UNLOCK(sc);
 
 	callout_stop(>sc_bstpcallout);
 
@@ -1065,7 +1065,7 @@ bstp_tick(void *arg)
 	int s;
 
 	s = splnet();
-	BRIDGE_INTR_LOCK(sc);
+	BRIDGE_LOCK(sc);
 

CVS commit: src/sys/netinet

2016-02-14 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Sun Feb 14 23:47:57 UTC 2016

Modified Files:
src/sys/netinet: tcp_usrreq.c

Log Message:
remove duplicated #include of 


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/sys/netinet/tcp_usrreq.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/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.209 src/sys/netinet/tcp_usrreq.c:1.210
--- src/sys/netinet/tcp_usrreq.c:1.209	Mon Aug 24 22:21:26 2015
+++ src/sys/netinet/tcp_usrreq.c	Sun Feb 14 23:47:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_usrreq.c,v 1.209 2015/08/24 22:21:26 pooka Exp $	*/
+/*	$NetBSD: tcp_usrreq.c,v 1.210 2016/02/14 23:47:57 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.209 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.210 2016/02/14 23:47:57 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -136,9 +136,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c
 #include 
 
 #ifdef INET6
-#ifndef INET
-#include 
-#endif
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/sparc64/sparc64

2016-02-14 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Feb 14 21:13:34 UTC 2016

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
sun4v: add breakpoint trap entry to the sun4v trap table


To generate a diff of this commit:
cvs rdiff -u -r1.387 -r1.388 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.387 src/sys/arch/sparc64/sparc64/locore.s:1.388
--- src/sys/arch/sparc64/sparc64/locore.s:1.387	Wed Feb  3 20:33:52 2016
+++ src/sys/arch/sparc64/sparc64/locore.s	Sun Feb 14 21:13:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.387 2016/02/03 20:33:52 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.388 2016/02/14 21:13:33 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -1075,7 +1075,9 @@ _C_LABEL(trapbase_sun4v):
 	sun4v_trap_entry_spill_fill_fail 1			! 0x0f4 fill_5_other
 	sun4v_trap_entry_spill_fill_fail 1			! 0x0f8 fill_6_other
 	sun4v_trap_entry_spill_fill_fail 1			! 0x0fc fill_7_other
-	sun4v_trap_entry 256	! 0x100-0x1ff
+	sun4v_trap_entry 1	! 0x100
+	BPT			! 0x101 = pseudo breakpoint instruction
+	sun4v_trap_entry 254	! 0x102-0x1ff
 	!
 	! trap level 1
 	!



CVS commit: src/sys/arch/powerpc/oea

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:12:31 UTC 2016

Modified Files:
src/sys/arch/powerpc/oea: ofw_consinit.c

Log Message:
Add missing va_end, from David Binderman in PR 50798.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/oea/ofw_consinit.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/arch/powerpc/oea/ofw_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.16 src/sys/arch/powerpc/oea/ofw_consinit.c:1.17
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.16	Sun May 12 13:23:08 2013
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Sun Feb 14 18:12:30 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.16 2013/05/12 13:23:08 macallan Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.17 2016/02/14 18:12:30 dholland Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.16 2013/05/12 13:23:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.17 2016/02/14 18:12:30 dholland Exp $");
 
 #include 
 #include 
@@ -119,6 +119,7 @@ void ofprint(const char *blah, ...)
 
 	va_start(va, blah);
 	len = vsnprintf(buf, sizeof(buf), blah, va);
+	va_end(va);
 	OF_write(console_instance, buf, len);
 }
 



CVS commit: src/sys/dev/ppbus

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:11:16 UTC 2016

Modified Files:
src/sys/dev/ppbus: ppbus_msq.c

Log Message:
Add missing va_end, from David Binderman in PR 50797.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ppbus/ppbus_msq.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/ppbus/ppbus_msq.c
diff -u src/sys/dev/ppbus/ppbus_msq.c:1.10 src/sys/dev/ppbus/ppbus_msq.c:1.11
--- src/sys/dev/ppbus/ppbus_msq.c:1.10	Sun Jul 17 20:54:51 2011
+++ src/sys/dev/ppbus/ppbus_msq.c	Sun Feb 14 18:11:16 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ppbus_msq.c,v 1.10 2011/07/17 20:54:51 joerg Exp $ */
+/* $NetBSD: ppbus_msq.c,v 1.11 2016/02/14 18:11:16 dholland Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 Nicolas Souchu
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppbus_msq.c,v 1.10 2011/07/17 20:54:51 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppbus_msq.c,v 1.11 2016/02/14 18:11:16 dholland Exp $");
 
 #include 
 #include 
@@ -259,6 +259,7 @@ ppbus_MS_init_msq(struct ppbus_microseq 
 			panic("%s: unknown parameter (0x%x)!", __func__, param);
 		}
 	}
+	va_end(p_list);
 
 	return (0);
 }



CVS commit: src/external/gpl3

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 19:08:10 UTC 2016

Modified Files:
src/external/gpl3/gcc.old/dist/gcc: gcc.c
src/external/gpl3/gcc/dist/gcc: gcc.c

Log Message:
Restore the local change
  -gcc: internal compiler error: Killed (program cc1plus)
  +gcc: internal compiler error: Killed (program cc1plus received signal 9)
which was lost in an update somewhere after netbsd-6.

This clarification was found in the past to significantly reduce the
number of bug reports caused by people running out of swap, such as
(most likely) seen again today in PR 50802.

XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/dist/gcc/gcc.c
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/dist/gcc/gcc.c

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

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/gcc.c
diff -u src/external/gpl3/gcc.old/dist/gcc/gcc.c:1.3 src/external/gpl3/gcc.old/dist/gcc/gcc.c:1.4
--- src/external/gpl3/gcc.old/dist/gcc/gcc.c:1.3	Wed Sep 23 03:39:10 2015
+++ src/external/gpl3/gcc.old/dist/gcc/gcc.c	Sun Feb 14 19:08:10 2016
@@ -2819,8 +2819,9 @@ execute (void)
 	  }
 	else
 #endif
-	  internal_error ("%s (program %s)",
-			  strsignal (WTERMSIG (status)), commands[i].prog);
+	  internal_error ("%s (program %s received signal %d)",
+			  strsignal (WTERMSIG (status)), commands[i].prog,
+			  WTERMSIG (status));
 	  }
 	else if (WIFEXITED (status)
 		 && WEXITSTATUS (status) >= MIN_FATAL_STATUS)

Index: src/external/gpl3/gcc/dist/gcc/gcc.c
diff -u src/external/gpl3/gcc/dist/gcc/gcc.c:1.13 src/external/gpl3/gcc/dist/gcc/gcc.c:1.14
--- src/external/gpl3/gcc/dist/gcc/gcc.c:1.13	Sun Jan 24 09:43:31 2016
+++ src/external/gpl3/gcc/dist/gcc/gcc.c	Sun Feb 14 19:08:10 2016
@@ -2928,9 +2928,10 @@ execute (void)
 	  }
 	else
 #endif
-	  internal_error_no_backtrace ("%s (program %s)",
+	  internal_error_no_backtrace ("%s (program %s received signal %d)",
 	   strsignal (WTERMSIG (status)),
-	   commands[i].prog);
+	   commands[i].prog,
+	   WTERMSIG (status));
 	  }
 	else if (WIFEXITED (status)
 		 && WEXITSTATUS (status) >= MIN_FATAL_STATUS)



CVS commit: src/sys

2016-02-14 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Feb 14 19:54:21 UTC 2016

Modified Files:
src/sys/arch/acorn26/ioc: iociic.c
src/sys/arch/arm/at91: at91twi.c
src/sys/arch/arm/iomd: iomdiic.c
src/sys/arch/arm/nvidia: tegra_i2c.c
src/sys/arch/arm/rockchip: rockchip_i2c.c
src/sys/arch/arm/samsung: exynos_i2c.c
src/sys/arch/arm/xscale: iopi2c.c
src/sys/arch/evbarm/armadillo: armadillo9_iic.c
src/sys/arch/evbarm/gumstix: gxiic.c
src/sys/arch/evbarm/nslu2: nslu2_iic.c
src/sys/arch/hpcarm/dev: nbpiic.c
src/sys/arch/i386/pci: viapcib.c
src/sys/arch/macppc/dev: cuda.c ki2c.c pmu.c
src/sys/arch/mips/alchemy/dev: ausmbus_psc.c
src/sys/arch/zaurus/dev: ziic.c
src/sys/dev/ic: pca9564.c
src/sys/dev/pci: amdpm_smbus.c igma.c nfsmb.c

Log Message:
zero the i2c_attach_args structure before filling it in.
fixes occasional crashes in iic_attach().


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/acorn26/ioc/iociic.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/at91/at91twi.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/iomd/iomdiic.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra_i2c.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rockchip_i2c.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/xscale/iopi2c.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/armadillo/armadillo9_iic.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/gumstix/gxiic.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/nslu2/nslu2_iic.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hpcarm/dev/nbpiic.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/pci/viapcib.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/dev/cuda.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/macppc/dev/ki2c.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/macppc/dev/pmu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/alchemy/dev/ausmbus_psc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/zaurus/dev/ziic.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/pca9564.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/amdpm_smbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/igma.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/nfsmb.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/arch/acorn26/ioc/iociic.c
diff -u src/sys/arch/acorn26/ioc/iociic.c:1.9 src/sys/arch/acorn26/ioc/iociic.c:1.10
--- src/sys/arch/acorn26/ioc/iociic.c:1.9	Tue Jul 19 16:05:10 2011
+++ src/sys/arch/acorn26/ioc/iociic.c	Sun Feb 14 19:54:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: iociic.c,v 1.9 2011/07/19 16:05:10 dyoung Exp $	*/
+/*	$NetBSD: iociic.c,v 1.10 2016/02/14 19:54:19 chs Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -145,6 +145,7 @@ iociic_attach(device_t parent, device_t 
 	sc->sc_i2c.ic_read_byte = iociic_read_byte;
 	sc->sc_i2c.ic_write_byte = iociic_write_byte;
 
+	memset(, 0, sizeof(iba));
 	iba.iba_tag = >sc_i2c;
 	(void) config_found_ia(self, "i2cbus", , iicbus_print);
 }

Index: src/sys/arch/arm/at91/at91twi.c
diff -u src/sys/arch/arm/at91/at91twi.c:1.6 src/sys/arch/arm/at91/at91twi.c:1.7
--- src/sys/arch/arm/at91/at91twi.c:1.6	Sat Oct 27 17:17:36 2012
+++ src/sys/arch/arm/at91/at91twi.c	Sun Feb 14 19:54:20 2016
@@ -1,5 +1,5 @@
-/*	$Id: at91twi.c,v 1.6 2012/10/27 17:17:36 chs Exp $	*/
-/*	$NetBSD: at91twi.c,v 1.6 2012/10/27 17:17:36 chs Exp $	*/
+/*	$Id: at91twi.c,v 1.7 2016/02/14 19:54:20 chs Exp $	*/
+/*	$NetBSD: at91twi.c,v 1.7 2016/02/14 19:54:20 chs Exp $	*/
 
 /*-
  * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at91twi.c,v 1.6 2012/10/27 17:17:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91twi.c,v 1.7 2016/02/14 19:54:20 chs Exp $");
 
 #include 
 #include 
@@ -134,6 +134,7 @@ found_ckdiv:
 	sc->sc_i2c.ic_write_byte = NULL;
 	sc->sc_i2c.ic_exec = at91twi_i2c_exec;
 
+	memset(, 0, sizeof(iba));
 	iba.iba_tag = >sc_i2c;
 	(void) config_found_ia(sc->sc_dev, "i2cbus", , iicbus_print);
 }

Index: src/sys/arch/arm/iomd/iomdiic.c
diff -u src/sys/arch/arm/iomd/iomdiic.c:1.7 src/sys/arch/arm/iomd/iomdiic.c:1.8
--- src/sys/arch/arm/iomd/iomdiic.c:1.7	Mon May 14 10:38:08 2012
+++ src/sys/arch/arm/iomd/iomdiic.c	Sun Feb 14 19:54:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomdiic.c,v 1.7 2012/05/14 10:38:08 skrll Exp $	*/
+/*	$NetBSD: iomdiic.c,v 1.8 2016/02/14 19:54:20 chs Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -147,6 +147,7 @@ iomdiic_attach(device_t parent, device_t
 	sc->sc_i2c.ic_read_byte = iomdiic_read_byte;
 	sc->sc_i2c.ic_write_byte = iomdiic_write_byte;
 
+	memset(, 0, sizeof(iba));
 	iba.iba_tag = >sc_i2c;
 	(void) config_found_ia(sc->sc_dev, "i2cbus", , iicbus_print);
 }

Index: src/sys/arch/arm/nvidia/tegra_i2c.c
diff -u src/sys/arch/arm/nvidia/tegra_i2c.c:1.12 src/sys/arch/arm/nvidia/tegra_i2c.c:1.13
--- 

CVS commit: src/external/gpl3/binutils/dist

2016-02-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 14 19:00:04 UTC 2016

Modified Files:
src/external/gpl3/binutils/dist/bfd: elf32-vax.c
src/external/gpl3/binutils/dist/gas/config: tc-vax.c

Log Message:
Make the vax target buildable


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/bfd/elf32-vax.c
cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/binutils/dist/gas/config/tc-vax.c

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

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/elf32-vax.c
diff -u src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.11 src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.12
--- src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.11	Fri Jan 29 14:42:44 2016
+++ src/external/gpl3/binutils/dist/bfd/elf32-vax.c	Sun Feb 14 19:00:04 2016
@@ -1365,7 +1365,8 @@ elf_vax_instantiate_got_entries (struct 
 	}
 
   /* Allocate space in the .got and .rela.got sections.  */
-  if (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+  if (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (
+  elf_hash_table (info)->dynamic_sections_created, 0, h))
 	{
 	  sgot->size += 4;
 	  srelgot->size += sizeof (Elf32_External_Rela);

Index: src/external/gpl3/binutils/dist/gas/config/tc-vax.c
diff -u src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.9 src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.10
--- src/external/gpl3/binutils/dist/gas/config/tc-vax.c:1.9	Fri Jan 29 14:42:45 2016
+++ src/external/gpl3/binutils/dist/gas/config/tc-vax.c	Sun Feb 14 19:00:04 2016
@@ -3598,8 +3598,6 @@ tc_vax_regname_to_dw2regnum (char *regna
 void
 vax_cfi_emit_pcrel_expr (expressionS *expP, unsigned int nbytes)
 {
-  vax_cons_special_reloc = "pcrel";
   expP->X_add_number += nbytes;
   emit_expr (expP, nbytes);
-  vax_cons_special_reloc = NULL;
 }



CVS commit: src/sys/arch/sgimips/dev

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 19:11:20 UTC 2016

Modified Files:
src/sys/arch/sgimips/dev: crmfb.c

Log Message:
Remove extra stray break missed by Christos when committing PR 50783.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sgimips/dev/crmfb.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/arch/sgimips/dev/crmfb.c
diff -u src/sys/arch/sgimips/dev/crmfb.c:1.42 src/sys/arch/sgimips/dev/crmfb.c:1.43
--- src/sys/arch/sgimips/dev/crmfb.c:1.42	Mon Feb  8 16:44:45 2016
+++ src/sys/arch/sgimips/dev/crmfb.c	Sun Feb 14 19:11:19 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.42 2016/02/08 16:44:45 christos Exp $ */
+/* $NetBSD: crmfb.c,v 1.43 2016/02/14 19:11:19 dholland Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.42 2016/02/08 16:44:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.43 2016/02/14 19:11:19 dholland Exp $");
 
 #include 
 #include 
@@ -1128,7 +1128,6 @@ crmfb_setup_video(struct crmfb_softc *sc
 	case 32:
 		sc->sc_de_mode = DE_MODE_TLB_A | DE_MODE_BUFDEPTH_32 |
 		DE_MODE_TYPE_RGBA | DE_MODE_PIXDEPTH_32;
-		break;
 		sc->sc_mte_mode = MTE_MODE_DST_ECC |
 		(MTE_TLB_A << MTE_DST_TLB_SHIFT) |
 		(MTE_TLB_A << MTE_SRC_TLB_SHIFT) |



CVS commit: src/lib/libedit

2016-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 14 14:49:34 UTC 2016

Modified Files:
src/lib/libedit: chared.c chared.h chartype.h common.c emacs.c
keymacro.c makelist map.c parse.c refresh.c refresh.h search.c
search.h terminal.c terminal.h tty.c vi.c

Log Message:
>From Ingo Schwarze:

As we have seen before, "histedit.h" can never get rid of including
the  header because using the data types defined there is
deeply ingrained in the public interfaces of libedit.

Now POSIX unconditionally requires that  defines the type
wint_t.  Consequently, it can be used unconditionally, no matter
whether WIDECHAR is active or not.  Consequently, the #define Int
is pointless.

Note that removing it is not gratuitious churn.  Auditing for
integer signedness problems is already hard when only fundamental
types like "int" and "unsigned" are involved.  It gets very hard
when types come into the picture that have platform-dependent
signedness, like "char" and "wint_t".  Adding yet another layer
on top, changing both the signedness and the width in a platform-
dependent way, makes auditing yet harder, which IMHO is really
dangerous.  Note that while removing the #define, i already found
one bug caused by this excessive complication - in the function
re_putc() in refresh.c.  If WIDECHAR was defined, it printed an
Int = wint_t value with %c.  Fortunately, that bug only affects
debugging, not production.  The fix is contained in the patch.

With WIDECHAR, this doesn't change anything.  For the case without
WIDECHAR, i checked that none of the places wants to store values
that might not fit in wint_t.

This only changes internal interfaces; public ones remain unchanged.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libedit/chared.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libedit/chared.h
cvs rdiff -u -r1.18 -r1.19 src/lib/libedit/chartype.h \
src/lib/libedit/makelist
cvs rdiff -u -r1.30 -r1.31 src/lib/libedit/common.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libedit/emacs.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libedit/keymacro.c
cvs rdiff -u -r1.36 -r1.37 src/lib/libedit/map.c
cvs rdiff -u -r1.28 -r1.29 src/lib/libedit/parse.c
cvs rdiff -u -r1.38 -r1.39 src/lib/libedit/refresh.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libedit/refresh.h
cvs rdiff -u -r1.32 -r1.33 src/lib/libedit/search.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libedit/search.h
cvs rdiff -u -r1.15 -r1.16 src/lib/libedit/terminal.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libedit/terminal.h
cvs rdiff -u -r1.50 -r1.51 src/lib/libedit/tty.c
cvs rdiff -u -r1.47 -r1.48 src/lib/libedit/vi.c

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

Modified files:

Index: src/lib/libedit/chared.c
diff -u src/lib/libedit/chared.c:1.40 src/lib/libedit/chared.c:1.41
--- src/lib/libedit/chared.c:1.40	Wed Jun 18 14:12:28 2014
+++ src/lib/libedit/chared.c	Sun Feb 14 09:49:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: chared.c,v 1.40 2014/06/18 18:12:28 christos Exp $	*/
+/*	$NetBSD: chared.c,v 1.41 2016/02/14 14:49:34 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)chared.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: chared.c,v 1.40 2014/06/18 18:12:28 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.41 2016/02/14 14:49:34 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -199,7 +199,7 @@ c_delbefore1(EditLine *el)
  *	Return if p is part of a word according to emacs
  */
 protected int
-ce__isword(Int p)
+ce__isword(wint_t p)
 {
 	return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL;
 }
@@ -209,7 +209,7 @@ ce__isword(Int p)
  *	Return if p is part of a word according to vi
  */
 protected int
-cv__isword(Int p)
+cv__isword(wint_t p)
 {
 	if (Isalnum(p) || p == '_')
 		return 1;
@@ -223,7 +223,7 @@ cv__isword(Int p)
  *	Return if p is part of a big word according to vi
  */
 protected int
-cv__isWord(Int p)
+cv__isWord(wint_t p)
 {
 	return !Isspace(p);
 }
@@ -233,7 +233,7 @@ cv__isWord(Int p)
  *	Find the previous word
  */
 protected Char *
-c__prev_word(Char *p, Char *low, int n, int (*wtest)(Int))
+c__prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
 {
 	p--;
 
@@ -257,7 +257,7 @@ c__prev_word(Char *p, Char *low, int n, 
  *	Find the next word
  */
 protected Char *
-c__next_word(Char *p, Char *high, int n, int (*wtest)(Int))
+c__next_word(Char *p, Char *high, int n, int (*wtest)(wint_t))
 {
 	while (n--) {
 		while ((p < high) && !(*wtest)(*p))
@@ -275,7 +275,7 @@ c__next_word(Char *p, Char *high, int n,
  *	Find the next word vi style
  */
 protected Char *
-cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(Int))
+cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(wint_t))
 {
 	int test;
 
@@ -304,7 +304,7 @@ cv_next_word(EditLine *el, Char *p, Char
  *	Find the previous word vi style
  */
 protected Char *
-cv_prev_word(Char *p, Char *low, int 

CVS commit: src/lib/libedit

2016-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 14 14:47:48 UTC 2016

Modified Files:
src/lib/libedit: chartype.c chartype.h read.c

Log Message:
>From Ingo Schwartze:

Next step:  Remove #ifdef'ing in read_char(), in the same style
as we did for setlocale(3) in el.c.

A few remarks are required to explain the choices made.

 * On first sight, handling mbrtowc(3) seems a bit less trivial
   than handling setlocale(3) because its prototype uses the data
   type mbstate_t from .  However, it turns out that
   "histedit.h" already includes  unconditionally (i don't
   like headers including other headers, but that ship has sailed,
   people are by now certainly used to the fact that including
   "histedit.h" doesn't require including  before), and
   "histedit.h" is of course included all over the place.  So from
   that perspective, there is no problem with using mbrtowc(3)
   unconditionally ever for !WIDECHAR.

 * However,  also defines the mbrtowc(3) prototype,
   so we cannot just #define mbrtowc away, or including the header
   will break.  It would also be a bad idea to porovide a local
   implementation of mbrtowc() and hope that it overrides the one
   in libc.  Besides, the required prototype is subtly different:
   While mbrtowc(3) takes "wchar_t *" as its first argument, we
   need a function that takes "Char *".  So unfortunately, we have
   to keep a ct_mbrtowc #define, at least until we can maybe get
   rid of "Char *" in the more remote future.

 * After getting rid of the #else clause in read_char(), we can
   pull "return 1;" into the default: clause.  After that, we can
   get rid of the ugly "goto again_lastbyte;" and just "break;".
   As a bonus, that also gets rid of the ugly CONSTCOND.

 * While here, delete the unused ct_mbtowc() from chartype.h.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libedit/chartype.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libedit/chartype.h
cvs rdiff -u -r1.76 -r1.77 src/lib/libedit/read.c

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

Modified files:

Index: src/lib/libedit/chartype.c
diff -u src/lib/libedit/chartype.c:1.13 src/lib/libedit/chartype.c:1.14
--- src/lib/libedit/chartype.c:1.13	Thu Feb 11 14:21:04 2016
+++ src/lib/libedit/chartype.c	Sun Feb 14 09:47:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: chartype.c,v 1.13 2016/02/11 19:21:04 christos Exp $	*/
+/*	$NetBSD: chartype.c,v 1.14 2016/02/14 14:47:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.13 2016/02/11 19:21:04 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.14 2016/02/14 14:47:48 christos Exp $");
 #endif /* not lint && not SCCSID */
 #include "el.h"
 #include 
@@ -210,6 +210,20 @@ ct_encode_char(char *dst, size_t len, Ch
 	}
 	return l;
 }
+
+#else
+
+size_t
+ct_mbrtowc(char *wc, const char *s, size_t n,
+void *mbs __attribute((__unused__))) {
+	if (s == NULL)
+		return 0;
+	if (n == 0)
+		return (size_t)-2;
+	if (wc != NULL)
+		*wc = *s;
+	return *s != '\0';
+}
 #endif
 
 protected const Char *

Index: src/lib/libedit/chartype.h
diff -u src/lib/libedit/chartype.h:1.17 src/lib/libedit/chartype.h:1.18
--- src/lib/libedit/chartype.h:1.17	Thu Feb 11 14:10:18 2016
+++ src/lib/libedit/chartype.h	Sun Feb 14 09:47:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: chartype.h,v 1.17 2016/02/11 19:10:18 christos Exp $	*/
+/*	$NetBSD: chartype.h,v 1.18 2016/02/14 14:47:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,6 @@
 #warning Build environment does not support non-BMP characters
 #endif
 
-#define ct_mbtowcmbtowc
 #define ct_mbrtowc   mbrtowc
 #define ct_wctombwctomb
 #define ct_wctomb_reset  wctomb(0,0)
@@ -115,8 +114,7 @@ Width(wchar_t c)
 
 #else /* NARROW */
 
-#define ct_mbtowcerror
-#define ct_mbrtowc   error
+size_t 	ct_mbrtowc(char *, const char *, size_t, void *);
 #define ct_wctomberror
 #define ct_wctomb_reset  
 #define ct_wcstombs(a, b, c)(strncpy(a, b, c), strlen(a))

Index: src/lib/libedit/read.c
diff -u src/lib/libedit/read.c:1.76 src/lib/libedit/read.c:1.77
--- src/lib/libedit/read.c:1.76	Fri Feb 12 10:36:08 2016
+++ src/lib/libedit/read.c	Sun Feb 14 09:47:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: read.c,v 1.76 2016/02/12 15:36:08 christos Exp $	*/
+/*	$NetBSD: read.c,v 1.77 2016/02/14 14:47:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)read.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: read.c,v 1.76 2016/02/12 15:36:08 christos Exp $");
+__RCSID("$NetBSD: read.c,v 1.77 2016/02/14 14:47:48 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -337,10 +337,9 @@ read_char(EditLine *el, Char *cp)
 		return 0;
 	}
 
-#ifdef WIDECHAR
-	do 

CVS commit: src/lib/libedit

2016-02-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 14 17:06:24 UTC 2016

Modified Files:
src/lib/libedit: chartype.h eln.c

Log Message:
>From Ingo Schwarze:

el_getc() for the WIDECHAR case, that is, the version in eln.c.
For a UTF-8 locale, it is broken in four ways:

 1. If the character read is outside the ASCII range, the function
does an undefined cast from wchar_t to char.  Even if wchar_t
is internally represented as UCS-4, that is wrong and dangerous
because characters beyond codepoint U+0255 get their high bits
truncated, meaning that perfectly valid printable Unicode
characters get mapped to arbitrary bytes, even the ASCII escape
character for some Unicode characters.  But wchar_t need not
be implemented in terms of UCS-4, so the outcome of this function
is undefined for any and all input.

 2. If insufficient space is available for the result, the function
fails to detect failure and returns garbage rather than -1 as
specified in the documentation.

 3. The documentation says that errno will be set on failure, but
that doesn't happen either in the above case.

 4. Even for ASCII characters, the results may be wrong if wchar_t
is not using UCS-4.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libedit/chartype.h
cvs rdiff -u -r1.21 -r1.22 src/lib/libedit/eln.c

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

Modified files:

Index: src/lib/libedit/chartype.h
diff -u src/lib/libedit/chartype.h:1.19 src/lib/libedit/chartype.h:1.20
--- src/lib/libedit/chartype.h:1.19	Sun Feb 14 09:49:34 2016
+++ src/lib/libedit/chartype.h	Sun Feb 14 12:06:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: chartype.h,v 1.19 2016/02/14 14:49:34 christos Exp $	*/
+/*	$NetBSD: chartype.h,v 1.20 2016/02/14 17:06:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -61,6 +61,7 @@
 #endif
 
 #define ct_mbrtowc   mbrtowc
+#define ct_wctob wctob
 #define ct_wctombwctomb
 #define ct_wctomb_reset  wctomb(0,0)
 #define ct_wcstombs  wcstombs
@@ -113,6 +114,7 @@ Width(wchar_t c)
 #else /* NARROW */
 
 size_t 	ct_mbrtowc(char *, const char *, size_t, void *);
+#define ct_wctob(w)  ((int)(w))
 #define ct_wctomberror
 #define ct_wctomb_reset  
 #define ct_wcstombs(a, b, c)(strncpy(a, b, c), strlen(a))

Index: src/lib/libedit/eln.c
diff -u src/lib/libedit/eln.c:1.21 src/lib/libedit/eln.c:1.22
--- src/lib/libedit/eln.c:1.21	Fri Feb 12 12:23:21 2016
+++ src/lib/libedit/eln.c	Sun Feb 14 12:06:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eln.c,v 1.21 2016/02/12 17:23:21 christos Exp $	*/
+/*	$NetBSD: eln.c,v 1.22 2016/02/14 17:06:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,12 +34,13 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.21 2016/02/12 17:23:21 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.22 2016/02/14 17:06:24 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include "histedit.h"
 #include "el.h"
 #include "read.h"
+#include 
 #include 
 #include 
 #include 
@@ -50,10 +51,18 @@ el_getc(EditLine *el, char *cp)
 	int num_read;
 	wchar_t wc = 0;
 
-	num_read = el_wgetc (el, );
-	if (num_read > 0)
-		*cp = (char)wc;
-	return num_read;
+	num_read = el_wgetc(el, );
+	*cp = '\0';
+	if (num_read <= 0)
+		return num_read;
+	num_read = ct_wctob(wc);
+	if (num_read == EOF) {
+		errno = ERANGE;
+		return -1;
+	} else {
+		*cp = (char)num_read;
+		return 1;
+	}
 }
 
 



CVS commit: src/sys/arch/arc/stand/boot

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:01:45 UTC 2016

Modified Files:
src/sys/arch/arc/stand/boot: disk.c

Log Message:
Add missing va_end. PR 50793 from David Binderman.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arc/stand/boot/disk.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/arch/arc/stand/boot/disk.c
diff -u src/sys/arch/arc/stand/boot/disk.c:1.6 src/sys/arch/arc/stand/boot/disk.c:1.7
--- src/sys/arch/arc/stand/boot/disk.c:1.6	Sun Jul 17 20:54:37 2011
+++ src/sys/arch/arc/stand/boot/disk.c	Sun Feb 14 18:01:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: disk.c,v 1.6 2011/07/17 20:54:37 joerg Exp $	*/
+/*	$NetBSD: disk.c,v 1.7 2016/02/14 18:01:45 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -112,8 +112,8 @@ diskopen(struct open_file *f, ...)
 	va_list ap;
 
 	va_start(ap, f);
-
 	device = va_arg(ap, char *);
+	va_end(ap);
 
 	/*
 	 * For NetBSD/sgimips, since we use the SGI partition map directly,



CVS commit: src/sys/arch/powerpc/oea

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:07:49 UTC 2016

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
Add missing va_end; PR 50795 from David Binderman.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/oea/pmap.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/arch/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.92 src/sys/arch/powerpc/oea/pmap.c:1.93
--- src/sys/arch/powerpc/oea/pmap.c:1.92	Sun Aug 10 17:49:04 2014
+++ src/sys/arch/powerpc/oea/pmap.c	Sun Feb 14 18:07:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.93 2016/02/14 18:07:49 dholland Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2014/08/10 17:49:04 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2016/02/14 18:07:49 dholland Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -3133,6 +3133,7 @@ pmap_setup_segment0_map(int use_large_pa
 (void)pmap_pte_insert(ptegidx, );
 }
 }
+va_end(ap);
 
 TLBSYNC();
 SYNC();



CVS commit: src/sys/arch/emips/stand/common

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:05:31 UTC 2016

Modified Files:
src/sys/arch/emips/stand/common: printf.c

Log Message:
Fix wrong indent.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/emips/stand/common/printf.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/arch/emips/stand/common/printf.c
diff -u src/sys/arch/emips/stand/common/printf.c:1.6 src/sys/arch/emips/stand/common/printf.c:1.7
--- src/sys/arch/emips/stand/common/printf.c:1.6	Sun Feb 14 18:04:47 2016
+++ src/sys/arch/emips/stand/common/printf.c	Sun Feb 14 18:05:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.6 2016/02/14 18:04:47 dholland Exp $	*/
+/*	$NetBSD: printf.c,v 1.7 2016/02/14 18:05:31 dholland Exp $	*/
 /*-
  * Copyright (c) 1998 Robert Nordier
  * All rights reserved.
@@ -73,9 +73,9 @@ printf(const char *fmt,...)
 	*s++ = hex[u & 0xfu];
 while (u >>= 4);
 goto dumpbuf;
-case 0:
-		va_end(ap);
-return;
+			case 0:
+va_end(ap);
+return;
 			}
 		}
 		xputchar(c);



CVS commit: src/sys/arch/emips/stand/common

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:04:47 UTC 2016

Modified Files:
src/sys/arch/emips/stand/common: printf.c

Log Message:
Add missing va_end(). PR 50794 from David Binderman.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/emips/stand/common/printf.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/arch/emips/stand/common/printf.c
diff -u src/sys/arch/emips/stand/common/printf.c:1.5 src/sys/arch/emips/stand/common/printf.c:1.6
--- src/sys/arch/emips/stand/common/printf.c:1.5	Mon Feb 24 07:41:15 2014
+++ src/sys/arch/emips/stand/common/printf.c	Sun Feb 14 18:04:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.5 2014/02/24 07:41:15 martin Exp $	*/
+/*	$NetBSD: printf.c,v 1.6 2016/02/14 18:04:47 dholland Exp $	*/
 /*-
  * Copyright (c) 1998 Robert Nordier
  * All rights reserved.
@@ -74,6 +74,7 @@ printf(const char *fmt,...)
 while (u >>= 4);
 goto dumpbuf;
 case 0:
+		va_end(ap);
 return;
 			}
 		}



CVS commit: src/sys/arch/sgimips/stand/common

2016-02-14 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Feb 14 18:09:51 UTC 2016

Modified Files:
src/sys/arch/sgimips/stand/common: disk.c

Log Message:
Add missing va_list, from David Binderman in PR 50796.

XXX: this file and arch/arc/stand/boot/disk.c are cutpaste clones.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sgimips/stand/common/disk.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/arch/sgimips/stand/common/disk.c
diff -u src/sys/arch/sgimips/stand/common/disk.c:1.11 src/sys/arch/sgimips/stand/common/disk.c:1.12
--- src/sys/arch/sgimips/stand/common/disk.c:1.11	Sun Jul 17 20:54:47 2011
+++ src/sys/arch/sgimips/stand/common/disk.c	Sun Feb 14 18:09:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: disk.c,v 1.11 2011/07/17 20:54:47 joerg Exp $	*/
+/*	$NetBSD: disk.c,v 1.12 2016/02/14 18:09:51 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -112,8 +112,8 @@ diskopen(struct open_file *f, ...)
 	va_list ap;
 
 	va_start(ap, f);
-
 	device = va_arg(ap, char *);
+	va_end(ap);
 
 	/*
 	 * For NetBSD/sgimips, since we use the SGI partition map directly,



CVS commit: src/sys/external/bsd/dwc2/dist

2016-02-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 14 10:34:09 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2/dist: dwc2_hcd.h

Log Message:
Fix DWC2_READ_4 in dwc2_sample_frrem which is unused


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/dwc2/dist/dwc2_hcd.h

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

Modified files:

Index: src/sys/external/bsd/dwc2/dist/dwc2_hcd.h
diff -u src/sys/external/bsd/dwc2/dist/dwc2_hcd.h:1.10 src/sys/external/bsd/dwc2/dist/dwc2_hcd.h:1.11
--- src/sys/external/bsd/dwc2/dist/dwc2_hcd.h:1.10	Sun Aug 30 12:59:59 2015
+++ src/sys/external/bsd/dwc2/dist/dwc2_hcd.h	Sun Feb 14 10:34:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_hcd.h,v 1.10 2015/08/30 12:59:59 skrll Exp $	*/
+/*	$NetBSD: dwc2_hcd.h,v 1.11 2016/02/14 10:34:09 skrll Exp $	*/
 
 /*
  * hcd.h - DesignWare HS OTG Controller host-mode declarations
@@ -733,7 +733,7 @@ do {	\
 			   qtd_list_entry);\
 	if (usb_pipeint(_qtd_->urb->pipe) &&\
 	(_qh_)->start_split_frame != 0 && !_qtd_->complete_split) {	\
-		_hfnum_.d32 = DWC2_READ_4(hsotg, (_hcd_)->regs + HFNUM);		\
+		_hfnum_.d32 = DWC2_READ_4((_hcd_), HFNUM);		\
 		switch (_hfnum_.b.frnum & 0x7) {			\
 		case 7:			\
 			(_hcd_)->hfnum_7_samples_##_letter_++;		\



CVS import: src/sys/external/bsd/dwc2/dist

2016-02-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 14 10:48:08 UTC 2016

Update of /cvsroot/src/sys/external/bsd/dwc2/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv16576

Log Message:
Import latest dwc2 sources

commit 192cb07f7928e8cb09a9851e6c0f7478baa3bc6d
Author: John Youn 
Date:   Mon Jan 11 16:32:28 2016 -0800

usb: dwc2: Fix probe problem on bcm2835

Fixes an issue found on Raspberry PI platform that prevents probe. Don't
skip setting the force mode if it's already set.

Fixes: 09c96980dc72 ("usb: dwc2: Add functions to set and clear force mode")
Tested-by: Heiko Stuebner 
Tested-by: Douglas Anderson 
Signed-off-by: John Youn 
Reported-by: Stefan Wahren 
Reported-by: Remi Pommarel 
Tested-by: Stefan Wahren 
Tested-by: Remi Pommarel 
Signed-off-by: Felipe Balbi 

commit 03b32e4c9bd1b52fcf1e4304e7a704aa0315e398
Author: John Youn 
Date:   Mon Jan 11 16:32:14 2016 -0800

Revert "usb: dwc2: Move reset into dwc2_get_hwparams()"

This reverts commit 263b7fb557f7 ("usb: dwc2: Move reset into
dwc2_get_hwparams()") due to regression found on bcm2835 platform. USB
ethernet fails, due to being unable to pick up proper parameters when
performing a plain reset before reading hw params.

Below shows the results of the gnptxfsiz and hptxfsiz with and before
and after reverting this (from Stefan Wahren):

So here is the probe result before Patch 1 is applied:

[1.283148] dwc2 2098.usb: Configuration mismatch. dr_mode forced to 
host
[1.313894] dwc2 2098.usb: gnptxfsiz=00201000
[1.314104] dwc2 2098.usb: hptxfsiz=
[1.353908] dwc2 2098.usb: 256 invalid for host_nperio_tx_fifo_size. 
Check HW configuration.
[1.354262] dwc2 2098.usb: 512 invalid for host_perio_tx_fifo_size. 
Check HW configuration.
[1.394249] dwc2 2098.usb: DWC OTG Controller
[1.394561] dwc2 2098.usb: new USB bus registered, assigned bus 
number 1
[1.394917] dwc2 2098.usb: irq 33, io mem 0x

And here is the probe result after Patch 1 is applied:

[1.280107] dwc2 2098.usb: Configuration mismatch. dr_mode forced to 
host
[1.353949] dwc2 2098.usb: gnptxfsiz=01001000
[1.354166] dwc2 2098.usb: hptxfsiz=02002000
[1.434301] dwc2 2098.usb: DWC OTG Controller
[1.434616] dwc2 2098.usb: new USB bus registered, assigned bus 
number 1
[1.434973] dwc2 2098.usb: irq 33, io mem 0x

Tested-by: Heiko Stuebner 
Tested-by: Douglas Anderson 
Signed-off-by: John Youn 
Reported-by: Stefan Wahren 
Reported-by: Remi Pommarel 
Tested-by: Stefan Wahren 
Tested-by: Remi Pommarel 
Signed-off-by: Felipe Balbi 

commit a40a00318c7fcdd23e73cfffac0e33430a43a3e3
Author: Heiko Stübner 
Date:   Fri Dec 18 19:30:59 2015 +0100

usb: dwc2: add shutdown callback to platform variant

In specific conditions (involving usb hubs) dwc2 devices can create a
lot of interrupts, even to the point of overwhelming devices running
at low frequencies. Some devices need to do special clock handling
at shutdown-time which may bring the system clock below the threshold
of being able to handle the dwc2 interrupts. Disabling dwc2-irqs
in a shutdown callbacks prevents reboots/poweroffs from getting stuck
in such cases.

The hsotg struct already contains an unused irq element, so we can
just use it to store the irq number for the shutdown callback.

Reviewed-by: Douglas Anderson 
Acked-by: John Youn 
Signed-off-by: Heiko Stuebner 
Signed-off-by: Felipe Balbi 

commit 6d76c92c2fcbee4fd1f6d7b375d71057c7a615b1
Author: Marek Vasut 
Date:   Fri Dec 18 03:26:17 2015 +0100

usb: dwc2: gadget: Repair DSTS register decoding

The "enumspd" field is located in register DSTS[2:1], but the code
which checks the bitfield does not shift the value accordingly. This
in turn causes incorrect detection of gadget link partner speed in
dwc2_hsotg_irq_enumdone() .

Shift the value accordingly to fix the problem with speed detection.

Acked-by: John Youn 
Signed-off-by: Marek Vasut 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: John Youn 
Signed-off-by: Felipe Balbi 

commit 

CVS commit: src/sys/external/bsd/dwc2/dist

2016-02-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 14 10:53:30 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2/dist: dwc2_core.c dwc2_core.h dwc2_coreintr.c
dwc2_hcd.c dwc2_hcd.h dwc2_hcdddma.c dwc2_hcdintr.c dwc2_hcdqueue.c
dwc2_hw.h

Log Message:
Merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/dwc2/dist/dwc2_core.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/dwc2/dist/dwc2_core.h \
src/sys/external/bsd/dwc2/dist/dwc2_hcdddma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_coreintr.c
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/dwc2/dist/dwc2_hcd.h
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/dwc2/dist/dwc2_hcdintr.c
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/dwc2/dist/dwc2_hw.h

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

Modified files:

Index: src/sys/external/bsd/dwc2/dist/dwc2_core.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.10 src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.11
--- src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.10	Tue Sep  1 14:03:00 2015
+++ src/sys/external/bsd/dwc2/dist/dwc2_core.c	Sun Feb 14 10:53:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_core.c,v 1.10 2015/09/01 14:03:00 skrll Exp $	*/
+/*	$NetBSD: dwc2_core.c,v 1.11 2016/02/14 10:53:30 skrll Exp $	*/
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.10 2015/09/01 14:03:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.11 2016/02/14 10:53:30 skrll Exp $");
 
 #include 
 #include 
@@ -127,6 +127,7 @@ static int dwc2_restore_host_registers(s
 
 	DWC2_WRITE_4(hsotg, HPRT0, hr->hprt0);
 	DWC2_WRITE_4(hsotg, HFIR, hr->hfir);
+	hsotg->frame_number = 0;
 
 	return 0;
 }
@@ -408,6 +409,12 @@ int dwc2_enter_hibernation(struct dwc2_h
 		}
 	}
 
+	/*
+	 * Clear any pending interrupts since dwc2 will not be able to
+	 * clear them after entering hibernation.
+	 */
+	DWC2_WRITE_4(hsotg, GINTSTS, 0x);
+
 	/* Put the controller in low power state */
 	pcgcctl = DWC2_READ_4(hsotg, PCGCTL);
 
@@ -485,64 +492,166 @@ static void dwc2_init_fs_ls_pclk_sel(str
  * Do core a soft reset of the core.  Be careful with this because it
  * resets all the internal state machines of the core.
  */
-static int dwc2_core_reset(struct dwc2_hsotg *hsotg)
+int dwc2_core_reset(struct dwc2_hsotg *hsotg)
 {
 	u32 greset;
 	int count = 0;
-	u32 gusbcfg;
 
 	dev_vdbg(hsotg->dev, "%s()\n", __func__);
 
-	/* Wait for AHB master IDLE state */
+	/* Core Soft Reset */
+	greset = DWC2_READ_4(hsotg, GRSTCTL);
+	greset |= GRSTCTL_CSFTRST;
+	DWC2_WRITE_4(hsotg, GRSTCTL, greset);
 	do {
-		usleep_range(2, 4);
+		udelay(1);
 		greset = DWC2_READ_4(hsotg, GRSTCTL);
 		if (++count > 50) {
 			dev_warn(hsotg->dev,
- "%s() HANG! AHB Idle GRSTCTL=%0x\n",
+ "%s() HANG! Soft Reset GRSTCTL=%0x\n",
  __func__, greset);
 			return -EBUSY;
 		}
-	} while (!(greset & GRSTCTL_AHBIDLE));
+	} while (greset & GRSTCTL_CSFTRST);
 
-	/* Core Soft Reset */
+	/* Wait for AHB master IDLE state */
 	count = 0;
-	greset |= GRSTCTL_CSFTRST;
-	DWC2_WRITE_4(hsotg, GRSTCTL, greset);
 	do {
-		usleep_range(2, 4);
+		udelay(1);
 		greset = DWC2_READ_4(hsotg, GRSTCTL);
 		if (++count > 50) {
 			dev_warn(hsotg->dev,
- "%s() HANG! Soft Reset GRSTCTL=%0x\n",
+ "%s() HANG! AHB Idle GRSTCTL=%0x\n",
  __func__, greset);
 			return -EBUSY;
 		}
-	} while (greset & GRSTCTL_CSFTRST);
+	} while (!(greset & GRSTCTL_AHBIDLE));
+
+	return 0;
+}
 
-	if (hsotg->dr_mode == USB_DR_MODE_HOST) {
-		gusbcfg = DWC2_READ_4(hsotg, GUSBCFG);
-		gusbcfg &= ~GUSBCFG_FORCEDEVMODE;
-		gusbcfg |= GUSBCFG_FORCEHOSTMODE;
-		DWC2_WRITE_4(hsotg, GUSBCFG, gusbcfg);
-	} else if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL) {
-		gusbcfg = DWC2_READ_4(hsotg, GUSBCFG);
-		gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
-		gusbcfg |= GUSBCFG_FORCEDEVMODE;
-		DWC2_WRITE_4(hsotg, GUSBCFG, gusbcfg);
-	} else if (hsotg->dr_mode == USB_DR_MODE_OTG) {
-		gusbcfg = DWC2_READ_4(hsotg, GUSBCFG);
-		gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
-		gusbcfg &= ~GUSBCFG_FORCEDEVMODE;
-		DWC2_WRITE_4(hsotg, GUSBCFG, gusbcfg);
+/*
+ * Force the mode of the controller.
+ *
+ * Forcing the mode is needed for two cases:
+ *
+ * 1) If the dr_mode is set to either HOST or PERIPHERAL we force the
+ * controller to stay in a particular mode regardless of ID pin
+ * changes. We do this usually after a core reset.
+ *
+ * 2) During probe we want to read reset values of the hw
+ * configuration registers that are only available in either host or
+ * device mode. We may need to force the mode if the current mode does
+ * not allow us to access the register in the mode that we want.
+ *
+ * In either 

CVS commit: src/sys/external/bsd/dwc2

2016-02-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb 14 10:56:23 UTC 2016

Modified Files:
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Update for latest dwc2 dist


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/external/bsd/dwc2/dwc2.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/external/bsd/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.38 src/sys/external/bsd/dwc2/dwc2.c:1.39
--- src/sys/external/bsd/dwc2/dwc2.c:1.38	Tue Dec 22 14:31:36 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Feb 14 10:56:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.38 2015/12/22 14:31:36 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.39 2016/02/14 10:56:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.38 2015/12/22 14:31:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.39 2016/02/14 10:56:22 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1685,7 +1685,7 @@ dwc2_init(struct dwc2_softc *sc)
 		retval = dwc2_hcd_init(hsotg);
 		if (retval) {
 			if (hsotg->gadget_enabled)
-s3c_hsotg_remove(hsotg);
+dwc2_hsotg_remove(hsotg);
 			goto fail2;
 		}
 	hsotg->hcd_enabled = 1;
@@ -1788,30 +1788,30 @@ void dwc2_host_complete(struct dwc2_hsot
 	ed = xfer->pipe->endpoint->edesc;
 	xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
 
-	xfer->actlen = dwc2_hcd_urb_get_actual_length(qtd->urb);
+	struct dwc2_hcd_urb *urb = qtd->urb;
+	xfer->actlen = dwc2_hcd_urb_get_actual_length(urb);
 
 	DPRINTFN(3, "xfer=%p actlen=%d\n", xfer, xfer->actlen);
 
-	if (xfertype == UE_ISOCHRONOUS && dbg_perio()) {
-		int i;
-
-		for (i = 0; i < xfer->nframes; i++)
-			dev_vdbg(hsotg->dev, " ISO Desc %d status %d\n",
- i, qtd->urb->iso_descs[i].status);
-	}
-
 	if (xfertype == UE_ISOCHRONOUS) {
 		int i;
-
 		xfer->actlen = 0;
 		for (i = 0; i < xfer->nframes; ++i) {
 			xfer->frlengths[i] =
 dwc2_hcd_urb_get_iso_desc_actual_length(
-		qtd->urb, i);
+		urb, i);
 			xfer->actlen += xfer->frlengths[i];
 		}
 	}
 
+	if (xfertype == UE_ISOCHRONOUS && dbg_perio()) {
+		int i;
+
+		for (i = 0; i < xfer->nframes; i++)
+			dev_vdbg(hsotg->dev, " ISO Desc %d status %d\n",
+ i, urb->iso_descs[i].status);
+	}
+
 	if (!status) {
 		if (!(xfer->flags & USBD_SHORT_XFER_OK) &&
 		xfer->actlen < xfer->length)
@@ -1838,6 +1838,7 @@ void dwc2_host_complete(struct dwc2_hsot
 		xfer->status = USBD_IOERROR;
 		break;
 	default:
+		xfer->status = USBD_IOERROR;
 		printf("%s: unknown error status %d\n", __func__, status);
 	}
 
@@ -1884,6 +1885,13 @@ _dwc2_hcd_start(struct dwc2_hsotg *hsotg
 
 	mutex_spin_enter(>lock);
 
+	hsotg->lx_state = DWC2_L0;
+	
+	if (dwc2_is_device_mode(hsotg)) {
+		mutex_spin_exit(>lock);
+		return 0;	/* why 0 ?? */
+	}
+
 	dwc2_hcd_reinit(hsotg);
 
 	mutex_spin_exit(>lock);