From owner-svn-src-all@freebsd.org Fri Jun 3 11:05:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AEA0B68F51; Fri, 3 Jun 2016 11:05:56 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 188C811D7; Fri, 3 Jun 2016 11:05:56 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u53B5tq4073577; Fri, 3 Jun 2016 11:05:55 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u53B5tVi073576; Fri, 3 Jun 2016 11:05:55 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201606031105.u53B5tVi073576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Fri, 3 Jun 2016 11:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301266 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2016 11:05:56 -0000 Author: skra Date: Fri Jun 3 11:05:55 2016 New Revision: 301266 URL: https://svnweb.freebsd.org/changeset/base/301266 Log: 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. Modified: head/sys/arm/freescale/imx/imx6_anatop.c Modified: head/sys/arm/freescale/imx/imx6_anatop.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_anatop.c Fri Jun 3 10:28:06 2016 (r301265) +++ head/sys/arm/freescale/imx/imx6_anatop.c Fri Jun 3 11:05:55 2016 (r301266) @@ -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_so 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); }