Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/dev Fix device_t/softc split bothces. From Ch...



details:   https://anonhg.NetBSD.org/src/rev/379bed910aa2
branches:  trunk
changeset: 781966:379bed910aa2
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Wed Oct 10 17:49:50 2012 +0000

description:
Fix device_t/softc split bothces.  From Chuck Silvers' patch posted on
current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
and several more fixes by me.

Not sure if these are fatal (at least 6.0_RC2 works without thise fixes),
but needs more investigation.

diffstat:

 sys/arch/x68k/dev/ite.c    |  33 ++++++++++++++++++---------------
 sys/arch/x68k/dev/itevar.h |   4 ++--
 2 files changed, 20 insertions(+), 17 deletions(-)

diffs (149 lines):

diff -r 3f01aaed4ce3 -r 379bed910aa2 sys/arch/x68k/dev/ite.c
--- a/sys/arch/x68k/dev/ite.c   Wed Oct 10 17:00:37 2012 +0000
+++ b/sys/arch/x68k/dev/ite.c   Wed Oct 10 17:49:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite.c,v 1.59 2011/04/24 16:26:58 rmind Exp $   */
+/*     $NetBSD: ite.c,v 1.60 2012/10/10 17:49:50 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.59 2011/04/24 16:26:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.60 2012/10/10 17:49:50 tsutsui Exp $");
 
 #include "ite.h"
 #if NITE > 0
@@ -135,6 +135,7 @@
 struct tty *ite_tty[NITE];
 struct ite_softc *kbd_ite = NULL;
 struct  ite_softc con_itesoftc;
+struct device con_itedev;
 
 struct  tty *kbd_tty = NULL;
 
@@ -170,12 +171,12 @@
 };
 
 int
-itematch(device_t pdp, cfdata_t cdp, void *auxp)
+itematch(device_t parent, cfdata_t cf, void *aux)
 {
        struct grf_softc *gp;
        
-       gp = auxp;
-       if (cdp->cf_loc[GRFCF_GRFADDR] != gp->g_cfaddr)
+       gp = aux;
+       if (cf->cf_loc[GRFCF_GRFADDR] != gp->g_cfaddr)
                return 0;
 
        return 1;
@@ -186,13 +187,14 @@
  * an ite device, it is also called from ite_cninit().
  */
 void
-iteattach(device_t pdp, device_t dp, void *auxp)
+iteattach(device_t parent, device_t self, void *aux)
 {
        struct ite_softc *ip;
        struct grf_softc *gp;
 
-       gp = (struct grf_softc *)auxp;
-       ip = device_private(dp);
+       gp = aux;
+       ip = device_private(self);
+       ip->device = self;
        if(con_itesoftc.grf != NULL
                /*&& con_itesoftc.grf->g_unit == gp->g_unit*/) {
                /*
@@ -205,7 +207,7 @@
                kbd_ite = ip;
        }
        ip->grf = gp;
-       iteinit(device_unit(&ip->device)); /* XXX */
+       iteinit(device_unit(self)); /* XXX */
        aprint_normal(": rows %d cols %d", ip->rows, ip->cols);
        if (kbd_ite == NULL)
                kbd_ite = ip;
@@ -240,7 +242,7 @@
        ip->cursorx = 0;
        ip->cursory = 0;
 
-       ip->isw = &itesw[device_unit(&ip->device)]; /* XXX */
+       ip->isw = &itesw[device_unit(ip->device)]; /* XXX */
        SUBR_INIT(ip);
        SUBR_CURSOR(ip, DRAW_CURSOR);
        if (!ip->tabs)
@@ -258,6 +260,7 @@
                return;
        con_itesoftc.grf = gp;
        con_itesoftc.tabs = cons_tabs;
+       con_itesoftc.device = &con_itedev;
 }
 
 /*
@@ -270,7 +273,7 @@
        struct ite_softc *ip;
 
        if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-           (ip = getitesp(unit)) == NULL || (ip->flags&ITE_ALIVE) == 0)
+           (ip = getitesp(dev)) == NULL || (ip->flags&ITE_ALIVE) == 0)
                return(ENXIO);
        /* force ite active, overriding graphics mode */
        if (flag & 1) {
@@ -309,7 +312,7 @@
 
        /* XXX check whether when call from grf.c */
        if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-           (ip = getitesp(unit)) == NULL || (ip->flags&ITE_ALIVE) == 0)
+           (ip = getitesp(dev)) == NULL || (ip->flags&ITE_ALIVE) == 0)
                return;
        if (flag & 2)
                ip->flags |= ITE_INGRF;
@@ -538,7 +541,7 @@
 
        /* XXX check whether when call from grf.c */
        if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-           (ip = getitesp(unit)) == NULL)
+           (ip = getitesp(dev)) == NULL)
                return;
 
        ip->flags &= ~ITE_INITED;
@@ -714,7 +717,7 @@
        struct key key;
        int s, i;
 
-       if (!kbd_ite || !(kbd_tty = ite_tty[device_unit(&kbd_ite->device)]))
+       if (!kbd_ite || !(kbd_tty = ite_tty[device_unit(kbd_ite->device)]))
                return;
 
        /* have to make sure we're at spltty in here */
@@ -2086,7 +2089,7 @@
 
        case BEL:
 #if NBELL > 0
-               if (kbd_ite && ite_tty[device_unit(&kbd_ite->device)])
+               if (kbd_ite && ite_tty[device_unit(kbd_ite->device)])
                        opm_bell();
 #endif
                break;
diff -r 3f01aaed4ce3 -r 379bed910aa2 sys/arch/x68k/dev/itevar.h
--- a/sys/arch/x68k/dev/itevar.h        Wed Oct 10 17:00:37 2012 +0000
+++ b/sys/arch/x68k/dev/itevar.h        Wed Oct 10 17:49:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: itevar.h,v 1.14 2011/02/08 20:20:25 rmind Exp $        */
+/*     $NetBSD: itevar.h,v 1.15 2012/10/10 17:49:50 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -61,7 +61,7 @@
 #define ARGBUF_SIZE 256
 
 struct ite_softc {
-       struct  device device;
+       device_t device;
        struct grf_softc *grf;
        struct  itesw *isw;
        int     flags;



Home | Main Index | Thread Index | Old Index