summaryrefslogtreecommitdiffstats
path: root/sys/arm/freescale
diff options
context:
space:
mode:
authorskra <skra@FreeBSD.org>2016-06-03 11:05:55 +0000
committerskra <skra@FreeBSD.org>2016-06-03 11:05:55 +0000
commit5583bfd183d3dbc2cd7d479de8eddb7e58420734 (patch)
tree7137e0588d21f2e47fb147c9d1e71ab045a3cf31 /sys/arm/freescale
parenta00165d816704b0ac2235fdeb0fce0e705654674 (diff)
downloadFreeBSD-src-5583bfd183d3dbc2cd7d479de8eddb7e58420734.zip
FreeBSD-src-5583bfd183d3dbc2cd7d479de8eddb7e58420734.tar.gz
Postpone allocation of IRQ resource to the time when interrupt
controller devices are attached. This has already been done for bus_setup_intr(). There was no doubt that if someone wants to setup an interrupt, corresponding interrupt controller device must already be attached. However, the same must be valid for allocation of an interrupt resource unless the allocation is done blindly, without any information that such interrupt even exists. While it was done this blind way before, it won't be possible after next INTRNG change.
Diffstat (limited to 'sys/arm/freescale')
-rw-r--r--sys/arm/freescale/imx/imx6_anatop.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/arm/freescale/imx/imx6_anatop.c b/sys/arm/freescale/imx/imx6_anatop.c
index 551531a..62c5a64 100644
--- a/sys/arm/freescale/imx/imx6_anatop.c
+++ b/sys/arm/freescale/imx/imx6_anatop.c
@@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
static struct resource_spec imx6_anatop_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
- { SYS_RES_IRQ, 0, RF_ACTIVE },
{ -1, 0 }
};
#define MEMRES 0
@@ -637,11 +636,20 @@ initialize_tempmon(struct imx6_anatop_softc *sc)
static void
intr_setup(void *arg)
{
+ int rid;
struct imx6_anatop_softc *sc;
sc = arg;
- bus_setup_intr(sc->dev, sc->res[IRQRES], INTR_TYPE_MISC | INTR_MPSAFE,
- tempmon_intr, NULL, sc, &sc->temp_intrhand);
+ rid = 0;
+ sc->res[IRQRES] = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &rid,
+ RF_ACTIVE);
+ if (sc->res[IRQRES] != NULL) {
+ bus_setup_intr(sc->dev, sc->res[IRQRES],
+ INTR_TYPE_MISC | INTR_MPSAFE, tempmon_intr, NULL, sc,
+ &sc->temp_intrhand);
+ } else {
+ device_printf(sc->dev, "Cannot allocate IRQ resource\n");
+ }
config_intrhook_disestablish(&sc->intr_setup_hook);
}
OpenPOWER on IntegriCloud