Commit 41447041 authored by Peter Rival's avatar Peter Rival Committed by Linus Torvalds

[PATCH] Compile fixes for alpha arch

Update alpha port to work with new nanosecond xtime, and the in_atomic()
requirements.
parent 59e8b32c
...@@ -57,6 +57,8 @@ static int set_rtc_mmss(unsigned long); ...@@ -57,6 +57,8 @@ static int set_rtc_mmss(unsigned long);
spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED; spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
#define TICK_SIZE (tick_nsec / 1000)
/* /*
* Shift amount by which scaled_ticks_per_cycle is scaled. Shifting * Shift amount by which scaled_ticks_per_cycle is scaled. Shifting
* by 48 gives us 16 bits for HZ while keeping the accuracy good even * by 48 gives us 16 bits for HZ while keeping the accuracy good even
...@@ -129,8 +131,8 @@ void timer_interrupt(int irq, void *dev, struct pt_regs * regs) ...@@ -129,8 +131,8 @@ void timer_interrupt(int irq, void *dev, struct pt_regs * regs)
*/ */
if ((time_status & STA_UNSYNC) == 0 if ((time_status & STA_UNSYNC) == 0
&& xtime.tv_sec > state.last_rtc_update + 660 && xtime.tv_sec > state.last_rtc_update + 660
&& xtime.tv_usec >= 500000 - ((unsigned) tick) / 2 && xtime.tv_nsec >= 500000 - ((unsigned) TICK_SIZE) / 2
&& xtime.tv_usec <= 500000 + ((unsigned) tick) / 2) { && xtime.tv_nsec <= 500000 + ((unsigned) TICK_SIZE) / 2) {
int tmp = set_rtc_mmss(xtime.tv_sec); int tmp = set_rtc_mmss(xtime.tv_sec);
state.last_rtc_update = xtime.tv_sec - (tmp ? 600 : 0); state.last_rtc_update = xtime.tv_sec - (tmp ? 600 : 0);
} }
...@@ -365,7 +367,7 @@ time_init(void) ...@@ -365,7 +367,7 @@ time_init(void)
year += 100; year += 100;
xtime.tv_sec = mktime(year, mon, day, hour, min, sec); xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
xtime.tv_usec = 0; xtime.tv_nsec = 0;
if (HZ > (1<<16)) { if (HZ > (1<<16)) {
extern void __you_loose (void); extern void __you_loose (void);
...@@ -414,7 +416,7 @@ do_gettimeofday(struct timeval *tv) ...@@ -414,7 +416,7 @@ do_gettimeofday(struct timeval *tv)
delta_cycles = rpcc() - state.last_time; delta_cycles = rpcc() - state.last_time;
sec = xtime.tv_sec; sec = xtime.tv_sec;
usec = xtime.tv_usec; usec = (xtime.tv_nsec / 1000);
partial_tick = state.partial_tick; partial_tick = state.partial_tick;
lost = jiffies - wall_jiffies; lost = jiffies - wall_jiffies;
...@@ -485,7 +487,7 @@ do_settimeofday(struct timeval *tv) ...@@ -485,7 +487,7 @@ do_settimeofday(struct timeval *tv)
} }
xtime.tv_sec = sec; xtime.tv_sec = sec;
xtime.tv_usec = usec; xtime.tv_nsec = (usec / 1000);
time_adjust = 0; /* stop active adjtime() */ time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC; time_status |= STA_UNSYNC;
time_maxerror = NTP_PHASE_LIMIT; time_maxerror = NTP_PHASE_LIMIT;
......
...@@ -74,9 +74,12 @@ typedef struct { ...@@ -74,9 +74,12 @@ typedef struct {
#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
#if CONFIG_PREEMPT #if CONFIG_PREEMPT
#define in_atomic() (preempt_count() != kernel_locked())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else #else
#define in_atomic() (preempt_count() != 0)
#define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
# endif # endif
#define irq_exit() \ #define irq_exit() \
......
...@@ -100,6 +100,7 @@ typedef struct { ...@@ -100,6 +100,7 @@ typedef struct {
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) #define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
#define rwlock_is_locked(x) (*(volatile int *)(x) != 0)
#if CONFIG_DEBUG_RWLOCK #if CONFIG_DEBUG_RWLOCK
extern void _raw_write_lock(rwlock_t * lock); extern void _raw_write_lock(rwlock_t * lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment