Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/usb Pull up following revision(s) (requested by r...



details:   https://anonhg.NetBSD.org/src/rev/94a85796a355
branches:  netbsd-9
changeset: 984100:94a85796a355
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jun 21 17:27:57 2021 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1306):

        sys/dev/usb/umass.c: revision 1.185
        sys/dev/usb/umass_scsipi.c: revision 1.68

umass(4): Use an empty function callback, not null pointer.

This stupid bug, with an `XXX Broken!' comment right above, has been
preventing NetBSD from suspend/resume with a USB drive plugged in for
longer than I want to even think about admitting.  *sigh*
umass(4): Assert that we got a cb up front.

Avoids jump to zero waaaaaaay down the line where we've forgotten why
we wanted to jump into oblivion.

diffstat:

 sys/dev/usb/umass.c        |   6 ++++--
 sys/dev/usb/umass_scsipi.c |  14 +++++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diffs (83 lines):

diff -r daf112b0f377 -r 94a85796a355 sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c       Mon Jun 21 17:25:48 2021 +0000
+++ b/sys/dev/usb/umass.c       Mon Jun 21 17:27:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass.c,v 1.175.2.1 2020/03/01 12:38:59 martin Exp $   */
+/*     $NetBSD: umass.c,v 1.175.2.2 2021/06/21 17:27:57 martin Exp $   */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.175.2.1 2020/03/01 12:38:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.175.2.2 2021/06/21 17:27:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1105,6 +1105,7 @@
        UMASSHIST_FUNC(); UMASSHIST_CALLED();
        static int dCBWtag = 42;        /* unique for CBW of transfer */
 
+       KASSERT(cb);
        DPRINTFM(UDMASS_BBB, "sc %#jx cmd=0x%02jx", (uintptr_t)sc,
            *(u_char *)cmd, 0, 0);
 
@@ -1629,6 +1630,7 @@
        DPRINTFM(UDMASS_CBI, "sc %#jx: cmd=0x%02jx, len=%jd",
             (uintptr_t)sc, *(u_char *)cmd, datalen, 0);
 
+       KASSERT(cb);
        KASSERTMSG(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
                   "sc->sc_wire == 0x%02x wrong for umass_cbi_transfer\n",
                   sc->sc_wire);
diff -r daf112b0f377 -r 94a85796a355 sys/dev/usb/umass_scsipi.c
--- a/sys/dev/usb/umass_scsipi.c        Mon Jun 21 17:25:48 2021 +0000
+++ b/sys/dev/usb/umass_scsipi.c        Mon Jun 21 17:27:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $        */
+/*     $NetBSD: umass_scsipi.c,v 1.62.2.1 2021/06/21 17:27:57 martin Exp $     */
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.62.2.1 2021/06/21 17:27:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -101,6 +101,8 @@
 Static int umass_scsipi_getgeom(struct scsipi_periph *,
                                struct disk_parms *, u_long);
 
+Static void umass_null_cb(struct umass_softc *, void *,
+                         int, int);
 Static void umass_scsipi_cb(struct umass_softc *, void *,
                            int, int);
 Static void umass_scsipi_sense_cb(struct umass_softc *, void *,
@@ -319,7 +321,7 @@
                                                  cmdlen, xs->data,
                                                  xs->datalen, dir,
                                                  xs->timeout, USBD_SYNCHRONOUS,
-                                                 0, xs);
+                                                 umass_null_cb, xs);
                        DPRINTFM(UDMASS_SCSI, "done err=%jd",
                            scbus->sc_sync_status, 0, 0, 0);
                        switch (scbus->sc_sync_status) {
@@ -419,6 +421,12 @@
 }
 
 Static void
+umass_null_cb(struct umass_softc *sc, void *priv, int residue, int status)
+{
+       UMASSHIST_FUNC(); UMASSHIST_CALLED();
+}
+
+Static void
 umass_scsipi_cb(struct umass_softc *sc, void *priv, int residue, int status)
 {
        UMASSHIST_FUNC(); UMASSHIST_CALLED();



Home | Main Index | Thread Index | Old Index