- Register the generic implementations for the device shutdown, suspend

and resume methods so these events propagate through the device driver
  hierarchy.
- In dma(4) enable the chaining of the DMA engine interrupt handler for
  the LANCE devices via a dma_setup_intr(). This was commented out before
  as I was unsure whether I'd use it but this is probably cleaner than
  fiddling with the DMA engine interrupt in the LANCE driver directly.
- In ebus_setup_dinfo() free 'intrs' instead of 'reg' twice in case
  setting up a child fails due to routing one of its interrupts fails. [1]

Found by:	Coverity Prevent [1]
MFC after:	3 days
This commit is contained in:
marius 2006-01-26 21:14:32 +00:00
parent 7ba1cf1d54
commit 679181b556
7 changed files with 22 additions and 9 deletions

View File

@ -71,6 +71,9 @@ static device_method_t central_methods[] = {
/* Device interface. */
DEVMETHOD(device_probe, central_probe),
DEVMETHOD(device_attach, central_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface. */
DEVMETHOD(bus_print_child, central_print_child),

View File

@ -116,6 +116,9 @@ static device_method_t ebus_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, ebus_probe),
DEVMETHOD(device_attach, ebus_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface */
DEVMETHOD(bus_print_child, ebus_print_child),
@ -426,7 +429,7 @@ ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node)
device_printf(dev,
"<%s>: could not map EBus interrupt %d\n",
edi->edi_obdinfo.obd_name, intrs[i]);
free(reg, M_OFWPROP);
free(intrs, M_OFWPROP);
goto fail;
}
resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i,

View File

@ -52,6 +52,9 @@ static device_method_t fhc_central_methods[] = {
/* Device interface. */
DEVMETHOD(device_probe, fhc_central_probe),
DEVMETHOD(device_attach, fhc_central_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface. */
DEVMETHOD(bus_print_child, fhc_print_child),

View File

@ -55,6 +55,9 @@ static device_method_t fhc_nexus_methods[] = {
/* Device interface. */
DEVMETHOD(device_probe, fhc_nexus_probe),
DEVMETHOD(device_attach, fhc_nexus_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface. */
DEVMETHOD(bus_print_child, fhc_print_child),

View File

@ -124,6 +124,9 @@ static device_method_t psycho_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, psycho_probe),
DEVMETHOD(device_attach, psycho_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface */
DEVMETHOD(bus_print_child, bus_generic_print_child),

View File

@ -105,9 +105,7 @@ static device_attach_t dma_attach;
static bus_print_child_t dma_print_child;
static bus_probe_nomatch_t dma_probe_nomatch;
static bus_get_resource_list_t dma_get_resource_list;
#if 0
static bus_setup_intr_t dma_setup_intr;
#endif
static ofw_bus_get_devinfo_t dma_get_devinfo;
static struct dma_devinfo *dma_setup_dinfo(device_t, struct dma_softc *,
@ -119,15 +117,14 @@ static device_method_t dma_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, dma_probe),
DEVMETHOD(device_attach, dma_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface */
DEVMETHOD(bus_print_child, dma_print_child),
DEVMETHOD(bus_probe_nomatch, dma_probe_nomatch),
#if 0
DEVMETHOD(bus_setup_intr, dma_setup_intr),
#else
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
#endif
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource),
@ -404,7 +401,6 @@ dma_get_resource_list(device_t dev, device_t child)
return (&ddi->ddi_rl);
}
#if 0
static int
dma_setup_intr(device_t dev, device_t child, struct resource *ires, int flags,
driver_intr_t *intr, void *arg, void **cookiep)
@ -423,7 +419,6 @@ dma_setup_intr(device_t dev, device_t child, struct resource *ires, int flags,
return (BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags,
intr, arg, cookiep));
}
#endif
static const struct ofw_bus_devinfo *
dma_get_devinfo(device_t bus, device_t child)

View File

@ -219,6 +219,9 @@ static device_method_t sbus_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, sbus_probe),
DEVMETHOD(device_attach, sbus_attach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
/* Bus interface */
DEVMETHOD(bus_print_child, sbus_print_child),