Use bus_alloc_resource_any(), rather than bus_alloc_resource()

with start 0 and end ~0. This avoids confusion WRT to what the
value of length can or should be.
This commit is contained in:
Marcel Moolenaar 2015-08-12 04:03:04 +00:00
parent 53d2ddb3fd
commit 9def69ec5f

View File

@ -474,14 +474,13 @@ uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan)
*/
sc->sc_rrid = rid;
sc->sc_rtype = SYS_RES_IOPORT;
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid,
0, ~0, uart_getrange(sc->sc_class), RF_ACTIVE);
sc->sc_rres = bus_alloc_resource_any(dev, sc->sc_rtype, &sc->sc_rrid,
RF_ACTIVE);
if (sc->sc_rres == NULL) {
sc->sc_rrid = rid;
sc->sc_rtype = SYS_RES_MEMORY;
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype,
&sc->sc_rrid, 0, ~0, uart_getrange(sc->sc_class),
RF_ACTIVE);
sc->sc_rres = bus_alloc_resource_any(dev, sc->sc_rtype,
&sc->sc_rrid, RF_ACTIVE);
if (sc->sc_rres == NULL)
return (ENXIO);
}
@ -556,8 +555,8 @@ uart_bus_attach(device_t dev)
* Re-allocate. We expect that the softc contains the information
* collected by uart_bus_probe() intact.
*/
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid,
0, ~0, uart_getrange(sc->sc_class), RF_ACTIVE);
sc->sc_rres = bus_alloc_resource_any(dev, sc->sc_rtype, &sc->sc_rrid,
RF_ACTIVE);
if (sc->sc_rres == NULL) {
mtx_destroy(&sc->sc_hwmtx_s);
return (ENXIO);