sparc32: irq_32.c cleanup

- drop filename in file header
- drop unused includes
- add KERN_* to printk
- fix spaces => tabs
- add spaces after reserved words
- drop all externs, they are now in header files

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Sam Ravnborg
2011-01-28 22:08:24 +00:00
committed by David S. Miller
parent 70044df411
commit fd49bf48ca

View File

@@ -1,5 +1,5 @@
/* /*
* arch/sparc/kernel/irq.c: Interrupt request handling routines. On the * Interrupt request handling routines. On the
* Sparc the IRQs are basically 'cast in stone' * Sparc the IRQs are basically 'cast in stone'
* and you are supposed to probe the prom's device * and you are supposed to probe the prom's device
* node trees to find out who's got which IRQ. * node trees to find out who's got which IRQ.
@@ -11,40 +11,10 @@
* Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org) * Copyright (C) 1998-2000 Anton Blanchard (anton@samba.org)
*/ */
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/linkage.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/signal.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/delay.h>
#include <linux/threads.h>
#include <linux/spinlock.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <asm/ptrace.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/psr.h>
#include <asm/smp.h>
#include <asm/vaddrs.h>
#include <asm/timer.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
#include <asm/traps.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/pcic.h> #include <asm/pcic.h>
#include <asm/cacheflush.h>
#include <asm/irq_regs.h>
#include <asm/leon.h> #include <asm/leon.h>
#include "kernel.h" #include "kernel.h"
@@ -57,6 +27,7 @@
#define SMP_NOP2 #define SMP_NOP2
#define SMP_NOP3 #define SMP_NOP3
#endif /* SMP */ #endif /* SMP */
unsigned long arch_local_irq_save(void) unsigned long arch_local_irq_save(void)
{ {
unsigned long retval; unsigned long retval;
@@ -135,8 +106,7 @@ static void irq_panic(void)
prom_halt(); prom_halt();
} }
void (*sparc_init_timers)(irq_handler_t ) = void (*sparc_init_timers)(irq_handler_t) = (void (*)(irq_handler_t))irq_panic;
(void (*)(irq_handler_t )) irq_panic;
/* /*
* Dave Redman (djhr@tadpole.co.uk) * Dave Redman (djhr@tadpole.co.uk)
@@ -173,11 +143,9 @@ int show_interrupts(struct seq_file *p, void *v)
int j; int j;
#endif #endif
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d)
extern int show_sun4d_interrupts(struct seq_file *, void *);
return show_sun4d_interrupts(p, v); return show_sun4d_interrupts(p, v);
}
spin_lock_irqsave(&irq_action_lock, flags); spin_lock_irqsave(&irq_action_lock, flags);
if (i < NR_IRQS) { if (i < NR_IRQS) {
action = sparc_irq[i].action; action = sparc_irq[i].action;
@@ -215,14 +183,12 @@ void free_irq(unsigned int irq, void *dev_id)
unsigned int cpu_irq; unsigned int cpu_irq;
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d) {
extern void sun4d_free_irq(unsigned int, void *);
sun4d_free_irq(irq, dev_id); sun4d_free_irq(irq, dev_id);
return; return;
} }
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if (cpu_irq > 14) { /* 14 irq levels on the sparc */ if (cpu_irq > 14) { /* 14 irq levels on the sparc */
printk("Trying to free bogus IRQ %d\n", irq); printk(KERN_ERR "Trying to free bogus IRQ %d\n", irq);
return; return;
} }
@@ -232,7 +198,7 @@ void free_irq(unsigned int irq, void *dev_id)
action = *actionp; action = *actionp;
if (!action->handler) { if (!action->handler) {
printk("Trying to free free IRQ%d\n",irq); printk(KERN_ERR "Trying to free free IRQ%d\n", irq);
goto out_unlock; goto out_unlock;
} }
if (dev_id) { if (dev_id) {
@@ -242,19 +208,21 @@ void free_irq(unsigned int irq, void *dev_id)
actionp = &action->next; actionp = &action->next;
} }
if (!action) { if (!action) {
printk("Trying to free free shared IRQ%d\n",irq); printk(KERN_ERR "Trying to free free shared IRQ%d\n",
irq);
goto out_unlock; goto out_unlock;
} }
} else if (action->flags & IRQF_SHARED) { } else if (action->flags & IRQF_SHARED) {
printk("Trying to free shared IRQ%d with NULL device ID\n", irq); printk(KERN_ERR "Trying to free shared IRQ%d with NULL device ID\n",
irq);
goto out_unlock; goto out_unlock;
} }
if (action->flags & SA_STATIC_ALLOC) if (action->flags & SA_STATIC_ALLOC) {
{ /*
/* This interrupt is marked as specially allocated * This interrupt is marked as specially allocated
* so it is a bad idea to free it. * so it is a bad idea to free it.
*/ */
printk("Attempt to free statically allocated IRQ%d (%s)\n", printk(KERN_ERR "Attempt to free statically allocated IRQ%d (%s)\n",
irq, action->name); irq, action->name);
goto out_unlock; goto out_unlock;
} }
@@ -275,7 +243,6 @@ void free_irq(unsigned int irq, void *dev_id)
out_unlock: out_unlock:
spin_unlock_irqrestore(&irq_action_lock, flags); spin_unlock_irqrestore(&irq_action_lock, flags);
} }
EXPORT_SYMBOL(free_irq); EXPORT_SYMBOL(free_irq);
/* /*
@@ -306,17 +273,17 @@ void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs)
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
action = sparc_irq[cpu_irq].action; action = sparc_irq[cpu_irq].action;
printk("IO device interrupt, irq = %d\n", irq); printk(KERN_ERR "IO device interrupt, irq = %d\n", irq);
printk("PC = %08lx NPC = %08lx FP=%08lx\n", regs->pc, printk(KERN_ERR "PC = %08lx NPC = %08lx FP=%08lx\n", regs->pc,
regs->npc, regs->u_regs[14]); regs->npc, regs->u_regs[14]);
if (action) { if (action) {
printk("Expecting: "); printk(KERN_ERR "Expecting: ");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (action->handler) if (action->handler)
printk("[%s:%d:0x%x] ", action->name, printk(KERN_CONT "[%s:%d:0x%x] ", action->name,
(int) i, (unsigned int) action->handler); i, (unsigned int)action->handler);
} }
printk("AIEEE\n"); printk(KERN_ERR "AIEEE\n");
panic("bogus interrupt received"); panic("bogus interrupt received");
} }
@@ -325,9 +292,6 @@ void handler_irq(int pil, struct pt_regs * regs)
struct pt_regs *old_regs; struct pt_regs *old_regs;
struct irqaction *action; struct irqaction *action;
int cpu = smp_processor_id(); int cpu = smp_processor_id();
#ifdef CONFIG_SMP
extern void smp4m_irq_rotate(int cpu);
#endif
old_regs = set_irq_regs(regs); old_regs = set_irq_regs(regs);
irq_enter(); irq_enter();
@@ -354,7 +318,8 @@ void handler_irq(int pil, struct pt_regs * regs)
#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
/* Fast IRQs on the Sparc can only have one routine attached to them, /*
* Fast IRQs on the Sparc can only have one routine attached to them,
* thus no sharing possible. * thus no sharing possible.
*/ */
static int request_fast_irq(unsigned int irq, static int request_fast_irq(unsigned int irq,
@@ -367,9 +332,7 @@ static int request_fast_irq(unsigned int irq,
int ret; int ret;
#if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON #if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
struct tt_entry *trap_table; struct tt_entry *trap_table;
extern struct tt_entry trapbase_cpu1, trapbase_cpu2, trapbase_cpu3;
#endif #endif
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if (cpu_irq > 14) { if (cpu_irq > 14) {
ret = -EINVAL; ret = -EINVAL;
@@ -390,26 +353,25 @@ static int request_fast_irq(unsigned int irq,
panic("Trying to register fast irq as shared.\n"); panic("Trying to register fast irq as shared.\n");
/* Anyway, someone already owns it so cannot be made fast. */ /* Anyway, someone already owns it so cannot be made fast. */
printk("request_fast_irq: Trying to register yet already owned.\n"); printk(KERN_ERR "request_fast_irq: Trying to register yet already owned.\n");
ret = -EBUSY; ret = -EBUSY;
goto out_unlock; goto out_unlock;
} }
/* If this is flagged as statically allocated then we use our /*
* If this is flagged as statically allocated then we use our
* private struct which is never freed. * private struct which is never freed.
*/ */
if (irqflags & SA_STATIC_ALLOC) { if (irqflags & SA_STATIC_ALLOC) {
if (static_irq_count < MAX_STATIC_ALLOC) if (static_irq_count < MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count++]; action = &static_irqaction[static_irq_count++];
else else
printk("Fast IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", printk(KERN_ERR "Fast IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
irq, devname); irq, devname);
} }
if (action == NULL) if (action == NULL)
action = kmalloc(sizeof(struct irqaction), action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
GFP_ATOMIC);
if (!action) { if (!action) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unlock; goto out_unlock;
@@ -426,9 +388,12 @@ static int request_fast_irq(unsigned int irq,
INSTANTIATE(sparc_ttable) INSTANTIATE(sparc_ttable)
#if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON #if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
trap_table = &trapbase_cpu1; INSTANTIATE(trap_table) trap_table = &trapbase_cpu1;
trap_table = &trapbase_cpu2; INSTANTIATE(trap_table) INSTANTIATE(trap_table)
trap_table = &trapbase_cpu3; INSTANTIATE(trap_table) trap_table = &trapbase_cpu2;
INSTANTIATE(trap_table)
trap_table = &trapbase_cpu3;
INSTANTIATE(trap_table)
#endif #endif
#undef INSTANTIATE #undef INSTANTIATE
/* /*
@@ -454,7 +419,8 @@ out:
return ret; return ret;
} }
/* These variables are used to access state from the assembler /*
* These variables are used to access state from the assembler
* interrupt handler, floppy_hardint, so we cannot put these in * interrupt handler, floppy_hardint, so we cannot put these in
* the floppy driver image because that would not work in the * the floppy driver image because that would not work in the
* modular case. * modular case.
@@ -477,8 +443,6 @@ EXPORT_SYMBOL(pdma_base);
unsigned long pdma_areasize; unsigned long pdma_areasize;
EXPORT_SYMBOL(pdma_areasize); EXPORT_SYMBOL(pdma_areasize);
extern void floppy_hardint(void);
static irq_handler_t floppy_irq_handler; static irq_handler_t floppy_irq_handler;
void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
@@ -494,9 +458,11 @@ void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
irq_exit(); irq_exit();
enable_pil_irq(irq); enable_pil_irq(irq);
set_irq_regs(old_regs); set_irq_regs(old_regs);
// XXX Eek, it's totally changed with preempt_count() and such /*
// if (softirq_pending(cpu)) * XXX Eek, it's totally changed with preempt_count() and such
// do_softirq(); * if (softirq_pending(cpu))
* do_softirq();
*/
} }
int sparc_floppy_request_irq(int irq, unsigned long flags, int sparc_floppy_request_irq(int irq, unsigned long flags,
@@ -518,12 +484,9 @@ int request_irq(unsigned int irq,
unsigned int cpu_irq; unsigned int cpu_irq;
int ret; int ret;
if (sparc_cpu_model == sun4d) { if (sparc_cpu_model == sun4d)
extern int sun4d_request_irq(unsigned int,
irq_handler_t ,
unsigned long, const char *, void *);
return sun4d_request_irq(irq, handler, irqflags, devname, dev_id); return sun4d_request_irq(irq, handler, irqflags, devname, dev_id);
}
cpu_irq = irq & (NR_IRQS - 1); cpu_irq = irq & (NR_IRQS - 1);
if (cpu_irq > 14) { if (cpu_irq > 14) {
ret = -EINVAL; ret = -EINVAL;
@@ -544,7 +507,8 @@ int request_irq(unsigned int irq,
goto out_unlock; goto out_unlock;
} }
if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) { if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) {
printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq); printk(KERN_ERR "Attempt to mix fast and slow interrupts on IRQ%d denied\n",
irq);
ret = -EBUSY; ret = -EBUSY;
goto out_unlock; goto out_unlock;
} }
@@ -559,13 +523,11 @@ int request_irq(unsigned int irq,
if (static_irq_count < MAX_STATIC_ALLOC) if (static_irq_count < MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count++]; action = &static_irqaction[static_irq_count++];
else else
printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname); printk(KERN_ERR "Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
irq, devname);
} }
if (action == NULL) if (action == NULL)
action = kmalloc(sizeof(struct irqaction), action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
GFP_ATOMIC);
if (!action) { if (!action) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unlock; goto out_unlock;
@@ -587,7 +549,6 @@ out_unlock:
out: out:
return ret; return ret;
} }
EXPORT_SYMBOL(request_irq); EXPORT_SYMBOL(request_irq);
void disable_irq_nosync(unsigned int irq) void disable_irq_nosync(unsigned int irq)
@@ -606,24 +567,22 @@ void enable_irq(unsigned int irq)
{ {
__enable_irq(irq); __enable_irq(irq);
} }
EXPORT_SYMBOL(enable_irq); EXPORT_SYMBOL(enable_irq);
/* We really don't need these at all on the Sparc. We only have /*
* We really don't need these at all on the Sparc. We only have
* stubs here because they are exported to modules. * stubs here because they are exported to modules.
*/ */
unsigned long probe_irq_on(void) unsigned long probe_irq_on(void)
{ {
return 0; return 0;
} }
EXPORT_SYMBOL(probe_irq_on); EXPORT_SYMBOL(probe_irq_on);
int probe_irq_off(unsigned long mask) int probe_irq_off(unsigned long mask)
{ {
return 0; return 0;
} }
EXPORT_SYMBOL(probe_irq_off); EXPORT_SYMBOL(probe_irq_off);
/* djhr /* djhr
@@ -636,10 +595,6 @@ EXPORT_SYMBOL(probe_irq_off);
void __init init_IRQ(void) void __init init_IRQ(void)
{ {
extern void sun4c_init_IRQ( void );
extern void sun4m_init_IRQ( void );
extern void sun4d_init_IRQ( void );
switch (sparc_cpu_model) { switch (sparc_cpu_model) {
case sun4c: case sun4c:
case sun4: case sun4: