Skip to content

Commit

Permalink
sparc/kernel/: possible cleanups
Browse files Browse the repository at this point in the history
This patch contains the following possible cleanups:
- make the following needlessly global code static:
  - apc.c: apc_swift_idle()
  - ebus.c: ebus_blacklist_irq()
  - ebus.c: fill_ebus_child()
  - ebus.c: fill_ebus_device()
  - entry.S: syscall_is_too_hard
  - etra: tsetup_sun4c_stackchk
  - head.S: cputyp
  - head.S: prom_vector_p
  - idprom.c: Sun_Machines[]
  - ioport.c: _sparc_find_resource()
  - ioport.c: create_proc_read_entry()
  - irq.c: struct sparc_irq[]
  - rtrap.S: sun4c_rett_stackchk
  - setup.c: prom_sync_me()
  - setup.c: boot_flags
  - sun4c_irq.c: sun4c_sbint_to_irq()
  - sun4d_irq.c: sbus_tid[]
  - sun4d_irq.c: struct sbus_actions
  - sun4d_irq.c: sun4d_sbint_to_irq()
  - sun4m_irq.c: sun4m_sbint_to_irq()
  - sun4m_irq.c: sun4m_get_irqmask()
  - sun4m_irq.c: sun4m_timers
  - sun4m_smp.c: smp4m_cross_call()
  - sun4m_smp.c: smp4m_blackbox_id()
  - sun4m_smp.c: smp4m_blackbox_current()
  - time.c: sp_clock_typ
  - time.c: sbus_time_init()
  - traps.c: instruction_dump()
  - wof.S: spwin_sun4c_stackchk
  - wuf.S: sun4c_fwin_stackchk
- #if 0 the following unused code:
  - process.c: sparc_backtrace_lock
  - process.c: __show_backtrace()
  - process.c: show_backtrace()
  - process.c: smp_show_backtrace_all_cpus()
- remove the following unused code:
  - entry.S: __handle_exception
  - smp.c: smp_num_cpus
  - smp.c: smp_activated
  - smp.c: __cpu_number_map[]
  - smp.c: __cpu_logical_map[]
  - smp.c: bitops_spinlock
  - traps.c: trap_curbuf
  - traps.c: trapbuf[]
  - traps.c: linux_smp_still_initting
  - traps.c: thiscpus_tbr
  - traps.c: thiscpus_mid

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Adrian Bunk authored and David S. Miller committed Jul 18, 2008
1 parent 5b664cb commit c61c65c
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 60 deletions.
2 changes: 1 addition & 1 deletion arch/sparc/kernel/apc.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __setup("apc=", apc_setup);
* CPU idle callback function
* See .../arch/sparc/kernel/process.c
*/
void apc_swift_idle(void)
static void apc_swift_idle(void)
{
#ifdef APC_DEBUG_LED
set_auxio(0x00, AUXIO_LED);
Expand Down
9 changes: 5 additions & 4 deletions arch/sparc/kernel/ebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static inline unsigned long ebus_alloc(size_t size)

/*
*/
int __init ebus_blacklist_irq(const char *name)
static int __init ebus_blacklist_irq(const char *name)
{
struct ebus_device_irq *dp;

Expand All @@ -83,8 +83,8 @@ int __init ebus_blacklist_irq(const char *name)
return 0;
}

void __init fill_ebus_child(struct device_node *dp,
struct linux_ebus_child *dev)
static void __init fill_ebus_child(struct device_node *dp,
struct linux_ebus_child *dev)
{
const int *regs;
const int *irqs;
Expand Down Expand Up @@ -144,7 +144,8 @@ void __init fill_ebus_child(struct device_node *dp,
}
}

void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev)
static void __init fill_ebus_device(struct device_node *dp,
struct linux_ebus_device *dev)
{
const struct linux_prom_registers *regs;
struct linux_ebus_child *child;
Expand Down
4 changes: 1 addition & 3 deletions arch/sparc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,6 @@ linux_sparc_syscall:
bne linux_fast_syscall
/* Just do first insn from SAVE_ALL in the delay slot */

.globl syscall_is_too_hard
syscall_is_too_hard:
SAVE_ALL_HEAD
rd %wim, %l3
Expand Down Expand Up @@ -1544,8 +1543,7 @@ kgdb_trap_low:
#endif

.align 4
.globl __handle_exception, flush_patch_exception
__handle_exception:
.globl flush_patch_exception
flush_patch_exception:
FLUSH_ALL_KERNEL_WINDOWS;
ldd [%o0], %o6
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/kernel/etrap.S
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ tsetup_mmu_patchme:
*/
#define glob_tmp g1

.globl tsetup_sun4c_stackchk
tsetup_sun4c_stackchk:
/* Done by caller: andcc %sp, 0x7, %g0 */
bne trap_setup_user_stack_is_bolixed
Expand Down
2 changes: 0 additions & 2 deletions arch/sparc/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*/

.align 4
.globl cputyp
cputyp:
.word 1

Expand Down Expand Up @@ -1280,7 +1279,6 @@ halt_me:
* gets initialized in c-code so all routines can use it.
*/

.globl prom_vector_p
prom_vector_p:
.word 0

Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/kernel/idprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static struct idprom idprom_buffer;
* of the Sparc CPU and have a meaningful IDPROM machtype value that we
* know about. See asm-sparc/machines.h for empirical constants.
*/
struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
/* First, Sun4's */
{ "Sun 4/100 Series", (SM_SUN4 | SM_4_110) },
{ "Sun 4/200 Series", (SM_SUN4 | SM_4_260) },
Expand Down
13 changes: 7 additions & 6 deletions arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@

#define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */

struct resource *_sparc_find_resource(struct resource *r, unsigned long);
static struct resource *_sparc_find_resource(struct resource *r,
unsigned long);

static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
unsigned long size, char *name);
static void _sparc_free_io(struct resource *res);

static void register_proc_sparc_ioport(void);

/* This points to the next to use virtual memory for DVMA mappings */
static struct resource _sparc_dvma = {
.name = "sparc_dvma", .start = DVMA_VADDR, .end = DVMA_END - 1
Expand Down Expand Up @@ -539,8 +542,6 @@ void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp)

int __init sbus_arch_preinit(void)
{
extern void register_proc_sparc_ioport(void);

register_proc_sparc_ioport();

#ifdef CONFIG_SUN4
Expand Down Expand Up @@ -853,8 +854,8 @@ _sparc_io_get_info(char *buf, char **start, off_t fpos, int length, int *eof,
* XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
* This probably warrants some sort of hashing.
*/
struct resource *
_sparc_find_resource(struct resource *root, unsigned long hit)
static struct resource *_sparc_find_resource(struct resource *root,
unsigned long hit)
{
struct resource *tmp;

Expand All @@ -865,7 +866,7 @@ _sparc_find_resource(struct resource *root, unsigned long hit)
return NULL;
}

void register_proc_sparc_ioport(void)
static void register_proc_sparc_ioport(void)
{
#ifdef CONFIG_PROC_FS
create_proc_read_entry("io_map",0,NULL,_sparc_io_get_info,&sparc_iomap);
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void (*sparc_init_timers)(irq_handler_t ) =
struct irqaction static_irqaction[MAX_STATIC_ALLOC];
int static_irq_count;

struct {
static struct {
struct irqaction *action;
int flags;
} sparc_irq[NR_IRQS];
Expand Down
3 changes: 2 additions & 1 deletion arch/sparc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ void machine_power_off(void)
machine_halt();
}

#if 0

static DEFINE_SPINLOCK(sparc_backtrace_lock);

void __show_backtrace(unsigned long fp)
Expand Down Expand Up @@ -228,7 +230,6 @@ void smp_show_backtrace_all_cpus(void)
}
#endif

#if 0
void show_stackframe(struct sparc_stackf *sf)
{
unsigned long size;
Expand Down
2 changes: 0 additions & 2 deletions arch/sparc/kernel/rtrap.S
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ ret_trap_user_stack_is_bolixed:
b signal_p
ld [%curptr + TI_FLAGS], %g2


.globl sun4c_rett_stackchk
sun4c_rett_stackchk:
be 1f
and %fp, 0xfff, %g1 ! delay slot
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct screen_info screen_info = {
extern unsigned long trapbase;

/* Pretty sick eh? */
void prom_sync_me(void)
static void prom_sync_me(void)
{
unsigned long prom_tbr, flags;

Expand Down Expand Up @@ -97,7 +97,7 @@ void prom_sync_me(void)
return;
}

unsigned int boot_flags __initdata = 0;
static unsigned int boot_flags __initdata = 0;
#define BOOTME_DEBUG 0x1

/* Exported for mm/init.c:paging_init. */
Expand Down
7 changes: 0 additions & 7 deletions arch/sparc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@

#include "irq.h"

int smp_num_cpus = 1;
volatile unsigned long cpu_callin_map[NR_CPUS] __initdata = {0,};
unsigned char boot_cpu_id = 0;
unsigned char boot_cpu_id4 = 0; /* boot_cpu_id << 2 */
int smp_activated = 0;
volatile int __cpu_number_map[NR_CPUS];
volatile int __cpu_logical_map[NR_CPUS];

cpumask_t cpu_online_map = CPU_MASK_NONE;
cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
Expand All @@ -55,9 +51,6 @@ cpumask_t smp_commenced_mask = CPU_MASK_NONE;
* instruction which is much better...
*/

/* Used to make bitops atomic */
unsigned char bitops_spinlock = 0;

void __cpuinit smp_store_cpu_info(int id)
{
int cpu_node;
Expand Down
3 changes: 2 additions & 1 deletion arch/sparc/kernel/sun4c_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ unsigned char *interrupt_enable = NULL;

static int sun4c_pil_map[] = { 0, 1, 2, 3, 5, 7, 8, 9 };

unsigned int sun4c_sbint_to_irq(struct sbus_dev *sdev, unsigned int sbint)
static unsigned int sun4c_sbint_to_irq(struct sbus_dev *sdev,
unsigned int sbint)
{
if (sbint >= sizeof(sun4c_pil_map)) {
printk(KERN_ERR "%s: bogus SBINT %d\n", sdev->prom_name, sbint);
Expand Down
7 changes: 4 additions & 3 deletions arch/sparc/kernel/sun4d_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ extern struct irqaction static_irqaction[MAX_STATIC_ALLOC];
extern int static_irq_count;
unsigned char cpu_leds[32];
#ifdef CONFIG_SMP
unsigned char sbus_tid[32];
static unsigned char sbus_tid[32];
#endif

static struct irqaction *irq_action[NR_IRQS];
extern spinlock_t irq_action_lock;

struct sbus_action {
static struct sbus_action {
struct irqaction *action;
/* For SMP this needs to be extended */
} *sbus_actions;
Expand Down Expand Up @@ -267,7 +267,8 @@ unsigned int sun4d_build_irq(struct sbus_dev *sdev, int irq)
return irq;
}

unsigned int sun4d_sbint_to_irq(struct sbus_dev *sdev, unsigned int sbint)
static unsigned int sun4d_sbint_to_irq(struct sbus_dev *sdev,
unsigned int sbint)
{
if (sbint >= sizeof(sbus_to_pil)) {
printk(KERN_ERR "%s: bogus SBINT %d\n", sdev->prom_name, sbint);
Expand Down
7 changes: 4 additions & 3 deletions arch/sparc/kernel/sun4m_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ static unsigned long irq_mask[] = {

static int sun4m_pil_map[] = { 0, 2, 3, 5, 7, 9, 11, 13 };

unsigned int sun4m_sbint_to_irq(struct sbus_dev *sdev, unsigned int sbint)
static unsigned int sun4m_sbint_to_irq(struct sbus_dev *sdev,
unsigned int sbint)
{
if (sbint >= sizeof(sun4m_pil_map)) {
printk(KERN_ERR "%s: bogus SBINT %d\n", sdev->prom_name, sbint);
Expand All @@ -163,7 +164,7 @@ unsigned int sun4m_sbint_to_irq(struct sbus_dev *sdev, unsigned int sbint)
return sun4m_pil_map[sbint] | 0x30;
}

inline unsigned long sun4m_get_irqmask(unsigned int irq)
static unsigned long sun4m_get_irqmask(unsigned int irq)
{
unsigned long mask;

Expand Down Expand Up @@ -281,7 +282,7 @@ static void sun4m_set_udt(int cpu)
#define TIMER_IRQ (OBIO_INTR | 10)
#define PROFILE_IRQ (OBIO_INTR | 14)

struct sun4m_timer_regs *sun4m_timers;
static struct sun4m_timer_regs *sun4m_timers;
unsigned int lvl14_resolution = (((1000000/HZ) + 1) << 10);

static void sun4m_clear_clock_irq(void)
Expand Down
9 changes: 5 additions & 4 deletions arch/sparc/kernel/sun4m_smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ static struct smp_funcall {
static DEFINE_SPINLOCK(cross_call_lock);

/* Cross calls must be serialized, at least currently. */
void smp4m_cross_call(smpfunc_t func, unsigned long arg1, unsigned long arg2,
unsigned long arg3, unsigned long arg4, unsigned long arg5)
static void smp4m_cross_call(smpfunc_t func, unsigned long arg1,
unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5)
{
register int ncpus = SUN4M_NCPUS;
unsigned long flags;
Expand Down Expand Up @@ -344,7 +345,7 @@ static void __init smp_setup_percpu_timer(void)
enable_pil_irq(14);
}

void __init smp4m_blackbox_id(unsigned *addr)
static void __init smp4m_blackbox_id(unsigned *addr)
{
int rd = *addr & 0x3e000000;
int rs1 = rd >> 11;
Expand All @@ -354,7 +355,7 @@ void __init smp4m_blackbox_id(unsigned *addr)
addr[2] = 0x80082003 | rd | rs1; /* and reg, 3, reg */
}

void __init smp4m_blackbox_current(unsigned *addr)
static void __init smp4m_blackbox_current(unsigned *addr)
{
int rd = *addr & 0x3e000000;
int rs1 = rd >> 11;
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "irq.h"

DEFINE_SPINLOCK(rtc_lock);
enum sparc_clock_type sp_clock_typ;
static enum sparc_clock_type sp_clock_typ;
DEFINE_SPINLOCK(mostek_lock);
void __iomem *mstk48t02_regs = NULL;
static struct mostek48t08 __iomem *mstk48t08_regs = NULL;
Expand Down Expand Up @@ -366,7 +366,7 @@ static int __init clock_init(void)
fs_initcall(clock_init);
#endif /* !CONFIG_SUN4 */

void __init sbus_time_init(void)
static void __init sbus_time_init(void)
{

BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM);
Expand Down
9 changes: 1 addition & 8 deletions arch/sparc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ struct trap_trace_entry {
unsigned long type;
};

int trap_curbuf = 0;
struct trap_trace_entry trapbuf[1024];

void syscall_trace_entry(struct pt_regs *regs)
{
printk("%s[%d]: ", current->comm, task_pid_nr(current));
Expand Down Expand Up @@ -72,7 +69,7 @@ void sun4d_nmi(struct pt_regs *regs)
prom_halt();
}

void instruction_dump (unsigned long *pc)
static void instruction_dump(unsigned long *pc)
{
int i;

Expand Down Expand Up @@ -479,10 +476,6 @@ void do_BUG(const char *file, int line)

extern void sparc_cpu_startup(void);

int linux_smp_still_initting;
unsigned int thiscpus_tbr;
int thiscpus_mid;

void trap_init(void)
{
extern void thread_info_offsets_are_bolixed_pete(void);
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/kernel/wof.S
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spwin_bad_ustack_from_kernel:
* As noted above %curptr cannot be touched by this routine at all.
*/

.globl spwin_sun4c_stackchk
spwin_sun4c_stackchk:
/* LOCATION: Window to be saved on the stack */

Expand Down
1 change: 0 additions & 1 deletion arch/sparc/kernel/wuf.S
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ fwin_user_finish_up:
*/

.align 4
.globl sun4c_fwin_stackchk
sun4c_fwin_stackchk:
/* LOCATION: Window 'W' */

Expand Down
2 changes: 0 additions & 2 deletions include/asm-sparc/machines.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ struct Sun_Machine_Models {
*/
#define NUM_SUN_MACHINES 15

extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES];

/* The machine type in the idprom area looks like this:
*
* ---------------
Expand Down
2 changes: 0 additions & 2 deletions include/asm-sparc/mostek.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ struct mostek48t08 {
struct mostek48t02 regs; /* Here is what we are interested in. */
};

extern enum sparc_clock_type sp_clock_typ;

#ifdef CONFIG_SUN4
enum sparc_clock_type { MSTK48T02, MSTK48T08, \
INTERSIL, MSTK_INVALID };
Expand Down
2 changes: 0 additions & 2 deletions include/asm-sparc/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ struct sun4m_timer_regs {
volatile unsigned int cfg; /* equals zero at boot time... */
};

extern struct sun4m_timer_regs *sun4m_timers;

#define SUN4D_PRM_CNT_L 0x80000000
#define SUN4D_PRM_CNT_LVALUE 0x7FFFFC00

Expand Down

0 comments on commit c61c65c

Please sign in to comment.