Module Name:    src
Committed By:   rin
Date:           Tue Oct  5 08:08:40 UTC 2021

Modified Files:
        src/sys/dev/pcmcia: wdc_pcmcia.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/pcmcia/wdc_pcmcia.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/pcmcia/wdc_pcmcia.c
diff -u src/sys/dev/pcmcia/wdc_pcmcia.c:1.127 src/sys/dev/pcmcia/wdc_pcmcia.c:1.128
--- src/sys/dev/pcmcia/wdc_pcmcia.c:1.127	Mon Sep  3 16:29:33 2018
+++ src/sys/dev/pcmcia/wdc_pcmcia.c	Tue Oct  5 08:08:40 2021
@@ -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 @@ wdc_pcmcia_enable(device_t self, int ono
 #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);

Reply via email to