Skip to content

Commit

Permalink
sh: trivial build cleanups.
Browse files Browse the repository at this point in the history
Several errors were spotted during building for custom config (SMP
included). Although SMP still does not compile (no ipi and
__smp_call_function) and does not work, this looks a bit cleaner.
Some other errors obtained via gcc-4.1.0 build.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Evgeniy Polyakov authored and Paul Mundt committed May 31, 2007
1 parent f75522c commit 66c5227
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 6 deletions.
6 changes: 6 additions & 0 deletions arch/sh/kernel/cf-enabler.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/irq.h>

Expand Down Expand Up @@ -149,6 +150,11 @@ static int __init cf_init_se(void)
ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200);
return 0;
}
#else
static int __init cf_init_se(void)
{
return -1;
}
#endif

int __init cf_init(void)
Expand Down
1 change: 1 addition & 0 deletions arch/sh/kernel/cpu/sh4/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
#include <linux/init.h>
#include <linux/io.h>
#include <linux/smp.h>
#include <asm/processor.h>
#include <asm/cache.h>

Expand Down
2 changes: 2 additions & 0 deletions arch/sh/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/

#include <linux/err.h>
#include <linux/cache.h>
#include <linux/cpumask.h>
#include <linux/delay.h>
Expand Down
3 changes: 3 additions & 0 deletions include/asm-sh/cpu-sh4/freq.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#define FRQMR1 0xffc80014
#else
#define FRQCR 0xffc00000
#define FRQCR_PSTBY 0x0200
#define FRQCR_PLLEN 0x0400
#define FRQCR_CKOEN 0x0800
#endif
#define MIN_DIVISOR_NR 0
#define MAX_DIVISOR_NR 3
Expand Down
1 change: 1 addition & 0 deletions include/asm-sh/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/sysdev.h>
#include <asm/cpu/dma.h>

Expand Down
6 changes: 3 additions & 3 deletions include/asm-sh/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ void __raw_readsl(unsigned long addr, void *data, int longlen);
* redefined by userlevel programs.
*/
#ifdef __readb
# define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; })
# define readb(a) ({ unsigned int r_ = __raw_readb(a); mb(); r_; })
#endif
#ifdef __raw_readw
# define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; })
# define readw(a) ({ unsigned int r_ = __raw_readw(a); mb(); r_; })
#endif
#ifdef __raw_readl
# define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; })
# define readl(a) ({ unsigned int r_ = __raw_readl(a); mb(); r_; })
#endif

#ifdef __raw_writeb
Expand Down
2 changes: 1 addition & 1 deletion include/asm-sh/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#ifdef CONFIG_SMP

#include <asm/spinlock.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
#include <asm/current.h>

Expand Down
8 changes: 7 additions & 1 deletion include/asm-sh/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define __ASM_SH_SPINLOCK_H

#include <asm/atomic.h>
#include <asm/spinlock_types.h>

/*
* Your basic SMP spinlocks, allowing only a single CPU anywhere
Expand Down Expand Up @@ -42,7 +43,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)

static inline void __raw_spin_unlock(raw_spinlock_t *lock)
{
assert_spin_locked(lock);
//assert_spin_locked(lock);

lock->lock = 0;
}
Expand Down Expand Up @@ -88,6 +89,11 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
__raw_spin_unlock(&rw->lock);
}

static inline int __raw_write_can_lock(raw_rwlock_t *rw)
{
return (atomic_read(&rw->counter) == RW_LOCK_BIAS);
}

static inline int __raw_read_trylock(raw_rwlock_t *lock)
{
atomic_t *count = (atomic_t*)lock;
Expand Down
4 changes: 3 additions & 1 deletion include/asm-sh/spinlock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ typedef struct {
volatile unsigned long lock;
} raw_spinlock_t;

#define __SPIN_LOCK_UNLOCKED { 0 }
#define __RAW_SPIN_LOCK_UNLOCKED { 1 }

#include <asm/atomic.h>

typedef struct {
raw_spinlock_t lock;
Expand Down

0 comments on commit 66c5227

Please sign in to comment.