Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia Do not establish the unused interrupt handler...



details:   https://anonhg.NetBSD.org/src/rev/5cdac58d2bcb
branches:  trunk
changeset: 988240:5cdac58d2bcb
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Oct 05 08:08:40 2021 +0000

description:
Do not establish the unused interrupt handler for memory-mapped mode,
for the sake of clarity.

diffstat:

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

diffs (56 lines):

diff -r e875a887d862 -r 5cdac58d2bcb sys/dev/pcmcia/wdc_pcmcia.c
--- a/sys/dev/pcmcia/wdc_pcmcia.c       Tue Oct 05 08:01:05 2021 +0000
+++ b/sys/dev/pcmcia/wdc_pcmcia.c       Tue Oct 05 08:08:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_pcmcia.c,v 1.127 2018/09/03 16:29:33 riastradh Exp $ */
+/*     $NetBSD: wdc_pcmcia.c,v 1.128 2021/10/05 08:08:40 rin Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.127 2018/09/03 16:29:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.128 2021/10/05 08:08:40 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -372,22 +372,28 @@
 #endif
 
        if (onoff) {
-               /* Establish the interrupt handler. */
-               sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
-                   wdcintr, &sc->ata_channel);
-               if (!sc->sc_ih)
-                       return (EIO);
+               if (!(sc->sc_wdcdev.sc_atac.atac_cap & ATAC_CAP_NOIRQ)) {
+                       /* Establish the interrupt handler. */
+                       sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_BIO,
+                           wdcintr, &sc->ata_channel);
+                       if (!sc->sc_ih)
+                               return (EIO);
+               }
 
                error = pcmcia_function_enable(sc->sc_pf);
                if (error) {
-                       pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
-                       sc->sc_ih = 0;
+                       if (sc->sc_ih) {
+                               pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
+                               sc->sc_ih = 0;
+                       }
                        return (error);
                }
        } else {
                pcmcia_function_disable(sc->sc_pf);
-               pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
-               sc->sc_ih = 0;
+               if (sc->sc_ih) {
+                       pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
+                       sc->sc_ih = 0;
+               }
        }
 
        return (0);



Home | Main Index | Thread Index | Old Index