Source-Changes-HG archive

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

[src/trunk]: src/sys convert to device_t, cfdata_t and CFATTACH_DECL_NEW.



details:   https://anonhg.NetBSD.org/src/rev/6786ae723547
branches:  trunk
changeset: 767649:6786ae723547
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Jul 26 08:56:26 2011 +0000

description:
convert to device_t, cfdata_t and CFATTACH_DECL_NEW.

diffstat:

 sys/arch/shark/ofw/igsfb_ofbus.c |  15 ++++++++-------
 sys/arch/shark/ofw/ofrom.c       |  17 ++++++++---------
 sys/arch/shark/shark/opms.c      |  23 +++++++++--------------
 sys/arch/shark/shark/scr.c       |  25 ++++++++++---------------
 sys/dev/ic/igsfb.c               |  10 +++++-----
 sys/dev/ic/igsfbvar.h            |   4 ++--
 sys/dev/ir/cir.c                 |  20 +++++++++++---------
 sys/dev/ir/cirvar.h              |   4 ++--
 sys/dev/ofw/ofcons.c             |   7 +++----
 sys/dev/ofw/ofdisk.c             |  17 +++++++++--------
 sys/dev/ofw/ofnet.c              |  16 +++++++++-------
 sys/dev/ofw/ofrtc.c              |   7 +++----
 sys/dev/pci/igsfb_pci.c          |   7 ++++---
 13 files changed, 83 insertions(+), 89 deletions(-)

diffs (truncated from 682 to 300 lines):

diff -r fa6f2943d788 -r 6786ae723547 sys/arch/shark/ofw/igsfb_ofbus.c
--- a/sys/arch/shark/ofw/igsfb_ofbus.c  Tue Jul 26 08:36:02 2011 +0000
+++ b/sys/arch/shark/ofw/igsfb_ofbus.c  Tue Jul 26 08:56:26 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igsfb_ofbus.c,v 1.12 2011/07/19 15:07:43 dyoung Exp $ */
+/*     $NetBSD: igsfb_ofbus.c,v 1.13 2011/07/26 08:56:26 mrg Exp $ */
 
 /*
  * Copyright (c) 2006 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb_ofbus.c,v 1.12 2011/07/19 15:07:43 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb_ofbus.c,v 1.13 2011/07/26 08:56:26 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -65,12 +65,12 @@
 
 
 
-static int     igsfb_ofbus_match(struct device *, struct cfdata *, void *);
-static void    igsfb_ofbus_attach(struct device *, struct device *, void *);
+static int     igsfb_ofbus_match(device_t, cfdata_t, void *);
+static void    igsfb_ofbus_attach(device_t, device_t, void *);
 static int     igsfb_setup_dc(struct igsfb_devconfig *);
 static paddr_t igsfb_ofbus_mmap(void *, void *, off_t, int);
 
-CFATTACH_DECL(igsfb_ofbus, sizeof(struct igsfb_softc),
+CFATTACH_DECL_NEW(igsfb_ofbus, sizeof(struct igsfb_softc),
     igsfb_ofbus_match, igsfb_ofbus_attach, NULL, NULL);
     
 static const char const *compat_strings[] = { "igs,cyperpro2010", NULL };
@@ -196,7 +196,7 @@
 
 
 static int
-igsfb_ofbus_match(struct device *parent, struct cfdata *match, void *aux)
+igsfb_ofbus_match(device_t parent, cfdata_t match, void *aux)
 {
        struct ofbus_attach_args *oba = aux;
 
@@ -207,13 +207,14 @@
 }
 
 static void
-igsfb_ofbus_attach(struct device *parent, struct device *self, void *aux)
+igsfb_ofbus_attach(device_t parent, device_t self, void *aux)
 {
        struct igsfb_softc *sc = (struct igsfb_softc *)self;
        struct ofbus_attach_args *oba = aux;
        uint32_t regs[16];
        int isconsole, ret;
        
+       sc->sc_dev = self;
        if (igsfb_ofbus_is_console(oba->oba_phandle)) {
                isconsole = 1;
                sc->sc_dc = &igsfb_console_dc;
diff -r fa6f2943d788 -r 6786ae723547 sys/arch/shark/ofw/ofrom.c
--- a/sys/arch/shark/ofw/ofrom.c        Tue Jul 26 08:36:02 2011 +0000
+++ b/sys/arch/shark/ofw/ofrom.c        Tue Jul 26 08:56:26 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofrom.c,v 1.22 2011/07/19 15:07:43 dyoung Exp $        */
+/*     $NetBSD: ofrom.c,v 1.23 2011/07/26 08:56:26 mrg Exp $   */
 
 /*
  * Copyright 1998
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofrom.c,v 1.22 2011/07/19 15:07:43 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofrom.c,v 1.23 2011/07/26 08:56:26 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -52,16 +52,15 @@
 #include <dev/ofw/openfirm.h>
 
 struct ofrom_softc {
-       struct device   sc_dev;
        int             enabled;
        paddr_t         base;
        paddr_t         size;
 };
 
-int ofromprobe(struct device *, struct cfdata *, void *);
-void ofromattach(struct device *, struct device *, void *);
+int ofromprobe(device_t, cfdata_t, void *);
+void ofromattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ofrom, sizeof(struct ofrom_softc),
+CFATTACH_DECL_NEW(ofrom, sizeof(struct ofrom_softc),
     ofromprobe, ofromattach, NULL, NULL);
 
 extern struct cfdriver ofrom_cd;
@@ -76,7 +75,7 @@
 };
 
 int
-ofromprobe(struct device *parent, struct cfdata *cf, void *aux)
+ofromprobe(device_t parent, cfdata_t cf, void *aux)
 {
        struct ofbus_attach_args *oba = aux;
        static const char *const compatible_strings[] = { "rom", NULL };
@@ -87,9 +86,9 @@
 
 
 void
-ofromattach(struct device *parent, struct device *self, void *aux)
+ofromattach(device_t parent, device_t self, void *aux)
 {
-       struct ofrom_softc *sc = (struct ofrom_softc *)self;
+       struct ofrom_softc *sc = device_private(self);
        struct ofbus_attach_args *oba = aux;
        char regbuf[8];
 
diff -r fa6f2943d788 -r 6786ae723547 sys/arch/shark/shark/opms.c
--- a/sys/arch/shark/shark/opms.c       Tue Jul 26 08:36:02 2011 +0000
+++ b/sys/arch/shark/shark/opms.c       Tue Jul 26 08:56:26 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: opms.c,v 1.23 2009/03/14 15:36:13 dsl Exp $        */
+/*      $NetBSD: opms.c,v 1.24 2011/07/26 08:56:26 mrg Exp $        */
 
 /*
  * Copyright 1997
@@ -91,7 +91,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: opms.c,v 1.23 2009/03/14 15:36:13 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opms.c,v 1.24 2011/07/26 08:56:26 mrg Exp $");
 
 #include "opms.h"
 #if NOPMS > 1
@@ -166,7 +166,6 @@
 /* Softc structure for the mouse */
 struct opms_softc 
 {               
-    struct device      sc_dev;
     void               *sc_ih;
     struct clist       sc_q;
     struct selinfo     sc_rsel;
@@ -182,20 +181,16 @@
 /*
 ** Forward routine declarations
 */
-int                  opmsprobe(struct device *, 
-                                         struct cfdata *, 
-                                         void *);
-void                 opmsattach(struct device *, 
-                                         struct device *, 
-                                         void *);
-int                  opmsintr(void *);
+int           opmsprobe(device_t, cfdata_t, void *);
+void          opmsattach(device_t, device_t, void *);
+int           opmsintr(void *);
 
 /* 
 ** Global variables 
 */
 
 /* Autoconfiguration data structures */
-CFATTACH_DECL(opms, sizeof(struct opms_softc),
+CFATTACH_DECL_NEW(opms, sizeof(struct opms_softc),
     opmsprobe, opmsattach, NULL, NULL);
 
 extern struct cfdriver opms_cd;
@@ -254,7 +249,7 @@
 **--
 */
 int
-opmsprobe(struct device *parent, struct cfdata *match, void *aux)
+opmsprobe(device_t parent, cfdata_t match, void *aux)
 {
     struct cfdata             *cf     = match;
     int                       probeOk = 0;    /* assume failure */
@@ -352,9 +347,9 @@
 **--
 */
 void
-opmsattach(struct device *parent, struct device *self, void *aux)
+opmsattach(device_t parent, device_t self, void *aux)
 {
-    struct opms_softc          *sc = (void *)self;
+    struct opms_softc         *sc = device_private(self);
     int                       irq = device_cfdata(self)->cf_loc[SPCKBDCF_IRQ];
     struct isa_attach_args    *ia = aux;                   
 
diff -r fa6f2943d788 -r 6786ae723547 sys/arch/shark/shark/scr.c
--- a/sys/arch/shark/shark/scr.c        Tue Jul 26 08:36:02 2011 +0000
+++ b/sys/arch/shark/shark/scr.c        Tue Jul 26 08:56:26 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scr.c,v 1.25 2009/11/27 03:23:13 rmind Exp $   */
+/*     $NetBSD: scr.c,v 1.26 2011/07/26 08:56:26 mrg Exp $     */
 
 /*
  * Copyright 1997
@@ -102,7 +102,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scr.c,v 1.25 2009/11/27 03:23:13 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scr.c,v 1.26 2011/07/26 08:56:26 mrg Exp $");
 
 #include "opt_ddb.h"
 
@@ -450,8 +450,7 @@
 /* our soft c structure */
 struct scr_softc 
 {
-    struct device       dev;
-    int                 open;
+    int     open;
 
     /* configuration information */
     int     status;                 /* status to be returned */
@@ -577,8 +576,8 @@
 */
 
 /* configure routines */
-int     scrprobe(struct device *, struct cfdata *, void *);
-void    scrattach(struct device *, struct device *, void *);
+int     scrprobe(device_t, cfdata_t, void *);
+void    scrattach(device_t, device_t, void *);
 
 static void   initStates(struct scr_softc * sc); 
 
@@ -632,7 +631,7 @@
 
 
 
-CFATTACH_DECL(scr, sizeof(struct scr_softc),
+CFATTACH_DECL_NEW(scr, sizeof(struct scr_softc),
     scrprobe, scrattach, NULL, NULL);
 
 extern struct cfdriver scr_cd;
@@ -680,10 +679,8 @@
 **     none.
 **--
 */
-int scrprobe(parent, match, aux)
-    struct  device  *parent;
-    struct cfdata   *match;
-    void            *aux;
+int
+scrprobe(device_t parent, cfdata_t match, void *aux)
 {
     struct isa_attach_args  *ia = aux;
     int                     rv = 0;           
@@ -746,10 +743,8 @@
 **      none.
 **--
 */
-void scrattach(parent, self, aux)
-    struct device *parent;
-    struct device *self;
-    void         *aux;
+void
+scrattach(device_t parent, device_t self, void *aux)
 {
     struct scr_softc       *sc = (void *)self;
 
diff -r fa6f2943d788 -r 6786ae723547 sys/dev/ic/igsfb.c
--- a/sys/dev/ic/igsfb.c        Tue Jul 26 08:36:02 2011 +0000
+++ b/sys/dev/ic/igsfb.c        Tue Jul 26 08:56:26 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igsfb.c,v 1.49 2010/05/12 20:58:52 macallan Exp $ */
+/*     $NetBSD: igsfb.c,v 1.50 2011/07/26 08:59:37 mrg Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 Valeriy E. Ushakov
@@ -31,7 +31,7 @@
  * Integraphics Systems IGA 168x and CyberPro series.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.49 2010/05/12 20:58:52 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb.c,v 1.50 2011/07/26 08:59:37 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -194,14 +194,14 @@
        dc->dc_console.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
        printf("%s: %dMB, %s%dx%d, %dbpp\n",
-              device_xname(&sc->sc_dev),
+              device_xname(sc->sc_dev),
               (uint32_t)(dc->dc_vmemsz >> 20),
               (dc->dc_hwflags & IGSFB_HW_BSWAP)
                   ? (dc->dc_hwflags & IGSFB_HW_BE_SELECT)
                       ? "hardware bswap, " : "software bswap, "
                   : "",
               dc->dc_width, dc->dc_height, dc->dc_depth);
-       printf("%s: using %dbpp for X\n", device_xname(&sc->sc_dev),
+       printf("%s: using %dbpp for X\n", device_xname(sc->sc_dev),
               dc->dc_maxdepth);
        ri = &dc->dc_console.scr_ri;
        ri->ri_ops.eraserows(ri, 0, ri->ri_rows, defattr);
@@ -215,7 +215,7 @@



Home | Main Index | Thread Index | Old Index