Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ess(4) device_t/softc split



Hi!

Subject says all. Patch attached.
Compile tested only since I don't have the hardware.

Christoph

Index: sys/dev/isapnp/ess_isapnp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isapnp/ess_isapnp.c,v
retrieving revision 1.21
diff -u -p -r1.21 ess_isapnp.c
--- sys/dev/isapnp/ess_isapnp.c 29 Sep 2009 11:01:39 -0000      1.21
+++ sys/dev/isapnp/ess_isapnp.c 25 Jan 2010 08:49:18 -0000
@@ -64,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: ess_isapnp.c
 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 @@ ess_isapnp_attach(device_t parent, devic
        struct isapnp_attach_args *ipa;
 
        sc = device_private(self);
+       sc->sc_dev = self;
        ipa = aux;
 
        aprint_naive("\n");
Index: sys/dev/isa/ess.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/ess.c,v
retrieving revision 1.77
diff -u -p -r1.77 ess.c
--- sys/dev/isa/ess.c   23 Jan 2010 17:22:04 -0000      1.77
+++ sys/dev/isa/ess.c   25 Jan 2010 08:49:19 -0000
@@ -930,21 +930,21 @@ essattach(struct ess_softc *sc, int enab
                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 @@ essattach(struct ess_softc *sc, int enab
                        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 @@ essattach(struct ess_softc *sc, int enab
            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 @@ essattach(struct ess_softc *sc, int enab
                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
 
Index: sys/dev/isa/ess_isa.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/ess_isa.c,v
retrieving revision 1.23
diff -u -p -r1.23 ess_isa.c
--- sys/dev/isa/ess_isa.c       29 Sep 2009 11:01:39 -0000      1.23
+++ sys/dev/isa/ess_isa.c       25 Jan 2010 08:49:19 -0000
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: ess_isa.c,v 
 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 @@ ess_isa_attach(device_t parent, device_t
        int enablejoy;
 
        sc = device_private(self);
+
+       sc->sc_dev = self;
        ia = aux;
        enablejoy = 0;
 
Index: sys/dev/isa/essvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/essvar.h,v
retrieving revision 1.24
diff -u -p -r1.24 essvar.h
--- sys/dev/isa/essvar.h        11 Dec 2005 12:22:02 -0000      1.24
+++ sys/dev/isa/essvar.h        25 Jan 2010 08:49:19 -0000
@@ -123,7 +123,7 @@ struct ess_audio_channel
 
 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 */


Home | Main Index | Thread Index | Old Index