- Use bus_setup_intr() and bus_teardown_intr() to register device driver
interrupt handlers rather than BUS_SETUP_INTR() and BUS_TEARDOWN_INTR(). Uses of the BUS_*() versions in the implementation of foo_intr methods in bus drivers were not changed. Mostly this just means that some drivers might start printing diagnostic messages like [FAST] when appropriate as well as honoring mpsafenet=0. - Fix two more of the ppbus drivers' identify routines to function correctly in the mythical case of a machine with more than one ppbus.
This commit is contained in:
parent
82b4c89720
commit
4793b3db38
@ -258,7 +258,7 @@ ar_attach(device_t device)
|
||||
|
||||
arc_init(hc);
|
||||
|
||||
if(BUS_SETUP_INTR(device_get_parent(device), device, hc->res_irq,
|
||||
if(bus_setup_intr(device, hc->res_irq,
|
||||
INTR_TYPE_NET, arintr, hc, &hc->intr_cookie) != 0)
|
||||
return (1);
|
||||
|
||||
@ -285,7 +285,7 @@ ar_attach(device_t device)
|
||||
#ifndef NETGRAPH
|
||||
ifp = SC2IFP(sc) = if_alloc(IFT_PPP);
|
||||
if (ifp == NULL) {
|
||||
if (BUS_TEARDOWN_INTR(device_get_parent(device), device,
|
||||
if (bus_teardown_intr(device,
|
||||
hc->res_irq, hc->intr_cookie) != 0) {
|
||||
printf("intr teardown failed.. continuing\n");
|
||||
}
|
||||
@ -351,11 +351,10 @@ ar_attach(device_t device)
|
||||
int
|
||||
ar_detach(device_t device)
|
||||
{
|
||||
device_t parent = device_get_parent(device);
|
||||
struct ar_hardc *hc = device_get_softc(device);
|
||||
|
||||
if (hc->intr_cookie != NULL) {
|
||||
if (BUS_TEARDOWN_INTR(parent, device,
|
||||
if (bus_teardown_intr(device,
|
||||
hc->res_irq, hc->intr_cookie) != 0) {
|
||||
printf("intr teardown failed.. continuing\n");
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ mse_common_attach(device_t dev)
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
if (BUS_SETUP_INTR(device_get_parent(dev), dev, sc->sc_intr,
|
||||
if (bus_setup_intr(dev, sc->sc_intr,
|
||||
INTR_TYPE_TTY, mseintr, sc, &sc->sc_ih)) {
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);
|
||||
|
@ -133,7 +133,7 @@ envctrl_attach(device_t dev)
|
||||
/* reset the chip */
|
||||
pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL);
|
||||
|
||||
rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq,
|
||||
rv = bus_setup_intr(dev, sc->res_irq,
|
||||
INTR_TYPE_NET /* | INTR_ENTROPY */,
|
||||
pcf_intr, sc, &sc->intr_cookie);
|
||||
if (rv) {
|
||||
@ -180,8 +180,7 @@ envctrl_detach(device_t dev)
|
||||
return (rv);
|
||||
|
||||
if (sc->res_irq != 0) {
|
||||
BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
|
||||
sc->intr_cookie);
|
||||
bus_teardown_intr(dev, sc->res_irq, sc->intr_cookie);
|
||||
bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ pcf_ebus_attach(device_t dev)
|
||||
pcf_rst_card(dev, IIC_FASTEST, own_addr, NULL);
|
||||
|
||||
if (sc->res_irq) {
|
||||
rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq,
|
||||
rv = bus_setup_intr(dev, sc->res_irq,
|
||||
INTR_TYPE_NET /* | INTR_ENTROPY */, pcf_intr, sc,
|
||||
&sc->intr_cookie);
|
||||
if (rv) {
|
||||
@ -241,7 +241,7 @@ pcf_ebus_detach(device_t dev)
|
||||
return (rv);
|
||||
|
||||
if (sc->res_irq != 0) {
|
||||
BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
|
||||
bus_teardown_intr(dev, sc->res_irq,
|
||||
sc->intr_cookie);
|
||||
bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq,
|
||||
sc->res_irq);
|
||||
|
@ -153,7 +153,7 @@ pcf_isa_attach(device_t dev)
|
||||
pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL);
|
||||
|
||||
if (sc->res_irq) {
|
||||
rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq,
|
||||
rv = bus_setup_intr(dev, sc->res_irq,
|
||||
INTR_TYPE_NET /* | INTR_ENTROPY */,
|
||||
pcf_intr, sc, &sc->intr_cookie);
|
||||
if (rv) {
|
||||
@ -201,8 +201,7 @@ pcf_isa_detach(device_t dev)
|
||||
return (rv);
|
||||
|
||||
if (sc->res_irq != 0) {
|
||||
BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
|
||||
sc->intr_cookie);
|
||||
bus_teardown_intr(dev, sc->res_irq, sc->intr_cookie);
|
||||
bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ lpioctl (struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
}
|
||||
|
||||
/* attach our interrupt handler, later detached when the bus is released */
|
||||
if ((error = BUS_SETUP_INTR(ppbus, dev, sc->res_irq,
|
||||
if ((error = bus_setup_intr(dev, sc->res_irq,
|
||||
INTR_TYPE_NET, lp_intr, dev, &ih))) {
|
||||
ppb_release_bus(ppbus, dev);
|
||||
return (error);
|
||||
|
@ -342,7 +342,7 @@ lpt_identify(driver_t *driver, device_t parent)
|
||||
|
||||
device_t dev;
|
||||
|
||||
dev = device_find_child(parent, LPT_NAME, 0);
|
||||
dev = device_find_child(parent, LPT_NAME, -1);
|
||||
if (!dev)
|
||||
BUS_ADD_CHILD(parent, 0, LPT_NAME, -1);
|
||||
}
|
||||
@ -744,7 +744,7 @@ lptwrite(struct cdev *dev, struct uio *uio, int ioflag)
|
||||
/* if interrupts are working, register the handler */
|
||||
if (sc->sc_irq & LP_USE_IRQ) {
|
||||
/* register our interrupt handler */
|
||||
err = BUS_SETUP_INTR(ppbus, lptdev, sc->intr_resource,
|
||||
err = bus_setup_intr(lptdev, sc->intr_resource,
|
||||
INTR_TYPE_TTY, lpt_intr, lptdev,
|
||||
&sc->intr_cookie);
|
||||
if (err) {
|
||||
|
@ -135,7 +135,7 @@ ppi_identify(driver_t *driver, device_t parent)
|
||||
|
||||
device_t dev;
|
||||
|
||||
dev = device_find_child(parent, "ppi", 0);
|
||||
dev = device_find_child(parent, "ppi", -1);
|
||||
if (!dev)
|
||||
BUS_ADD_CHILD(parent, 0, "ppi", -1);
|
||||
}
|
||||
@ -276,7 +276,7 @@ ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
||||
#ifdef PERIPH_1284
|
||||
if (ppi->intr_resource) {
|
||||
/* register our interrupt handler */
|
||||
BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
|
||||
bus_setup_intr(ppidev, ppi->intr_resource,
|
||||
INTR_TYPE_TTY, ppiintr, dev, &ppi->intr_cookie);
|
||||
}
|
||||
#endif /* PERIPH_1284 */
|
||||
|
@ -1997,8 +1997,8 @@ ppc_attach(device_t dev)
|
||||
/* register the ppc interrupt handler as default */
|
||||
if (ppc->res_irq) {
|
||||
/* default to the tty mask for registration */ /* XXX */
|
||||
if (BUS_SETUP_INTR(parent, dev, ppc->res_irq, INTR_TYPE_TTY,
|
||||
ppcintr, dev, &ppc->intr_cookie) == 0) {
|
||||
if (bus_setup_intr(dev, ppc->res_irq, INTR_TYPE_TTY,
|
||||
ppcintr, dev, &ppc->intr_cookie) == 0) {
|
||||
|
||||
/* remember the ppcintr is registered */
|
||||
ppc->ppc_registered = 1;
|
||||
|
@ -1074,11 +1074,11 @@ determined_type: ;
|
||||
rid = 0;
|
||||
com->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
|
||||
if (com->irqres) {
|
||||
ret = BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres,
|
||||
ret = bus_setup_intr(dev, com->irqres,
|
||||
INTR_TYPE_TTY | INTR_FAST,
|
||||
siointr, com, &com->cookie);
|
||||
if (ret) {
|
||||
ret = BUS_SETUP_INTR(device_get_parent(dev), dev,
|
||||
ret = bus_setup_intr(dev,
|
||||
com->irqres, INTR_TYPE_TTY,
|
||||
siointr, com, &com->cookie);
|
||||
if (ret == 0)
|
||||
|
@ -389,7 +389,7 @@ sr_attach(device_t device)
|
||||
src_init(hc);
|
||||
sr_init_sca(hc);
|
||||
|
||||
if (BUS_SETUP_INTR(device_get_parent(device), device, hc->res_irq,
|
||||
if (bus_setup_intr(device, hc->res_irq,
|
||||
INTR_TYPE_NET, srintr, hc, &hc->intr_cookie) != 0)
|
||||
goto errexit;
|
||||
|
||||
@ -462,11 +462,10 @@ errexit:
|
||||
int
|
||||
sr_detach(device_t device)
|
||||
{
|
||||
device_t parent = device_get_parent(device);
|
||||
struct sr_hardc *hc = device_get_softc(device);
|
||||
|
||||
if (hc->intr_cookie != NULL) {
|
||||
if (BUS_TEARDOWN_INTR(parent, device,
|
||||
if (bus_teardown_intr(device,
|
||||
hc->res_irq, hc->intr_cookie) != 0) {
|
||||
printf("intr teardown failed.. continuing\n");
|
||||
}
|
||||
|
@ -332,11 +332,11 @@ uart_bus_attach(device_t dev)
|
||||
sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid,
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (sc->sc_ires != NULL) {
|
||||
error = BUS_SETUP_INTR(device_get_parent(dev), dev,
|
||||
error = bus_setup_intr(dev,
|
||||
sc->sc_ires, INTR_TYPE_TTY | INTR_FAST, uart_intr,
|
||||
sc, &sc->sc_icookie);
|
||||
if (error)
|
||||
error = BUS_SETUP_INTR(device_get_parent(dev), dev,
|
||||
error = bus_setup_intr(dev,
|
||||
sc->sc_ires, INTR_TYPE_TTY | INTR_MPSAFE,
|
||||
uart_intr, sc, &sc->sc_icookie);
|
||||
else
|
||||
|
@ -654,8 +654,7 @@ fdc_release_resources(struct fdc_data *fdc)
|
||||
|
||||
dev = fdc->fdc_dev;
|
||||
if (fdc->fdc_intr) {
|
||||
BUS_TEARDOWN_INTR(device_get_parent(dev), dev, fdc->res_irq,
|
||||
fdc->fdc_intr);
|
||||
bus_teardown_intr(dev, fdc->res_irq, fdc->fdc_intr);
|
||||
fdc->fdc_intr = NULL;
|
||||
}
|
||||
if (fdc->res_irq != 0) {
|
||||
@ -823,7 +822,7 @@ fdc_attach(device_t dev)
|
||||
|
||||
fdc = device_get_softc(dev);
|
||||
fdc->fdc_dev = dev;
|
||||
error = BUS_SETUP_INTR(device_get_parent(dev), dev, fdc->res_irq,
|
||||
error = bus_setup_intr(dev, fdc->res_irq,
|
||||
INTR_TYPE_BIO | INTR_ENTROPY, fdc_intr, fdc,
|
||||
&fdc->fdc_intr);
|
||||
if (error) {
|
||||
|
@ -136,8 +136,7 @@ pckbdattach(device_t dev)
|
||||
res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
|
||||
if (res == NULL)
|
||||
return ENXIO;
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, INTR_TYPE_TTY,
|
||||
pckbd_isa_intr, kbd, &ih);
|
||||
bus_setup_intr(dev, res, INTR_TYPE_TTY, pckbd_isa_intr, kbd, &ih);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2024,7 +2024,6 @@ ppc_attach(device_t dev)
|
||||
struct ppc_data *ppc = DEVTOSOFTC(dev);
|
||||
|
||||
device_t ppbus;
|
||||
device_t parent = device_get_parent(dev);
|
||||
|
||||
device_printf(dev, "%s chipset (%s) in %s mode%s\n",
|
||||
ppc_models[ppc->ppc_model], ppc_avms[ppc->ppc_avm],
|
||||
@ -2052,7 +2051,7 @@ ppc_attach(device_t dev)
|
||||
/* register the ppc interrupt handler as default */
|
||||
if (ppc->res_irq) {
|
||||
/* default to the tty mask for registration */ /* XXX */
|
||||
if (BUS_SETUP_INTR(parent, dev, ppc->res_irq, INTR_TYPE_TTY,
|
||||
if (bus_setup_intr(dev, ppc->res_irq, INTR_TYPE_TTY,
|
||||
ppcintr, dev, &ppc->intr_cookie) == 0) {
|
||||
|
||||
/* remember the ppcintr is registered */
|
||||
|
@ -1738,11 +1738,11 @@ determined_type: ;
|
||||
rid = 0;
|
||||
com->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
|
||||
if (com->irqres) {
|
||||
ret = BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres,
|
||||
ret = bus_setup_intr(dev, com->irqres,
|
||||
INTR_TYPE_TTY | INTR_FAST,
|
||||
siointr, com, &com->cookie);
|
||||
if (ret) {
|
||||
ret = BUS_SETUP_INTR(device_get_parent(dev), dev,
|
||||
ret = bus_setup_intr(dev,
|
||||
com->irqres, INTR_TYPE_TTY,
|
||||
siointr, com, &com->cookie);
|
||||
if (ret == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user