Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh5/sh5 Fix const/cast fallout.



details:   https://anonhg.NetBSD.org/src/rev/ccc15fedfe91
branches:  trunk
changeset: 581406:ccc15fedfe91
user:      scw <scw%NetBSD.org@localhost>
date:      Wed Jun 01 13:05:29 2005 +0000

description:
Fix const/cast fallout.

diffstat:

 sys/arch/sh5/sh5/db_disasm.c |   6 +++---
 sys/arch/sh5/sh5/db_trace.c  |  10 +++++-----
 sys/arch/sh5/sh5/mem.c       |   8 ++++----
 sys/arch/sh5/sh5/pmap.c      |   8 ++++----
 sys/arch/sh5/sh5/sh5_clock.c |  21 ++++++++++++++-------
 5 files changed, 30 insertions(+), 23 deletions(-)

diffs (219 lines):

diff -r 0d8f80d84e83 -r ccc15fedfe91 sys/arch/sh5/sh5/db_disasm.c
--- a/sys/arch/sh5/sh5/db_disasm.c      Wed Jun 01 13:04:32 2005 +0000
+++ b/sys/arch/sh5/sh5/db_disasm.c      Wed Jun 01 13:05:29 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_disasm.c,v 1.16 2003/12/08 08:08:40 jdolecek Exp $  */
+/*     $NetBSD: db_disasm.c,v 1.17 2005/06/01 13:05:29 scw Exp $       */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16 2003/12/08 08:08:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.17 2005/06/01 13:05:29 scw Exp $");
 
 #include "opt_ddb.h"
 
@@ -1416,7 +1416,7 @@
 static int
 sh5_fmt_xsd16_decode_op(int fmt, int op, int d, db_addr_t loc, char *ops)
 {
-       char *symname;
+       const char *symname;
        db_sym_t sym;
        db_expr_t diff;
        opcode_t nextop;
diff -r 0d8f80d84e83 -r ccc15fedfe91 sys/arch/sh5/sh5/db_trace.c
--- a/sys/arch/sh5/sh5/db_trace.c       Wed Jun 01 13:04:32 2005 +0000
+++ b/sys/arch/sh5/sh5/db_trace.c       Wed Jun 01 13:05:29 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_trace.c,v 1.14 2003/11/09 21:39:48 scw Exp $        */
+/*     $NetBSD: db_trace.c,v 1.15 2005/06/01 13:05:29 scw Exp $        */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.14 2003/11/09 21:39:48 scw Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.15 2005/06/01 13:05:29 scw Exp $");
 
 #include "opt_ddb.h"
 
@@ -150,14 +150,14 @@
 
 void
 db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
-    char *modif, void (*pr)(const char *, ...))
+    const char *modif, void (*pr)(const char *, ...))
 {
        db_addr_t pc, fp;
        db_addr_t nextpc, nextfp;
        db_addr_t lastpc = 0, lastfp = 0;
        db_sym_t sym;
        db_expr_t diff, pc_adj;
-       char *symp;
+       const char *symp;
        int trace_thread, dump_eframe;
 
        /* trace_thread is non-zero if tracing a specific process */
@@ -371,7 +371,7 @@
 {
        db_sym_t sym;
        db_expr_t diff;
-       char *symp;
+       const char *symp;
 
        addr &= ~3;
 #if 0
diff -r 0d8f80d84e83 -r ccc15fedfe91 sys/arch/sh5/sh5/mem.c
--- a/sys/arch/sh5/sh5/mem.c    Wed Jun 01 13:04:32 2005 +0000
+++ b/sys/arch/sh5/sh5/mem.c    Wed Jun 01 13:05:29 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.8 2003/08/07 16:29:32 agc Exp $      */
+/*     $NetBSD: mem.c,v 1.9 2005/06/01 13:05:29 scw Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -74,7 +74,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.8 2003/08/07 16:29:32 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.9 2005/06/01 13:05:29 scw Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -119,7 +119,7 @@
                /* lock against other uses of shared vmmap */
                while (physlock > 0) {
                        physlock++;
-                       error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
+                       error = tsleep(&physlock, PZERO | PCATCH,
                            "mmrw", 0);
                        if (error)
                                return (error);
@@ -187,7 +187,7 @@
        }
        if (minor(dev) == DEV_MEM) {
                if (physlock > 1)
-                       wakeup((caddr_t)&physlock);
+                       wakeup(&physlock);
                physlock = 0;
        }
        return (error);
diff -r 0d8f80d84e83 -r ccc15fedfe91 sys/arch/sh5/sh5/pmap.c
--- a/sys/arch/sh5/sh5/pmap.c   Wed Jun 01 13:04:32 2005 +0000
+++ b/sys/arch/sh5/sh5/pmap.c   Wed Jun 01 13:05:29 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.38 2005/04/01 11:59:34 yamt Exp $   */
+/*     $NetBSD: pmap.c,v 1.39 2005/06/01 13:05:29 scw Exp $    */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.38 2005/04/01 11:59:34 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.39 2005/06/01 13:05:29 scw Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kernel_ipt.h"
@@ -514,7 +514,7 @@
 static __inline tlbcookie_t
 pmap_kernel_ipt_get_tlbcookie(kpte_t *kpte)
 {
-       u_int16_t *kpp = (u_int16_t *)&kpte->tlbcookie;
+       volatile u_int16_t *kpp = (volatile u_int16_t *)&kpte->tlbcookie;
 
        return ((tlbcookie_t)*kpp);
 }
@@ -522,7 +522,7 @@
 static __inline void
 pmap_kernel_ipt_set_tlbcookie(kpte_t *kpte, tlbcookie_t tlbcookie)
 {
-       u_int16_t *kpp = (u_int16_t *)&kpte->tlbcookie;
+       volatile u_int16_t *kpp = (volatile u_int16_t *)&kpte->tlbcookie;
 
        *kpp = (u_int16_t)tlbcookie;
 }
diff -r 0d8f80d84e83 -r ccc15fedfe91 sys/arch/sh5/sh5/sh5_clock.c
--- a/sys/arch/sh5/sh5/sh5_clock.c      Wed Jun 01 13:04:32 2005 +0000
+++ b/sys/arch/sh5/sh5/sh5_clock.c      Wed Jun 01 13:05:29 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sh5_clock.c,v 1.7 2003/08/07 16:29:32 agc Exp $        */
+/*     $NetBSD: sh5_clock.c,v 1.8 2005/06/01 13:05:29 scw Exp $        */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sh5_clock.c,v 1.7 2003/08/07 16:29:32 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sh5_clock.c,v 1.8 2005/06/01 13:05:29 scw Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -252,6 +252,7 @@
 inittodr(time_t base)
 {
         int badbase = 0, waszero = (base == 0);
+       struct timeval thetime;
 
        if (todr_handle == NULL)
                panic("inittodr: todr not configured");
@@ -268,8 +269,8 @@
                 badbase = 1;
         }
 
-        if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
-            time.tv_sec == 0) {
+        if (todr_gettime(todr_handle, &thetime) != 0 ||
+            thetime.tv_sec == 0) {
 badrtc:
                 printf("WARNING: bad date in battery clock");
                 /*
@@ -277,10 +278,11 @@
                  * anything better, resetting the clock.
                  */
                 time.tv_sec = base;
+               time.tv_usec = 0;
                 if (!badbase)
                         resettodr();
         } else {
-                int deltat = time.tv_sec - base;
+                int deltat = thetime.tv_sec - base;
 
                 if (deltat < 0)
                         deltat = -deltat;
@@ -290,7 +292,9 @@
                        goto badrtc;
 
                 printf("WARNING: clock %s %d days",
-                    time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
+                    thetime.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
+
+               time = thetime;
         }
         printf(" -- CHECK AND RESET THE DATE!\n");
 }
@@ -304,10 +308,13 @@
 void
 resettodr(void)
 {
+       struct timeval thetime;
 
         if (!time.tv_sec)
                 return;
 
-        if (todr_settime(todr_handle, (struct timeval *)&time) != 0)
+       thetime = time;
+
+        if (todr_settime(todr_handle, &thetime) != 0)
                 printf("resettodr: failed to set time\n");
 }



Home | Main Index | Thread Index | Old Index