[SPARC64]: Fix sparse warnings in arch/sparc64/kernel/time.c

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2008-03-26 01:11:55 -07:00
parent bfdf9ebc39
commit cf3d7c1ef4
4 changed files with 49 additions and 31 deletions

View File

@ -14,6 +14,8 @@ extern void __init boot_cpu_id_too_large(int cpu);
extern unsigned int dcache_parity_tl1_occurred;
extern unsigned int icache_parity_tl1_occurred;
extern void timer_interrupt(int irq, struct pt_regs *regs);
extern asmlinkage void syscall_trace(struct pt_regs *regs,
int syscall_exit_p);

View File

@ -1,6 +1,6 @@
/* smp.c: Sparc64 SMP support.
*
* Copyright (C) 1997, 2007 David S. Miller (davem@davemloft.net)
* Copyright (C) 1997, 2007, 2008 David S. Miller (davem@davemloft.net)
*/
#include <linux/module.h>
@ -30,6 +30,7 @@
#include <asm/cpudata.h>
#include <asm/hvtramp.h>
#include <asm/io.h>
#include <asm/timer.h>
#include <asm/irq.h>
#include <asm/irq_regs.h>

View File

@ -1,7 +1,6 @@
/* $Id: time.c,v 1.42 2002/01/23 14:33:55 davem Exp $
* time.c: UltraSparc timer and TOD clock support.
/* time.c: UltraSparc timer and TOD clock support.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1997, 2008 David S. Miller (davem@davemloft.net)
* Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
*
* Based largely on code which is:
@ -48,6 +47,8 @@
#include <asm/uaccess.h>
#include <asm/irq_regs.h>
#include "entry.h"
DEFINE_SPINLOCK(mostek_lock);
DEFINE_SPINLOCK(rtc_lock);
void __iomem *mstk48t02_regs = NULL;
@ -508,6 +509,37 @@ static int __init has_low_battery(void)
return (data1 == data2); /* Was the write blocked? */
}
static void __init mostek_set_system_time(void __iomem *mregs)
{
unsigned int year, mon, day, hour, min, sec;
u8 tmp;
spin_lock_irq(&mostek_lock);
/* Traditional Mostek chip. */
tmp = mostek_read(mregs + MOSTEK_CREG);
tmp |= MSTK_CREG_READ;
mostek_write(mregs + MOSTEK_CREG, tmp);
sec = MSTK_REG_SEC(mregs);
min = MSTK_REG_MIN(mregs);
hour = MSTK_REG_HOUR(mregs);
day = MSTK_REG_DOM(mregs);
mon = MSTK_REG_MONTH(mregs);
year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
tmp = mostek_read(mregs + MOSTEK_CREG);
tmp &= ~MSTK_CREG_READ;
mostek_write(mregs + MOSTEK_CREG, tmp);
spin_unlock_irq(&mostek_lock);
}
/* Probe for the real time clock chip. */
static void __init set_system_time(void)
{
@ -520,7 +552,6 @@ static void __init set_system_time(void)
unsigned long dregs = 0UL;
void __iomem *bregs = 0UL;
#endif
u8 tmp;
if (!mregs && !dregs && !bregs) {
prom_printf("Something wrong, clock regs not mapped yet.\n");
@ -528,20 +559,11 @@ static void __init set_system_time(void)
}
if (mregs) {
spin_lock_irq(&mostek_lock);
mostek_set_system_time(mregs);
return;
}
/* Traditional Mostek chip. */
tmp = mostek_read(mregs + MOSTEK_CREG);
tmp |= MSTK_CREG_READ;
mostek_write(mregs + MOSTEK_CREG, tmp);
sec = MSTK_REG_SEC(mregs);
min = MSTK_REG_MIN(mregs);
hour = MSTK_REG_HOUR(mregs);
day = MSTK_REG_DOM(mregs);
mon = MSTK_REG_MONTH(mregs);
year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
} else if (bregs) {
if (bregs) {
unsigned char val = readb(bregs + 0x0e);
unsigned int century;
@ -596,14 +618,6 @@ static void __init set_system_time(void)
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
if (mregs) {
tmp = mostek_read(mregs + MOSTEK_CREG);
tmp &= ~MSTK_CREG_READ;
mostek_write(mregs + MOSTEK_CREG, tmp);
spin_unlock_irq(&mostek_lock);
}
}
/* davem suggests we keep this within the 4M locked kernel image */
@ -1027,7 +1041,7 @@ void __init time_init(void)
setup_clockevent_multiplier(clock);
sparc64_clockevent.max_delta_ns =
clockevent_delta2ns(0x7fffffffffffffff, &sparc64_clockevent);
clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent);
sparc64_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &sparc64_clockevent);

View File

@ -1,14 +1,13 @@
/* $Id: timer.h,v 1.3 2000/05/09 17:40:15 davem Exp $
* timer.h: System timer definitions for sun5.
/* timer.h: System timer definitions for sun5.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1997, 2008 David S. Miller (davem@davemloft.net)
*/
#ifndef _SPARC64_TIMER_H
#define _SPARC64_TIMER_H
#include <linux/types.h>
#include <linux/init.h>
struct sparc64_tick_ops {
unsigned long (*get_tick)(void);
@ -25,5 +24,7 @@ struct sparc64_tick_ops {
extern struct sparc64_tick_ops *tick_ops;
extern unsigned long sparc64_get_clock_tick(unsigned int cpu);
extern void __devinit setup_sparc64_timer(void);
extern void __init time_init(void);
#endif /* _SPARC64_TIMER_H */