Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi Don't return an error for "Not Ready To Ready...



details:   https://anonhg.NetBSD.org/src/rev/a1fdf06e0c8d
branches:  trunk
changeset: 526575:a1fdf06e0c8d
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon May 06 13:43:57 2002 +0000

description:
Don't return an error for "Not Ready To Ready Transition (Medium May Have
Changed)" and "Power On, Reset, or Bus Device Reset Occurred" senses, if
we're trying to open the device.

diffstat:

 sys/dev/scsipi/ch.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (59 lines):

diff -r 9bf2cace1f9d -r a1fdf06e0c8d sys/dev/scsipi/ch.c
--- a/sys/dev/scsipi/ch.c       Mon May 06 13:42:29 2002 +0000
+++ b/sys/dev/scsipi/ch.c       Mon May 06 13:43:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ch.c,v 1.48 2001/11/13 06:56:39 lukem Exp $    */
+/*     $NetBSD: ch.c,v 1.49 2002/05/06 13:43:57 bouyer Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.48 2001/11/13 06:56:39 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.49 2002/05/06 13:43:57 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -272,8 +272,6 @@
        if ((error = scsipi_adapter_addref(adapt)) != 0)
                return (error);
 
-       periph->periph_flags |= PERIPH_OPEN;
-
        /*
         * Make sure the unit is on-line.  If a UNIT ATTENTION
         * occurs, we will mark that an Init-Element-Status is
@@ -286,6 +284,8 @@
        if (error)
                goto bad;
 
+       periph->periph_flags |= PERIPH_OPEN;
+
        /*
         * Make sure our parameters are up to date.
         */
@@ -510,15 +510,18 @@
                /* "Power On, Reset, or Bus Device Reset Occurred" */
                sc->sc_periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
                /*
-                * Enqueue an Element-Status-Changed event, and
-                * wake up any processes waiting for them.
-                */
-               /*
                 * Enqueue an Element-Status-Changed event, and wake up
                 * any processes waiting for them.
                 */
                if ((xs->xs_control & XS_CTL_IGNORE_MEDIA_CHANGE) == 0)
                        ch_event(sc, CHEV_ELEMENT_STATUS_CHANGED);
+               if ((periph->periph_flags & PERIPH_OPEN) == 0) {
+                       /*
+                        * if the device is not yet open, we can ignore this
+                        * information.
+                        */
+                       return (0);
+               }
                break;
        default:
                break;



Home | Main Index | Thread Index | Old Index