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. Based on patch from cegger@.
details: https://anonhg.NetBSD.org/src/rev/92e0f67ced8c
branches: trunk
changeset: 755096:92e0f67ced8c
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat May 22 16:35:00 2010 +0000
description:
Split device_t/softc. Based on patch from cegger@.
ess_pnpbios.c and ess_ofisa.c fixes by me.
Tested on ess_isapnp.c, and no crash with ess_ofisa.c on shark.
diffstat:
sys/arch/i386/pnpbios/ess_pnpbios.c | 8 +++++---
sys/dev/isa/ess.c | 28 ++++++++++++++--------------
sys/dev/isa/ess_isa.c | 8 +++++---
sys/dev/isa/essvar.h | 6 +++---
sys/dev/isapnp/ess_isapnp.c | 7 ++++---
sys/dev/ofisa/ess_ofisa.c | 28 ++++++++++++++++------------
6 files changed, 47 insertions(+), 38 deletions(-)
diffs (truncated from 334 to 300 lines):
diff -r e9a6541c4abd -r 92e0f67ced8c sys/arch/i386/pnpbios/ess_pnpbios.c
--- a/sys/arch/i386/pnpbios/ess_pnpbios.c Sat May 22 15:55:41 2010 +0000
+++ b/sys/arch/i386/pnpbios/ess_pnpbios.c Sat May 22 16:35:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ess_pnpbios.c,v 1.20 2009/10/20 10:34:21 cegger Exp $ */
+/* $NetBSD: ess_pnpbios.c,v 1.21 2010/05/22 16:35:00 tsutsui Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ess_pnpbios.c,v 1.20 2009/10/20 10:34:21 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess_pnpbios.c,v 1.21 2010/05/22 16:35:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,7 +58,7 @@
int ess_pnpbios_match(device_t, cfdata_t, void *);
void ess_pnpbios_attach(device_t, device_t, void *);
-CFATTACH_DECL(ess_pnpbios, sizeof(struct ess_softc),
+CFATTACH_DECL_NEW(ess_pnpbios, sizeof(struct ess_softc),
ess_pnpbios_match, ess_pnpbios_attach, NULL, NULL);
int
@@ -87,6 +87,8 @@
struct ess_softc *sc = device_private(self);
struct pnpbiosdev_attach_args *aa = aux;
+ sc->sc_dev = self;
+
if (pnpbios_io_map(aa->pbt, aa->resc, 0, &sc->sc_iot, &sc->sc_ioh)) {
aprint_error(": can't map i/o space\n");
return;
diff -r e9a6541c4abd -r 92e0f67ced8c sys/dev/isa/ess.c
--- a/sys/dev/isa/ess.c Sat May 22 15:55:41 2010 +0000
+++ b/sys/dev/isa/ess.c Sat May 22 16:35:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ess.c,v 1.77 2010/01/23 17:22:04 cegger Exp $ */
+/* $NetBSD: ess.c,v 1.78 2010/05/22 16:35:00 tsutsui Exp $ */
/*
* Copyright 1997
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.77 2010/01/23 17:22:04 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.78 2010/05/22 16:35:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -930,21 +930,21 @@
sc->sc_audio1.ih = isa_intr_establish(sc->sc_ic,
sc->sc_audio1.irq, sc->sc_audio1.ist, IPL_AUDIO,
ess_audio1_intr, sc);
- aprint_normal_dev(&sc->sc_dev,
+ aprint_normal_dev(sc->sc_dev,
"audio1 interrupting at irq %d\n", sc->sc_audio1.irq);
} else
- aprint_normal_dev(&sc->sc_dev, "audio1 polled\n");
+ aprint_normal_dev(sc->sc_dev, "audio1 polled\n");
sc->sc_audio1.maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_audio1.drq);
if (isa_drq_alloc(sc->sc_ic, sc->sc_audio1.drq) != 0) {
- aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n",
+ aprint_error_dev(sc->sc_dev, "can't reserve drq %d\n",
sc->sc_audio1.drq);
return;
}
if (isa_dmamap_create(sc->sc_ic, sc->sc_audio1.drq,
sc->sc_audio1.maxsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) {
- aprint_error_dev(&sc->sc_dev, "can't create map for drq %d\n",
+ aprint_error_dev(sc->sc_dev, "can't create map for drq %d\n",
sc->sc_audio1.drq);
return;
}
@@ -955,23 +955,23 @@
sc->sc_audio2.ih = isa_intr_establish(sc->sc_ic,
sc->sc_audio2.irq, sc->sc_audio2.ist, IPL_AUDIO,
ess_audio2_intr, sc);
- aprint_normal_dev(&sc->sc_dev,
+ aprint_normal_dev(sc->sc_dev,
"audio2 interrupting at irq %d\n",
sc->sc_audio2.irq);
} else
- aprint_normal_dev(&sc->sc_dev, "audio2 polled\n");
+ aprint_normal_dev(sc->sc_dev, "audio2 polled\n");
sc->sc_audio2.maxsize = isa_dmamaxsize(sc->sc_ic,
sc->sc_audio2.drq);
if (isa_drq_alloc(sc->sc_ic, sc->sc_audio2.drq) != 0) {
- aprint_error_dev(&sc->sc_dev, "can't reserve drq %d\n",
+ aprint_error_dev(sc->sc_dev, "can't reserve drq %d\n",
sc->sc_audio2.drq);
return;
}
if (isa_dmamap_create(sc->sc_ic, sc->sc_audio2.drq,
sc->sc_audio2.maxsize, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) {
- aprint_error_dev(&sc->sc_dev, "can't create map for drq %d\n",
+ aprint_error_dev(sc->sc_dev, "can't create map for drq %d\n",
sc->sc_audio2.drq);
return;
}
@@ -1044,14 +1044,14 @@
sc->sc_version);
if (ESS_USE_AUDIO1(sc->sc_model))
- audio_attach_mi(&ess_1788_hw_if, sc, &sc->sc_dev);
+ audio_attach_mi(&ess_1788_hw_if, sc, sc->sc_dev);
else
- audio_attach_mi(&ess_1888_hw_if, sc, &sc->sc_dev);
+ audio_attach_mi(&ess_1888_hw_if, sc, sc->sc_dev);
arg.type = AUDIODEV_TYPE_OPL;
arg.hwif = 0;
arg.hdl = 0;
- (void)config_found(&sc->sc_dev, &arg, audioprint);
+ (void)config_found(sc->sc_dev, &arg, audioprint);
#if NJOY_ESS > 0
if (sc->sc_model == ESS_1888 && enablejoy) {
@@ -1062,7 +1062,7 @@
ess_write_mix_reg(sc, 0x40, m40);
arg.type = AUDIODEV_TYPE_AUX;
- (void)config_found(&sc->sc_dev, &arg, audioprint);
+ (void)config_found(sc->sc_dev, &arg, audioprint);
}
#endif
diff -r e9a6541c4abd -r 92e0f67ced8c sys/dev/isa/ess_isa.c
--- a/sys/dev/isa/ess_isa.c Sat May 22 15:55:41 2010 +0000
+++ b/sys/dev/isa/ess_isa.c Sat May 22 16:35:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ess_isa.c,v 1.23 2009/09/29 11:01:39 cegger Exp $ */
+/* $NetBSD: ess_isa.c,v 1.24 2010/05/22 16:35:00 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ess_isa.c,v 1.23 2009/09/29 11:01:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess_isa.c,v 1.24 2010/05/22 16:35:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,7 +55,7 @@
int ess_isa_probe(device_t, cfdata_t, void *);
void ess_isa_attach(device_t, device_t, void *);
-CFATTACH_DECL(ess_isa, sizeof(struct ess_softc),
+CFATTACH_DECL_NEW(ess_isa, sizeof(struct ess_softc),
ess_isa_probe, ess_isa_attach, NULL, NULL);
int
@@ -127,6 +127,8 @@
int enablejoy;
sc = device_private(self);
+
+ sc->sc_dev = self;
ia = aux;
enablejoy = 0;
diff -r e9a6541c4abd -r 92e0f67ced8c sys/dev/isa/essvar.h
--- a/sys/dev/isa/essvar.h Sat May 22 15:55:41 2010 +0000
+++ b/sys/dev/isa/essvar.h Sat May 22 16:35:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: essvar.h,v 1.24 2005/12/11 12:22:02 christos Exp $ */
+/* $NetBSD: essvar.h,v 1.25 2010/05/22 16:35:00 tsutsui Exp $ */
/*
* Copyright 1997
* Digital Equipment Corporation. All rights reserved.
@@ -33,7 +33,7 @@
*/
/*
-** @(#) $RCSfile: essvar.h,v $ $Revision: 1.24 $ (SHARK) $Date: 2005/12/11 12:22:02 $
+** @(#) $RCSfile: essvar.h,v $ $Revision: 1.25 $ (SHARK) $Date: 2010/05/22 16:35:00 $
**
**++
**
@@ -123,7 +123,7 @@
struct ess_softc
{
- struct device sc_dev; /* base device */
+ device_t sc_dev; /* base device */
isa_chipset_tag_t sc_ic;
bus_space_tag_t sc_iot; /* tag */
bus_space_handle_t sc_ioh; /* handle */
diff -r e9a6541c4abd -r 92e0f67ced8c sys/dev/isapnp/ess_isapnp.c
--- a/sys/dev/isapnp/ess_isapnp.c Sat May 22 15:55:41 2010 +0000
+++ b/sys/dev/isapnp/ess_isapnp.c Sat May 22 16:35:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ess_isapnp.c,v 1.21 2009/09/29 11:01:39 cegger Exp $ */
+/* $NetBSD: ess_isapnp.c,v 1.22 2010/05/22 16:35:00 tsutsui Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ess_isapnp.c,v 1.21 2009/09/29 11:01:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess_isapnp.c,v 1.22 2010/05/22 16:35:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,7 +64,7 @@
int ess_isapnp_match(device_t, cfdata_t, void *);
void ess_isapnp_attach(device_t, device_t, void *);
-CFATTACH_DECL(ess_isapnp, sizeof(struct ess_softc),
+CFATTACH_DECL_NEW(ess_isapnp, sizeof(struct ess_softc),
ess_isapnp_match, ess_isapnp_attach, NULL, NULL);
/*
@@ -97,6 +97,7 @@
struct isapnp_attach_args *ipa;
sc = device_private(self);
+ sc->sc_dev = self;
ipa = aux;
aprint_naive("\n");
diff -r e9a6541c4abd -r 92e0f67ced8c sys/dev/ofisa/ess_ofisa.c
--- a/sys/dev/ofisa/ess_ofisa.c Sat May 22 15:55:41 2010 +0000
+++ b/sys/dev/ofisa/ess_ofisa.c Sat May 22 16:35:00 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ess_ofisa.c,v 1.24 2009/05/12 14:38:56 cegger Exp $ */
+/* $NetBSD: ess_ofisa.c,v 1.25 2010/05/22 16:35:00 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ess_ofisa.c,v 1.24 2009/05/12 14:38:56 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ess_ofisa.c,v 1.25 2010/05/22 16:35:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,7 +54,7 @@
int ess_ofisa_match(device_t, cfdata_t, void *);
void ess_ofisa_attach(device_t, device_t, void *);
-CFATTACH_DECL(ess_ofisa, sizeof(struct ess_softc),
+CFATTACH_DECL_NEW(ess_ofisa, sizeof(struct ess_softc),
ess_ofisa_match, ess_ofisa_attach, NULL, NULL);
int
@@ -88,6 +88,8 @@
int n, ndrq;
char *model;
+ sc->sc_dev = self;
+
/*
* We're living on an OFW. We have to ask the OFW what our
* registers and interrupts properties look like.
@@ -101,15 +103,15 @@
n = ofisa_reg_get(aa->oba.oba_phandle, ®, 1);
if (n != 1) {
- printf(": error getting register data\n");
+ aprint_error(": error getting register data\n");
return;
}
if (reg.type != OFISA_REG_TYPE_IO) {
- printf(": register type not i/o\n");
+ aprint_error(": register type not i/o\n");
return;
}
if (reg.len != ESS_NPORT) {
- printf(": weird register size (%lu, expected %d)\n",
+ aprint_error(": weird register size (%lu, expected %d)\n",
(unsigned long)reg.len, ESS_NPORT);
return;
}
@@ -126,13 +128,13 @@
sc->sc_audio2.irq = intr[1].irq;
sc->sc_audio2.ist = intr[1].share;
} else {
- printf(": error getting interrupt data\n");
+ aprint_error(": error getting interrupt data\n");
return;
}
ndrq = ofisa_dma_get(aa->oba.oba_phandle, dma, 2);
if (ndrq != 2) {
- printf(": error getting DMA data\n");
Home |
Main Index |
Thread Index |
Old Index