From owner-svn-src-all@FreeBSD.ORG Mon Jul 2 23:53:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CE791065673; Mon, 2 Jul 2012 23:53:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E570C8FC1A; Mon, 2 Jul 2012 23:53:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q62Nr8Jt007264; Mon, 2 Jul 2012 23:53:08 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q62Nr8a2007262; Mon, 2 Jul 2012 23:53:08 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201207022353.q62Nr8a2007262@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 2 Jul 2012 23:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238044 - head/sys/dev/fdt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 02 Jul 2012 23:53:09 -0000 Author: marcel Date: Mon Jul 2 23:53:08 2012 New Revision: 238044 URL: http://svn.freebsd.org/changeset/base/238044 Log: Simplify simplebus_setup_intr and don't call MD code directly. We can (and have to) trust our parent to handle interrupt configuration. Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Jul 2 23:49:29 2012 (r238043) +++ head/sys/dev/fdt/simplebus.c Mon Jul 2 23:53:08 2012 (r238044) @@ -288,39 +288,34 @@ simplebus_setup_intr(device_t bus, devic struct simplebus_devinfo *di; enum intr_trigger trig; enum intr_polarity pol; - int irq, rid; + int error, rid; - if (res == NULL) - panic("simplebus_setup_intr: NULL irq resource!"); + if (device_get_parent(child) != bus) + return (ECHILD); - rid = rman_get_rid(res); - if (rid > DI_MAX_INTR_NUM) { - device_printf(child, "rid out of range rid = %d\n", rid); - return (ERANGE); - } + di = device_get_ivars(child); + if (di == NULL) + return (ENXIO); - irq = rman_get_start(res); + if (res == NULL) + return (EINVAL); - if ((di = device_get_ivars(child)) == NULL) { - device_printf(child, "could not retrieve devinfo\n"); - return (ENXIO); - } + rid = rman_get_rid(res); + if (rid >= DI_MAX_INTR_NUM) + return (ENOENT); trig = di->di_intr_sl[rid].trig; pol = di->di_intr_sl[rid].pol; + if (trig != INTR_TRIGGER_CONFORM || pol != INTR_POLARITY_CONFORM) { + error = bus_generic_config_intr(bus, rman_get_start(res), + trig, pol); + if (error) + return (error); + } - debugf("intr config: irq = %d, trig = %d, pol = %d\n", irq, trig, pol); - -#if defined(__powerpc__) - int err; - - err = powerpc_config_intr(irq, trig, pol); - if (err) - return (err); -#endif - - return (bus_generic_setup_intr(bus, child, res, flags, filter, ihand, - arg, cookiep)); + error = bus_generic_setup_intr(bus, child, res, flags, filter, ihand, + arg, cookiep); + return (error); } static const struct ofw_bus_devinfo *