CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:07:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp

Log Message:
Update


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.13 -r1.8.4.14 src/sys/dev/usb/TODO.usbmp

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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.13 src/sys/dev/usb/TODO.usbmp:1.8.4.14
--- src/sys/dev/usb/TODO.usbmp:1.8.4.13	Tue Feb 14 06:45:21 2017
+++ src/sys/dev/usb/TODO.usbmp	Tue Sep  5 07:07:15 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.13 2017/02/14 06:45:21 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.14 2017/09/05 07:07:15 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -23,7 +23,6 @@ usb_detach_{waitold,wakeup} to cv_{wait,
   if_aue.c
   if_axe.c
   if_axen.c
-  if_smsc.c
   if_udav.c
   if_url.c
   ubt.c
@@ -73,7 +72,6 @@ splusb drivers:
   - if_otus.c
   - if_rum.c
   - if_run.c
-  - if_smsc.c
   - if_udav.c
   - if_upl.c
   - if_ural.c
@@ -121,7 +119,6 @@ missing CALLOUT_MPSAFE drivers:
   - if_otus.c
   - if_rum.c
   - if_run.c
-  - if_smsc.c
   - if_udav.c
   - if_upgt.c
   - if_ural.c
@@ -144,7 +141,6 @@ missing USB_TASKQ_MPSAFE tasks:
   - if_otus.c
   - if_rum.c
   - if_run.c
-  - if_smsc.c
   - if_udav.c
   - if_upgt.c
   - if_ural.c



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:06:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_upl.c

Log Message:
Remove unnecessary splnet from upl_attach


To generate a diff of this commit:
cvs rdiff -u -r1.47.4.16 -r1.47.4.17 src/sys/dev/usb/if_upl.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:06:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_upl.c

Log Message:
Remove unnecessary splnet from upl_attach


To generate a diff of this commit:
cvs rdiff -u -r1.47.4.16 -r1.47.4.17 src/sys/dev/usb/if_upl.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/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.47.4.16 src/sys/dev/usb/if_upl.c:1.47.4.17
--- src/sys/dev/usb/if_upl.c:1.47.4.16	Sun Feb  5 13:40:46 2017
+++ src/sys/dev/usb/if_upl.c	Tue Sep  5 07:06:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.47.4.16 2017/02/05 13:40:46 skrll Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.47.4.17 2017/09/05 07:06:30 skrll Exp $	*/
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.47.4.16 2017/02/05 13:40:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.47.4.17 2017/09/05 07:06:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -220,7 +220,6 @@ upl_attach(device_t parent, device_t sel
 	struct upl_softc *sc = device_private(self);
 	struct usb_attach_arg *uaa = aux;
 	char			*devinfop;
-	int			s;
 	struct usbd_device *	dev = uaa->uaa_device;
 	struct usbd_interface *	iface;
 	usbd_status		err;
@@ -285,8 +284,6 @@ upl_attach(device_t parent, device_t sel
 		return;
 	}
 
-	s = splnet();
-
 	/* Initialize interface info.*/
 	ifp = >sc_if;
 	ifp->if_softc = sc;
@@ -316,7 +313,6 @@ upl_attach(device_t parent, device_t sel
 	RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 	sc->sc_attached = 1;
-	splx(s);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:07:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp

Log Message:
Update


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.13 -r1.8.4.14 src/sys/dev/usb/TODO.usbmp

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:04:17 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_kue.c if_kuereg.h

Log Message:
WIP MPification


To generate a diff of this commit:
cvs rdiff -u -r1.81.4.14 -r1.81.4.15 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.18.24.3 -r1.18.24.4 src/sys/dev/usb/if_kuereg.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/dev/usb/if_kue.c
diff -u src/sys/dev/usb/if_kue.c:1.81.4.14 src/sys/dev/usb/if_kue.c:1.81.4.15
--- src/sys/dev/usb/if_kue.c:1.81.4.14	Mon Aug 28 17:52:27 2017
+++ src/sys/dev/usb/if_kue.c	Tue Sep  5 07:04:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kue.c,v 1.81.4.14 2017/08/28 17:52:27 skrll Exp $	*/
+/*	$NetBSD: if_kue.c,v 1.81.4.15 2017/09/05 07:04:17 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.81.4.14 2017/08/28 17:52:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.81.4.15 2017/09/05 07:04:17 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -166,15 +166,20 @@ CFATTACH_DECL_NEW(kue, sizeof(struct kue
 kue_detach, kue_activate);
 
 static int kue_tx_list_init(struct kue_softc *);
+static void kue_tx_list_free(struct kue_softc *);
 static int kue_rx_list_init(struct kue_softc *);
+static void kue_rx_list_free(struct kue_softc *);
 static int kue_send(struct kue_softc *, struct mbuf *, int);
 static int kue_open_pipes(struct kue_softc *);
 static void kue_rxeof(struct usbd_xfer *, void *, usbd_status);
 static void kue_txeof(struct usbd_xfer *, void *, usbd_status);
 static void kue_start(struct ifnet *);
+static void kue_start_locked(struct ifnet *);
 static int kue_ioctl(struct ifnet *, u_long, void *);
 static void kue_init(void *);
+static void kue_init_locked(void *);
 static void kue_stop(struct kue_softc *);
+static void kue_stop_locked(struct kue_softc *);
 static void kue_watchdog(struct ifnet *);
 
 static void kue_setmulti(struct kue_softc *);
@@ -398,7 +403,6 @@ kue_attach(device_t parent, device_t sel
 	struct kue_softc *sc = device_private(self);
 	struct usb_attach_arg *uaa = aux;
 	char			*devinfop;
-	int			s;
 	struct ifnet		*ifp;
 	struct usbd_device *	dev = uaa->uaa_device;
 	struct usbd_interface *	iface;
@@ -479,8 +483,6 @@ kue_attach(device_t parent, device_t sel
 	sc->kue_mcfilters = kmem_alloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN,
 	KM_SLEEP);
 
-	s = splnet();
-
 	/*
 	 * A KLSI chip was detected. Inform the world.
 	 */
@@ -506,7 +508,6 @@ kue_attach(device_t parent, device_t sel
 	RND_TYPE_NET, RND_FLAG_DEFAULT);
 
 	sc->kue_attached = true;
-	splx(s);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->kue_udev, sc->kue_dev);
 
@@ -599,6 +600,18 @@ kue_rx_list_init(struct kue_softc *sc)
 	return 0;
 }
 
+static void
+kue_rx_list_free(struct kue_softc *sc)
+{
+	/* Free RX resources. */
+	for (int i = 0; i < KUE_RX_LIST_CNT; i++) {
+		if (sc->kue_cdata.kue_rx_chain[i].kue_xfer != NULL) {
+			usbd_destroy_xfer(sc->kue_cdata.kue_rx_chain[i].kue_xfer);
+			sc->kue_cdata.kue_rx_chain[i].kue_xfer = NULL;
+		}
+	}
+}
+
 static int
 kue_tx_list_init(struct kue_softc *sc)
 {
@@ -625,6 +638,18 @@ kue_tx_list_init(struct kue_softc *sc)
 	return 0;
 }
 
+static void
+kue_tx_list_free(struct kue_softc *sc)
+{
+	/* Free TX resources. */
+	for (int i = 0; i < KUE_TX_LIST_CNT; i++) {
+		if (sc->kue_cdata.kue_tx_chain[i].kue_xfer != NULL) {
+			usbd_destroy_xfer(sc->kue_cdata.kue_tx_chain[i].kue_xfer);
+			sc->kue_cdata.kue_tx_chain[i].kue_xfer = NULL;
+		}
+	}
+}
+
 /*
  * A frame has been uploaded: pass the resulting mbuf chain up to
  * the higher level protocols.
@@ -813,6 +838,17 @@ kue_send(struct kue_softc *sc, struct mb
 static void
 kue_start(struct ifnet *ifp)
 {
+	struct kue_softc *sc = ifp->if_softc;
+	KASSERT(ifp->if_extflags & IFEF_START_MPSAFE);
+
+	mutex_enter(>kue_txlock);
+	kue_start_locked(ifp);
+	mutex_exit(>kue_txlock);
+}
+
+static void
+kue_start_locked(struct ifnet *ifp)
+{
 	struct kue_softc	*sc = ifp->if_softc;
 	struct mbuf		*m;
 
@@ -853,9 +889,18 @@ kue_start(struct ifnet *ifp)
 static void
 kue_init(void *xsc)
 {
+	struct kue_softc *sc = xsc;
+
+	mutex_enter(>kue_lock);
+	kue_init_locked(xsc);
+	mutex_exit(>kue_lock);
+}
+
+static void
+kue_init_locked(void *xsc)
+{
 	struct kue_softc	*sc = xsc;
 	struct ifnet		*ifp = GET_IFP(sc);
-	int			s;
 	uint8_t			eaddr[ETHER_ADDR_LEN];
 
 	DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->kue_dev),__func__));
@@ -863,8 +908,6 @@ kue_init(void *xsc)
 	if (ifp->if_flags & IFF_RUNNING)
 		return;
 
-	s = splnet();
-
 	memcpy(eaddr, CLLADDR(ifp->if_sadl), sizeof(eaddr));
 	/* Set MAC address */
 	kue_ctl(sc, KUE_CTL_WRITE, KUE_CMD_SET_MAC, 0, eaddr, ETHER_ADDR_LEN);
@@ -892,21 +935,18 @@ kue_init(void *xsc)
 
 	if (sc->kue_ep[KUE_ENDPT_RX] == NULL) {
 		if (kue_open_pipes(sc)) {
-			splx(s);
 			return;
 		}
 	}
 	

CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:04:17 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_kue.c if_kuereg.h

Log Message:
WIP MPification


To generate a diff of this commit:
cvs rdiff -u -r1.81.4.14 -r1.81.4.15 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.18.24.3 -r1.18.24.4 src/sys/dev/usb/if_kuereg.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:01:12 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehci.c

Log Message:
#ifdef DIAGNOSTIC -> KASSERT and add another KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.234.2.109 -r1.234.2.110 src/sys/dev/usb/ehci.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 07:01:12 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehci.c

Log Message:
#ifdef DIAGNOSTIC -> KASSERT and add another KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.234.2.109 -r1.234.2.110 src/sys/dev/usb/ehci.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.234.2.109 src/sys/dev/usb/ehci.c:1.234.2.110
--- src/sys/dev/usb/ehci.c:1.234.2.109	Mon Aug 28 17:52:27 2017
+++ src/sys/dev/usb/ehci.c	Tue Sep  5 07:01:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.234.2.109 2017/08/28 17:52:27 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.234.2.110 2017/09/05 07:01:12 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.109 2017/08/28 17:52:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.110 2017/09/05 07:01:12 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3154,10 +3154,8 @@ ehci_abort_xfer(struct usbd_xfer *xfer, 
 	 */
 	if (xfer->ux_hcflags & UXFER_ABORTING) {
 		DPRINTF("already aborting", 0, 0, 0, 0);
-#ifdef DIAGNOSTIC
-		if (status == USBD_TIMEOUT)
-			printf("ehci_abort_xfer: TIMEOUT while aborting\n");
-#endif
+		KASSERT(status != USBD_TIMEOUT);
+
 		/* Override the status which might be USBD_TIMEOUT. */
 		xfer->ux_status = status;
 		DPRINTF("waiting for abort to finish", 0, 0, 0, 0);
@@ -3313,10 +3311,7 @@ ehci_abort_isoc_xfer(struct usbd_xfer *x
 	if (xfer->ux_hcflags & UXFER_ABORTING) {
 		DPRINTF("already aborting", 0, 0, 0, 0);
 
-#ifdef DIAGNOSTIC
-		if (status == USBD_TIMEOUT)
-			printf("ehci_abort_isoc_xfer: TIMEOUT while aborting\n");
-#endif
+		KASSERT(status != USBD_TIMEOUT);
 
 		xfer->ux_status = status;
 		DPRINTF("waiting for abort to finish", 0, 0, 0, 0);
@@ -3445,6 +3440,7 @@ ehci_timeout_task(void *addr)
 	DPRINTF("xfer=%p", xfer, 0, 0, 0);
 
 	mutex_enter(>sc_lock);
+	KASSERT(xfer->ux_status == USBD_TIMEOUT);
 	ehci_abort_xfer(xfer, USBD_TIMEOUT);
 	mutex_exit(>sc_lock);
 }



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 06:58:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.22 -r1.149.2.23 src/sys/dev/usb/umass.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.149.2.22 src/sys/dev/usb/umass.c:1.149.2.23
--- src/sys/dev/usb/umass.c:1.149.2.22	Tue Aug 29 06:49:07 2017
+++ src/sys/dev/usb/umass.c	Tue Sep  5 06:58:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.149.2.22 2017/08/29 06:49:07 skrll Exp $	*/
+/*	$NetBSD: umass.c,v 1.149.2.23 2017/09/05 06:58:51 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.22 2017/08/29 06:49:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.23 2017/09/05 06:58:51 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -271,12 +271,10 @@ const struct umass_wire_methods umass_cb
 
 #ifdef UMASS_DEBUG
 /* General debugging functions */
-Static void umass_bbb_dump_cbw(struct umass_softc *sc,
-umass_bbb_cbw_t *cbw);
-Static void umass_bbb_dump_csw(struct umass_softc *sc,
-umass_bbb_csw_t *csw);
+Static void umass_bbb_dump_cbw(struct umass_softc *sc, umass_bbb_cbw_t *cbw);
+Static void umass_bbb_dump_csw(struct umass_softc *sc, umass_bbb_csw_t *csw);
 Static void umass_dump_buffer(struct umass_softc *sc, uint8_t *buffer,
-int buflen, int printlen);
+int buflen, int printlen);
 #endif
 
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  5 06:58:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.22 -r1.149.2.23 src/sys/dev/usb/umass.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep  1 13:45:24 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_cue.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.68.4.15 -r1.68.4.16 src/sys/dev/usb/if_cue.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-09-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep  1 13:45:24 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_cue.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.68.4.15 -r1.68.4.16 src/sys/dev/usb/if_cue.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/usb/if_cue.c
diff -u src/sys/dev/usb/if_cue.c:1.68.4.15 src/sys/dev/usb/if_cue.c:1.68.4.16
--- src/sys/dev/usb/if_cue.c:1.68.4.15	Sun Feb  5 13:40:46 2017
+++ src/sys/dev/usb/if_cue.c	Fri Sep  1 13:45:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cue.c,v 1.68.4.15 2017/02/05 13:40:46 skrll Exp $	*/
+/*	$NetBSD: if_cue.c,v 1.68.4.16 2017/09/01 13:45:24 skrll Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *	Bill Paul .  All rights reserved.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.68.4.15 2017/02/05 13:40:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.68.4.16 2017/09/01 13:45:24 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1118,7 +1118,7 @@ cue_init_locked(struct ifnet *ifp)
 	for (i = 0; i < CUE_RX_LIST_CNT; i++) {
 		struct cue_chain *c = >cue_cdata.cue_rx_chain[i];
 		usbd_setup_xfer(c->cue_xfer, c, c->cue_buf, CUE_BUFSZ,
-		USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT, cue_rxeof);
+		USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT, cue_rxeof);
 		usbd_transfer(c->cue_xfer);
 	}
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-08-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 30 10:08:22 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c if_smscvar.h

Log Message:
Track used TX trasnfers and check there's a free transfer in
smsc_start_locked


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.36 -r1.22.2.37 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.3.4.7 -r1.3.4.8 src/sys/dev/usb/if_smscvar.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/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.36 src/sys/dev/usb/if_smsc.c:1.22.2.37
--- src/sys/dev/usb/if_smsc.c:1.22.2.36	Sat Apr 15 14:38:44 2017
+++ src/sys/dev/usb/if_smsc.c	Wed Aug 30 10:08:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.36 2017/04/15 14:38:44 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.37 2017/08/30 10:08:22 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -694,6 +694,12 @@ smsc_start_locked(struct ifnet *ifp)
 		return;
 	}
 
+	/* Any free USB transfers? */
+	if (sc->sc_cdata.tx_free == 0) {
+		smsc_dbg_printf(sc, "%s: all USB transfers in use\n", __func__);
+		return;
+	}
+
 	if ((ifp->if_flags & (IFF_OACTIVE|IFF_RUNNING)) != IFF_RUNNING) {
 		smsc_dbg_printf(sc, "%s: not running\n", __func__);
 		return;
@@ -703,15 +709,21 @@ smsc_start_locked(struct ifnet *ifp)
 	if (m_head == NULL)
 		return;
 
+	sc->sc_cdata.tx_free--;
+
 	IFQ_DEQUEUE(>if_snd, m_head);
-	if (smsc_encap(sc, m_head, 0)) {
+	if (smsc_encap(sc, m_head, sc->sc_cdata.tx_next)) {
 		m_free(m_head);
+		sc->sc_cdata.tx_free++;
 		return;
 	}
 
+	sc->sc_cdata.tx_next = (sc->sc_cdata.tx_next + 1) % SMSC_TX_LIST_CNT;
+
 	bpf_mtap(ifp, m_head);
 
-	ifp->if_flags |= IFF_OACTIVE;
+	if (sc->sc_cdata.tx_free == 0)
+		ifp->if_flags |= IFF_OACTIVE;
 
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
@@ -1559,6 +1571,7 @@ smsc_txeof(struct usbd_xfer *xfer, void 
 		return;
 	}
 
+	sc->sc_cdata.tx_free++;
 	ifp->if_timer = 0;
 	ifp->if_flags &= ~IFF_OACTIVE;
 
@@ -1608,6 +1621,9 @@ smsc_tx_list_init(struct smsc_softc *sc)
 		}
 	}
 
+	cd->tx_free = SMSC_TX_LIST_CNT;
+	cd->tx_next = 0;
+
 	return 0;
 }
 
@@ -1721,7 +1737,5 @@ smsc_encap(struct smsc_softc *sc, struct
 		return EIO;
 	}
 
-	sc->sc_cdata.tx_cnt++;
-
 	return 0;
 }

Index: src/sys/dev/usb/if_smscvar.h
diff -u src/sys/dev/usb/if_smscvar.h:1.3.4.7 src/sys/dev/usb/if_smscvar.h:1.3.4.8
--- src/sys/dev/usb/if_smscvar.h:1.3.4.7	Sat Apr 15 14:38:44 2017
+++ src/sys/dev/usb/if_smscvar.h	Wed Aug 30 10:08:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smscvar.h,v 1.3.4.7 2017/04/15 14:38:44 skrll Exp $	*/
+/*	$NetBSD: if_smscvar.h,v 1.3.4.8 2017/08/30 10:08:22 skrll Exp $	*/
 
 /*	$OpenBSD: if_smscreg.h,v 1.2 2012/09/27 12:38:11 jsg Exp $	*/
 /*-
@@ -46,9 +46,8 @@ struct smsc_chain {
 struct smsc_cdata {
 	struct smsc_chain	 tx_chain[SMSC_TX_LIST_CNT];
 	struct smsc_chain	 rx_chain[SMSC_RX_LIST_CNT];
-	int			 tx_prod;
-	int			 tx_cons;
-	int			 tx_cnt;
+	int			 tx_free;
+	int			 tx_next;
 	int			 rx_prod;
 };
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-08-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 30 10:08:22 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c if_smscvar.h

Log Message:
Track used TX trasnfers and check there's a free transfer in
smsc_start_locked


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.36 -r1.22.2.37 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.3.4.7 -r1.3.4.8 src/sys/dev/usb/if_smscvar.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-08-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 29 06:49:07 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.21 -r1.149.2.22 src/sys/dev/usb/umass.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.149.2.21 src/sys/dev/usb/umass.c:1.149.2.22
--- src/sys/dev/usb/umass.c:1.149.2.21	Mon Aug 28 17:52:28 2017
+++ src/sys/dev/usb/umass.c	Tue Aug 29 06:49:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.149.2.21 2017/08/28 17:52:28 skrll Exp $	*/
+/*	$NetBSD: umass.c,v 1.149.2.22 2017/08/29 06:49:07 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.21 2017/08/28 17:52:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.22 2017/08/29 06:49:07 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -679,7 +679,7 @@ umass_attach(device_t parent, device_t s
 	}
 
 	/*
-	 * Record buffer pinters for data transfer (it's huge), command and
+	 * Record buffer pointers for data transfer (it's huge), command and
 	 * status data here
 	 */
 	switch (sc->sc_wire) {



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-08-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 29 06:49:07 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.21 -r1.149.2.22 src/sys/dev/usb/umass.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-04-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 15 14:38:44 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c if_smscvar.h

Log Message:
WIP MPification


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.35 -r1.22.2.36 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.3.4.6 -r1.3.4.7 src/sys/dev/usb/if_smscvar.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/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.35 src/sys/dev/usb/if_smsc.c:1.22.2.36
--- src/sys/dev/usb/if_smsc.c:1.22.2.35	Mon Feb  6 10:20:01 2017
+++ src/sys/dev/usb/if_smsc.c	Sat Apr 15 14:38:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.35 2017/02/06 10:20:01 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.36 2017/04/15 14:38:44 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -172,6 +172,7 @@ struct mbuf	*smsc_newbuf(void);
 void		 smsc_tick(void *);
 void		 smsc_tick_task(void *);
 void		 smsc_miibus_statchg(struct ifnet *);
+void		 smsc_miibus_statchg_locked(struct ifnet *);
 int		 smsc_miibus_readreg(device_t, int, int);
 void		 smsc_miibus_writereg(device_t, int, int, int);
 int		 smsc_ifmedia_upd(struct ifnet *);
@@ -312,14 +313,37 @@ smsc_miibus_writereg(device_t dev, int p
 void
 smsc_miibus_statchg(struct ifnet *ifp)
 {
+	if (ifp == NULL)
+		return;
+
+	struct smsc_softc * const sc = ifp->if_softc;
+
+	mutex_enter(>sc_lock);
+	if (sc->sc_dying) {
+		mutex_exit(>sc_lock);
+		return;
+	}
+	smsc_miibus_statchg_locked(ifp);
+
+	mutex_exit(>sc_lock);
+}
+
+
+void
+smsc_miibus_statchg_locked(struct ifnet *ifp)
+{
 	struct smsc_softc * const sc = ifp->if_softc;
 	struct mii_data * const mii = >sc_mii;
 	int err;
 	uint32_t flow;
 	uint32_t afc_cfg;
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
+	KASSERT(mutex_owned(>sc_lock));
+
+	if ((ifp->if_flags & IFF_RUNNING) == 0) {
+		smsc_dbg_printf(sc, "%s: not running\n", __func__);
 		return;
+	}
 
 	/* Use the MII status to determine link status */
 	sc->sc_flags &= ~SMSC_FLAG_LINK;
@@ -405,15 +429,20 @@ smsc_ifmedia_sts(struct ifnet *ifp, stru
 	struct smsc_softc * const sc = ifp->if_softc;
 	struct mii_data * const mii = >sc_mii;
 
+	/* SMSC_LOCK */
+
 	mii_pollstat(mii);
 
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;
+
+	/* SMSC_UNLOCK */
 }
 
 static inline uint32_t
 smsc_hash(uint8_t addr[ETHER_ADDR_LEN])
 {
+
 	return (ether_crc32_be(addr, ETHER_ADDR_LEN) >> 26) & 0x3f;
 }
 
@@ -426,6 +455,8 @@ smsc_setmulti(struct smsc_softc *sc)
 	uint32_t hashtbl[2] = { 0, 0 };
 	uint32_t hash;
 
+	KASSERT(mutex_owned(>sc_lock));
+
 	if (sc->sc_dying)
 		return;
 
@@ -441,16 +472,19 @@ allmulti:
 		sc->sc_mac_csr &= ~(SMSC_MAC_CSR_PRMS | SMSC_MAC_CSR_MCPAS);
 	}
 
+	ETHER_LOCK(>sc_ec);
 	ETHER_FIRST_MULTI(step, >sc_ec, enm);
 	while (enm != NULL) {
-		if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
-		ETHER_ADDR_LEN) != 0)
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			ETHER_UNLOCK(>sc_ec);
 			goto allmulti;
+		}
 
 		hash = smsc_hash(enm->enm_addrlo);
 		hashtbl[hash >> 5] |= 1 << (hash & 0x1F);
 		ETHER_NEXT_MULTI(step, enm);
 	}
+	ETHER_UNLOCK(>sc_ec);
 
 	/* Debug */
 	if (sc->sc_mac_csr & SMSC_MAC_CSR_HPFILT) {
@@ -528,6 +562,7 @@ done:
 void
 smsc_reset(struct smsc_softc *sc)
 {
+	KASSERT(mutex_owned(>sc_lock));
 	if (sc->sc_dying)
 		return;
 
@@ -600,6 +635,10 @@ smsc_init_locked(struct ifnet *ifp)
 		goto fail3;
 	}
 
+	mutex_enter(>sc_rxlock);
+	mutex_enter(>sc_txlock);
+	sc->sc_stopping = false;
+
 	/* Start up the receive pipe. */
 	for (size_t i = 0; i < SMSC_RX_LIST_CNT; i++) {
 		struct smsc_chain *c = >sc_cdata.rx_chain[i];
@@ -608,7 +647,8 @@ smsc_init_locked(struct ifnet *ifp)
 		usbd_transfer(c->sc_xfer);
 	}
 
-	sc->sc_stopping = false;
+	mutex_exit(>sc_txlock);
+	mutex_exit(>sc_rxlock);
 
 	/* Indicate we are up and running. */
 	ifp->if_flags |= IFF_RUNNING;
@@ -650,20 +690,24 @@ smsc_start_locked(struct ifnet *ifp)
 
 	/* Don't send anything if there is no link or controller is busy. */
 	if ((sc->sc_flags & SMSC_FLAG_LINK) == 0) {
+		smsc_dbg_printf(sc, "%s: no link\n", __func__);
 		return;
 	}
 
-	if ((ifp->if_flags & (IFF_OACTIVE|IFF_RUNNING)) != IFF_RUNNING)
+	if ((ifp->if_flags & (IFF_OACTIVE|IFF_RUNNING)) != IFF_RUNNING) {
+		smsc_dbg_printf(sc, "%s: not running\n", __func__);
 		return;
+	}
 
 	IFQ_POLL(>if_snd, m_head);
 	if (m_head == NULL)
 		return;
 
+	IFQ_DEQUEUE(>if_snd, m_head);
 	if (smsc_encap(sc, m_head, 0)) {
+		m_free(m_head);
 		return;
 	}
-	IFQ_DEQUEUE(>if_snd, m_head);
 
 	bpf_mtap(ifp, m_head);
 
@@ -683,10 +727,19 @@ smsc_tick(void *xsc)
 	if (sc == NULL)
 		return;
 
-	if (sc->sc_dying)
+	mutex_enter(>sc_lock);
+
+	if (sc->sc_dying) {
+		mutex_exit(>sc_lock);
 		return;
+	}
+
+	if (!sc->sc_ttpending) {
+		

CVS commit: [nick-nhusb] src/sys/dev/usb

2017-04-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 15 14:38:44 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c if_smscvar.h

Log Message:
WIP MPification


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.35 -r1.22.2.36 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.3.4.6 -r1.3.4.7 src/sys/dev/usb/if_smscvar.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 14 06:45:21 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp

Log Message:
Fix previous


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.12 -r1.8.4.13 src/sys/dev/usb/TODO.usbmp

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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.12 src/sys/dev/usb/TODO.usbmp:1.8.4.13
--- src/sys/dev/usb/TODO.usbmp:1.8.4.12	Tue Feb 14 06:44:30 2017
+++ src/sys/dev/usb/TODO.usbmp	Tue Feb 14 06:45:21 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.12 2017/02/14 06:44:30 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.13 2017/02/14 06:45:21 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -144,7 +144,7 @@ missing USB_TASKQ_MPSAFE tasks:
   - if_otus.c
   - if_rum.c
   - if_run.c
-  - if_udav.c
+  - if_smsc.c
   - if_udav.c
   - if_upgt.c
   - if_ural.c



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 14 06:45:21 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp

Log Message:
Fix previous


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.12 -r1.8.4.13 src/sys/dev/usb/TODO.usbmp

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 14 06:44:31 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp

Log Message:
More stuff to do...


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.11 -r1.8.4.12 src/sys/dev/usb/TODO.usbmp

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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.11 src/sys/dev/usb/TODO.usbmp:1.8.4.12
--- src/sys/dev/usb/TODO.usbmp:1.8.4.11	Sat Jan 28 12:12:19 2017
+++ src/sys/dev/usb/TODO.usbmp	Tue Feb 14 06:44:30 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.11 2017/01/28 12:12:19 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.12 2017/02/14 06:44:30 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -133,6 +133,29 @@ missing CALLOUT_MPSAFE drivers:
   - ulpt.c
   - uyurex.c
 
+missing USB_TASKQ_MPSAFE tasks:
+  - if_athn_usb.c
+  - if_atu.c
+  - if_aue.c
+  - if_axe.c
+  - if_axen.c
+  - if_cue.c
+  - if_cue.c
+  - if_otus.c
+  - if_rum.c
+  - if_run.c
+  - if_udav.c
+  - if_udav.c
+  - if_upgt.c
+  - if_ural.c
+  - if_url.c
+  - if_urtw.c
+  - if_urtwn.c
+  - if_zyd.c
+  - uatp.c
+  - ukbd.c
+  - umcs.c
+
 driver testing:		STATUS
   - uhub		working
   - uhid		working



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 14 06:44:31 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp

Log Message:
More stuff to do...


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.11 -r1.8.4.12 src/sys/dev/usb/TODO.usbmp

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  6 10:20:01 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Remove useless checks


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.34 -r1.22.2.35 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.34 src/sys/dev/usb/if_smsc.c:1.22.2.35
--- src/sys/dev/usb/if_smsc.c:1.22.2.34	Mon Feb  6 09:08:48 2017
+++ src/sys/dev/usb/if_smsc.c	Mon Feb  6 10:20:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.34 2017/02/06 09:08:48 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.35 2017/02/06 10:20:01 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -318,8 +318,7 @@ smsc_miibus_statchg(struct ifnet *ifp)
 	uint32_t flow;
 	uint32_t afc_cfg;
 
-	if (mii == NULL || ifp == NULL ||
-	(ifp->if_flags & IFF_RUNNING) == 0)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
 	/* Use the MII status to determine link status */
@@ -1236,9 +1235,6 @@ smsc_tick_task(void *xsc)
 
 	struct ifnet * const ifp = >sc_ec.ec_if;
 	struct mii_data	* const mii = >sc_mii;
-	if (mii == NULL)
-		return;
-
 	const int s = splnet();
 
 	mii_tick(mii);



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  6 10:20:01 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Remove useless checks


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.34 -r1.22.2.35 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  6 09:08:48 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Sprinkle const and reduce scope of a couple of variables.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.33 -r1.22.2.34 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.33 src/sys/dev/usb/if_smsc.c:1.22.2.34
--- src/sys/dev/usb/if_smsc.c:1.22.2.33	Mon Feb  6 09:02:38 2017
+++ src/sys/dev/usb/if_smsc.c	Mon Feb  6 09:08:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.33 2017/02/06 09:02:38 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.34 2017/02/06 09:08:48 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1283,14 +1283,11 @@ smsc_unlock_mii(struct smsc_softc *sc)
 void
 smsc_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
 {
-	struct smsc_chain *c = (struct smsc_chain *)priv;
-	struct smsc_softc *sc = c->sc_sc;
-	struct ifnet *ifp = >sc_ec.ec_if;
+	struct smsc_chain * const c = (struct smsc_chain *)priv;
+	struct smsc_softc * const sc = c->sc_sc;
+	struct ifnet * const ifp = >sc_ec.ec_if;
 	u_char *buf = c->sc_buf;
 	uint32_t total_len;
-	uint32_t rxhdr;
-	uint16_t pktlen;
-	struct mbuf *m;
 
 	mutex_enter(>sc_rxlock);
 
@@ -1322,6 +1319,7 @@ smsc_rxeof(struct usbd_xfer *xfer, void 
 	smsc_dbg_printf(sc, "xfer status total_len %d\n", total_len);
 
 	while (total_len != 0) {
+		uint32_t rxhdr;
 		if (total_len < sizeof(rxhdr)) {
 			smsc_dbg_printf(sc, "total_len %d < sizeof(rxhdr) %zu\n",
 			total_len, sizeof(rxhdr));
@@ -1345,7 +1343,7 @@ smsc_rxeof(struct usbd_xfer *xfer, void 
 			goto done;
 		}
 
-		pktlen = (uint16_t)SMSC_RX_STAT_FRM_LENGTH(rxhdr);
+		uint16_t pktlen = (uint16_t)SMSC_RX_STAT_FRM_LENGTH(rxhdr);
 		smsc_dbg_printf(sc, "rxeof total_len %d pktlen %d rxhdr "
 		"0x%08x\n", total_len, pktlen, rxhdr);
 
@@ -1372,7 +1370,7 @@ smsc_rxeof(struct usbd_xfer *xfer, void 
 			goto done;
 		}
 
-		m = smsc_newbuf();
+		struct mbuf *m = smsc_newbuf();
 		if (m == NULL) {
 			smsc_dbg_printf(sc, "smc_newbuf returned NULL\n");
 			ifp->if_ierrors++;



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  6 09:08:48 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Sprinkle const and reduce scope of a couple of variables.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.33 -r1.22.2.34 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  6 09:02:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.32 -r1.22.2.33 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.32 src/sys/dev/usb/if_smsc.c:1.22.2.33
--- src/sys/dev/usb/if_smsc.c:1.22.2.32	Sun Feb  5 13:40:46 2017
+++ src/sys/dev/usb/if_smsc.c	Mon Feb  6 09:02:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.32 2017/02/05 13:40:46 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.33 2017/02/06 09:02:38 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -422,10 +422,10 @@ void
 smsc_setmulti(struct smsc_softc *sc)
 {
 	struct ifnet * const ifp = >sc_ec.ec_if;
-	struct ether_multi	*enm;
-	struct ether_multistep	 step;
-	uint32_t		 hashtbl[2] = { 0, 0 };
-	uint32_t		 hash;
+	struct ether_multi *enm;
+	struct ether_multistep step;
+	uint32_t hashtbl[2] = { 0, 0 };
+	uint32_t hash;
 
 	if (sc->sc_dying)
 		return;
@@ -966,8 +966,8 @@ out:
 int
 smsc_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-	struct smsc_softc	*sc = ifp->if_softc;
-	int			s, error = 0;
+	struct smsc_softc *sc = ifp->if_softc;
+	int s, error = 0;
 
 	if (sc->sc_dying)
 		return EIO;
@@ -1283,14 +1283,14 @@ smsc_unlock_mii(struct smsc_softc *sc)
 void
 smsc_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
 {
-	struct smsc_chain	*c = (struct smsc_chain *)priv;
-	struct smsc_softc	*sc = c->sc_sc;
-	struct ifnet		*ifp = >sc_ec.ec_if;
-	u_char			*buf = c->sc_buf;
-	uint32_t		total_len;
-	uint32_t		rxhdr;
-	uint16_t		pktlen;
-	struct mbuf		*m;
+	struct smsc_chain *c = (struct smsc_chain *)priv;
+	struct smsc_softc *sc = c->sc_sc;
+	struct ifnet *ifp = >sc_ec.ec_if;
+	u_char *buf = c->sc_buf;
+	uint32_t total_len;
+	uint32_t rxhdr;
+	uint16_t pktlen;
+	struct mbuf *m;
 
 	mutex_enter(>sc_rxlock);
 
@@ -1595,7 +1595,7 @@ smsc_rx_list_free(struct smsc_softc *sc)
 struct mbuf *
 smsc_newbuf(void)
 {
-	struct mbuf	*m;
+	struct mbuf *m;
 
 	MGETHDR(m, M_DONTWAIT, MT_DATA);
 	if (m == NULL)



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  6 09:02:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.32 -r1.22.2.33 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  5 09:02:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c umass_scsipi.c

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.19 -r1.149.2.20 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.49.2.9 -r1.49.2.10 src/sys/dev/usb/umass_scsipi.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.149.2.19 src/sys/dev/usb/umass.c:1.149.2.20
--- src/sys/dev/usb/umass.c:1.149.2.19	Sun Jan 29 10:16:09 2017
+++ src/sys/dev/usb/umass.c	Sun Feb  5 09:02:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.149.2.19 2017/01/29 10:16:09 skrll Exp $	*/
+/*	$NetBSD: umass.c,v 1.149.2.20 2017/02/05 09:02:38 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.19 2017/01/29 10:16:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.20 2017/02/05 09:02:38 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -139,6 +139,7 @@ __KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 

Index: src/sys/dev/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.49.2.9 src/sys/dev/usb/umass_scsipi.c:1.49.2.10
--- src/sys/dev/usb/umass_scsipi.c:1.49.2.9	Sun Jan 29 10:16:09 2017
+++ src/sys/dev/usb/umass_scsipi.c	Sun Feb  5 09:02:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.49.2.9 2017/01/29 10:16:09 skrll Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.49.2.10 2017/02/05 09:02:38 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.9 2017/01/29 10:16:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.10 2017/02/05 09:02:38 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: umass_scsipi
 #include 		/* XXX */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  5 09:02:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c umass_scsipi.c

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.19 -r1.149.2.20 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.49.2.9 -r1.49.2.10 src/sys/dev/usb/umass_scsipi.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 08:39:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Wrap a long line


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.30 -r1.22.2.31 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.30 src/sys/dev/usb/if_smsc.c:1.22.2.31
--- src/sys/dev/usb/if_smsc.c:1.22.2.30	Fri Feb  3 07:48:05 2017
+++ src/sys/dev/usb/if_smsc.c	Fri Feb  3 08:39:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.30 2017/02/03 07:48:05 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.31 2017/02/03 08:39:30 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1122,7 +1122,8 @@ smsc_attach(device_t parent, device_t se
 		}
 	}
 
-	aprint_normal_dev(self, "Ethernet address %s\n", ether_sprintf(sc->sc_enaddr));
+	aprint_normal_dev(self, "Ethernet address %s\n",
+	ether_sprintf(sc->sc_enaddr));
 
 	IFQ_SET_READY(>if_snd);
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 08:39:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Wrap a long line


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.30 -r1.22.2.31 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 07:54:44 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_kue.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.81.4.11 -r1.81.4.12 src/sys/dev/usb/if_kue.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/usb/if_kue.c
diff -u src/sys/dev/usb/if_kue.c:1.81.4.11 src/sys/dev/usb/if_kue.c:1.81.4.12
--- src/sys/dev/usb/if_kue.c:1.81.4.11	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_kue.c	Fri Feb  3 07:54:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kue.c,v 1.81.4.11 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_kue.c,v 1.81.4.12 2017/02/03 07:54:44 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.81.4.11 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.81.4.12 2017/02/03 07:54:44 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -500,7 +500,7 @@ kue_attach(device_t parent, device_t sel
 	ifp->if_ioctl = kue_ioctl;
 	ifp->if_start = kue_start;
 	ifp->if_watchdog = kue_watchdog;
-	strncpy(ifp->if_xname, device_xname(sc->kue_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->kue_dev), IFNAMSIZ);
 
 	IFQ_SET_READY(>if_snd);
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 07:54:44 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_kue.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.81.4.11 -r1.81.4.12 src/sys/dev/usb/if_kue.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 07:48:05 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_axe.c if_smsc.c

Log Message:
Simplify.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.67.4.13 -r1.67.4.14 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.22.2.29 -r1.22.2.30 src/sys/dev/usb/if_smsc.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/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.67.4.13 src/sys/dev/usb/if_axe.c:1.67.4.14
--- src/sys/dev/usb/if_axe.c:1.67.4.13	Mon Dec 12 13:15:39 2016
+++ src/sys/dev/usb/if_axe.c	Fri Feb  3 07:48:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.67.4.13 2016/12/12 13:15:39 skrll Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.67.4.14 2017/02/03 07:48:05 skrll Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67.4.13 2016/12/12 13:15:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67.4.14 2017/02/03 07:48:05 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1877,12 +1877,12 @@ axe_ioctl(struct ifnet *ifp, u_long cmd,
 
 	if (error == ENETRESET) {
 		error = 0;
-		if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
-			;
-		else if (ifp->if_flags & IFF_RUNNING) {
-			mutex_enter(>axe_lock);
-			axe_setmulti(sc);
-			mutex_exit(>axe_lock);
+		if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI) {
+			if (ifp->if_flags & IFF_RUNNING) {
+mutex_enter(>axe_lock);
+axe_setmulti(sc);
+mutex_exit(>axe_lock);
+			}
 		}
 	}
 

Index: src/sys/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.29 src/sys/dev/usb/if_smsc.c:1.22.2.30
--- src/sys/dev/usb/if_smsc.c:1.22.2.29	Thu Feb  2 07:40:51 2017
+++ src/sys/dev/usb/if_smsc.c	Fri Feb  3 07:48:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.29 2017/02/02 07:40:51 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.30 2017/02/03 07:48:05 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -978,12 +978,12 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd
 
 	if (error == ENETRESET) {
 		error = 0;
-		if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
-			;
-		else if (ifp->if_flags & IFF_RUNNING) {
-			mutex_enter(>sc_lock);
-			smsc_setmulti(sc);
-			mutex_exit(>sc_lock);
+		if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI) {
+			if (ifp->if_flags & IFF_RUNNING) {
+mutex_enter(>sc_lock);
+smsc_setmulti(sc);
+mutex_exit(>sc_lock);
+			}
 		}
 	}
 	return error;



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  3 07:48:05 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_axe.c if_smsc.c

Log Message:
Simplify.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.67.4.13 -r1.67.4.14 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.22.2.29 -r1.22.2.30 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:40:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Style / more const.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.28 -r1.22.2.29 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:40:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Style / more const.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.28 -r1.22.2.29 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.28 src/sys/dev/usb/if_smsc.c:1.22.2.29
--- src/sys/dev/usb/if_smsc.c:1.22.2.28	Thu Feb  2 07:36:45 2017
+++ src/sys/dev/usb/if_smsc.c	Thu Feb  2 07:40:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.28 2017/02/02 07:36:45 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.29 2017/02/02 07:40:51 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -679,7 +679,7 @@ smsc_start_locked(struct ifnet *ifp)
 void
 smsc_tick(void *xsc)
 {
-	struct smsc_softc *sc = xsc;
+	struct smsc_softc * const sc = xsc;
 
 	if (sc == NULL)
 		return;
@@ -1225,22 +1225,20 @@ smsc_detach(device_t self, int flags)
 void
 smsc_tick_task(void *xsc)
 {
-	int			 s;
-	struct smsc_softc	*sc = xsc;
-	struct ifnet		*ifp;
-	struct mii_data		*mii;
+	struct smsc_softc * const sc = xsc;
 
 	if (sc == NULL)
 		return;
 
 	if (sc->sc_dying)
 		return;
-	ifp = >sc_ec.ec_if;
-	mii = >sc_mii;
+
+	struct ifnet * const ifp = >sc_ec.ec_if;
+	struct mii_data	* const mii = >sc_mii;
 	if (mii == NULL)
 		return;
 
-	s = splnet();
+	const int s = splnet();
 
 	mii_tick(mii);
 	if ((sc->sc_flags & SMSC_FLAG_LINK) == 0)



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:36:45 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.27 -r1.22.2.28 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:36:45 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.27 -r1.22.2.28 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.27 src/sys/dev/usb/if_smsc.c:1.22.2.28
--- src/sys/dev/usb/if_smsc.c:1.22.2.27	Thu Feb  2 07:35:36 2017
+++ src/sys/dev/usb/if_smsc.c	Thu Feb  2 07:36:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.27 2017/02/02 07:35:36 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.28 2017/02/02 07:36:45 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1626,7 +1626,7 @@ smsc_encap(struct smsc_softc *sc, struct
 	 * length of the packet and buffer.
 	 */
 	txhdr = SMSC_TX_CTRL_0_BUF_SIZE(m->m_pkthdr.len) |
-			SMSC_TX_CTRL_0_FIRST_SEG | SMSC_TX_CTRL_0_LAST_SEG;
+	SMSC_TX_CTRL_0_FIRST_SEG | SMSC_TX_CTRL_0_LAST_SEG;
 	txhdr = htole32(txhdr);
 	memcpy(c->sc_buf, , sizeof(txhdr));
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:35:36 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Use lower case


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.26 -r1.22.2.27 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:35:36 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Use lower case


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.26 -r1.22.2.27 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.26 src/sys/dev/usb/if_smsc.c:1.22.2.27
--- src/sys/dev/usb/if_smsc.c:1.22.2.26	Thu Feb  2 07:34:15 2017
+++ src/sys/dev/usb/if_smsc.c	Thu Feb  2 07:35:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.26 2017/02/02 07:34:15 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.27 2017/02/02 07:35:36 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -280,7 +280,7 @@ smsc_miibus_readreg(device_t dev, int ph
 done:
 	smsc_unlock_mii(sc);
 
-	return val & 0x;
+	return val & 0x;
 }
 
 void



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:34:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Remove useless check


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.25 -r1.22.2.26 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:34:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Remove useless check


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.25 -r1.22.2.26 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.25 src/sys/dev/usb/if_smsc.c:1.22.2.26
--- src/sys/dev/usb/if_smsc.c:1.22.2.25	Thu Feb  2 07:23:03 2017
+++ src/sys/dev/usb/if_smsc.c	Thu Feb  2 07:34:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.25 2017/02/02 07:23:03 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.26 2017/02/02 07:34:15 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -474,9 +474,6 @@ smsc_sethwcsum(struct smsc_softc *sc)
 	uint32_t val;
 	int err;
 
-	if (!ifp)
-		return EIO;
-
 	err = smsc_read_reg(sc, SMSC_COE_CTRL, );
 	if (err != 0) {
 		smsc_warn_printf(sc, "failed to read SMSC_COE_CTRL (err=%d)\n",



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:23:03 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Sprinkle some const


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.24 -r1.22.2.25 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.24 src/sys/dev/usb/if_smsc.c:1.22.2.25
--- src/sys/dev/usb/if_smsc.c:1.22.2.24	Thu Feb  2 07:16:03 2017
+++ src/sys/dev/usb/if_smsc.c	Thu Feb  2 07:23:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.24 2017/02/02 07:16:03 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.25 2017/02/02 07:23:03 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -259,7 +259,7 @@ smsc_wait_for_bits(struct smsc_softc *sc
 int
 smsc_miibus_readreg(device_t dev, int phy, int reg)
 {
-	struct smsc_softc *sc = device_private(dev);
+	struct smsc_softc * const sc = device_private(dev);
 	uint32_t addr;
 	uint32_t val = 0;
 
@@ -286,7 +286,7 @@ done:
 void
 smsc_miibus_writereg(device_t dev, int phy, int reg, int val)
 {
-	struct smsc_softc *sc = device_private(dev);
+	struct smsc_softc * const sc = device_private(dev);
 	uint32_t addr;
 
 	if (sc->sc_phyno != phy)
@@ -312,8 +312,8 @@ smsc_miibus_writereg(device_t dev, int p
 void
 smsc_miibus_statchg(struct ifnet *ifp)
 {
-	struct smsc_softc *sc = ifp->if_softc;
-	struct mii_data *mii = >sc_mii;
+	struct smsc_softc * const sc = ifp->if_softc;
+	struct mii_data * const mii = >sc_mii;
 	int err;
 	uint32_t flow;
 	uint32_t afc_cfg;
@@ -386,8 +386,8 @@ smsc_miibus_statchg(struct ifnet *ifp)
 int
 smsc_ifmedia_upd(struct ifnet *ifp)
 {
-	struct smsc_softc *sc = ifp->if_softc;
-	struct mii_data *mii = >sc_mii;
+	struct smsc_softc * const sc = ifp->if_softc;
+	struct mii_data * const mii = >sc_mii;
 	int err;
 
 	if (mii->mii_instance) {
@@ -403,8 +403,8 @@ smsc_ifmedia_upd(struct ifnet *ifp)
 void
 smsc_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
-	struct smsc_softc *sc = ifp->if_softc;
-	struct mii_data *mii = >sc_mii;
+	struct smsc_softc * const sc = ifp->if_softc;
+	struct mii_data * const mii = >sc_mii;
 
 	mii_pollstat(mii);
 
@@ -421,7 +421,7 @@ smsc_hash(uint8_t addr[ETHER_ADDR_LEN])
 void
 smsc_setmulti(struct smsc_softc *sc)
 {
-	struct ifnet		*ifp = >sc_ec.ec_if;
+	struct ifnet * const ifp = >sc_ec.ec_if;
 	struct ether_multi	*enm;
 	struct ether_multistep	 step;
 	uint32_t		 hashtbl[2] = { 0, 0 };
@@ -470,7 +470,7 @@ allmulti:
 int
 smsc_sethwcsum(struct smsc_softc *sc)
 {
-	struct ifnet *ifp = >sc_ec.ec_if;
+	struct ifnet * const ifp = >sc_ec.ec_if;
 	uint32_t val;
 	int err;
 
@@ -545,7 +545,7 @@ smsc_reset(struct smsc_softc *sc)
 int
 smsc_init(struct ifnet *ifp)
 {
-	struct smsc_softc *sc = ifp->if_softc;
+	struct smsc_softc * const sc = ifp->if_softc;
 
 	mutex_enter(>sc_lock);
 	int ret = smsc_init_locked(ifp);



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:23:03 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Sprinkle some const


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.24 -r1.22.2.25 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:16:03 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Add a TAB


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.23 -r1.22.2.24 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.23 src/sys/dev/usb/if_smsc.c:1.22.2.24
--- src/sys/dev/usb/if_smsc.c:1.22.2.23	Tue Jan 31 17:09:08 2017
+++ src/sys/dev/usb/if_smsc.c	Thu Feb  2 07:16:03 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.23 2017/01/31 17:09:08 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.24 2017/02/02 07:16:03 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
-/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
+/*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
 /*-
  * Copyright (c) 2012
  *	Ben Gray .



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  2 07:16:03 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Add a TAB


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.23 -r1.22.2.24 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  1 07:55:08 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_otus.c if_zyd.c

Log Message:
Be more careful about malloc returning NULL


To generate a diff of this commit:
cvs rdiff -u -r1.25.6.9 -r1.25.6.10 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.36.14.13 -r1.36.14.14 src/sys/dev/usb/if_zyd.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/usb/if_otus.c
diff -u src/sys/dev/usb/if_otus.c:1.25.6.9 src/sys/dev/usb/if_otus.c:1.25.6.10
--- src/sys/dev/usb/if_otus.c:1.25.6.9	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_otus.c	Wed Feb  1 07:55:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_otus.c,v 1.25.6.9 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_otus.c,v 1.25.6.10 2017/02/01 07:55:08 skrll Exp $	*/
 /*	$OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.6.9 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.6.10 2017/02/01 07:55:08 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1493,7 +1493,7 @@ otus_node_alloc(struct ieee80211_node_ta
 	DPRINTFN(DBG_FN, DBG_NO_SC, "\n");
 
 	on = malloc(sizeof(*on), M_DEVBUF, M_NOWAIT | M_ZERO);
-	return >ni;
+	return on ? >ni : NULL;
 }
 
 Static int

Index: src/sys/dev/usb/if_zyd.c
diff -u src/sys/dev/usb/if_zyd.c:1.36.14.13 src/sys/dev/usb/if_zyd.c:1.36.14.14
--- src/sys/dev/usb/if_zyd.c:1.36.14.13	Sat Jan 28 12:12:19 2017
+++ src/sys/dev/usb/if_zyd.c	Wed Feb  1 07:55:08 2017
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $	*/
-/*	$NetBSD: if_zyd.c,v 1.36.14.13 2017/01/28 12:12:19 skrll Exp $	*/
+/*	$NetBSD: if_zyd.c,v 1.36.14.14 2017/02/01 07:55:08 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini 
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.36.14.13 2017/01/28 12:12:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.36.14.14 2017/02/01 07:55:08 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -672,8 +672,7 @@ zyd_node_alloc(struct ieee80211_node_tab
 	struct zyd_node *zn;
 
 	zn = malloc(sizeof(struct zyd_node), M_80211_NODE, M_NOWAIT | M_ZERO);
-
-	return >ni;
+	return zn ? >ni : NULL;
 }
 
 Static int



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  1 07:55:08 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_otus.c if_zyd.c

Log Message:
Be more careful about malloc returning NULL


To generate a diff of this commit:
cvs rdiff -u -r1.25.6.9 -r1.25.6.10 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.36.14.13 -r1.36.14.14 src/sys/dev/usb/if_zyd.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 17:09:08 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Minor code re-org.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.22 -r1.22.2.23 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.22 src/sys/dev/usb/if_smsc.c:1.22.2.23
--- src/sys/dev/usb/if_smsc.c:1.22.2.22	Tue Jan 31 16:52:39 2017
+++ src/sys/dev/usb/if_smsc.c	Tue Jan 31 17:09:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.22 2017/01/31 16:52:39 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.23 2017/01/31 17:09:08 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1032,14 +1032,8 @@ smsc_attach(device_t parent, device_t se
 		", err=%s\n", usbd_errstr(err));
 		return;
 	}
-	/* Setup the endpoints for the SMSC LAN95xx device(s) */
-	usb_init_task(>sc_tick_task, smsc_tick_task, sc, 0);
-
-	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sc_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
-	mutex_init(>sc_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB);
-	mutex_init(>sc_mii_lock, MUTEX_DEFAULT, IPL_NONE);
 
+	/* Setup the endpoints for the SMSC LAN95xx device(s) */
 	err = usbd_device2interface_handle(dev, SMSC_IFACE_IDX, >sc_iface);
 	if (err) {
 		aprint_error_dev(self, "getting interface handle failed\n");
@@ -1072,6 +1066,13 @@ smsc_attach(device_t parent, device_t se
 		}
 	}
 
+	usb_init_task(>sc_tick_task, smsc_tick_task, sc, 0);
+
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
+	mutex_init(>sc_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB);
+	mutex_init(>sc_mii_lock, MUTEX_DEFAULT, IPL_NONE);
+
 	ifp = >sc_ec.ec_if;
 	ifp->if_softc = sc;
 	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 17:09:08 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Minor code re-org.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.22 -r1.22.2.23 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 16:52:40 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Remove useless lines.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.21 -r1.22.2.22 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 16:52:40 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Remove useless lines.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.21 -r1.22.2.22 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.21 src/sys/dev/usb/if_smsc.c:1.22.2.22
--- src/sys/dev/usb/if_smsc.c:1.22.2.21	Tue Jan 31 11:41:14 2017
+++ src/sys/dev/usb/if_smsc.c	Tue Jan 31 16:52:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.21 2017/01/31 11:41:14 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.22 2017/01/31 16:52:39 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -367,7 +367,6 @@ smsc_miibus_statchg(struct ifnet *ifp)
 			afc_cfg |= 0xf;
 		else
 			afc_cfg &= ~0xf;
-
 	} else {
 		smsc_dbg_printf(sc, "half duplex operation\n");
 		sc->sc_mac_csr &= ~SMSC_MAC_CSR_FDPX;
@@ -710,8 +709,6 @@ smsc_stop_locked(struct ifnet *ifp, int 
 	struct smsc_softc * const sc = ifp->if_softc;
 	usbd_status err;
 
-//	smsc_reset(sc);
-
 	KASSERT(mutex_owned(>sc_lock));
 	mutex_enter(>sc_rxlock);
 	mutex_enter(>sc_txlock);
@@ -973,7 +970,6 @@ int
 smsc_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 	struct smsc_softc	*sc = ifp->if_softc;
-// 	struct ifreq /*const*/	*ifr = data;
 	int			s, error = 0;
 
 	if (sc->sc_dying)



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 11:41:14 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c if_smscvar.h

Log Message:
G/C sc_stop_task


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.20 -r1.22.2.21 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.3.4.5 -r1.3.4.6 src/sys/dev/usb/if_smscvar.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/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.20 src/sys/dev/usb/if_smsc.c:1.22.2.21
--- src/sys/dev/usb/if_smsc.c:1.22.2.20	Tue Jan 31 11:39:46 2017
+++ src/sys/dev/usb/if_smsc.c	Tue Jan 31 11:41:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.20 2017/01/31 11:39:46 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.21 2017/01/31 11:41:14 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1038,7 +1038,6 @@ smsc_attach(device_t parent, device_t se
 	}
 	/* Setup the endpoints for the SMSC LAN95xx device(s) */
 	usb_init_task(>sc_tick_task, smsc_tick_task, sc, 0);
-	usb_init_task(>sc_stop_task, (void (*)(void *))smsc_stop, sc, 0);
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
@@ -1185,7 +1184,6 @@ smsc_detach(device_t self, int flags)
 	 * in the same thread as detach.
 	 */
 	usb_rem_task(sc->sc_udev, >sc_tick_task);
-	usb_rem_task(sc->sc_udev, >sc_stop_task);
 
 	s = splusb();
 

Index: src/sys/dev/usb/if_smscvar.h
diff -u src/sys/dev/usb/if_smscvar.h:1.3.4.5 src/sys/dev/usb/if_smscvar.h:1.3.4.6
--- src/sys/dev/usb/if_smscvar.h:1.3.4.5	Wed Dec 28 08:53:56 2016
+++ src/sys/dev/usb/if_smscvar.h	Tue Jan 31 11:41:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smscvar.h,v 1.3.4.5 2016/12/28 08:53:56 skrll Exp $	*/
+/*	$NetBSD: if_smscvar.h,v 1.3.4.6 2017/01/31 11:41:14 skrll Exp $	*/
 
 /*	$OpenBSD: if_smscreg.h,v 1.2 2012/09/27 12:38:11 jsg Exp $	*/
 /*-
@@ -78,7 +78,6 @@ struct smsc_softc {
 	int			sc_refcnt;
 
 	struct usb_task		sc_tick_task;
-	struct usb_task		sc_stop_task;
 
 	int			sc_ed[SMSC_ENDPT_MAX];
 	struct usbd_pipe *	sc_ep[SMSC_ENDPT_MAX];



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 11:41:14 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c if_smscvar.h

Log Message:
G/C sc_stop_task


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.20 -r1.22.2.21 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.3.4.5 -r1.3.4.6 src/sys/dev/usb/if_smscvar.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 11:39:46 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Style / indentation


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.19 -r1.22.2.20 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 11:39:46 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
Style / indentation


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.19 -r1.22.2.20 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.19 src/sys/dev/usb/if_smsc.c:1.22.2.20
--- src/sys/dev/usb/if_smsc.c:1.22.2.19	Tue Jan 31 08:30:38 2017
+++ src/sys/dev/usb/if_smsc.c	Tue Jan 31 11:39:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.19 2017/01/31 08:30:38 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.20 2017/01/31 11:39:46 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1116,16 +1116,17 @@ smsc_attach(device_t parent, device_t se
 		KASSERT(prop_data_size(eaprop) == ETHER_ADDR_LEN);
 		memcpy(sc->sc_enaddr, prop_data_data_nocopy(eaprop),
 		ETHER_ADDR_LEN);
-	} else
-	/* Check if there is already a MAC address in the register */
-	if ((smsc_read_reg(sc, SMSC_MAC_ADDRL, _l) == 0) &&
-	(smsc_read_reg(sc, SMSC_MAC_ADDRH, _h) == 0)) {
-		sc->sc_enaddr[5] = (uint8_t)((mac_h >> 8) & 0xff);
-		sc->sc_enaddr[4] = (uint8_t)((mac_h) & 0xff);
-		sc->sc_enaddr[3] = (uint8_t)((mac_l >> 24) & 0xff);
-		sc->sc_enaddr[2] = (uint8_t)((mac_l >> 16) & 0xff);
-		sc->sc_enaddr[1] = (uint8_t)((mac_l >> 8) & 0xff);
-		sc->sc_enaddr[0] = (uint8_t)((mac_l) & 0xff);
+	} else {
+		/* Check if there is already a MAC address in the register */
+		if ((smsc_read_reg(sc, SMSC_MAC_ADDRL, _l) == 0) &&
+		(smsc_read_reg(sc, SMSC_MAC_ADDRH, _h) == 0)) {
+			sc->sc_enaddr[5] = (uint8_t)((mac_h >> 8) & 0xff);
+			sc->sc_enaddr[4] = (uint8_t)((mac_h) & 0xff);
+			sc->sc_enaddr[3] = (uint8_t)((mac_l >> 24) & 0xff);
+			sc->sc_enaddr[2] = (uint8_t)((mac_l >> 16) & 0xff);
+			sc->sc_enaddr[1] = (uint8_t)((mac_l >> 8) & 0xff);
+			sc->sc_enaddr[0] = (uint8_t)((mac_l) & 0xff);
+		}
 	}
 
 	aprint_normal_dev(self, "Ethernet address %s\n", ether_sprintf(sc->sc_enaddr));



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 08:30:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.18 -r1.22.2.19 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.22.2.18 src/sys/dev/usb/if_smsc.c:1.22.2.19
--- src/sys/dev/usb/if_smsc.c:1.22.2.18	Wed Dec 28 09:45:16 2016
+++ src/sys/dev/usb/if_smsc.c	Tue Jan 31 08:30:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.22.2.18 2016/12/28 09:45:16 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.22.2.19 2017/01/31 08:30:38 skrll Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -67,17 +67,15 @@
 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
 #include 
-#include 
 #include 
-#include 
-
-#include 
-
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 08:30:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_smsc.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.18 -r1.22.2.19 src/sys/dev/usb/if_smsc.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 07:25:34 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.84 -r1.254.2.85 src/sys/dev/usb/ohci.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 07:25:34 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.84 -r1.254.2.85 src/sys/dev/usb/ohci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.84 src/sys/dev/usb/ohci.c:1.254.2.85
--- src/sys/dev/usb/ohci.c:1.254.2.84	Wed Dec 28 10:44:27 2016
+++ src/sys/dev/usb/ohci.c	Tue Jan 31 07:25:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.84 2016/12/28 10:44:27 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.85 2017/01/31 07:25:34 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.84 2016/12/28 10:44:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.85 2017/01/31 07:25:34 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -626,22 +626,24 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 		KASSERT(next != cur);
 
 		curlen = 0;
-		ohci_physaddr_t sdataphys = DMAADDR(dma, curoffs);
+		const ohci_physaddr_t sdataphys = DMAADDR(dma, curoffs);
 		ohci_physaddr_t edataphys = DMAADDR(dma, curoffs + len - 1);
 
-		ohci_physaddr_t sphyspg = OHCI_PAGE(sdataphys);
+		const ohci_physaddr_t sphyspg = OHCI_PAGE(sdataphys);
 		ohci_physaddr_t ephyspg = OHCI_PAGE(edataphys);
 		/*
 		 * The OHCI hardware can handle at most one page
 		 * crossing per TD
 		 */
 		curlen = len;
-		if (!(sphyspg == ephyspg || sphyspg + 1 == ephyspg)) {
+		if (sphyspg != ephyspg &&
+		sphyspg + OHCI_PAGE_SIZE != ephyspg) {
 			/* must use multiple TDs, fill as much as possible. */
 			curlen = 2 * OHCI_PAGE_SIZE -
-			(sdataphys & (OHCI_PAGE_SIZE - 1));
+			OHCI_PAGE_OFFSET(sdataphys);
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
+			edataphys = DMAADDR(dma, curoffs + curlen - 1);
 		}
 		KASSERT(curlen != 0);
 		DPRINTFN(4, "sdataphys=0x%08x edataphys=0x%08x "



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 15:58:14 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: auvitek_video.c if_run.c slurm.c uark.c
uatp.c uberry.c ubsa.c udsir.c uhso.c ukyopon.c usbdi_util.c
uslsa.c uyap.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.6.32.5 -r1.6.32.6 src/sys/dev/usb/auvitek_video.c
cvs rdiff -u -r1.10.6.12 -r1.10.6.13 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.1.18.5 -r1.1.18.6 src/sys/dev/usb/slurm.c
cvs rdiff -u -r1.6.14.8 -r1.6.14.9 src/sys/dev/usb/uark.c
cvs rdiff -u -r1.10.4.8 -r1.10.4.9 src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.9.14.5 -r1.9.14.6 src/sys/dev/usb/uberry.c
cvs rdiff -u -r1.30.16.9 -r1.30.16.10 src/sys/dev/usb/ubsa.c
cvs rdiff -u -r1.1.14.10 -r1.1.14.11 src/sys/dev/usb/udsir.c
cvs rdiff -u -r1.17.2.12 -r1.17.2.13 src/sys/dev/usb/uhso.c
cvs rdiff -u -r1.16.16.8 -r1.16.16.9 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.63.2.14 -r1.63.2.15 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.19.6.6 -r1.19.6.7 src/sys/dev/usb/uslsa.c
cvs rdiff -u -r1.19.24.4 -r1.19.24.5 src/sys/dev/usb/uyap.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 15:58:14 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: auvitek_video.c if_run.c slurm.c uark.c
uatp.c uberry.c ubsa.c udsir.c uhso.c ukyopon.c usbdi_util.c
uslsa.c uyap.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.6.32.5 -r1.6.32.6 src/sys/dev/usb/auvitek_video.c
cvs rdiff -u -r1.10.6.12 -r1.10.6.13 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.1.18.5 -r1.1.18.6 src/sys/dev/usb/slurm.c
cvs rdiff -u -r1.6.14.8 -r1.6.14.9 src/sys/dev/usb/uark.c
cvs rdiff -u -r1.10.4.8 -r1.10.4.9 src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.9.14.5 -r1.9.14.6 src/sys/dev/usb/uberry.c
cvs rdiff -u -r1.30.16.9 -r1.30.16.10 src/sys/dev/usb/ubsa.c
cvs rdiff -u -r1.1.14.10 -r1.1.14.11 src/sys/dev/usb/udsir.c
cvs rdiff -u -r1.17.2.12 -r1.17.2.13 src/sys/dev/usb/uhso.c
cvs rdiff -u -r1.16.16.8 -r1.16.16.9 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.63.2.14 -r1.63.2.15 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.19.6.6 -r1.19.6.7 src/sys/dev/usb/uslsa.c
cvs rdiff -u -r1.19.24.4 -r1.19.24.5 src/sys/dev/usb/uyap.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/usb/auvitek_video.c
diff -u src/sys/dev/usb/auvitek_video.c:1.6.32.5 src/sys/dev/usb/auvitek_video.c:1.6.32.6
--- src/sys/dev/usb/auvitek_video.c:1.6.32.5	Mon Dec 28 09:26:33 2015
+++ src/sys/dev/usb/auvitek_video.c	Sun Jan 29 15:58:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_video.c,v 1.6.32.5 2015/12/28 09:26:33 skrll Exp $ */
+/* $NetBSD: auvitek_video.c,v 1.6.32.6 2017/01/29 15:58:14 skrll Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.6.32.5 2015/12/28 09:26:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.6.32.6 2017/01/29 15:58:14 skrll Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ auvitek_video_attach(struct auvitek_soft
 
 	auvitek_video_rescan(sc, NULL, NULL);
 
-	return (sc->sc_videodev != NULL);
+	return sc->sc_videodev != NULL;
 }
 
 int

Index: src/sys/dev/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.10.6.12 src/sys/dev/usb/if_run.c:1.10.6.13
--- src/sys/dev/usb/if_run.c:1.10.6.12	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_run.c	Sun Jan 29 15:58:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.10.6.12 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_run.c,v 1.10.6.13 2017/01/29 15:58:14 skrll Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.10.6.12 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.10.6.13 2017/01/29 15:58:14 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1110,7 +1110,7 @@ run_efuse_read(struct run_softc *sc, uin
 static int
 run_efuse_read_2(struct run_softc *sc, uint16_t addr, uint16_t *val)
 {
-	return (run_efuse_read(sc, addr, val, 2));
+	return run_efuse_read(sc, addr, val, 2);
 }
 
 static int
@@ -4100,7 +4100,7 @@ run_rt3593_rf_init(struct run_softc *sc)
 
 	run_read(sc, RT3070_OPT_14, );
 	run_write(sc, RT3070_OPT_14, tmp | 1);
-	return (0);
+	return 0;
 }
 
 static int
@@ -4165,7 +4165,7 @@ run_rt5390_rf_init(struct run_softc *sc)
 
 	run_read(sc, RT3070_OPT_14, );
 	run_write(sc, RT3070_OPT_14, tmp | 1);
-	return (0);
+	return 0;
 }
 
 static int
@@ -4486,7 +4486,7 @@ run_adjust_freq_offset(struct run_softc 
 	if (tmp != rf)
 		run_mcu_cmd(sc, 0x74, (tmp << 8 ) | rf);
 
-	return (0);
+	return 0;
 }
 
 static int

Index: src/sys/dev/usb/slurm.c
diff -u src/sys/dev/usb/slurm.c:1.1.18.5 src/sys/dev/usb/slurm.c:1.1.18.6
--- src/sys/dev/usb/slurm.c:1.1.18.5	Sat Jul  9 20:25:16 2016
+++ src/sys/dev/usb/slurm.c	Sun Jan 29 15:58:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: slurm.c,v 1.1.18.5 2016/07/09 20:25:16 skrll Exp $ */
+/*	$NetBSD: slurm.c,v 1.1.18.6 2017/01/29 15:58:14 skrll Exp $ */
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: slurm.c,v 1.1.18.5 2016/07/09 20:25:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: slurm.c,v 1.1.18.6 2017/01/29 15:58:14 skrll Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ slurm_detach(device_t self, int flags)
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
 
-	return (rv);
+	return rv;
 }
 
 static int

Index: src/sys/dev/usb/uark.c
diff -u src/sys/dev/usb/uark.c:1.6.14.8 src/sys/dev/usb/uark.c:1.6.14.9
--- src/sys/dev/usb/uark.c:1.6.14.8	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/uark.c	Sun Jan 29 15:58:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uark.c,v 1.6.14.8 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: uark.c,v 1.6.14.9 2017/01/29 15:58:14 skrll Exp $	*/
 /*	$OpenBSD: uark.c,v 1.13 2009/10/13 19:33:17 pirofti Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, 

CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 11:27:52 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: uyurex.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.9.14.10 -r1.9.14.11 src/sys/dev/usb/uyurex.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/usb/uyurex.c
diff -u src/sys/dev/usb/uyurex.c:1.9.14.10 src/sys/dev/usb/uyurex.c:1.9.14.11
--- src/sys/dev/usb/uyurex.c:1.9.14.10	Sun Jan 29 09:55:21 2017
+++ src/sys/dev/usb/uyurex.c	Sun Jan 29 11:27:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uyurex.c,v 1.9.14.10 2017/01/29 09:55:21 skrll Exp $ */
+/*	$NetBSD: uyurex.c,v 1.9.14.11 2017/01/29 11:27:52 skrll Exp $ */
 /*	$OpenBSD: uyurex.c,v 1.3 2010/03/04 03:47:22 deraadt Exp $ */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.10 2017/01/29 09:55:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.11 2017/01/29 11:27:52 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -125,7 +125,7 @@ uyurex_match(device_t parent, cfdata_t m
 	if (uyurex_lookup(uha->uiaa->uiaa_vendor, uha->uiaa->uiaa_product) == NULL)
 		return UMATCH_NONE;
 
-	return (UMATCH_VENDOR_PRODUCT);
+	return UMATCH_VENDOR_PRODUCT;
 }
 
 void
@@ -224,7 +224,7 @@ uyurex_detach(device_t self, int flags)
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 	sc->sc_hdev.sc_dev);
 
-	return (rv);
+	return rv;
 }
 
 int
@@ -237,7 +237,7 @@ uyurex_activate(device_t self, enum deva
 		sc->sc_dying = 1;
 		break;
 	}
-	return (0);
+	return 0;
 }
 
 void



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 11:27:52 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: uyurex.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.9.14.10 -r1.9.14.11 src/sys/dev/usb/uyurex.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:16:09 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c umass_isdata.c umass_scsipi.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.18 -r1.149.2.19 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.30.2.7 -r1.30.2.8 src/sys/dev/usb/umass_isdata.c
cvs rdiff -u -r1.49.2.8 -r1.49.2.9 src/sys/dev/usb/umass_scsipi.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.149.2.18 src/sys/dev/usb/umass.c:1.149.2.19
--- src/sys/dev/usb/umass.c:1.149.2.18	Sun Jan 29 10:10:30 2017
+++ src/sys/dev/usb/umass.c	Sun Jan 29 10:16:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.149.2.18 2017/01/29 10:10:30 skrll Exp $	*/
+/*	$NetBSD: umass.c,v 1.149.2.19 2017/01/29 10:16:09 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.18 2017/01/29 10:10:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.19 2017/01/29 10:16:09 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -135,12 +135,12 @@ __KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.
 #include "wd.h"
 
 #include 
-#include 
-#include 
-#include 
 #include 
+#include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 

Index: src/sys/dev/usb/umass_isdata.c
diff -u src/sys/dev/usb/umass_isdata.c:1.30.2.7 src/sys/dev/usb/umass_isdata.c:1.30.2.8
--- src/sys/dev/usb/umass_isdata.c:1.30.2.7	Sun Jan 29 10:10:30 2017
+++ src/sys/dev/usb/umass_isdata.c	Sun Jan 29 10:16:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_isdata.c,v 1.30.2.7 2017/01/29 10:10:30 skrll Exp $	*/
+/*	$NetBSD: umass_isdata.c,v 1.30.2.8 2017/01/29 10:16:09 skrll Exp $	*/
 
 /*
  * TODO:
@@ -37,21 +37,21 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.30.2.7 2017/01/29 10:10:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.30.2.8 2017/01/29 10:16:09 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
 #endif
 
 #include 
-#include 
-#include 
-#include 
 #include 
+#include 
 #include 
-#include 
 #include 
+#include 
 #include 
+#include 
+#include 
 
 #include 
 #include 

Index: src/sys/dev/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.49.2.8 src/sys/dev/usb/umass_scsipi.c:1.49.2.9
--- src/sys/dev/usb/umass_scsipi.c:1.49.2.8	Sun Jan 29 10:13:51 2017
+++ src/sys/dev/usb/umass_scsipi.c	Sun Jan 29 10:16:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.49.2.8 2017/01/29 10:13:51 skrll Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.49.2.9 2017/01/29 10:16:09 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.8 2017/01/29 10:13:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.9 2017/01/29 10:16:09 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -41,15 +41,16 @@ __KERNEL_RCSID(0, "$NetBSD: umass_scsipi
 #include "scsibus.h"
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
+#include 
 #include 
+#include 		/* XXX */
 #include 
+#include 
 #include 
 #include 
+#include 
 
 /* SCSI & ATAPI */
 #include 
@@ -64,7 +65,6 @@ __KERNEL_RCSID(0, "$NetBSD: umass_scsipi
 #include 
 #include 
 
-#include 		/* XXX */
 #include 	/* XXX */
 
 /* USB */



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:16:09 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c umass_isdata.c umass_scsipi.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.18 -r1.149.2.19 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.30.2.7 -r1.30.2.8 src/sys/dev/usb/umass_isdata.c
cvs rdiff -u -r1.49.2.8 -r1.49.2.9 src/sys/dev/usb/umass_scsipi.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:13:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass_scsipi.c

Log Message:
The scsipi layer still uses malloc(9)


To generate a diff of this commit:
cvs rdiff -u -r1.49.2.7 -r1.49.2.8 src/sys/dev/usb/umass_scsipi.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/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.49.2.7 src/sys/dev/usb/umass_scsipi.c:1.49.2.8
--- src/sys/dev/usb/umass_scsipi.c:1.49.2.7	Sun Jan 29 10:10:30 2017
+++ src/sys/dev/usb/umass_scsipi.c	Sun Jan 29 10:13:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.49.2.7 2017/01/29 10:10:30 skrll Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.49.2.8 2017/01/29 10:13:51 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.7 2017/01/29 10:10:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.8 2017/01/29 10:13:51 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: umass_scsipi
 #include 
 #include 
 #include 
+#include 
 
 /* SCSI & ATAPI */
 #include 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:13:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass_scsipi.c

Log Message:
The scsipi layer still uses malloc(9)


To generate a diff of this commit:
cvs rdiff -u -r1.49.2.7 -r1.49.2.8 src/sys/dev/usb/umass_scsipi.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:10:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c umass_isdata.c umass_scsipi.c

Log Message:
Convert to kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.17 -r1.149.2.18 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.30.2.6 -r1.30.2.7 src/sys/dev/usb/umass_isdata.c
cvs rdiff -u -r1.49.2.6 -r1.49.2.7 src/sys/dev/usb/umass_scsipi.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.149.2.17 src/sys/dev/usb/umass.c:1.149.2.18
--- src/sys/dev/usb/umass.c:1.149.2.17	Sun Jan 29 10:08:38 2017
+++ src/sys/dev/usb/umass.c	Sun Jan 29 10:10:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.149.2.17 2017/01/29 10:08:38 skrll Exp $	*/
+/*	$NetBSD: umass.c,v 1.149.2.18 2017/01/29 10:10:30 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.17 2017/01/29 10:08:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.18 2017/01/29 10:10:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -140,7 +140,6 @@ __KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -822,7 +821,7 @@ umass_detach(device_t self, int flags)
 	if (scbus != NULL) {
 		if (scbus->sc_child != NULL)
 			rv = config_detach(scbus->sc_child, flags);
-		free(scbus, M_DEVBUF);
+		kmem_free(scbus, sizeof(*scbus));
 		sc->bus = NULL;
 	}
 

Index: src/sys/dev/usb/umass_isdata.c
diff -u src/sys/dev/usb/umass_isdata.c:1.30.2.6 src/sys/dev/usb/umass_isdata.c:1.30.2.7
--- src/sys/dev/usb/umass_isdata.c:1.30.2.6	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/umass_isdata.c	Sun Jan 29 10:10:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_isdata.c,v 1.30.2.6 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: umass_isdata.c,v 1.30.2.7 2017/01/29 10:10:30 skrll Exp $	*/
 
 /*
  * TODO:
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.30.2.6 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.30.2.7 2017/01/29 10:10:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: umass_isdata
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -188,7 +188,7 @@ umass_isdata_attach(struct umass_softc *
 	struct uisdata_softc *scbus;
 	struct isd200_config *cf;
 
-	scbus = malloc(sizeof(*scbus), M_DEVBUF, M_WAITOK | M_ZERO);
+	scbus = kmem_zalloc(sizeof(*scbus), KM_SLEEP);
 	sc->bus = >base;
 	cf = >sc_isd_config;
 
@@ -201,7 +201,7 @@ umass_isdata_attach(struct umass_softc *
 	err = usbd_do_request(sc->sc_udev, , cf);
 	if (err) {
 		sc->bus = NULL;
-		free(scbus, M_DEVBUF);
+		kmem_free(scbus, sizeof(*scbus));
 		return EIO;
 	}
 	DPRINTF(("umass_wd_attach info:\n  EventNotification=0x%02x "

Index: src/sys/dev/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.49.2.6 src/sys/dev/usb/umass_scsipi.c:1.49.2.7
--- src/sys/dev/usb/umass_scsipi.c:1.49.2.6	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/umass_scsipi.c	Sun Jan 29 10:10:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.49.2.6 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.49.2.7 2017/01/29 10:10:30 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.6 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.49.2.7 2017/01/29 10:10:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -49,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: umass_scsipi
 #include 
 #include 
 #include 
-#include 
 
 /* SCSI & ATAPI */
 #include 
@@ -180,7 +179,7 @@ umass_scsipi_setup(struct umass_softc *s
 {
 	struct umass_scsipi_softc *scbus;
 
-	scbus = malloc(sizeof(*scbus), M_DEVBUF, M_WAITOK | M_ZERO);
+	scbus = kmem_zalloc(sizeof(*scbus), KM_SLEEP);
 	sc->bus = >base;
 
 	/* Only use big commands for USB SCSI devices. */



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:10:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c umass_isdata.c umass_scsipi.c

Log Message:
Convert to kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.17 -r1.149.2.18 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.30.2.6 -r1.30.2.7 src/sys/dev/usb/umass_isdata.c
cvs rdiff -u -r1.49.2.6 -r1.49.2.7 src/sys/dev/usb/umass_scsipi.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 10:08:38 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: umass.c

Log Message:
Fix a comment


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.16 -r1.149.2.17 src/sys/dev/usb/umass.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/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.149.2.16 src/sys/dev/usb/umass.c:1.149.2.17
--- src/sys/dev/usb/umass.c:1.149.2.16	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/umass.c	Sun Jan 29 10:08:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.149.2.16 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: umass.c,v 1.149.2.17 2017/01/29 10:08:38 skrll Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -108,8 +108,8 @@
  * umass_*_reset.
  *
  * The reason for doing this is a) CAM performs a lot better this way and b) it
- * avoids using tsleep from interrupt context (for example after a failed
- * transfer).
+ * avoids sleeping in interrupt context which is prohibited (for example after a
+ * failed transfer).
  */
 
 /*
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.16 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.149.2.17 2017/01/29 10:08:38 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 09:55:21 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: uyurex.c

Log Message:
Another tsleep bites the dust


To generate a diff of this commit:
cvs rdiff -u -r1.9.14.9 -r1.9.14.10 src/sys/dev/usb/uyurex.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/usb/uyurex.c
diff -u src/sys/dev/usb/uyurex.c:1.9.14.9 src/sys/dev/usb/uyurex.c:1.9.14.10
--- src/sys/dev/usb/uyurex.c:1.9.14.9	Sat Jan 28 10:15:01 2017
+++ src/sys/dev/usb/uyurex.c	Sun Jan 29 09:55:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uyurex.c,v 1.9.14.9 2017/01/28 10:15:01 skrll Exp $ */
+/*	$NetBSD: uyurex.c,v 1.9.14.10 2017/01/29 09:55:21 skrll Exp $ */
 /*	$OpenBSD: uyurex.c,v 1.3 2010/03/04 03:47:22 deraadt Exp $ */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.9 2017/01/28 10:15:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.10 2017/01/29 09:55:21 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -341,7 +341,7 @@ uyurex_set_mode(struct uyurex_softc *sc,
 	}
 
 	/* wait ack */
-	tsleep(>sc_sme, 0, "uyurex", (1000*hz+999)/1000 + 1);
+	kpause("uyurexsm", false, (1000*hz+999)/1000 + 1, NULL);
 }
 
 void



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan 29 09:55:21 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: uyurex.c

Log Message:
Another tsleep bites the dust


To generate a diff of this commit:
cvs rdiff -u -r1.9.14.9 -r1.9.14.10 src/sys/dev/usb/uyurex.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 12:12:20 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp if_zyd.c if_zydreg.h

Log Message:
Remove tsleep/wakeup from if_zyd


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.10 -r1.8.4.11 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.36.14.12 -r1.36.14.13 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.7.16.4 -r1.7.16.5 src/sys/dev/usb/if_zydreg.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/dev/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.10 src/sys/dev/usb/TODO.usbmp:1.8.4.11
--- src/sys/dev/usb/TODO.usbmp:1.8.4.10	Sat Jan 28 12:04:17 2017
+++ src/sys/dev/usb/TODO.usbmp	Sat Jan 28 12:12:19 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.10 2017/01/28 12:04:17 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.11 2017/01/28 12:12:19 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -97,7 +97,6 @@ splusb drivers:
 
 wakeup/tsleep drivers:
   - if_run.c
-  - if_zyd.c
   - ucycom.c
   - udsir.c
   - uirda.c

Index: src/sys/dev/usb/if_zyd.c
diff -u src/sys/dev/usb/if_zyd.c:1.36.14.12 src/sys/dev/usb/if_zyd.c:1.36.14.13
--- src/sys/dev/usb/if_zyd.c:1.36.14.12	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_zyd.c	Sat Jan 28 12:12:19 2017
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $	*/
-/*	$NetBSD: if_zyd.c,v 1.36.14.12 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_zyd.c,v 1.36.14.13 2017/01/28 12:12:19 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini 
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.36.14.12 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.36.14.13 2017/01/28 12:12:19 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -343,6 +343,8 @@ zyd_attach(device_t parent, device_t sel
 	IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
+	cv_init(>sc_cmdcv, "zydcmd");
 	SIMPLEQ_INIT(>sc_rqh);
 
 	/* defer configrations after file system is ready to load firmware */
@@ -466,12 +468,11 @@ zyd_detach(device_t self, int flags)
 	struct zyd_softc *sc = device_private(self);
 	struct ieee80211com *ic = >sc_ic;
 	struct ifnet *ifp = >sc_if;
-	int s;
 
 	if (!sc->attached)
 		return 0;
 
-	s = splusb();
+	mutex_enter(>sc_lock);
 
 	zyd_stop(ifp, 1);
 	usb_rem_task(sc->sc_udev, >sc_task);
@@ -487,7 +488,10 @@ zyd_detach(device_t self, int flags)
 	ieee80211_ifdetach(ic);
 	if_detach(ifp);
 
-	splx(s);
+	mutex_exit(>sc_lock);
+
+	mutex_destroy(>sc_lock);
+	cv_destroy(>sc_cmdcv);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
 
@@ -792,7 +796,6 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c
 	uint16_t xferflags;
 	int error;
 	usbd_status uerror;
-	int s = 0;
 
 	error = usbd_create_xfer(sc->zyd_ep[ZYD_ENDPT_IOUT],
 	sizeof(uint16_t) + ilen, USBD_FORCE_SHORT_XFER, 0, );
@@ -806,19 +809,18 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c
 	if (!(flags & ZYD_CMD_FLAG_READ))
 		xferflags |= USBD_SYNCHRONOUS;
 	else {
-		s = splusb();
 		rq.idata = idata;
 		rq.odata = odata;
 		rq.len = olen / sizeof(struct zyd_pair);
+		mutex_enter(>sc_lock);
 		SIMPLEQ_INSERT_TAIL(>sc_rqh, , rq);
+		mutex_exit(>sc_lock);
 	}
 
 	usbd_setup_xfer(xfer, 0, , sizeof(uint16_t) + ilen, xferflags,
 	ZYD_INTR_TIMEOUT, NULL);
 	uerror = usbd_transfer(xfer);
 	if (uerror != USBD_IN_PROGRESS && uerror != 0) {
-		if (flags & ZYD_CMD_FLAG_READ)
-			splx(s);
 		printf("%s: could not send command (error=%s)\n",
 		device_xname(sc->sc_dev), usbd_errstr(uerror));
 		(void)usbd_destroy_xfer(xfer);
@@ -829,11 +831,12 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c
 		return 0;	/* write: don't wait for reply */
 	}
 	/* wait at most one second for command reply */
-	error = tsleep(odata, PCATCH, "zydcmd", hz);
+	mutex_enter(>sc_lock);
+	error = cv_timedwait_sig(>sc_cmdcv, >sc_lock, hz);
 	if (error == EWOULDBLOCK)
 		printf("%s: zyd_read sleep timeout\n", device_xname(sc->sc_dev));
 	SIMPLEQ_REMOVE(>sc_rqh, , rq, rq);
-	splx(s);
+	mutex_exit(>sc_lock);
 
 	(void)usbd_destroy_xfer(xfer);
 	return error;
@@ -1872,6 +1875,7 @@ zyd_intr(struct usbd_xfer *xfer, void * 
 		datalen -= sizeof(cmd->code);
 		datalen -= 2;	/* XXX: padding? */
 
+		mutex_enter(>sc_lock);
 		SIMPLEQ_FOREACH(rqp, >sc_rqh, rq) {
 			int i;
 
@@ -1888,10 +1892,11 @@ zyd_intr(struct usbd_xfer *xfer, void * 
 			/* copy answer into caller-supplied buffer */
 			memcpy(rqp->odata, cmd->data,
 			sizeof(struct zyd_pair) * rqp->len);
-			wakeup(rqp->odata);	/* wakeup caller */
-
+			cv_signal(>sc_cmdcv);
+			mutex_exit(>sc_lock);
 			return;
 		}
+		mutex_exit(>sc_lock);
 		return;	/* unexpected IORD notification */
 	} else {
 		printf("%s: unknown notification %x\n", 

CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 12:12:20 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp if_zyd.c if_zydreg.h

Log Message:
Remove tsleep/wakeup from if_zyd


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.10 -r1.8.4.11 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.36.14.12 -r1.36.14.13 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.7.16.4 -r1.7.16.5 src/sys/dev/usb/if_zydreg.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 12:04:17 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp if_urtwn.c if_urtwnvar.h

Log Message:
Remove tsleep(9) and wakeup(9) from urtwn(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.9 -r1.8.4.10 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.34.4.15 -r1.34.4.16 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.8.4.4 -r1.8.4.5 src/sys/dev/usb/if_urtwnvar.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/dev/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.9 src/sys/dev/usb/TODO.usbmp:1.8.4.10
--- src/sys/dev/usb/TODO.usbmp:1.8.4.9	Sat Jan 28 10:15:01 2017
+++ src/sys/dev/usb/TODO.usbmp	Sat Jan 28 12:04:17 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.9 2017/01/28 10:15:01 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.10 2017/01/28 12:04:17 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -97,7 +97,6 @@ splusb drivers:
 
 wakeup/tsleep drivers:
   - if_run.c
-  - if_urtwn.c
   - if_zyd.c
   - ucycom.c
   - udsir.c

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.34.4.15 src/sys/dev/usb/if_urtwn.c:1.34.4.16
--- src/sys/dev/usb/if_urtwn.c:1.34.4.15	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_urtwn.c	Sat Jan 28 12:04:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.34.4.15 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.34.4.16 2017/01/28 12:04:17 skrll Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.4.15 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.4.16 2017/01/28 12:04:17 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -372,6 +372,7 @@ urtwn_attach(device_t parent, device_t s
 
 	(void) usbd_do_request(sc->sc_udev, , 0);
 
+	cv_init(>sc_task_cv, "urtwntsk");
 	mutex_init(>sc_task_mtx, MUTEX_DEFAULT, IPL_NET);
 	mutex_init(>sc_tx_mtx, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_rx_mtx, MUTEX_DEFAULT, IPL_NONE);
@@ -559,6 +560,7 @@ urtwn_detach(device_t self, int flags)
 	callout_destroy(>sc_scan_to);
 	callout_destroy(>sc_calib_to);
 
+	cv_destroy(>sc_task_cv);
 	mutex_destroy(>sc_write_mtx);
 	mutex_destroy(>sc_fwcmd_mtx);
 	mutex_destroy(>sc_tx_mtx);
@@ -823,8 +825,8 @@ urtwn_task(void *arg)
 		ring->queued--;
 		ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
 	}
+	cv_broadcast(>sc_task_cv);
 	mutex_spin_exit(>sc_task_mtx);
-	wakeup(>cmdq);
 	splx(s);
 }
 
@@ -863,8 +865,10 @@ urtwn_wait_async(struct urtwn_softc *sc)
 	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
 
 	/* Wait for all queued asynchronous commands to complete. */
+	mutex_spin_enter(>sc_task_mtx);
 	while (sc->cmdq.queued > 0)
-		tsleep(>cmdq, 0, "endtask", 0);
+		cv_wait(>sc_task_cv, >sc_task_mtx);
+	mutex_spin_exit(>sc_task_mtx);
 }
 
 static int

Index: src/sys/dev/usb/if_urtwnvar.h
diff -u src/sys/dev/usb/if_urtwnvar.h:1.8.4.4 src/sys/dev/usb/if_urtwnvar.h:1.8.4.5
--- src/sys/dev/usb/if_urtwnvar.h:1.8.4.4	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_urtwnvar.h	Sat Jan 28 12:04:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwnvar.h,v 1.8.4.4 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_urtwnvar.h,v 1.8.4.5 2017/01/28 12:04:17 skrll Exp $	*/
 /*	$OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $	*/
 
 /*-
@@ -128,6 +128,7 @@ struct urtwn_softc {
 	callout_t			sc_scan_to;
 	callout_t			sc_calib_to;
 
+	kcondvar_t			sc_task_cv;
 	kmutex_t			sc_task_mtx;
 	kmutex_t			sc_fwcmd_mtx;
 	kmutex_t			sc_tx_mtx;



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 12:04:17 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp if_urtwn.c if_urtwnvar.h

Log Message:
Remove tsleep(9) and wakeup(9) from urtwn(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.9 -r1.8.4.10 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.34.4.15 -r1.34.4.16 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.8.4.4 -r1.8.4.5 src/sys/dev/usb/if_urtwnvar.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 10:15:01 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp uyurex.c

Log Message:
Remove tsleep from uyurex(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.8 -r1.8.4.9 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.9.14.8 -r1.9.14.9 src/sys/dev/usb/uyurex.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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.8 src/sys/dev/usb/TODO.usbmp:1.8.4.9
--- src/sys/dev/usb/TODO.usbmp:1.8.4.8	Sat Jan 28 10:10:15 2017
+++ src/sys/dev/usb/TODO.usbmp	Sat Jan 28 10:15:01 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.8 2017/01/28 10:10:15 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.9 2017/01/28 10:15:01 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -104,7 +104,6 @@ wakeup/tsleep drivers:
   - uirda.c
   - umass_isdata.c
   - ustir.c
-  - uyurex.c
 
 missing D_MPSAFE drivers:
   - ucycom

Index: src/sys/dev/usb/uyurex.c
diff -u src/sys/dev/usb/uyurex.c:1.9.14.8 src/sys/dev/usb/uyurex.c:1.9.14.9
--- src/sys/dev/usb/uyurex.c:1.9.14.8	Mon Dec  5 10:55:20 2016
+++ src/sys/dev/usb/uyurex.c	Sat Jan 28 10:15:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uyurex.c,v 1.9.14.8 2016/12/05 10:55:20 skrll Exp $ */
+/*	$NetBSD: uyurex.c,v 1.9.14.9 2017/01/28 10:15:01 skrll Exp $ */
 /*	$OpenBSD: uyurex.c,v 1.3 2010/03/04 03:47:22 deraadt Exp $ */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.8 2016/12/05 10:55:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.14.9 2017/01/28 10:15:01 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -359,7 +359,7 @@ uyurex_read_value_request(struct uyurex_
 		return;
 
 	/* wait till sensor data are updated, 500ms will be enough */
-	tsleep(>sc_sme, 0, "uyurex", (500*hz+999)/1000 + 1);
+	kpause("uyurexrd", false, (500*hz+999)/1000 + 1, NULL);
 }
 
 void
@@ -382,5 +382,5 @@ uyurex_write_value_request(struct uyurex
 		return;
 
 	/* wait till sensor data are updated, 250ms will be enough */
-	tsleep(>sc_sme, 0, "uyurex", (250*hz+999)/1000 + 1);
+	kpause("uyurexwr", false, (250*hz+999)/1000 + 1, NULL);
 }



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 10:15:01 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp uyurex.c

Log Message:
Remove tsleep from uyurex(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.8 -r1.8.4.9 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.9.14.8 -r1.9.14.9 src/sys/dev/usb/uyurex.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 10:10:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp uthum.c

Log Message:
Remove tsleep from uthum(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.7 -r1.8.4.8 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.10.14.8 -r1.10.14.9 src/sys/dev/usb/uthum.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 10:10:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp uthum.c

Log Message:
Remove tsleep from uthum(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.7 -r1.8.4.8 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.10.14.8 -r1.10.14.9 src/sys/dev/usb/uthum.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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.7 src/sys/dev/usb/TODO.usbmp:1.8.4.8
--- src/sys/dev/usb/TODO.usbmp:1.8.4.7	Sat Jan 28 10:05:09 2017
+++ src/sys/dev/usb/TODO.usbmp	Sat Jan 28 10:10:15 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.7 2017/01/28 10:05:09 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.8 2017/01/28 10:10:15 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -104,7 +104,6 @@ wakeup/tsleep drivers:
   - uirda.c
   - umass_isdata.c
   - ustir.c
-  - uthum.c
   - uyurex.c
 
 missing D_MPSAFE drivers:

Index: src/sys/dev/usb/uthum.c
diff -u src/sys/dev/usb/uthum.c:1.10.14.8 src/sys/dev/usb/uthum.c:1.10.14.9
--- src/sys/dev/usb/uthum.c:1.10.14.8	Mon Dec  5 10:55:20 2016
+++ src/sys/dev/usb/uthum.c	Sat Jan 28 10:10:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uthum.c,v 1.10.14.8 2016/12/05 10:55:20 skrll Exp $   */
+/*	$NetBSD: uthum.c,v 1.10.14.9 2017/01/28 10:10:15 skrll Exp $   */
 /*	$OpenBSD: uthum.c,v 1.6 2010/01/03 18:43:02 deraadt Exp $   */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.10.14.8 2016/12/05 10:55:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.10.14.9 2017/01/28 10:10:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -294,7 +294,7 @@ uthum_read_data(struct uthum_softc *sc, 
 
 	/* wait if required */
 	if (need_delay > 1)
-		tsleep(>sc_sme, 0, "uthum", (need_delay*hz+999)/1000 + 1);
+		kpause("uthum", false, (need_delay*hz+999)/1000 + 1, NULL);
 
 	/* get answer */
 	if (uhidev_get_report(>sc_hdev, UHID_FEATURE_REPORT,



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 10:05:09 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp ulpt.c

Log Message:
Remove tsleep from ulpt(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.6 -r1.8.4.7 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.95.4.11 -r1.95.4.12 src/sys/dev/usb/ulpt.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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.6 src/sys/dev/usb/TODO.usbmp:1.8.4.7
--- src/sys/dev/usb/TODO.usbmp:1.8.4.6	Sat Jan 28 09:43:28 2017
+++ src/sys/dev/usb/TODO.usbmp	Sat Jan 28 10:05:09 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.6 2017/01/28 09:43:28 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.7 2017/01/28 10:05:09 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -103,7 +103,6 @@ wakeup/tsleep drivers:
   - udsir.c
   - uirda.c
   - umass_isdata.c
-  - ulpt.c
   - ustir.c
   - uthum.c
   - uyurex.c

Index: src/sys/dev/usb/ulpt.c
diff -u src/sys/dev/usb/ulpt.c:1.95.4.11 src/sys/dev/usb/ulpt.c:1.95.4.12
--- src/sys/dev/usb/ulpt.c:1.95.4.11	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/ulpt.c	Sat Jan 28 10:05:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulpt.c,v 1.95.4.11 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: ulpt.c,v 1.95.4.12 2017/01/28 10:05:09 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.95.4.11 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.95.4.12 2017/01/28 10:05:09 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -465,7 +465,7 @@ ulptopen(dev_t dev, int flag, int mode, 
 		}
 
 		/* wait 1/4 second, give up if we get a signal */
-		error = tsleep((void *)sc, LPTPRI | PCATCH, "ulptop", STEP);
+		error = kpause("ulptop", true, STEP, NULL);
 		if (error != EWOULDBLOCK) {
 			sc->sc_state = 0;
 			goto done;
@@ -704,7 +704,7 @@ ulpt_do_read(struct ulpt_softc *sc, stru
 		}
 
 		/*
-		 * XXX Even with the short timeout, this will tsleep,
+		 * XXX Even with the short timeout, this will sleep,
 		 * but it should be adequately prompt in practice.
 		 */
 		n = nreq;
@@ -748,7 +748,7 @@ ulpt_do_read(struct ulpt_softc *sc, stru
 
 		case USBD_INTERRUPTED:
 			/*
-			 * The tsleep in usbd_bulk_transfer was
+			 * The sleep in usbd_bulk_transfer was
 			 * interrupted.  Reflect it to the caller so
 			 * that reading can be interrupted.
 			 */



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 10:05:09 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp ulpt.c

Log Message:
Remove tsleep from ulpt(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.6 -r1.8.4.7 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.95.4.11 -r1.95.4.12 src/sys/dev/usb/ulpt.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 09:43:28 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp uvscom.c

Log Message:
Remove tsleep from uvscom(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.5 -r1.8.4.6 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.28.16.9 -r1.28.16.10 src/sys/dev/usb/uvscom.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/usb/TODO.usbmp
diff -u src/sys/dev/usb/TODO.usbmp:1.8.4.5 src/sys/dev/usb/TODO.usbmp:1.8.4.6
--- src/sys/dev/usb/TODO.usbmp:1.8.4.5	Wed Dec 14 22:09:21 2016
+++ src/sys/dev/usb/TODO.usbmp	Sat Jan 28 09:43:28 2017
@@ -1,4 +1,4 @@
-$NetBSD: TODO.usbmp,v 1.8.4.5 2016/12/14 22:09:21 skrll Exp $
+$NetBSD: TODO.usbmp,v 1.8.4.6 2017/01/28 09:43:28 skrll Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
@@ -106,7 +106,6 @@ wakeup/tsleep drivers:
   - ulpt.c
   - ustir.c
   - uthum.c
-  - uvscom.c
   - uyurex.c
 
 missing D_MPSAFE drivers:

Index: src/sys/dev/usb/uvscom.c
diff -u src/sys/dev/usb/uvscom.c:1.28.16.9 src/sys/dev/usb/uvscom.c:1.28.16.10
--- src/sys/dev/usb/uvscom.c:1.28.16.9	Mon Dec  5 10:55:20 2016
+++ src/sys/dev/usb/uvscom.c	Sat Jan 28 09:43:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvscom.c,v 1.28.16.9 2016/12/05 10:55:20 skrll Exp $	*/
+/*	$NetBSD: uvscom.c,v 1.28.16.10 2017/01/28 09:43:28 skrll Exp $	*/
 /*-
  * Copyright (c) 2001-2002, Shunsuke Akiyama .
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28.16.9 2016/12/05 10:55:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28.16.10 2017/01/28 09:43:28 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -759,7 +759,7 @@ uvscom_open(void *addr, int portno)
 		/* unit is not ready */
 
 		for (i = UVSCOM_UNIT_WAIT; i > 0; --i) {
-			tsleep(, TTIPRI, "uvsop", hz);	/* XXX */
+			kpause("uvsopen", false, hz, NULL);
 			if (ISSET(sc->sc_usr, UVSCOM_USTAT_MASK))
 break;
 		}



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 09:43:28 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: TODO.usbmp uvscom.c

Log Message:
Remove tsleep from uvscom(4)


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.5 -r1.8.4.6 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.28.16.9 -r1.28.16.10 src/sys/dev/usb/uvscom.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan 26 12:40:16 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_url.c if_urndis.c if_urndisreg.h

Log Message:
consistent softc member name prefix


To generate a diff of this commit:
cvs rdiff -u -r1.48.4.11 -r1.48.4.12 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.9.4.14 -r1.9.4.15 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.1.32.4 -r1.1.32.5 src/sys/dev/usb/if_urndisreg.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/dev/usb/if_url.c
diff -u src/sys/dev/usb/if_url.c:1.48.4.11 src/sys/dev/usb/if_url.c:1.48.4.12
--- src/sys/dev/usb/if_url.c:1.48.4.11	Mon Dec  5 10:55:18 2016
+++ src/sys/dev/usb/if_url.c	Thu Jan 26 12:40:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_url.c,v 1.48.4.11 2016/12/05 10:55:18 skrll Exp $	*/
+/*	$NetBSD: if_url.c,v 1.48.4.12 2017/01/26 12:40:16 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.48.4.11 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.48.4.12 2017/01/26 12:40:16 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -192,7 +192,7 @@ url_attach(device_t parent, device_t sel
 	struct ifnet *ifp;
 	struct mii_data *mii;
 	u_char eaddr[ETHER_ADDR_LEN];
-	int i, s;
+	int i;
 
 	sc->sc_dev = self;
 
@@ -256,8 +256,6 @@ url_attach(device_t parent, device_t sel
 		goto bad;
 	}
 
-	s = splnet();
-
 	/* reset the adapter */
 	url_reset(sc);
 
@@ -266,7 +264,6 @@ url_attach(device_t parent, device_t sel
 		  ETHER_ADDR_LEN);
 	if (err) {
 		aprint_error_dev(self, "read MAC address failed\n");
-		splx(s);
 		goto bad;
 	}
 
@@ -321,7 +318,6 @@ url_attach(device_t parent, device_t sel
 
 	callout_init(>sc_stat_ch, 0);
 	sc->sc_attached = 1;
-	splx(s);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, dev, sc->sc_dev);
 

Index: src/sys/dev/usb/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.9.4.14 src/sys/dev/usb/if_urndis.c:1.9.4.15
--- src/sys/dev/usb/if_urndis.c:1.9.4.14	Thu Dec 29 08:04:08 2016
+++ src/sys/dev/usb/if_urndis.c	Thu Jan 26 12:40:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.9.4.14 2016/12/29 08:04:08 skrll Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.9.4.15 2017/01/26 12:40:16 skrll Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.9.4.14 2016/12/29 08:04:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.9.4.15 2017/01/26 12:40:16 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1046,9 +1046,9 @@ urndis_init(struct ifnet *ifp)
 {
 	struct urndis_softc *sc = ifp->if_softc;
 
-	mutex_enter(>urndis_lock);
+	mutex_enter(>sc_lock);
 	int ret = urndis_init_locked(ifp);
-	mutex_exit(>urndis_lock);
+	mutex_exit(>sc_lock);
 
 	return ret;
 }
@@ -1130,9 +1130,9 @@ urndis_stop(struct ifnet *ifp)
 {
 	struct urndis_softc *sc = ifp->if_softc;
 
-	mutex_enter(>urndis_lock);
+	mutex_enter(>sc_lock);
 	urndis_stop_locked(ifp);
-	mutex_exit(>urndis_lock);
+	mutex_exit(>sc_lock);
 }
 
 static void
@@ -1188,9 +1188,9 @@ urndis_start(struct ifnet *ifp)
 	struct urndis_softc *sc = ifp->if_softc;
 	KASSERT(ifp->if_extflags & IFEF_START_MPSAFE);
 
-	mutex_enter(>urndis_txlock);
+	mutex_enter(>sc_txlock);
 	urndis_start_locked(ifp);
-	mutex_exit(>urndis_txlock);
+	mutex_exit(>sc_txlock);
 }
 
 static void
@@ -1476,9 +1476,9 @@ urndis_attach(device_t parent, device_t 
 	return;
 
 found:
-	mutex_init(>urndis_lock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>urndis_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
-	mutex_init(>urndis_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB);
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
+	mutex_init(>sc_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB);
 
 	ifp = GET_IFP(sc);
 	ifp->if_softc = sc;
@@ -1537,9 +1537,9 @@ found:
 	return;
 
 fail:
-	mutex_destroy(>urndis_lock);
-	mutex_destroy(>urndis_txlock);
-	mutex_destroy(>urndis_rxlock);
+	mutex_destroy(>sc_lock);
+	mutex_destroy(>sc_txlock);
+	mutex_destroy(>sc_rxlock);
 }
 
 static int
@@ -1568,9 +1568,9 @@ urndis_detach(device_t self, int flags)
 
 	urndis_stop(ifp);
 
-	mutex_destroy(>urndis_rxlock);
-	mutex_destroy(>urndis_txlock);
-	mutex_destroy(>urndis_lock);
+	mutex_destroy(>sc_rxlock);
+	mutex_destroy(>sc_txlock);
+	mutex_destroy(>sc_lock);
 
 	sc->sc_attached = 0;
 

Index: src/sys/dev/usb/if_urndisreg.h
diff -u src/sys/dev/usb/if_urndisreg.h:1.1.32.4 src/sys/dev/usb/if_urndisreg.h:1.1.32.5
--- src/sys/dev/usb/if_urndisreg.h:1.1.32.4	Wed Dec 28 08:55:20 2016
+++ src/sys/dev/usb/if_urndisreg.h	Thu Jan 26 12:40:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndisreg.h,v 1.1.32.4 2016/12/28 08:55:20 skrll Exp $ */
+/*	$NetBSD: if_urndisreg.h,v 1.1.32.5 2017/01/26 12:40:16 skrll Exp $ */
 /*	$OpenBSD: if_urndisreg.h,v 1.14 2010/07/08 18:22:01 ckuethe 

CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan 26 12:40:16 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: if_url.c if_urndis.c if_urndisreg.h

Log Message:
consistent softc member name prefix


To generate a diff of this commit:
cvs rdiff -u -r1.48.4.11 -r1.48.4.12 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.9.4.14 -r1.9.4.15 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.1.32.4 -r1.1.32.5 src/sys/dev/usb/if_urndisreg.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan  3 12:50:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: usb.c usb.h usb_subr.c usbdivar.h xhci.c

Log Message:
Improve handling of roothub device and free up a bus address for LS/FS/HS
controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.156.2.16 -r1.156.2.17 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.111.2.11 -r1.111.2.12 src/sys/dev/usb/usb.h
cvs rdiff -u -r1.198.2.38 -r1.198.2.39 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.109.2.27 -r1.109.2.28 src/sys/dev/usb/usbdivar.h
cvs rdiff -u -r1.28.2.83 -r1.28.2.84 src/sys/dev/usb/xhci.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/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.156.2.16 src/sys/dev/usb/usb.c:1.156.2.17
--- src/sys/dev/usb/usb.c:1.156.2.16	Sun Jan  1 14:56:25 2017
+++ src/sys/dev/usb/usb.c	Tue Jan  3 12:50:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.156.2.16 2017/01/01 14:56:25 skrll Exp $	*/
+/*	$NetBSD: usb.c,v 1.156.2.17 2017/01/03 12:50:50 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.156.2.16 2017/01/01 14:56:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.156.2.17 2017/01/03 12:50:50 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -727,8 +727,12 @@ usbioctl(dev_t devt, u_long cmd, void *d
 			error = EINVAL;
 			goto fail;
 		}
-		if (addr < 0 || addr >= USB_MAX_DEVICES ||
-		sc->sc_bus->ub_devices[addr] == NULL) {
+		if (addr < 0 || addr >= USB_MAX_DEVICES) {
+			error = EINVAL;
+			goto fail;
+		}
+		size_t dindex = usb_addr2dindex(addr);
+		if (sc->sc_bus->ub_devices[dindex] == NULL) {
 			error = EINVAL;
 			goto fail;
 		}
@@ -750,7 +754,7 @@ usbioctl(dev_t devt, u_long cmd, void *d
 	goto ret;
 			}
 		}
-		err = usbd_do_request_flags(sc->sc_bus->ub_devices[addr],
+		err = usbd_do_request_flags(sc->sc_bus->ub_devices[dindex],
 			  >ucr_request, ptr, ur->ucr_flags, >ucr_actlen,
 			  USBD_DEFAULT_TIMEOUT);
 		if (err) {
@@ -783,7 +787,8 @@ usbioctl(dev_t devt, u_long cmd, void *d
 			error = EINVAL;
 			goto fail;
 		}
-		if ((dev = sc->sc_bus->ub_devices[addr]) == NULL) {
+		size_t dindex = usb_addr2dindex(addr);
+		if ((dev = sc->sc_bus->ub_devices[dindex]) == NULL) {
 			error = ENXIO;
 			goto fail;
 		}
@@ -802,7 +807,8 @@ usbioctl(dev_t devt, u_long cmd, void *d
 			error = EINVAL;
 			goto fail;
 		}
-		if ((dev = sc->sc_bus->ub_devices[addr]) == NULL) {
+		size_t dindex = usb_addr2dindex(addr);
+		if ((dev = sc->sc_bus->ub_devices[dindex]) == NULL) {
 			error = ENXIO;
 			goto fail;
 		}

Index: src/sys/dev/usb/usb.h
diff -u src/sys/dev/usb/usb.h:1.111.2.11 src/sys/dev/usb/usb.h:1.111.2.12
--- src/sys/dev/usb/usb.h:1.111.2.11	Mon Jan  2 16:55:50 2017
+++ src/sys/dev/usb/usb.h	Tue Jan  3 12:50:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.h,v 1.111.2.11 2017/01/02 16:55:50 skrll Exp $	*/
+/*	$NetBSD: usb.h,v 1.111.2.12 2017/01/03 12:50:50 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -53,9 +53,9 @@
 
 #define USB_STACK_VERSION 2
 
-#define USB_MAX_DEVICES	(128 + 1)	/* 0, root, and 1->127 */
-#define USB_MIN_DEVICES	2   /* unused + root HUB */
-#define USB_START_ADDR	0
+#define USB_MAX_DEVICES		128		/* 0, 1-127 */
+#define USB_MIN_DEVICES		2   /* unused + root HUB */
+#define USB_START_ADDR		0
 
 #define USB_CONTROL_ENDPOINT 0
 #define USB_MAX_ENDPOINTS 16

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.198.2.38 src/sys/dev/usb/usb_subr.c:1.198.2.39
--- src/sys/dev/usb/usb_subr.c:1.198.2.38	Thu Dec 29 08:40:27 2016
+++ src/sys/dev/usb/usb_subr.c	Tue Jan  3 12:50:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.198.2.38 2016/12/29 08:40:27 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.198.2.39 2017/01/03 12:50:50 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.38 2016/12/29 08:40:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.198.2.39 2017/01/03 12:50:50 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -832,9 +832,11 @@ usbd_getnewaddr(struct usbd_bus *bus)
 {
 	int addr;
 
-	for (addr = 1; addr < USB_MAX_DEVICES; addr++)
-		if (bus->ub_devices[addr] == NULL)
+	for (addr = 1; addr < USB_MAX_DEVICES; addr++) {
+		size_t dindex = usb_addr2dindex(addr);
+		if (bus->ub_devices[dindex] == NULL)
 			return addr;
+	}
 	return -1;
 }
 
@@ -1336,7 +1338,7 @@ usbd_new_device(device_t parent, struct 
 	/* Allow device time to set new address */
 	usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);
 	dev->ud_addr = addr;	/* new device address now */
-	bus->ub_devices[addr] = dev;
+	bus->ub_devices[usb_addr2dindex(addr)] = dev;
 
 	/* Re-establish the 

CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan  3 12:50:51 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: usb.c usb.h usb_subr.c usbdivar.h xhci.c

Log Message:
Improve handling of roothub device and free up a bus address for LS/FS/HS
controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.156.2.16 -r1.156.2.17 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.111.2.11 -r1.111.2.12 src/sys/dev/usb/usb.h
cvs rdiff -u -r1.198.2.38 -r1.198.2.39 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.109.2.27 -r1.109.2.28 src/sys/dev/usb/usbdivar.h
cvs rdiff -u -r1.28.2.83 -r1.28.2.84 src/sys/dev/usb/xhci.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:54:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Use %s for __func__... oops


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.81 -r1.28.2.82 src/sys/dev/usb/xhci.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.28.2.81 src/sys/dev/usb/xhci.c:1.28.2.82
--- src/sys/dev/usb/xhci.c:1.28.2.81	Mon Jan  2 16:45:30 2017
+++ src/sys/dev/usb/xhci.c	Mon Jan  2 16:54:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.28.2.81 2017/01/02 16:45:30 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.28.2.82 2017/01/02 16:54:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.81 2017/01/02 16:45:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.82 2017/01/02 16:54:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2996,7 +2996,7 @@ xhci_setup_route(struct usbd_pipe *pipe,
 goto found;
 			}
 		}
-		panic("%d: cannot find HS port", __func__);
+		panic("%s: cannot find HS port", __func__);
 	found:
 		DPRINTFN(4, "high speed port %d", p, 0, 0, 0);
 	} else {



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:45:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Use __func__ in panic message


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.80 -r1.28.2.81 src/sys/dev/usb/xhci.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:54:15 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Use %s for __func__... oops


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.81 -r1.28.2.82 src/sys/dev/usb/xhci.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:45:30 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Use __func__ in panic message


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.80 -r1.28.2.81 src/sys/dev/usb/xhci.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.28.2.80 src/sys/dev/usb/xhci.c:1.28.2.81
--- src/sys/dev/usb/xhci.c:1.28.2.80	Mon Jan  2 16:34:40 2017
+++ src/sys/dev/usb/xhci.c	Mon Jan  2 16:45:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.28.2.80 2017/01/02 16:34:40 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.28.2.81 2017/01/02 16:45:30 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.80 2017/01/02 16:34:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.81 2017/01/02 16:45:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2996,7 +2996,7 @@ xhci_setup_route(struct usbd_pipe *pipe,
 goto found;
 			}
 		}
-		panic("xhci_setup_route: cannot find HS port");
+		panic("%d: cannot find HS port", __func__);
 	found:
 		DPRINTFN(4, "high speed port %d", p, 0, 0, 0);
 	} else {



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:34:40 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Actually print the bus root hub device in debug output


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.79 -r1.28.2.80 src/sys/dev/usb/xhci.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.28.2.79 src/sys/dev/usb/xhci.c:1.28.2.80
--- src/sys/dev/usb/xhci.c:1.28.2.79	Mon Jan  2 16:32:23 2017
+++ src/sys/dev/usb/xhci.c	Mon Jan  2 16:34:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.28.2.79 2017/01/02 16:32:23 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.28.2.80 2017/01/02 16:34:40 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.79 2017/01/02 16:32:23 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.80 2017/01/02 16:34:40 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2299,7 +2299,7 @@ xhci_new_device(device_t parent, struct 
 
 	if (depth == 0 && port == 0) {
 		usbd_attach_roothub(parent, dev);
-		DPRINTFN(1, "root_hub %p", bus->ub_roothub, 0, 0, 0);
+		DPRINTFN(1, "root hub %p", dev, 0, 0, 0);
 		return USBD_NORMAL_COMPLETION;
 	}
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:39:37 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhcireg.h

Log Message:
Use lower case for hex constants.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.8 -r1.2.2.9 src/sys/dev/usb/xhcireg.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/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.2.2.8 src/sys/dev/usb/xhcireg.h:1.2.2.9
--- src/sys/dev/usb/xhcireg.h:1.2.2.8	Wed Oct  5 20:55:59 2016
+++ src/sys/dev/usb/xhcireg.h	Mon Jan  2 16:39:36 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.2.2.8 2016/10/05 20:55:59 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.2.2.9 2017/01/02 16:39:36 skrll Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -38,10 +38,10 @@
 
 #define	PCI_XHCI_FLADJ		0x61	/* RW frame length adjust */
 
-#define	PCI_XHCI_INTEL_XUSB2PR	0xD0/* Intel USB2 Port Routing */
-#define	PCI_XHCI_INTEL_USB2PRM	0xD4/* Intel USB2 Port Routing Mask */
-#define	PCI_XHCI_INTEL_USB3_PSSEN 0xD8  /* Intel USB3 Port SuperSpeed Enable */
-#define	PCI_XHCI_INTEL_USB3PRM	0xDC/* Intel USB3 Port Routing Mask */
+#define	PCI_XHCI_INTEL_XUSB2PR	0xd0/* Intel USB2 Port Routing */
+#define	PCI_XHCI_INTEL_USB2PRM	0xd4/* Intel USB2 Port Routing Mask */
+#define	PCI_XHCI_INTEL_USB3_PSSEN 0xd8  /* Intel USB3 Port SuperSpeed Enable */
+#define	PCI_XHCI_INTEL_USB3PRM	0xdc/* Intel USB3 Port Routing Mask */
 
 /* XHCI capability registers */
 #define	XHCI_CAPLENGTH		0x00	/* RO capability */
@@ -66,7 +66,7 @@
 (__SHIFTOUT((x), XHCI_HCS2_SPBUFHI) << 5) | \
 (__SHIFTOUT((x), XHCI_HCS2_SPBUFLO))
 
-#define	XHCI_HCSPARAMS3		0x0C	/* RO structual parameters 3 */
+#define	XHCI_HCSPARAMS3		0x0c	/* RO structual parameters 3 */
 #define	 XHCI_HCS3_U1_DEL(x)	((x) & 0xFF)
 #define	 XHCI_HCS3_U2_DEL(x)	(((x) >> 16) & 0x)
 
@@ -132,14 +132,14 @@
 #define	 XHCI_CRCR_LO_CRR	0x0008	/* RW - command ring running */
 #define	 XHCI_CRCR_LO_MASK	0x000F
 
-#define	XHCI_CRCR_HI		0x1C	/* XHCI command ring control */
+#define	XHCI_CRCR_HI		0x1c	/* XHCI command ring control */
 #define	XHCI_DCBAAP		0x30	/* XHCI dev context BA pointer */
 #define	XHCI_DCBAAP_HI		0x34	/* XHCI dev context BA pointer */
 #define	XHCI_CONFIG		0x38
 #define	XHCI_CONFIG_SLOTS_MASK	0x00FF	/* RW - number of device slots enabled */
 
 /* XHCI port status registers */
-#define	XHCI_PORTSC(n)		(0x3F0 + (0x10 * (n)))	/* XHCI port status */
+#define	XHCI_PORTSC(n)		(0x3f0 + (0x10 * (n)))	/* XHCI port status */
 #define	 XHCI_PS_CCS		0x0001	/* RO - current connect status */
 #define	 XHCI_PS_PED		0x0002	/* RW - port enabled / disabled */
 #define	 XHCI_PS_OCA		0x0008	/* RO - over current active */
@@ -170,7 +170,7 @@
 #define	 XHCI_PS_WPR		0x8000U	/* RW - warm port reset */
 #define	 XHCI_PS_CLEAR		0x80FF01FFU	/* command bits */
 
-#define	XHCI_PORTPMSC(n)	(0x3F4 + (0x10 * (n)))	/* XHCI status and control */
+#define	XHCI_PORTPMSC(n)	(0x3f4 + (0x10 * (n)))	/* XHCI status and control */
 #define	 XHCI_PM3_U1TO_GET(x)	(((x) >> 0) & 0xFF)	/* RW - U1 timeout */
 #define	 XHCI_PM3_U1TO_SET(x)	(((x) & 0xFF) << 0)	/* RW - U1 timeout */
 #define	 XHCI_PM3_U2TO_GET(x)	(((x) >> 8) & 0xFF)	/* RW - U2 timeout */
@@ -184,10 +184,10 @@
 #define	 XHCI_PM2_L1SLOT_SET(x)	(((x) & 0xFF) << 8)	/* RW - L1 device slot */
 #define	 XHCI_PM2_HLE		0x0001		/* RW - hardware LPM enable */
 
-#define	XHCI_PORTLI(n)		(0x3F8 + (0x10 * (n)))	/* XHCI port link info */
+#define	XHCI_PORTLI(n)		(0x3f8 + (0x10 * (n)))	/* XHCI port link info */
 #define	 XHCI_PLI3_ERR_GET(x)	(((x) >> 0) & 0x)	/* RO - port link errors */
 
-#define	XHCI_PORTRSV(n)		(0x3FC + (0x10 * (n)))	/* XHCI port reserved */
+#define	XHCI_PORTRSV(n)		(0x3fc + (0x10 * (n)))	/* XHCI port reserved */
 
 /* XHCI runtime registers.  Offset given by XHCI_CAPLENGTH + XHCI_RTSOFF registers */
 #define	XHCI_MFINDEX		0x		/* RO - microframe index */



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:39:37 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhcireg.h

Log Message:
Use lower case for hex constants.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.8 -r1.2.2.9 src/sys/dev/usb/xhcireg.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:34:40 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Actually print the bus root hub device in debug output


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.79 -r1.28.2.80 src/sys/dev/usb/xhci.c

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2017-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  2 16:32:23 UTC 2017

Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c

Log Message:
Remove unnecessary brackets


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.78 -r1.28.2.79 src/sys/dev/usb/xhci.c

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



  1   2   3   4   5   6   7   8   9   10   >