diff options
author | marius <marius@FreeBSD.org> | 2010-01-15 15:47:31 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2010-01-15 15:47:31 +0000 |
commit | 390f07e1ae5eba410fe3705d4cb341d97346b96c (patch) | |
tree | a91f3e2ba7413024ab5e5692d508155a1d8e067c /sys/sparc64 | |
parent | 330f528fe079cc616d3700d4c66f8d43e2c9e1aa (diff) | |
download | FreeBSD-src-390f07e1ae5eba410fe3705d4cb341d97346b96c.zip FreeBSD-src-390f07e1ae5eba410fe3705d4cb341d97346b96c.tar.gz |
MFC: r201005, r201371
- Take advantage of bus_{read,write}_*(9).
- Set dow = -1 in mk48txx_gettime() because some drivers (for example
the NetBSD and OpenBSD mk48txx(4)) don't set it correctly.
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/sparc64/eeprom.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/sparc64/sparc64/eeprom.c b/sys/sparc64/sparc64/eeprom.c index 223b96c..da9909a 100644 --- a/sys/sparc64/sparc64/eeprom.c +++ b/sys/sparc64/sparc64/eeprom.c @@ -107,7 +107,7 @@ DRIVER_MODULE(eeprom, sbus, eeprom_driver, eeprom_devclass, 0, 0); static int eeprom_probe(device_t dev) { - + if (strcmp("eeprom", ofw_bus_get_name(dev)) == 0) { device_set_desc(dev, "EEPROM/clock"); return (0); @@ -119,7 +119,6 @@ static int eeprom_attach(device_t dev) { struct mk48txx_softc *sc; - struct resource *res; struct timespec ts; int error, rid; @@ -128,14 +127,13 @@ eeprom_attach(device_t dev) mtx_init(&sc->sc_mtx, "eeprom_mtx", NULL, MTX_DEF); rid = 0; - res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (res == NULL) { + sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_res == NULL) { device_printf(dev, "cannot allocate resources\n"); error = ENXIO; goto fail_mtx; } - sc->sc_bst = rman_get_bustag(res); - sc->sc_bsh = rman_get_bushandle(res); if ((sc->sc_model = ofw_bus_get_model(dev)) == NULL) { device_printf(dev, "cannot determine model\n"); @@ -180,7 +178,7 @@ eeprom_attach(device_t dev) return (0); fail_res: - bus_release_resource(dev, SYS_RES_MEMORY, rid, res); + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->sc_res); fail_mtx: mtx_destroy(&sc->sc_mtx); |