diff options
| author | Nate Lawson <njl@FreeBSD.org> | 2004-07-15 16:41:07 +0000 |
|---|---|---|
| committer | Nate Lawson <njl@FreeBSD.org> | 2004-07-15 16:41:07 +0000 |
| commit | 0bdf1a550888dcf6d8906110e1640192bf2652c8 (patch) | |
| tree | ff5fb16f534d910b0a40e3a042c69b33da342a77 | |
| parent | a6e4d8c45383824144e371bb6adc8e877611c4c9 (diff) | |
Notes
| -rw-r--r-- | sys/dev/fdc/fdc_isa.c | 32 | ||||
| -rw-r--r-- | sys/dev/fdc/fdc_pccard.c | 14 |
2 files changed, 31 insertions, 15 deletions
diff --git a/sys/dev/fdc/fdc_isa.c b/sys/dev/fdc/fdc_isa.c index b14c990804af..a1a6dd32e7ac 100644 --- a/sys/dev/fdc/fdc_isa.c +++ b/sys/dev/fdc/fdc_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 M. Warner Losh. * All rights reserved. * @@ -61,7 +61,7 @@ fdctl_wr_isa(fdc_p fdc, u_int8_t v) bus_space_write_1(fdc->ctlt, fdc->ctlh, 0, v); } -static int +int fdc_isa_alloc_resources(device_t dev, struct fdc_data *fdc) { int ispnp, nports; @@ -191,7 +191,6 @@ static int fdc_isa_probe(device_t dev) { int error, ic_type; - int ispnp; struct fdc_data *fdc; fdc = device_get_softc(dev); @@ -202,8 +201,6 @@ fdc_isa_probe(device_t dev) error = ISA_PNP_PROBE(device_get_parent(dev), dev, fdc_ids); if (error == ENXIO) return (ENXIO); - ispnp = (error == 0); - /* Attempt to allocate our resources for the duration of the probe */ error = fdc_isa_alloc_resources(dev, fdc); @@ -211,11 +208,9 @@ fdc_isa_probe(device_t dev) goto out; /* Check that the controller is working. */ - if (!ispnp) { - error = fdc_initial_reset(fdc); - if (error) - goto out; - } + error = fdc_initial_reset(fdc); + if (error) + goto out; /* Try to determine a more specific device type. */ if (fd_cmd(fdc, 1, NE7CMD_VERSION, 1, &ic_type) == 0) { @@ -266,8 +261,20 @@ fdc_isa_attach(device_t dev) break; } } - fdc_isa_alloc_resources(dev, fdc); - return (fdc_attach(dev)); + + error = fdc_isa_alloc_resources(dev, fdc); + if (error) + goto out; + error = fdc_attach(dev); + if (error) + goto out; + error = fdc_hints_probe(dev); + if (error) + goto out; +out: + if (error) + fdc_release_resources(fdc); + return (error); } static device_method_t fdc_methods[] = { @@ -295,4 +302,3 @@ static driver_t fdc_driver = { }; DRIVER_MODULE(fdc, isa, fdc_driver, fdc_devclass, 0, 0); -DRIVER_MODULE(fdc, acpi, fdc_driver, fdc_devclass, 0, 0); diff --git a/sys/dev/fdc/fdc_pccard.c b/sys/dev/fdc/fdc_pccard.c index 85a0ad032a0e..3dc5f25b5866 100644 --- a/sys/dev/fdc/fdc_pccard.c +++ b/sys/dev/fdc/fdc_pccard.c @@ -99,6 +99,7 @@ fdc_pccard_probe(device_t dev) static int fdc_pccard_attach(device_t dev) { + int error; struct fdc_data *fdc; return ENXIO; @@ -107,8 +108,17 @@ fdc_pccard_attach(device_t dev) fdc->fdctl_wr = fdctl_wr_pcmcia; fdc->flags = FDC_NODMA; fdc->fdct = FDC_NE765; - fdc_pccard_alloc_resources(dev, fdc); - return (fdc_attach(dev)); + error = fdc_pccard_alloc_resources(dev, fdc); + if (error) + goto out; + error = fdc_attach(dev); + if (error) + goto out; + +out: + if (error) + fdc_release_resources(fdc); + return (error); } static device_method_t fdc_pccard_methods[] = { |
