Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/dev finish device_t-ification



details:   https://anonhg.NetBSD.org/src/rev/fa6f2943d788
branches:  trunk
changeset: 767648:fa6f2943d788
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Jul 26 08:36:02 2011 +0000

description:
finish device_t-ification

diffstat:

 sys/arch/macppc/dev/am79c950.c |  30 +++++++++++++++---------------
 sys/arch/macppc/dev/battery.c  |   5 +++--
 sys/arch/macppc/dev/if_mc.c    |   7 ++++---
 sys/arch/macppc/dev/if_mcvar.h |   4 ++--
 sys/arch/macppc/dev/ki2c.c     |  11 ++++++-----
 sys/arch/macppc/dev/ki2cvar.h  |   4 ++--
 sys/arch/macppc/dev/mediabay.c |  19 ++++++++++---------
 sys/arch/macppc/dev/obio.c     |  11 ++++++-----
 sys/arch/macppc/dev/smartbat.c |  19 ++++++++++---------
 9 files changed, 58 insertions(+), 52 deletions(-)

diffs (truncated from 495 to 300 lines):

diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/am79c950.c
--- a/sys/arch/macppc/dev/am79c950.c    Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/am79c950.c    Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am79c950.c,v 1.31 2011/07/01 18:41:51 dyoung Exp $     */
+/*     $NetBSD: am79c950.c,v 1.32 2011/07/26 08:36:02 macallan Exp $   */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.31 2011/07/01 18:41:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.32 2011/07/26 08:36:02 macallan Exp $");
 
 #include "opt_inet.h"
 
@@ -149,7 +149,7 @@
        memcpy(sc->sc_enaddr, lladdr, ETHER_ADDR_LEN);
        printf(": address %s\n", ether_sprintf(lladdr));
 
-       memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
+       memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
        ifp->if_softc = sc;
        ifp->if_ioctl = mcioctl;
        ifp->if_start = mcstart;
@@ -421,7 +421,7 @@
        }
 
        if (totlen > PAGE_SIZE)
-               panic("%s: maceput: packet overflow", sc->sc_dev.dv_xname);
+               panic("%s: maceput: packet overflow", device_xname(sc->sc_dev));
 
 #if 0
        if (totlen < ETHERMIN + sizeof(struct ether_header)) {
@@ -449,20 +449,20 @@
 
        if (ir & JAB) {
 #ifdef MCDEBUG
-               printf("%s: jabber error\n", sc->sc_dev.dv_xname);
+               printf("%s: jabber error\n", device_xname(sc->sc_dev));
 #endif
                sc->sc_if.if_oerrors++;
        }
 
        if (ir & BABL) {
 #ifdef MCDEBUG
-               printf("%s: babble\n", sc->sc_dev.dv_xname);
+               printf("%s: babble\n", device_xname(sc->sc_dev));
 #endif
                sc->sc_if.if_oerrors++;
        }
 
        if (ir & CERR) {
-               printf("%s: collision error\n", sc->sc_dev.dv_xname);
+               printf("%s: collision error\n", device_xname(sc->sc_dev));
                sc->sc_if.if_collisions++;
        }
 
@@ -493,13 +493,13 @@
                return;
 
        if (xmtfs & UFLO) {
-               printf("%s: underflow\n", sc->sc_dev.dv_xname);
+               printf("%s: underflow\n", device_xname(sc->sc_dev));
                mcreset(sc);
                return;
        }
 
        if (xmtfs & LCOL) {
-               printf("%s: late collision\n", sc->sc_dev.dv_xname);
+               printf("%s: late collision\n", device_xname(sc->sc_dev));
                sc->sc_if.if_oerrors++;
                sc->sc_if.if_collisions++;
        }
@@ -516,7 +516,7 @@
 
        if (xmtfs & LCAR) {
                sc->sc_havecarrier = 0;
-               printf("%s: lost carrier\n", sc->sc_dev.dv_xname);
+               printf("%s: lost carrier\n", device_xname(sc->sc_dev));
                sc->sc_if.if_oerrors++;
        }
 
@@ -536,12 +536,12 @@
 #ifdef MCDEBUG
        if (rxf.rx_rcvsts & 0xf0)
                printf("%s: rcvcnt %02x rcvsts %02x rntpc 0x%02x rcvcc 0x%02x\n",
-                   sc->sc_dev.dv_xname, rxf.rx_rcvcnt, rxf.rx_rcvsts,
+                   device_xname(sc->sc_dev), rxf.rx_rcvcnt, rxf.rx_rcvsts,
                    rxf.rx_rntpc, rxf.rx_rcvcc);
 #endif
 
        if (rxf.rx_rcvsts & OFLO) {
-               printf("%s: receive FIFO overflow\n", sc->sc_dev.dv_xname);
+               printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev));
                sc->sc_if.if_ierrors++;
                return;
        }
@@ -551,7 +551,7 @@
 
        if (rxf.rx_rcvsts & FRAM) {
 #ifdef MCDEBUG
-               printf("%s: framing error\n", sc->sc_dev.dv_xname);
+               printf("%s: framing error\n", device_xname(sc->sc_dev));
 #endif
                sc->sc_if.if_ierrors++;
                return;
@@ -559,7 +559,7 @@
 
        if (rxf.rx_rcvsts & FCS) {
 #ifdef MCDEBUG
-               printf("%s: frame control checksum error\n", sc->sc_dev.dv_xname);
+               printf("%s: frame control checksum error\n", device_xname(sc->sc_dev));
 #endif
                sc->sc_if.if_ierrors++;
                return;
@@ -579,7 +579,7 @@
            len > ETHERMTU + sizeof(struct ether_header)) {
 #ifdef MCDEBUG
                printf("%s: invalid packet size %d; dropping\n",
-                   sc->sc_dev.dv_xname, len);
+                   device_xname(sc->sc_dev), len);
 #endif
                ifp->if_ierrors++;
                return;
diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/battery.c
--- a/sys/arch/macppc/dev/battery.c     Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/battery.c     Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: battery.c,v 1.14 2011/07/10 14:41:34 pgoyette Exp $ */
+/*     $NetBSD: battery.c,v 1.15 2011/07/26 08:37:45 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: battery.c,v 1.14 2011/07/10 14:41:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: battery.c,v 1.15 2011/07/26 08:37:45 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -117,6 +117,7 @@
        struct battery_softc *sc = device_private(self);
        uint32_t reg;
 
+       sc->sc_dev = self;
        sc->sc_pmu_ops = baa->baa_pmu_ops;
        aprint_normal(": legacy battery ");
 
diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/if_mc.c
--- a/sys/arch/macppc/dev/if_mc.c       Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/if_mc.c       Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mc.c,v 1.21 2011/07/01 18:41:52 dyoung Exp $        */
+/*     $NetBSD: if_mc.c,v 1.22 2011/07/26 08:36:02 macallan Exp $      */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.21 2011/07/01 18:41:52 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.22 2011/07/26 08:36:02 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -79,7 +79,7 @@
 
 #define N_SUPMEDIA (sizeof(mc_supmedia) / sizeof(int));
 
-CFATTACH_DECL(mc, sizeof(struct mc_softc),
+CFATTACH_DECL_NEW(mc, sizeof(struct mc_softc),
     mc_match, mc_attach, NULL, NULL);
 
 hide int
@@ -109,6 +109,7 @@
        u_int8_t myaddr[ETHER_ADDR_LEN];
        u_int *reg;
 
+       sc->sc_dev = self;
        sc->sc_node = ca->ca_node;
        sc->sc_regt = ca->ca_tag;
 
diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/if_mcvar.h
--- a/sys/arch/macppc/dev/if_mcvar.h    Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/if_mcvar.h    Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mcvar.h,v 1.12 2009/03/14 14:46:01 dsl Exp $        */
+/*     $NetBSD: if_mcvar.h,v 1.13 2011/07/26 08:36:02 macallan Exp $   */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -62,7 +62,7 @@
 };
 
 struct mc_softc {
-       struct device   sc_dev;         /* base device glue */
+       device_t        sc_dev;         /* base device glue */
        struct ethercom sc_ethercom;    /* Ethernet common part */
 #define        sc_if           sc_ethercom.ec_if
        struct ifmedia  sc_media;
diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/ki2c.c
--- a/sys/arch/macppc/dev/ki2c.c        Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/ki2c.c        Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ki2c.c,v 1.17 2011/06/18 08:08:28 matt Exp $   */
+/*     $NetBSD: ki2c.c,v 1.18 2011/07/26 08:36:02 macallan Exp $       */
 /*     Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp */
 
 /*-
@@ -59,7 +59,7 @@
                    void *, size_t, int);
 
 
-CFATTACH_DECL(ki2c, sizeof(struct ki2c_softc), ki2c_match, ki2c_attach,
+CFATTACH_DECL_NEW(ki2c, sizeof(struct ki2c_softc), ki2c_match, ki2c_attach,
        NULL, NULL);
 
 int
@@ -85,7 +85,8 @@
 
        char name[32];
        u_int reg[20];
-       
+
+       sc->sc_dev = self;
        ca->ca_reg[0] += ca->ca_baseaddr;
 
        if (OF_getprop(node, "AAPL,i2c-rate", &rate, 4) != 4) {
@@ -125,7 +126,7 @@
        sc->sc_i2c.ic_exec = ki2c_i2c_exec;
 
        iba.iba_tag = &sc->sc_i2c;
-       (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print);
+       (void) config_found_ia(sc->sc_dev, "i2cbus", &iba, iicbus_print);
 
        /* 
         * newer OF puts I2C devices under 'i2c-bus' instead of attaching them 
@@ -167,7 +168,7 @@
 #ifdef DIAGNOSTIC
                else {
                        printf("%s: device (%s) has no reg or i2c-address property.\n",
-                           sc->sc_dev.dv_xname, name);
+                           device_xname(sc->sc_dev), name);
                }
 #endif
        }
diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/ki2cvar.h
--- a/sys/arch/macppc/dev/ki2cvar.h     Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/ki2cvar.h     Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ki2cvar.h,v 1.3 2007/12/07 16:01:19 macallan Exp $     */
+/*     $NetBSD: ki2cvar.h,v 1.4 2011/07/26 08:36:02 macallan Exp $     */
 /*     Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp */
 
 /*-
@@ -83,7 +83,7 @@
 #define I2C_ERROR      0x04
 
 struct ki2c_softc {
-       struct device sc_dev;
+       device_t sc_dev;
        u_char *sc_reg;
        int sc_regstep;
        
diff -r bbbf01aec281 -r fa6f2943d788 sys/arch/macppc/dev/mediabay.c
--- a/sys/arch/macppc/dev/mediabay.c    Tue Jul 26 07:18:35 2011 +0000
+++ b/sys/arch/macppc/dev/mediabay.c    Tue Jul 26 08:36:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mediabay.c,v 1.21 2011/06/30 00:52:57 matt Exp $       */
+/*     $NetBSD: mediabay.c,v 1.22 2011/07/26 08:36:02 macallan Exp $   */
 
 /*-
  * Copyright (C) 1999 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.21 2011/06/30 00:52:57 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.22 2011/07/26 08:36:02 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -46,7 +46,7 @@
 };
 
 struct mediabay_softc {
-       struct device sc_dev;
+       device_t sc_dev;
        bus_space_tag_t sc_tag;
        int sc_node;
        u_int *sc_addr;
@@ -69,7 +69,7 @@
 int mediabay_intr(void *);
 void mediabay_kthread(void *);



Home | Main Index | Thread Index | Old Index