svn commit: r238044 - head/sys/dev/fdt
Marcel Moolenaar
marcel at FreeBSD.org
Mon Jul 2 23:53:09 UTC 2012
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 *
More information about the svn-src-head
mailing list