Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Split device_t/softc of all ad1848 variants properly. C...
details: https://anonhg.NetBSD.org/src/rev/ca16cdbe4bd9
branches: trunk
changeset: 765679:ca16cdbe4bd9
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Thu Jun 02 14:12:24 2011 +0000
description:
Split device_t/softc of all ad1848 variants properly. Compile test only.
Please check all attribute users in all files.* on device_t/softc split.
XXX: not sure if gus(4) needs device_t in ad1848_isa_softc
diffstat:
sys/arch/amiga/dev/toccata.c | 23 ++++++++++++-----------
sys/arch/i386/pnpbios/wss_pnpbios.c | 7 ++++---
sys/arch/i386/pnpbios/ym_pnpbios.c | 8 +++++---
sys/arch/prep/isa/paud_isa.c | 19 ++++++++++---------
sys/dev/acpi/wss_acpi.c | 25 +++++++++++++------------
sys/dev/acpi/ym_acpi.c | 11 ++++++-----
sys/dev/isa/wss_isa.c | 24 ++++++++++++++----------
sys/dev/isa/ym.c | 6 +++---
sys/dev/isapnp/wss_isapnp.c | 9 +++++----
sys/dev/isapnp/ym_isapnp.c | 7 ++++---
10 files changed, 76 insertions(+), 63 deletions(-)
diffs (truncated from 540 to 300 lines):
diff -r b7af1c4af1ca -r ca16cdbe4bd9 sys/arch/amiga/dev/toccata.c
--- a/sys/arch/amiga/dev/toccata.c Thu Jun 02 12:51:52 2011 +0000
+++ b/sys/arch/amiga/dev/toccata.c Thu Jun 02 14:12:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: toccata.c,v 1.12 2008/04/28 20:23:12 martin Exp $ */
+/* $NetBSD: toccata.c,v 1.13 2011/06/02 14:12:24 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.12 2008/04/28 20:23:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.13 2011/06/02 14:12:24 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -222,14 +222,14 @@
void *sc_playarg;
};
-int toccata_match(struct device *, struct cfdata *, void *);
-void toccata_attach(struct device *, struct device *, void *);
+int toccata_match(device_t, cfdata_t, void *);
+void toccata_attach(device_t, device_t, void *);
-CFATTACH_DECL(toccata, sizeof(struct toccata_softc),
+CFATTACH_DECL_NEW(toccata, sizeof(struct toccata_softc),
toccata_match, toccata_attach, NULL, NULL);
int
-toccata_match(struct device *parent, struct cfdata *cfp, void *aux)
+toccata_match(device_t parent, cfdata_t cfp, void *aux)
{
struct zbus_args *zap;
@@ -245,15 +245,16 @@
}
void
-toccata_attach(struct device *parent, struct device *self, void *aux)
+toccata_attach(device_t parent, device_t self, void *aux)
{
struct toccata_softc *sc;
struct ad1848_softc *asc;
struct zbus_args *zap;
volatile uint8_t *boardp;
- sc = (struct toccata_softc *)self;
+ sc = device_private(self);
asc = &sc->sc_ad;
+ asc->sc_dev = self;
zap = aux;
boardp = (volatile uint8_t *)zap->va;
@@ -280,7 +281,7 @@
sc->sc_isr.isr_intr = toccata_intr;
add_isr(&sc->sc_isr);
- audio_attach_mi(&audiocs_hw_if, sc, &asc->sc_dev);
+ audio_attach_mi(&audiocs_hw_if, sc, self);
}
@@ -329,8 +330,8 @@
* FIFO interrupt.
*/
#ifdef DEBUG
- printf("%s: got unexpected interrupt %x\n", sc->sc_ad.sc_dev.dv_xname,
- status);
+ printf("%s: got unexpected interrupt %x\n",
+ device_xname(sc->sc_ad.sc_dev), status);
#endif
*sc->sc_boardp = TOCC_ACT;
return 1;
diff -r b7af1c4af1ca -r ca16cdbe4bd9 sys/arch/i386/pnpbios/wss_pnpbios.c
--- a/sys/arch/i386/pnpbios/wss_pnpbios.c Thu Jun 02 12:51:52 2011 +0000
+++ b/sys/arch/i386/pnpbios/wss_pnpbios.c Thu Jun 02 14:12:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wss_pnpbios.c,v 1.18 2009/05/04 12:13:19 cegger Exp $ */
+/* $NetBSD: wss_pnpbios.c,v 1.19 2011/06/02 14:12:24 tsutsui Exp $ */
/*
* Copyright (c) 1999
* Matthias Drochner. All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wss_pnpbios.c,v 1.18 2009/05/04 12:13:19 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wss_pnpbios.c,v 1.19 2011/06/02 14:12:24 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,7 +55,7 @@
int wss_pnpbios_hints_index(const char *);
-CFATTACH_DECL(wss_pnpbios, sizeof(struct wss_softc),
+CFATTACH_DECL_NEW(wss_pnpbios, sizeof(struct wss_softc),
wss_pnpbios_match, wss_pnpbios_attach, NULL, NULL);
struct wss_pnpbios_hint {
@@ -128,6 +128,7 @@
return;
}
+ sc->sc_ad1848.sc_ad1848.sc_dev = self;
sc->wss_ic = aa->ic;
if (pnpbios_getirqnum(aa->pbt, aa->resc, 0, &sc->wss_irq, NULL)) {
diff -r b7af1c4af1ca -r ca16cdbe4bd9 sys/arch/i386/pnpbios/ym_pnpbios.c
--- a/sys/arch/i386/pnpbios/ym_pnpbios.c Thu Jun 02 12:51:52 2011 +0000
+++ b/sys/arch/i386/pnpbios/ym_pnpbios.c Thu Jun 02 14:12:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ym_pnpbios.c,v 1.15 2009/05/04 12:13:19 cegger Exp $ */
+/* $NetBSD: ym_pnpbios.c,v 1.16 2011/06/02 14:12:24 tsutsui Exp $ */
/*
* Copyright (c) 1999
* Matthias Drochner. All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ym_pnpbios.c,v 1.15 2009/05/04 12:13:19 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ym_pnpbios.c,v 1.16 2011/06/02 14:12:24 tsutsui Exp $");
#include "mpu_ym.h"
@@ -64,7 +64,7 @@
int ym_pnpbios_match(device_t, cfdata_t, void *);
void ym_pnpbios_attach(device_t, device_t, void *);
-CFATTACH_DECL(ym_pnpbios, sizeof(struct ym_softc),
+CFATTACH_DECL_NEW(ym_pnpbios, sizeof(struct ym_softc),
ym_pnpbios_match, ym_pnpbios_attach, NULL, NULL);
int
@@ -87,6 +87,8 @@
struct ad1848_softc *ac = &sc->sc_ad1848.sc_ad1848;
struct pnpbiosdev_attach_args *aa = aux;
+ ac->sc_dev = self;
+
if (pnpbios_io_map(aa->pbt, aa->resc, 0,
&sc->sc_iot, &sc->sc_sb_ioh) != 0) {
printf(": can't map sb i/o space\n");
diff -r b7af1c4af1ca -r ca16cdbe4bd9 sys/arch/prep/isa/paud_isa.c
--- a/sys/arch/prep/isa/paud_isa.c Thu Jun 02 12:51:52 2011 +0000
+++ b/sys/arch/prep/isa/paud_isa.c Thu Jun 02 14:12:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: paud_isa.c,v 1.12 2008/04/28 20:23:33 martin Exp $ */
+/* $NetBSD: paud_isa.c,v 1.13 2011/06/02 14:12:25 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: paud_isa.c,v 1.12 2008/04/28 20:23:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: paud_isa.c,v 1.13 2011/06/02 14:12:25 tsutsui Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -72,10 +72,10 @@
/* autoconfiguration driver */
-static void paud_attach_isa(struct device *, struct device *, void *);
-static int paud_match_isa(struct device *, struct cfdata *, void *);
+static void paud_attach_isa(device_t, device_t, void *);
+static int paud_match_isa(device_t, cfdata_t, void *);
-CFATTACH_DECL(paud_isa, sizeof(struct ad1848_isa_softc),
+CFATTACH_DECL_NEW(paud_isa, sizeof(struct ad1848_isa_softc),
paud_match_isa, paud_attach_isa, NULL, NULL);
/*
@@ -125,7 +125,7 @@
/* autoconfig routines */
static int
-paud_match_isa(struct device *parent, struct cfdata *cf, void *aux)
+paud_match_isa(device_t parent, cfdata_t cf, void *aux)
{
struct ad1848_isa_softc probesc, *sc = &probesc;
struct isa_attach_args *ia = aux;
@@ -147,12 +147,13 @@
* Audio chip found.
*/
static void
-paud_attach_isa(struct device *parent, struct device *self, void *aux)
+paud_attach_isa(device_t parent, device_t self, void *aux)
{
struct ad1848_isa_softc *sc;
struct isa_attach_args *ia;
- sc = (struct ad1848_isa_softc *)self;
+ sc = device_private(self);
+ sc->sc_ad1848.sc_dev = self;
ia = aux;
sc->sc_ad1848.sc_iot = ia->ia_iot;
sc->sc_ic = ia->ia_ic;
@@ -167,7 +168,7 @@
IST_EDGE, IPL_AUDIO, ad1848_isa_intr, sc);
ad1848_isa_attach(sc);
aprint_normal("\n");
- audio_attach_mi(&paud_hw_if, &sc->sc_ad1848, &sc->sc_ad1848.sc_dev);
+ audio_attach_mi(&paud_hw_if, &sc->sc_ad1848, self);
}
diff -r b7af1c4af1ca -r ca16cdbe4bd9 sys/dev/acpi/wss_acpi.c
--- a/sys/dev/acpi/wss_acpi.c Thu Jun 02 12:51:52 2011 +0000
+++ b/sys/dev/acpi/wss_acpi.c Thu Jun 02 14:12:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wss_acpi.c,v 1.28 2011/06/02 13:02:40 nonaka Exp $ */
+/* $NetBSD: wss_acpi.c,v 1.29 2011/06/02 14:12:25 tsutsui Exp $ */
/*
* Copyright (c) 2002 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wss_acpi.c,v 1.28 2011/06/02 13:02:40 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wss_acpi.c,v 1.29 2011/06/02 14:12:25 tsutsui Exp $");
#include <sys/param.h>
#include <sys/audioio.h>
@@ -45,7 +45,7 @@
static int wss_acpi_match(device_t, cfdata_t, void *);
static void wss_acpi_attach(device_t, device_t, void *);
-CFATTACH_DECL(wss_acpi, sizeof(struct wss_softc), wss_acpi_match,
+CFATTACH_DECL_NEW(wss_acpi, sizeof(struct wss_softc), wss_acpi_match,
wss_acpi_attach, NULL, NULL);
/*
@@ -107,7 +107,7 @@
static void
wss_acpi_attach(device_t parent, device_t self, void *aux)
{
- struct wss_softc *sc = (struct wss_softc *)self;
+ struct wss_softc *sc = device_private(self);
struct acpi_attach_args *aa = aux;
struct acpi_resources res;
struct acpi_io *dspio, *oplio;
@@ -117,11 +117,12 @@
ACPI_STATUS rv;
struct wss_acpi_hint *wah;
+ sc->sc_ad1848.sc_ad1848.sc_dev = self;
wah = &wss_acpi_hints[
wss_acpi_hints_index(aa->aa_node->ad_devinfo->HardwareId.String)];
/* Parse our resources */
- rv = acpi_resource_parse(sc->sc_ad1848.sc_ad1848.sc_dev,
+ rv = acpi_resource_parse(self,
aa->aa_node->ad_handle, "_CRS", &res,
&acpi_resource_parse_ops_default);
if (ACPI_FAILURE(rv))
@@ -132,17 +133,17 @@
dspio = acpi_res_io(&res, wah->io_region_idx_ad1848);
oplio = acpi_res_io(&res, wah->io_region_idx_opl);
if (dspio == NULL || oplio == NULL) {
- aprint_error_dev(sc->sc_ad1848.sc_ad1848.sc_dev, "unable to find i/o registers resource\n");
+ aprint_error_dev(self, "unable to find i/o registers resource\n");
goto out;
}
if (bus_space_map(sc->sc_iot, dspio->ar_base, dspio->ar_length,
0, &sc->sc_ioh) != 0) {
- aprint_error_dev(sc->sc_ad1848.sc_ad1848.sc_dev, "unable to map i/o registers\n");
+ aprint_error_dev(self, "unable to map i/o registers\n");
goto out;
}
if (bus_space_map(sc->sc_iot, oplio->ar_base, oplio->ar_length,
0, &sc->sc_opl_ioh) != 0) {
- aprint_error_dev(sc->sc_ad1848.sc_ad1848.sc_dev, "unable to map opl i/o registers\n");
+ aprint_error_dev(self, "unable to map opl i/o registers\n");
goto out;
}
@@ -151,7 +152,7 @@
/* Find our IRQ */
irq = acpi_res_irq(&res, 0);
if (irq == NULL) {
- aprint_error_dev(sc->sc_ad1848.sc_ad1848.sc_dev, "unable to find irq resource\n");
+ aprint_error_dev(self, "unable to find irq resource\n");
/* XXX bus_space_unmap */
goto out;
}
@@ -161,7 +162,7 @@
playdrq = acpi_res_drq(&res, 0);
recdrq = acpi_res_drq(&res, 1);
if (playdrq == NULL || recdrq == NULL) {
- aprint_error_dev(sc->sc_ad1848.sc_ad1848.sc_dev, " unable to find drq resources\n");
+ aprint_error_dev(self, " unable to find drq resources\n");
/* XXX bus_space_unmap */
Home |
Main Index |
Thread Index |
Old Index