summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-02-22 18:16:26 +0000
committerjhb <jhb@FreeBSD.org>2006-02-22 18:16:26 +0000
commit4793b3db380bcaac1d396101ed11d3b3001642e5 (patch)
tree804a52776d979b0d584c9efe815d95731c11d05d
parent82b4c8972021decda7584eb5dce699df1de06416 (diff)
downloadFreeBSD-src-4793b3db380bcaac1d396101ed11d3b3001642e5.zip
FreeBSD-src-4793b3db380bcaac1d396101ed11d3b3001642e5.tar.gz
- 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.
-rw-r--r--sys/dev/ar/if_ar.c7
-rw-r--r--sys/dev/mse/mse.c2
-rw-r--r--sys/dev/pcf/envctrl.c5
-rw-r--r--sys/dev/pcf/pcf_ebus.c4
-rw-r--r--sys/dev/pcf/pcf_isa.c5
-rw-r--r--sys/dev/ppbus/if_plip.c2
-rw-r--r--sys/dev/ppbus/lpt.c4
-rw-r--r--sys/dev/ppbus/ppi.c4
-rw-r--r--sys/dev/ppc/ppc.c4
-rw-r--r--sys/dev/sio/sio.c4
-rw-r--r--sys/dev/sr/if_sr.c5
-rw-r--r--sys/dev/uart/uart_core.c4
-rw-r--r--sys/pc98/cbus/fdc.c5
-rw-r--r--sys/pc98/cbus/pckbd.c3
-rw-r--r--sys/pc98/cbus/ppc.c3
-rw-r--r--sys/pc98/cbus/sio.c4
16 files changed, 29 insertions, 36 deletions
diff --git a/sys/dev/ar/if_ar.c b/sys/dev/ar/if_ar.c
index da657dd..b29c26b 100644
--- a/sys/dev/ar/if_ar.c
+++ b/sys/dev/ar/if_ar.c
@@ -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");
}
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c
index 1c2a986..025faea 100644
--- a/sys/dev/mse/mse.c
+++ b/sys/dev/mse/mse.c
@@ -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);
diff --git a/sys/dev/pcf/envctrl.c b/sys/dev/pcf/envctrl.c
index 25a163c..a567cb7 100644
--- a/sys/dev/pcf/envctrl.c
+++ b/sys/dev/pcf/envctrl.c
@@ -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);
}
diff --git a/sys/dev/pcf/pcf_ebus.c b/sys/dev/pcf/pcf_ebus.c
index 3ea2051..46511a0 100644
--- a/sys/dev/pcf/pcf_ebus.c
+++ b/sys/dev/pcf/pcf_ebus.c
@@ -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);
diff --git a/sys/dev/pcf/pcf_isa.c b/sys/dev/pcf/pcf_isa.c
index 2de3b45..34ce67d 100644
--- a/sys/dev/pcf/pcf_isa.c
+++ b/sys/dev/pcf/pcf_isa.c
@@ -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);
}
diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c
index 2b71be4..2af0fd1 100644
--- a/sys/dev/ppbus/if_plip.c
+++ b/sys/dev/ppbus/if_plip.c
@@ -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);
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index dec1084..6296da5 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -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) {
diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c
index f689bc1..35be2db 100644
--- a/sys/dev/ppbus/ppi.c
+++ b/sys/dev/ppbus/ppi.c
@@ -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 */
diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c
index 5890ca0..d7adf42 100644
--- a/sys/dev/ppc/ppc.c
+++ b/sys/dev/ppc/ppc.c
@@ -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;
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 5f1a690..df9f11b 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -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)
diff --git a/sys/dev/sr/if_sr.c b/sys/dev/sr/if_sr.c
index 0260b12..45c764e 100644
--- a/sys/dev/sr/if_sr.c
+++ b/sys/dev/sr/if_sr.c
@@ -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");
}
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index b2ff203..51d618f 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -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
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c
index d2ac417..9fc1710 100644
--- a/sys/pc98/cbus/fdc.c
+++ b/sys/pc98/cbus/fdc.c
@@ -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) {
diff --git a/sys/pc98/cbus/pckbd.c b/sys/pc98/cbus/pckbd.c
index 7eed7ca..a93aa52 100644
--- a/sys/pc98/cbus/pckbd.c
+++ b/sys/pc98/cbus/pckbd.c
@@ -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;
}
diff --git a/sys/pc98/cbus/ppc.c b/sys/pc98/cbus/ppc.c
index 664336e..2989eed 100644
--- a/sys/pc98/cbus/ppc.c
+++ b/sys/pc98/cbus/ppc.c
@@ -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 */
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index 51f4a45..5071fa9 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -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)
OpenPOWER on IntegriCloud