summaryrefslogtreecommitdiffstats
path: root/sys/dev/pccard
diff options
context:
space:
mode:
authorpiso <piso@FreeBSD.org>2007-05-31 19:29:20 +0000
committerpiso <piso@FreeBSD.org>2007-05-31 19:29:20 +0000
commitb5a7cab3ba8571b11307ccdf9f85c2a5408aa1d0 (patch)
tree1b5e7f16e434a83f7966afb0d03cfe1e42838808 /sys/dev/pccard
parent42dfc7815053cf9eda064a398dd5f2e1efa583ca (diff)
downloadFreeBSD-src-b5a7cab3ba8571b11307ccdf9f85c2a5408aa1d0.zip
FreeBSD-src-b5a7cab3ba8571b11307ccdf9f85c2a5408aa1d0.tar.gz
Make the interrupt handler wrapper capable of correctly support filter+ithread handler.
Discussed and reviewed with: bsdimp, simokawa
Diffstat (limited to 'sys/dev/pccard')
-rw-r--r--sys/dev/pccard/pccard.c35
-rw-r--r--sys/dev/pccard/pccardvarp.h2
2 files changed, 20 insertions, 17 deletions
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c
index 64e0a7c..989203a 100644
--- a/sys/dev/pccard/pccard.c
+++ b/sys/dev/pccard/pccard.c
@@ -118,7 +118,8 @@ static struct resource *pccard_alloc_resource(device_t dev,
static int pccard_release_resource(device_t dev, device_t child, int type,
int rid, struct resource *r);
static void pccard_child_detached(device_t parent, device_t dev);
-static int pccard_intr(void *arg);
+static int pccard_filter(void *arg);
+static void pccard_intr(void *arg);
static int pccard_setup_intr(device_t dev, device_t child,
struct resource *irq, int flags, driver_filter_t *filt,
driver_intr_t *intr, void *arg, void **cookiep);
@@ -1177,7 +1178,7 @@ pccard_child_detached(device_t parent, device_t dev)
}
static int
-pccard_intr(void *arg)
+pccard_filter(void *arg)
{
struct pccard_function *pf = (struct pccard_function*) arg;
int reg;
@@ -1208,12 +1209,20 @@ pccard_intr(void *arg)
doisr = 0;
}
if (doisr) {
- if (pf->filt_handler != NULL)
- pf->filt_handler(pf->intr_handler_arg);
+ if (pf->intr_filter != NULL)
+ return (pf->intr_filter(pf->intr_handler_arg));
else
- pf->intr_handler(pf->intr_handler_arg);
+ return (FILTER_SCHEDULE_THREAD);
}
- return (FILTER_HANDLED);
+ return (FILTER_STRAY);
+}
+
+static void
+pccard_intr(void *arg)
+{
+ struct pccard_function *pf = (struct pccard_function*) arg;
+
+ pf->intr_handler(pf->intr_handler_arg);
}
static int
@@ -1226,19 +1235,13 @@ pccard_setup_intr(device_t dev, device_t child, struct resource *irq,
struct pccard_function *pf = ivar->pf;
int err;
- if (pf->intr_handler != NULL)
+ if (pf->intr_filter != NULL || pf->intr_handler != NULL)
panic("Only one interrupt handler per function allowed");
- if (filt != NULL && intr != NULL)
- return (EINVAL);
- if (filt != NULL)
- err = bus_generic_setup_intr(dev, child, irq, flags,
- pccard_intr, NULL, pf, cookiep);
- else
- err = bus_generic_setup_intr(dev, child, irq, flags,
- NULL, (driver_intr_t *)pccard_intr, pf, cookiep);
+ err = bus_generic_setup_intr(dev, child, irq, flags, pccard_filter,
+ pccard_intr, pf, cookiep);
if (err != 0)
return (err);
- pf->filt_handler = filt;
+ pf->intr_filter = filt;
pf->intr_handler = intr;
pf->intr_handler_arg = arg;
pf->intr_handler_cookie = *cookiep;
diff --git a/sys/dev/pccard/pccardvarp.h b/sys/dev/pccard/pccardvarp.h
index 892a028..e418730 100644
--- a/sys/dev/pccard/pccardvarp.h
+++ b/sys/dev/pccard/pccardvarp.h
@@ -112,7 +112,7 @@ struct pccard_function {
bus_addr_t pf_mfc_iobase;
bus_addr_t pf_mfc_iomax;
int pf_flags;
- driver_filter_t *filt_handler;
+ driver_filter_t *intr_filter;
driver_intr_t *intr_handler;
void *intr_handler_arg;
void *intr_handler_cookie;
OpenPOWER on IntegriCloud