Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia enami noted that my last fix was not correct....



details:   https://anonhg.NetBSD.org/src/rev/9546d1cf4f50
branches:  trunk
changeset: 553886:9546d1cf4f50
user:      briggs <briggs%NetBSD.org@localhost>
date:      Wed Oct 22 15:03:04 2003 +0000

description:
enami noted that my last fix was not correct.  Simplify the code some (and
make it more correct) by removing a flag to track wdc attachment.  Disable
the function after wdcattach() is called, and remove a conditional when
enabling the function in wdc_pcmcia_enable().

diffstat:

 sys/dev/pcmcia/wdc_pcmcia.c |  30 +++++++++++-------------------
 1 files changed, 11 insertions(+), 19 deletions(-)

diffs (73 lines):

diff -r a31ae9080d24 -r 9546d1cf4f50 sys/dev/pcmcia/wdc_pcmcia.c
--- a/sys/dev/pcmcia/wdc_pcmcia.c       Wed Oct 22 14:18:27 2003 +0000
+++ b/sys/dev/pcmcia/wdc_pcmcia.c       Wed Oct 22 15:03:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_pcmcia.c,v 1.61 2003/10/22 07:48:25 briggs Exp $ */
+/*     $NetBSD: wdc_pcmcia.c,v 1.62 2003/10/22 15:03:04 briggs Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.61 2003/10/22 07:48:25 briggs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.62 2003/10/22 15:03:04 briggs Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -74,7 +74,6 @@
        void *sc_ih;
        struct pcmcia_function *sc_pf;
        int sc_flags;
-#define        WDC_PCMCIA_ATTACH       0x0001
 #define WDC_PCMCIA_MEMMODE     0x0002
 };
 
@@ -376,9 +375,11 @@
        sc->sc_wdcdev.sc_atapi_adapter._generic.adapt_enable =
            wdc_pcmcia_enable;
 
-       sc->sc_flags |= WDC_PCMCIA_ATTACH;
        wdcattach(&sc->wdc_channel);
-       sc->sc_flags &= ~WDC_PCMCIA_ATTACH;
+
+       /* Disable the function */
+       pcmcia_function_disable(sc->sc_pf);
+
        return;
 
  mapaux_failed:
@@ -433,9 +434,6 @@
                }
        }
 
-       /* Disable the function */
-       pcmcia_function_disable(sc->sc_pf);
-
        return (0);
 }
 
@@ -456,17 +454,11 @@
                        return (EIO);
                }
 
-               /*
-                * If attach is in progress, we know that card power is
-                * enabled.
-                */
-               if ((sc->sc_flags & WDC_PCMCIA_ATTACH) == 0) {
-                       if (pcmcia_function_enable(sc->sc_pf)) {
-                               printf("%s: couldn't enable PCMCIA function\n",
-                                   sc->sc_wdcdev.sc_dev.dv_xname);
-                               pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
-                               return (EIO);
-                       }
+               if (pcmcia_function_enable(sc->sc_pf)) {
+                       printf("%s: couldn't enable PCMCIA function\n",
+                           sc->sc_wdcdev.sc_dev.dv_xname);
+                       pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
+                       return (EIO);
                }
        } else {
                pcmcia_function_disable(sc->sc_pf);



Home | Main Index | Thread Index | Old Index