Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/iomd Fixes for -Wshadow and -Wcast-qual



details:   https://anonhg.NetBSD.org/src/rev/d65e1de31db0
branches:  trunk
changeset: 581717:d65e1de31db0
user:      chris <chris%NetBSD.org@localhost>
date:      Sat Jun 04 00:47:18 2005 +0000

description:
Fixes for -Wshadow and -Wcast-qual

diffstat:

 sys/arch/arm/iomd/iomd_clock.c |  25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (82 lines):

diff -r cd56a2db645c -r d65e1de31db0 sys/arch/arm/iomd/iomd_clock.c
--- a/sys/arch/arm/iomd/iomd_clock.c    Sat Jun 04 00:44:13 2005 +0000
+++ b/sys/arch/arm/iomd/iomd_clock.c    Sat Jun 04 00:47:18 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomd_clock.c,v 1.13 2005/02/26 12:00:52 simonb Exp $   */
+/*     $NetBSD: iomd_clock.c,v 1.14 2005/06/04 00:47:18 chris Exp $    */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -181,14 +181,13 @@
  */
 
 void
-setstatclockrate(hz)
-       int hz;
+setstatclockrate(int newhz)
 {
        int count;
     
-       count = TIMER_FREQUENCY / hz;
+       count = TIMER_FREQUENCY / newhz;
 
-       printf("Setting statclock to %dHz (%d ticks)\n", hz, count);
+       printf("Setting statclock to %dHz (%d ticks)\n", newhz, count);
 
        bus_space_write_1(clock_sc->sc_iot, clock_sc->sc_ioh,
            IOMD_T1LOW, (count >> 0) & 0xff);
@@ -388,6 +387,7 @@
 {
        time_t deltat;
        int badbase;
+       struct timeval thetime;
 
        if (base < (MINYEAR - 1970) * SECYR) {
                printf("WARNING: preposterous time in file system");
@@ -398,8 +398,8 @@
                badbase = 0;
 
        if (todr_handle == NULL ||
-           todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
-           time.tv_sec == 0) {
+           todr_gettime(todr_handle, &thetime) != 0 ||
+           thetime.tv_sec == 0) {
                /*
                 * Believe the time in the file system for lack of
                 * anything better, resetting the TODR.
@@ -418,14 +418,16 @@
                 * See if we gained/lost two or more days; if
                 * so, assume something is amiss.
                 */
-               deltat = time.tv_sec - base;
+               deltat = thetime.tv_sec - base;
                if (deltat < 0)
                        deltat = -deltat;
                if (deltat < 2 * SECDAY)
                        return;         /* all is well */
                printf("WARNING: clock %s %ld days\n",
-                   time.tv_sec < base ? "lost" : "gained",
+                   thetime.tv_sec < base ? "lost" : "gained",
                    (long)deltat / SECDAY);
+
+               time = thetime;
        }
  bad:
        printf("WARNING: CHECK AND RESET THE DATE!\n");
@@ -439,12 +441,15 @@
 void
 resettodr(void)
 {
+       struct timeval thetime;
 
        if (time.tv_sec == 0)
                return;
 
+       thetime = time;
+
        if (todr_handle != NULL &&
-           todr_settime(todr_handle, (struct timeval *)&time) != 0)
+           todr_settime(todr_handle, &thetime) != 0)
                printf("resettodr: failed to set time\n");
 }
 



Home | Main Index | Thread Index | Old Index