Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus Split device_t/softc.



details:   https://anonhg.NetBSD.org/src/rev/b9f0e78a07fd
branches:  trunk
changeset: 747493:b9f0e78a07fd
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Sep 17 17:51:52 2009 +0000

description:
Split device_t/softc.
Tested on:
> lebuffer0 at sbus0 slot 3 offset 0x40000: 128K memory

diffstat:

 sys/dev/sbus/lebuffer.c    |  12 +++++++-----
 sys/dev/sbus/lebuffervar.h |   4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (72 lines):

diff -r d872d8d35324 -r b9f0e78a07fd sys/dev/sbus/lebuffer.c
--- a/sys/dev/sbus/lebuffer.c   Thu Sep 17 16:42:50 2009 +0000
+++ b/sys/dev/sbus/lebuffer.c   Thu Sep 17 17:51:52 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lebuffer.c,v 1.34 2009/09/17 16:28:12 tsutsui Exp $ */
+/*     $NetBSD: lebuffer.c,v 1.35 2009/09/17 17:51:52 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lebuffer.c,v 1.34 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lebuffer.c,v 1.35 2009/09/17 17:51:52 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,7 +50,7 @@
 int    lebufmatch(device_t, cfdata_t, void *);
 void   lebufattach(device_t, device_t, void *);
 
-CFATTACH_DECL(lebuffer, sizeof(struct lebuf_softc),
+CFATTACH_DECL_NEW(lebuffer, sizeof(struct lebuf_softc),
     lebufmatch, lebufattach, NULL, NULL);
 
 int
@@ -76,7 +76,7 @@
 lebufattach(device_t parent, device_t self, void *aux)
 {
        struct sbus_attach_args *sa = aux;
-       struct lebuf_softc *sc = (void *)self;
+       struct lebuf_softc *sc = device_private(self);
        struct sbus_softc *sbsc = device_private(parent);
        int node;
        int sbusburst;
@@ -84,6 +84,8 @@
        bus_dma_tag_t   dt = sa->sa_dmatag;
        bus_space_handle_t bh;
 
+       sc->sc_dev = self;
+
        if (sbus_bus_map(bt, sa->sa_slot, sa->sa_offset, sa->sa_size,
                         BUS_SPACE_MAP_LINEAR, &bh) != 0) {
                aprint_error_dev(self, "attach: cannot map registers\n");
@@ -122,7 +124,7 @@
                struct sbus_attach_args sax;
                sbus_setup_attach_args(sbsc,
                                       bt, dt, node, &sax);
-               (void)config_found(&sc->sc_dev, (void *)&sax, lebufprint);
+               (void)config_found(self, (void *)&sax, lebufprint);
                sbus_destroy_attach_args(&sax);
        }
 }
diff -r d872d8d35324 -r b9f0e78a07fd sys/dev/sbus/lebuffervar.h
--- a/sys/dev/sbus/lebuffervar.h        Thu Sep 17 16:42:50 2009 +0000
+++ b/sys/dev/sbus/lebuffervar.h        Thu Sep 17 17:51:52 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lebuffervar.h,v 1.7 2009/09/17 16:28:12 tsutsui Exp $ */
+/*     $NetBSD: lebuffervar.h,v 1.8 2009/09/17 17:51:52 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 struct lebuf_softc {
-       struct device sc_dev;           /* us as a device */
+       device_t sc_dev;                /* us as a device */
        u_int   sc_rev;                 /* revision */
        int     sc_node;                /* PROM node ID */
        int     sc_burst;               /* DVMA burst size in effect */



Home | Main Index | Thread Index | Old Index