Skip to content

Commit

Permalink
Merge branch 'sparc32-sparse'
Browse files Browse the repository at this point in the history
Sam Ravnborg says:

====================
sparse warning fixes in arch/sparc/

The following patch-set address a lot of sparse warnings
in the sparc32 specific parts of arch/sparc/.
A few sparc64 bits are touched too when code are shared.

Within arch/sparc/mm/ only two warnings remains.
These are related to the return value of of_ioremap() which is __iomem.

Within arch/sparc/kernel/ only three files now produces sparse warnings:
    sys_sparc_32.c
    time_32.c
    auxio_32.c

The fixes was not obvious so the warnings was left for now.

When looking at tadpole.c I was left with the impression that most
of the code was actually unused - but for now I added a "TODO".

This is made on top of 3.15-rc2.

This set replaces the two sets sent the last days.
V2:
- Do not add extern in front of prototypes.
- Tidy up a few changelongs

There are still sparse warnings left that are easy to address.
But this fixes the majority.
====================
  • Loading branch information
David S. Miller committed Apr 29, 2014
2 parents 2aafe1a + 1bbc906 commit 8cf749a
Show file tree
Hide file tree
Showing 42 changed files with 221 additions and 121 deletions.
7 changes: 7 additions & 0 deletions arch/sparc/include/asm/auxio.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#ifndef ___ASM_SPARC_AUXIO_H
#define ___ASM_SPARC_AUXIO_H

#ifndef __ASSEMBLY__

extern void __iomem *auxio_register;

#endif /* ifndef __ASSEMBLY__ */

#if defined(__sparc__) && defined(__arch64__)
#include <asm/auxio_64.h>
#else
Expand Down
2 changes: 0 additions & 2 deletions arch/sparc/include/asm/auxio_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@

#ifndef __ASSEMBLY__

extern void __iomem *auxio_register;

#define AUXIO_LTE_ON 1
#define AUXIO_LTE_OFF 0

Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ extern void do_BUG(const char *file, int line);
#include <asm-generic/bug.h>

struct pt_regs;
extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn));
void __noreturn die_if_kernel(char *str, struct pt_regs *regs);

#endif
10 changes: 10 additions & 0 deletions arch/sparc/include/asm/cpudata.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#ifndef ___ASM_SPARC_CPUDATA_H
#define ___ASM_SPARC_CPUDATA_H

#ifndef __ASSEMBLY__

#include <linux/threads.h>
#include <linux/percpu.h>

extern const struct seq_operations cpuinfo_op;

#endif /* !(__ASSEMBLY__) */

#if defined(__sparc__) && defined(__arch64__)
#include <asm/cpudata_64.h>
#else
Expand Down
5 changes: 0 additions & 5 deletions arch/sparc/include/asm/cpudata_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#ifndef __ASSEMBLY__

#include <linux/percpu.h>
#include <linux/threads.h>

typedef struct {
/* Dcache line 1 */
unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
Expand All @@ -35,8 +32,6 @@ DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
#define local_cpu_data() __get_cpu_var(__cpu_data)

extern const struct seq_operations cpuinfo_op;

#endif /* !(__ASSEMBLY__) */

#include <asm/trap_block.h>
Expand Down
11 changes: 2 additions & 9 deletions arch/sparc/include/asm/floppy_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
#include <linux/of.h>
#include <linux/of_device.h>

#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/idprom.h>
#include <asm/oplib.h>
#include <asm/auxio.h>
#include <asm/setup.h>
#include <asm/page.h>
#include <asm/irq.h>

/* We don't need no stinkin' I/O port allocation crap. */
Expand Down Expand Up @@ -49,7 +50,6 @@ struct sun_flpy_controller {

/* You'll only ever find one controller on a SparcStation anyways. */
static struct sun_flpy_controller *sun_fdc = NULL;
extern volatile unsigned char *fdc_status;

struct sun_floppy_ops {
unsigned char (*fd_inb)(int port);
Expand Down Expand Up @@ -212,13 +212,6 @@ static void sun_82077_fd_outb(unsigned char value, int port)
* underruns. If non-zero, doing_pdma encodes the direction of
* the transfer for debugging. 1=read 2=write
*/
extern char *pdma_vaddr;
extern unsigned long pdma_size;
extern volatile int doing_pdma;

/* This is software state */
extern char *pdma_base;
extern unsigned long pdma_areasize;

/* Common routines to all controller types on the Sparc. */
static inline void virtual_dma_init(void)
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/include/asm/irq_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define irq_canonicalize(irq) (irq)

extern void __init init_IRQ(void);
void __init sun4d_init_sbi_irq(void);

#define NO_IRQ 0xffffffff

Expand Down
2 changes: 2 additions & 0 deletions arch/sparc/include/asm/pgalloc_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct page;
void *srmmu_get_nocache(int size, int align);
void srmmu_free_nocache(void *addr, int size);

extern struct resource sparc_iomap;

#define check_pgt_cache() do { } while (0)

pgd_t *get_pgd_fast(void);
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/include/asm/pgtable_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct page;

extern void load_mmu(void);
extern unsigned long calc_highpages(void);
unsigned long __init bootmem_init(unsigned long *pages_avail);

#define pte_ERROR(e) __builtin_trap()
#define pmd_ERROR(e) __builtin_trap()
Expand Down
25 changes: 24 additions & 1 deletion arch/sparc/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#ifndef _SPARC_SETUP_H
#define _SPARC_SETUP_H

#include <uapi/asm/setup.h>
#include <linux/interrupt.h>

#include <uapi/asm/setup.h>

extern char reboot_command[];

Expand All @@ -22,6 +23,28 @@ static inline int con_is_present(void)
{
return serial_console ? 0 : 1;
}

/* from irq_32.c */
extern volatile unsigned char *fdc_status;
extern char *pdma_vaddr;
extern unsigned long pdma_size;
extern volatile int doing_pdma;

/* This is software state */
extern char *pdma_base;
extern unsigned long pdma_areasize;

int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler);

/* setup_32.c */
extern unsigned long cmdline_memory_size;

/* devices.c */
void __init device_scan(void);

/* unaligned_32.c */
unsigned long safe_compute_effective_address(struct pt_regs *, unsigned int);

#endif

extern void sun_do_break(void);
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/timer_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static inline unsigned int timer_value(unsigned int value)
return (value + 1) << TIMER_VALUE_SHIFT;
}

extern __volatile__ unsigned int *master_l10_counter;
extern volatile unsigned int __iomem *master_l10_counter;

extern irqreturn_t notrace timer_interrupt(int dummy, void *dev_id);

Expand Down
3 changes: 3 additions & 0 deletions arch/sparc/kernel/auxio_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/export.h>

#include <asm/oplib.h>
#include <asm/io.h>
#include <asm/auxio.h>
#include <asm/string.h> /* memset(), Linux has no bzero() */
#include <asm/cpu_type.h>

#include "kernel.h"

/* Probe and map in the Auxiliary I/O register */

/* auxio_register is not static because it is referenced
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <asm/cpudata.h>

#include "kernel.h"
#include "entry.h"

DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
EXPORT_PER_CPU_SYMBOL(__cpu_data);
Expand Down
11 changes: 4 additions & 7 deletions arch/sparc/kernel/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <asm/smp.h>
#include <asm/cpudata.h>
#include <asm/cpu_type.h>
#include <asm/setup.h>

extern void clock_stop_probe(void); /* tadpole.c */
#include "kernel.h"

static char *cpu_mid_prop(void)
{
Expand Down Expand Up @@ -131,11 +132,7 @@ void __init device_scan(void)
}
#endif /* !CONFIG_SMP */

{
extern void auxio_probe(void);
extern void auxio_power_probe(void);
auxio_probe();
auxio_power_probe();
}
auxio_probe();
auxio_power_probe();
clock_stop_probe();
}
6 changes: 3 additions & 3 deletions arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,

if (name == NULL) name = "???";

if ((xres = xres_alloc()) != 0) {
if ((xres = xres_alloc()) != NULL) {
tack = xres->xname;
res = &xres->xres;
} else {
Expand Down Expand Up @@ -400,7 +400,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
BUG();
}

struct dma_map_ops sbus_dma_ops = {
static struct dma_map_ops sbus_dma_ops = {
.alloc = sbus_alloc_coherent,
.free = sbus_free_coherent,
.map_page = sbus_map_page,
Expand Down Expand Up @@ -681,7 +681,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
const char *nm;

for (r = root->child; r != NULL; r = r->sibling) {
if ((nm = r->name) == 0) nm = "???";
if ((nm = r->name) == NULL) nm = "???";
seq_printf(m, "%016llx-%016llx: %s\n",
(unsigned long long)r->start,
(unsigned long long)r->end, nm);
Expand Down
9 changes: 9 additions & 0 deletions arch/sparc/kernel/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ void handler_irq(unsigned int pil, struct pt_regs *regs);

unsigned long leon_get_irqmask(unsigned int irq);

/* irq_32.c */
void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs);

/* sun4m_irq.c */
void sun4m_nmi(struct pt_regs *regs);

/* sun4d_irq.c */
void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs);

#ifdef CONFIG_SMP

/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/kernel/irq_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <asm/cacheflush.h>
#include <asm/cpudata.h>
#include <asm/setup.h>
#include <asm/pcic.h>
#include <asm/leon.h>

Expand Down
44 changes: 44 additions & 0 deletions arch/sparc/kernel/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ extern void sun4m_clear_profile_irq(int cpu);
/* sun4m_smp.c */
void sun4m_cpu_pre_starting(void *arg);
void sun4m_cpu_pre_online(void *arg);
void __init smp4m_boot_cpus(void);
int smp4m_boot_one_cpu(int i, struct task_struct *idle);
void __init smp4m_smp_done(void);
void smp4m_cross_call_irq(void);
void smp4m_percpu_timer_interrupt(struct pt_regs *regs);

/* sun4d_irq.c */
extern spinlock_t sun4d_imsk_lock;
Expand All @@ -67,10 +72,17 @@ extern void sun4d_free_irq(unsigned int irq, void *dev_id);
/* sun4d_smp.c */
void sun4d_cpu_pre_starting(void *arg);
void sun4d_cpu_pre_online(void *arg);
void __init smp4d_boot_cpus(void);
int smp4d_boot_one_cpu(int i, struct task_struct *idle);
void __init smp4d_smp_done(void);
void smp4d_cross_call_irq(void);
void smp4d_percpu_timer_interrupt(struct pt_regs *regs);

/* leon_smp.c */
void leon_cpu_pre_starting(void *arg);
void leon_cpu_pre_online(void *arg);
void leonsmp_ipi_interrupt(void);
void leon_cross_call_irq(void);

/* head_32.S */
extern unsigned int t_nmi[];
Expand All @@ -95,6 +107,38 @@ extern void floppy_hardint(void);
extern unsigned long sun4m_cpu_startup;
extern unsigned long sun4d_cpu_startup;

/* process_32.c */
asmlinkage int sparc_do_fork(unsigned long clone_flags,
unsigned long stack_start,
struct pt_regs *regs,
unsigned long stack_size);

/* signal_32.c */
asmlinkage void do_sigreturn(struct pt_regs *regs);
asmlinkage void do_rt_sigreturn(struct pt_regs *regs);
void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
unsigned long thread_info_flags);
asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
struct sigstack __user *ossptr,
unsigned long sp);

/* ptrace_32.c */
asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);

/* unaligned_32.c */
asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn);

/* windows.c */
void try_to_clear_window_buffer(struct pt_regs *regs, int who);

/* tadpole.c */
void __init clock_stop_probe(void);

/* auxio_32.c */
void __init auxio_probe(void);
void __init auxio_power_probe(void);

#else /* CONFIG_SPARC32 */
#endif /* CONFIG_SPARC32 */
#endif /* !(__SPARC_KERNEL_H) */
11 changes: 6 additions & 5 deletions arch/sparc/kernel/leon_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base addr

int leondebug_irq_disable;
int leon_debug_irqout;
static int dummy_master_l10_counter;
static volatile unsigned int dummy_master_l10_counter;
unsigned long amba_system_id;
static DEFINE_SPINLOCK(leon_irq_lock);

static unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
unsigned int sparc_leon_eirq;
#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu])
#define LEON_IACK (&leon3_irqctrl_regs->iclear)
Expand Down Expand Up @@ -65,7 +65,7 @@ static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
}

/* The extended IRQ controller has been found, this function registers it */
void leon_eirq_setup(unsigned int eirq)
static void leon_eirq_setup(unsigned int eirq)
{
unsigned long mask, oldmask;
unsigned int veirq;
Expand Down Expand Up @@ -270,7 +270,7 @@ static u32 leon_cycles_offset(void)
#ifdef CONFIG_SMP

/* smp clockevent irq */
irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
static irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
{
struct clock_event_device *ce;
int cpu = smp_processor_id();
Expand Down Expand Up @@ -313,7 +313,8 @@ void __init leon_init_timers(void)

leondebug_irq_disable = 0;
leon_debug_irqout = 0;
master_l10_counter = (unsigned int *)&dummy_master_l10_counter;
master_l10_counter =
(unsigned int __iomem *)&dummy_master_l10_counter;
dummy_master_l10_counter = 0;

rootnp = of_find_node_by_path("/ambapp0");
Expand Down
Loading

0 comments on commit 8cf749a

Please sign in to comment.