Deleted Added
full compact
2c2
< * Copyright (c) 2012 Robert N. M. Watson
---
> * Copyright (c) 2012-2013 Robert N. M. Watson
32c32
< __FBSDID("$FreeBSD: head/sys/dev/altera/avgen/altera_avgen.c 239674 2012-08-25 11:07:43Z rwatson $");
---
> __FBSDID("$FreeBSD: head/sys/dev/altera/avgen/altera_avgen.c 245376 2013-01-13 16:43:59Z rwatson $");
229,231d228
< static int
< altera_avgen_nexus_probe(device_t dev)
< {
233,236d229
< device_set_desc(dev, "Generic Altera Avalon device attachment");
< return (BUS_PROBE_DEFAULT);
< }
<
324,325c317,319
< static int
< altera_avgen_nexus_attach(device_t dev)
---
> int
> altera_avgen_attach(struct altera_avgen_softc *sc, const char *str_fileio,
> const char *str_mmapio, const char *str_devname, int devunit)
327,329c321
< struct altera_avgen_softc *sc;
< const char *str_fileio, *str_mmapio;
< const char *str_devname;
---
> device_t dev = sc->avg_dev;
331c323
< int devunit, error;
---
> int error;
333,359d324
< sc = device_get_softc(dev);
< sc->avg_dev = dev;
< sc->avg_unit = device_get_unit(dev);
<
< /*
< * Query non-standard hints to find out what operations are permitted
< * on the device, and whether it is cached.
< */
< str_fileio = NULL;
< str_mmapio = NULL;
< str_devname = NULL;
< devunit = -1;
< sc->avg_width = 1;
< error = resource_int_value(device_get_name(dev), device_get_unit(dev),
< ALTERA_AVALON_STR_WIDTH, &sc->avg_width);
< if (error != 0 && error != ENOENT) {
< device_printf(dev, "invalid %s\n", ALTERA_AVALON_STR_WIDTH);
< return (error);
< }
< (void)resource_string_value(device_get_name(dev),
< device_get_unit(dev), ALTERA_AVALON_STR_FILEIO, &str_fileio);
< (void)resource_string_value(device_get_name(dev),
< device_get_unit(dev), ALTERA_AVALON_STR_MMAPIO, &str_mmapio);
< (void)resource_string_value(device_get_name(dev),
< device_get_unit(dev), ALTERA_AVALON_STR_DEVNAME, &str_devname);
< (void)resource_int_value(device_get_name(dev), device_get_unit(dev),
< ALTERA_AVALON_STR_DEVUNIT, &devunit);
377,384d341
< /* Memory allocation and checking. */
< sc->avg_rid = 0;
< sc->avg_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
< &sc->avg_rid, RF_ACTIVE);
< if (sc->avg_res == NULL) {
< device_printf(dev, "couldn't map memory\n");
< return (ENXIO);
< }
389,390c346
< error = ENXIO;
< goto error;
---
> return (ENXIO);
394,395c350
< error = ENXIO;
< goto error;
---
> return (ENXIO);
412,413c367
< error = ENXIO;
< goto error;
---
> return (ENXIO);
418,421d371
<
< error:
< bus_release_resource(dev, SYS_RES_MEMORY, sc->avg_rid, sc->avg_res);
< return (error);
424,425c374,375
< static int
< altera_avgen_nexus_detach(device_t dev)
---
> void
> altera_avgen_detach(struct altera_avgen_softc *sc)
427d376
< struct altera_avgen_softc *sc;
429d377
< sc = device_get_softc(dev);
431,432d378
< bus_release_resource(dev, SYS_RES_MEMORY, sc->avg_rid, sc->avg_res);
< return (0);
434,451d379
<
< static device_method_t altera_avgen_nexus_methods[] = {
< DEVMETHOD(device_probe, altera_avgen_nexus_probe),
< DEVMETHOD(device_attach, altera_avgen_nexus_attach),
< DEVMETHOD(device_detach, altera_avgen_nexus_detach),
< { 0, 0 }
< };
<
< static driver_t altera_avgen_nexus_driver = {
< "altera_avgen",
< altera_avgen_nexus_methods,
< sizeof(struct altera_avgen_softc),
< };
<
< static devclass_t altera_avgen_devclass;
<
< DRIVER_MODULE(avgen, nexus, altera_avgen_nexus_driver, altera_avgen_devclass,
< 0, 0);