Clean up memory allocated during autoconfiguration

This commit is contained in:
kochi 2004-04-11 10:36:35 +00:00
parent 817b0a57d8
commit 193c08b383
11 changed files with 150 additions and 75 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: npx_acpi.c,v 1.7 2004/04/11 08:36:45 kochi Exp $ */
/* $NetBSD: npx_acpi.c,v 1.8 2004/04/11 10:36:45 kochi Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: npx_acpi.c,v 1.7 2004/04/11 08:36:45 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: npx_acpi.c,v 1.8 2004/04/11 10:36:45 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -101,7 +101,7 @@ npx_acpi_attach(struct device *parent, struct device *self, void *aux)
if (io == NULL) {
printf("%s: unable to find i/o register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/* find our IRQ */
@ -109,14 +109,14 @@ npx_acpi_attach(struct device *parent, struct device *self, void *aux)
if (irq == NULL) {
printf("%s: unable to find irq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
sc->sc_iot = aa->aa_iot;
if (bus_space_map(sc->sc_iot, io->ar_base, io->ar_length,
0, &sc->sc_ioh)) {
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
return;
goto out;
}
sc->sc_type = npxprobe1(sc->sc_iot, sc->sc_ioh, irq->ar_irq);
@ -135,10 +135,13 @@ npx_acpi_attach(struct device *parent, struct device *self, void *aux)
printf("%s: error reporting broken; not using\n",
sc->sc_dev.dv_xname);
sc->sc_type = NPX_NONE;
return;
goto out;
case NPX_NONE:
panic("npx_acpi_attach");
}
npxattach(sc);
out:
acpi_resource_cleanup(&res);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: spic_acpi.c,v 1.10 2004/04/11 08:36:45 kochi Exp $ */
/* $NetBSD: spic_acpi.c,v 1.11 2004/04/11 10:36:45 kochi Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.10 2004/04/11 08:36:45 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.11 2004/04/11 10:36:45 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -58,8 +58,6 @@ struct spic_acpi_softc {
struct acpi_devnode *sc_node; /* our ACPI devnode */
struct acpi_resources sc_res; /* our bus resources */
void *sc_ih;
};
@ -93,6 +91,8 @@ spic_acpi_attach(struct device *parent, struct device *self, void *aux)
struct acpi_attach_args *aa = aux;
struct acpi_io *io;
struct acpi_irq *irq;
struct acpi_resources res;
ACPI_STATUS rv;
printf(": Sony Programmable I/O Controller\n");
@ -101,29 +101,29 @@ spic_acpi_attach(struct device *parent, struct device *self, void *aux)
/* Parse our resources. */
rv = acpi_resource_parse(&sc->sc_spic.sc_dev, sc->sc_node->ad_handle,
"_CRS", &sc->sc_res, &acpi_resource_parse_ops_default);
"_CRS", &res, &acpi_resource_parse_ops_default);
if (ACPI_FAILURE(rv))
return;
sc->sc_spic.sc_iot = aa->aa_iot;
io = acpi_res_io(&sc->sc_res, 0);
io = acpi_res_io(&res, 0);
if (io == NULL) {
printf("%s: unable to find io resource\n",
sc->sc_spic.sc_dev.dv_xname);
return;
goto out;
}
if (bus_space_map(sc->sc_spic.sc_iot, io->ar_base, io->ar_length,
0, &sc->sc_spic.sc_ioh) != 0) {
printf("%s: unable to map data register\n",
sc->sc_spic.sc_dev.dv_xname);
return;
goto out;
}
irq = acpi_res_irq(&sc->sc_res, 0);
irq = acpi_res_irq(&res, 0);
if (irq == NULL) {
printf("%s: unable to find irq resource\n",
sc->sc_spic.sc_dev.dv_xname);
/* XXX unmap */
return;
goto out;
}
#if 0
sc->sc_ih = isa_intr_establish(NULL, irq->ar_irq,
@ -131,5 +131,6 @@ spic_acpi_attach(struct device *parent, struct device *self, void *aux)
#endif
spic_attach(&sc->sc_spic);
out:
acpi_resource_cleanup(&res);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_ec.c,v 1.26 2004/04/11 08:36:19 kochi Exp $ */
/* $NetBSD: acpi_ec.c,v 1.27 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -172,7 +172,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.26 2004/04/11 08:36:19 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.27 2004/04/11 10:36:35 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -530,13 +530,13 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
if (io0 == NULL) {
printf("%s: unable to find data register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
if (bus_space_map(sc->sc_data_st, io0->ar_base, io0->ar_length,
0, &sc->sc_data_sh) != 0) {
printf("%s: unable to map data register\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
sc->sc_csr_st = aa->aa_iot;
@ -544,13 +544,13 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
if (io1 == NULL) {
printf("%s: unable to find csr register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
if (bus_space_map(sc->sc_csr_st, io1->ar_base, io1->ar_length,
0, &sc->sc_csr_sh) != 0) {
printf("%s: unable to map csr register\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/*
@ -577,7 +577,7 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
if (ACPI_FAILURE(rv)) {
printf("%s: unable to evaluate _GPE: %s\n",
sc->sc_dev.dv_xname, AcpiFormatException(rv));
return;
goto out;
}
sc->sc_gpebit = v;
@ -594,7 +594,7 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
if (ACPI_FAILURE(rv)) {
printf("%s: unable to install GPE handler: %s\n",
sc->sc_dev.dv_xname, AcpiFormatException(rv));
return;
goto out;
}
/* Install address space handler. */
@ -605,9 +605,10 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
sc->sc_dev.dv_xname, AcpiFormatException(rv));
(void)AcpiRemoveGpeHandler(NULL, sc->sc_gpebit,
EcGpeHandler);
return;
}
out:
acpi_resource_cleanup(&sc->sc_res);
return_VOID;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_resource.c,v 1.13 2004/04/11 09:25:28 kochi Exp $ */
/* $NetBSD: acpi_resource.c,v 1.14 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.13 2004/04/11 09:25:28 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.14 2004/04/11 10:36:35 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -385,6 +385,60 @@ acpi_resource_print(struct device *dev, struct acpi_resources *res)
printf("\n");
}
/*
* acpi_resource_cleanup:
*
* Free all allocated buffers
*/
void
acpi_resource_cleanup(struct acpi_resources *res)
{
while (!SIMPLEQ_EMPTY(&res->ar_io)) {
struct acpi_io *ar;
ar = SIMPLEQ_FIRST(&res->ar_io);
SIMPLEQ_REMOVE_HEAD(&res->ar_io, ar_list);
AcpiOsFree(ar);
}
while (!SIMPLEQ_EMPTY(&res->ar_iorange)) {
struct acpi_iorange *ar;
ar = SIMPLEQ_FIRST(&res->ar_iorange);
SIMPLEQ_REMOVE_HEAD(&res->ar_iorange, ar_list);
AcpiOsFree(ar);
}
while (!SIMPLEQ_EMPTY(&res->ar_mem)) {
struct acpi_mem *ar;
ar = SIMPLEQ_FIRST(&res->ar_mem);
SIMPLEQ_REMOVE_HEAD(&res->ar_mem, ar_list);
AcpiOsFree(ar);
}
while (!SIMPLEQ_EMPTY(&res->ar_memrange)) {
struct acpi_memrange *ar;
ar = SIMPLEQ_FIRST(&res->ar_memrange);
SIMPLEQ_REMOVE_HEAD(&res->ar_memrange, ar_list);
AcpiOsFree(ar);
}
while (!SIMPLEQ_EMPTY(&res->ar_irq)) {
struct acpi_irq *ar;
ar = SIMPLEQ_FIRST(&res->ar_irq);
SIMPLEQ_REMOVE_HEAD(&res->ar_irq, ar_list);
AcpiOsFree(ar);
}
while (!SIMPLEQ_EMPTY(&res->ar_drq)) {
struct acpi_drq *ar;
ar = SIMPLEQ_FIRST(&res->ar_drq);
SIMPLEQ_REMOVE_HEAD(&res->ar_drq, ar_list);
AcpiOsFree(ar);
}
res->ar_nio = res->ar_niorange = res->ar_nmem =
res->ar_nmemrange = res->ar_nirq = res->ar_ndrq = 0;
}
struct acpi_io *
acpi_res_io(struct acpi_resources *res, int idx)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpivar.h,v 1.18 2004/04/11 08:36:19 kochi Exp $ */
/* $NetBSD: acpivar.h,v 1.19 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -271,6 +271,7 @@ ACPI_STATUS acpi_get(ACPI_HANDLE, ACPI_BUFFER *,
ACPI_STATUS acpi_resource_parse(struct device *, ACPI_HANDLE, char *,
void *, const struct acpi_resource_parse_ops *);
void acpi_resource_print(struct device *, struct acpi_resources *);
void acpi_resource_cleanup(struct acpi_resources *);
#if defined(_KERNEL_OPT)
#include "acpiec.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: atppc_acpi.c,v 1.3 2004/04/11 09:38:19 kochi Exp $ */
/* $NetBSD: atppc_acpi.c,v 1.4 2004/04/11 10:36:35 kochi Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: atppc_acpi.c,v 1.3 2004/04/11 09:38:19 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: atppc_acpi.c,v 1.4 2004/04/11 10:36:35 kochi Exp $");
#include "opt_atppc.h"
@ -134,7 +134,7 @@ atppc_acpi_attach(struct device *parent, struct device *self, void *aux)
if (io == NULL) {
printf("%s: unable to find i/o register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/* find our IRQ */
@ -142,7 +142,7 @@ atppc_acpi_attach(struct device *parent, struct device *self, void *aux)
if (irq == NULL) {
printf("%s: unable to find irq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
nirq = irq->ar_irq;
@ -151,7 +151,7 @@ atppc_acpi_attach(struct device *parent, struct device *self, void *aux)
if (drq == NULL) {
printf("%s: unable to find drq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
asc->sc_drq = drq->ar_drq;
@ -166,7 +166,7 @@ atppc_acpi_attach(struct device *parent, struct device *self, void *aux)
&sc->sc_ioh) != 0) {
printf("%s: attempt to map bus space failed, device not "
"properly attached.\n", self->dv_xname);
return;
goto out;
}
sc->sc_ieh = isa_intr_establish(aa->aa_ic, nirq,
@ -187,6 +187,8 @@ atppc_acpi_attach(struct device *parent, struct device *self, void *aux)
/* Run soft configuration attach */
atppc_sc_attach(sc);
out:
acpi_resource_cleanup(&res);
}
/* Start DMA operation over ISA bus */

View File

@ -1,4 +1,4 @@
/* $NetBSD: com_acpi.c,v 1.13 2004/04/11 08:36:19 kochi Exp $ */
/* $NetBSD: com_acpi.c,v 1.14 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.13 2004/04/11 08:36:19 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: com_acpi.c,v 1.14 2004/04/11 10:36:35 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -114,7 +114,7 @@ com_acpi_attach(struct device *parent, struct device *self, void *aux)
if (io == NULL) {
printf("%s: unable to find i/o register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/* find our IRQ */
@ -122,7 +122,7 @@ com_acpi_attach(struct device *parent, struct device *self, void *aux)
if (irq == NULL) {
printf("%s: unable to find irq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
sc->sc_iot = aa->aa_iot;
@ -131,7 +131,7 @@ com_acpi_attach(struct device *parent, struct device *self, void *aux)
0, &sc->sc_ioh)) {
printf("%s: can't map i/o space\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
}
sc->sc_iobase = io->ar_base;
@ -140,7 +140,7 @@ com_acpi_attach(struct device *parent, struct device *self, void *aux)
if (comprobe1(sc->sc_iot, sc->sc_ioh) == 0) {
printf(": com probe failed\n");
return;
goto out;
}
sc->sc_frequency = 115200 * 16;
@ -150,4 +150,6 @@ com_acpi_attach(struct device *parent, struct device *self, void *aux)
asc->sc_ih = isa_intr_establish(aa->aa_ic, irq->ar_irq,
(irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
IPL_SERIAL, comintr, sc);
out:
acpi_resource_cleanup(&res);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdc_acpi.c,v 1.20 2004/04/11 08:36:19 kochi Exp $ */
/* $NetBSD: fdc_acpi.c,v 1.21 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.20 2004/04/11 08:36:19 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.21 2004/04/11 10:36:35 kochi Exp $");
#include "rnd.h"
@ -69,7 +69,6 @@ struct fdc_acpi_softc {
struct fdc_softc sc_fdc;
bus_space_handle_t sc_baseioh;
struct acpi_devnode *sc_node; /* ACPI devnode */
struct acpi_resources res;
};
static int fdc_acpi_enumerate(struct fdc_acpi_softc *);
@ -115,6 +114,7 @@ fdc_acpi_attach(struct device *parent, struct device *self, void *aux)
struct acpi_io *io, *ctlio;
struct acpi_irq *irq;
struct acpi_drq *drq;
struct acpi_resources res;
ACPI_STATUS rv;
printf("\n");
@ -124,32 +124,32 @@ fdc_acpi_attach(struct device *parent, struct device *self, void *aux)
/* parse resources */
rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
&asc->res, &acpi_resource_parse_ops_default);
&res, &acpi_resource_parse_ops_default);
if (ACPI_FAILURE(rv))
return;
/* find our i/o registers */
io = acpi_res_io(&asc->res, 0);
io = acpi_res_io(&res, 0);
if (io == NULL) {
printf("%s: unable to find i/o register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/* find our IRQ */
irq = acpi_res_irq(&asc->res, 0);
irq = acpi_res_irq(&res, 0);
if (irq == NULL) {
printf("%s: unable to find irq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/* find our DRQ */
drq = acpi_res_drq(&asc->res, 0);
drq = acpi_res_drq(&res, 0);
if (drq == NULL) {
printf("%s: unable to find drq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
sc->sc_drq = drq->ar_drq;
@ -157,7 +157,7 @@ fdc_acpi_attach(struct device *parent, struct device *self, void *aux)
if (bus_space_map(sc->sc_iot, io->ar_base, io->ar_length,
0, &asc->sc_baseioh)) {
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
return;
goto out;
}
switch (io->ar_length) {
@ -169,26 +169,26 @@ fdc_acpi_attach(struct device *parent, struct device *self, void *aux)
&sc->sc_ioh)) {
printf("%s: unable to subregion i/o space\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
break;
default:
printf("%s: unknown size: %d of io mapping\n",
sc->sc_dev.dv_xname, io->ar_length);
return;
goto out;
}
/*
* omitting the controller I/O port. (One has to exist for there to
* be a working fdc). Just try and force the mapping in.
*/
ctlio = acpi_res_io(&asc->res, 1);
ctlio = acpi_res_io(&res, 1);
if (ctlio == NULL) {
if (bus_space_map(sc->sc_iot, io->ar_base + io->ar_length + 1,
1, 0, &sc->sc_fdctlioh)) {
printf("%s: unable to force map ctl i/o space\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
printf("%s: ctl io %x did't probe. Forced attach\n",
sc->sc_dev.dv_xname, io->ar_base + io->ar_length + 1);
@ -197,7 +197,7 @@ fdc_acpi_attach(struct device *parent, struct device *self, void *aux)
0, &sc->sc_fdctlioh)) {
printf("%s: unable to map ctl i/o space\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
}
@ -222,6 +222,9 @@ fdc_acpi_attach(struct device *parent, struct device *self, void *aux)
}
fdcattach(sc);
out:
acpi_resource_cleanup(&res);
}
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpt_acpi.c,v 1.8 2004/04/11 08:36:19 kochi Exp $ */
/* $NetBSD: lpt_acpi.c,v 1.9 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lpt_acpi.c,v 1.8 2004/04/11 08:36:19 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: lpt_acpi.c,v 1.9 2004/04/11 10:36:35 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -108,7 +108,7 @@ lpt_acpi_attach(struct device *parent, struct device *self, void *aux)
if (io == NULL) {
printf("%s: unable to find i/o register resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
/* find our IRQ */
@ -116,14 +116,14 @@ lpt_acpi_attach(struct device *parent, struct device *self, void *aux)
if (irq == NULL) {
printf("%s: unable to find irq resource\n",
sc->sc_dev.dv_xname);
return;
goto out;
}
sc->sc_iot = aa->aa_iot;
if (bus_space_map(sc->sc_iot, io->ar_base, io->ar_length,
0, &sc->sc_ioh)) {
printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
return;
goto out;
}
lpt_attach_subr(sc);
@ -131,4 +131,7 @@ lpt_acpi_attach(struct device *parent, struct device *self, void *aux)
sc->sc_ih = isa_intr_establish(aa->aa_ic, irq->ar_irq,
(irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL,
IPL_TTY, lptintr, sc);
out:
acpi_resource_cleanup(&res);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pckbc_acpi.c,v 1.13 2004/04/11 08:36:19 kochi Exp $ */
/* $NetBSD: pckbc_acpi.c,v 1.14 2004/04/11 10:36:35 kochi Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c,v 1.13 2004/04/11 08:36:19 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c,v 1.14 2004/04/11 10:36:35 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -175,7 +175,7 @@ pckbc_acpi_attach(struct device *parent,
irq = acpi_res_irq(&res, 0);
if (irq == NULL) {
printf("%s: unable to find irq resource\n", sc->sc_dv.dv_xname);
return;
goto out;
}
psc->sc_irq = irq->ar_irq;
psc->sc_ist = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
@ -190,7 +190,7 @@ pckbc_acpi_attach(struct device *parent,
if (io0 == NULL) {
printf("%s: unable to find i/o resources\n",
sc->sc_dv.dv_xname);
return;
goto out;
}
if (pckbc_is_console(aa->aa_iot, io0->ar_base)) {
@ -204,7 +204,7 @@ pckbc_acpi_attach(struct device *parent,
if (io1 == NULL) {
printf("%s: unable to find i/o resources\n",
sc->sc_dv.dv_xname);
return;
goto out;
}
if (bus_space_map(aa->aa_iot, io0->ar_base,
io0->ar_length, 0, &ioh_d) ||
@ -230,6 +230,8 @@ pckbc_acpi_attach(struct device *parent,
config_defer(&first->sc_pckbc.sc_dv,
(void(*)(struct device *))pckbc_attach);
}
out:
acpi_resource_cleanup(&res);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: wss_acpi.c,v 1.11 2004/04/11 08:56:48 kochi Exp $ */
/* $NetBSD: wss_acpi.c,v 1.12 2004/04/11 10:36:35 kochi Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wss_acpi.c,v 1.11 2004/04/11 08:56:48 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: wss_acpi.c,v 1.12 2004/04/11 10:36:35 kochi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -143,19 +143,19 @@ wss_acpi_attach(struct device *parent, struct device *self, void *aux)
if (dspio == NULL || oplio == NULL) {
printf("%s: unable to find i/o registers resource\n",
sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
return;
goto out;
}
if (bus_space_map(sc->sc_iot, dspio->ar_base, dspio->ar_length,
0, &sc->sc_ioh) != 0) {
printf("%s: unable to map i/o registers\n",
sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
return;
goto out;
}
if (bus_space_map(sc->sc_iot, oplio->ar_base, oplio->ar_length,
0, &sc->sc_opl_ioh) != 0) {
printf("%s: unable to map opl i/o registers\n",
sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
return;
goto out;
}
sc->wss_ic = aa->aa_ic;
@ -166,7 +166,7 @@ wss_acpi_attach(struct device *parent, struct device *self, void *aux)
printf("%s: unable to find irq resource\n",
sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
/* XXX bus_space_unmap */
return;
goto out;
}
sc->wss_irq = irq->ar_irq;
@ -177,7 +177,7 @@ wss_acpi_attach(struct device *parent, struct device *self, void *aux)
printf("%s: unable to find drq resources\n",
sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
/* XXX bus_space_unmap */
return;
goto out;
}
sc->wss_playdrq = playdrq->ar_drq;
sc->wss_recdrq = recdrq->ar_drq;
@ -191,7 +191,7 @@ wss_acpi_attach(struct device *parent, struct device *self, void *aux)
printf("%s: ad1848 probe failed\n",
sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
/* XXX cleanup */
return;
goto out;
}
printf("%s", sc->sc_ad1848.sc_ad1848.sc_dev.dv_xname);
@ -202,4 +202,7 @@ wss_acpi_attach(struct device *parent, struct device *self, void *aux)
arg.hwif = 0;
arg.hdl = 0;
config_found(self, &arg, audioprint);
out:
acpi_resource_cleanup(&res);
}