Skip to content

Commit

Permalink
powerpc: Remove get_irq_desc()
Browse files Browse the repository at this point in the history
get_irq_desc() is a powerpc-specific version of irq_to_desc(). That
is reason enough to remove it, but it also doesn't know about sparse
irq_desc support which irq_to_desc() does (when we enable it).

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Michael Ellerman authored and Benjamin Herrenschmidt committed Oct 30, 2009
1 parent 59e3f83 commit 6cff46f
Show file tree
Hide file tree
Showing 25 changed files with 62 additions and 60 deletions.
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <asm/atomic.h>


#define get_irq_desc(irq) (&irq_desc[(irq)])

/* Define a way to iterate across irqs. */
#define for_each_irq(i) \
for ((i) = 0; (i) < NR_IRQS; ++(i))
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/crash.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
hard_irq_disable();

for_each_irq(i) {
struct irq_desc *desc = irq_desc + i;
struct irq_desc *desc = irq_to_desc(i);

if (desc->status & IRQ_INPROGRESS)
desc->chip->eoi(i);
Expand Down
28 changes: 15 additions & 13 deletions arch/powerpc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int show_interrupts(struct seq_file *p, void *v)
}

if (i < NR_IRQS) {
desc = get_irq_desc(i);
desc = irq_to_desc(i);
spin_lock_irqsave(&desc->lock, flags);
action = desc->action;
if (!action || !action->handler)
Expand Down Expand Up @@ -230,23 +230,25 @@ int show_interrupts(struct seq_file *p, void *v)
#ifdef CONFIG_HOTPLUG_CPU
void fixup_irqs(cpumask_t map)
{
struct irq_desc *desc;
unsigned int irq;
static int warned;

for_each_irq(irq) {
cpumask_t mask;

if (irq_desc[irq].status & IRQ_PER_CPU)
desc = irq_to_desc(irq);
if (desc && desc->status & IRQ_PER_CPU)
continue;

cpumask_and(&mask, irq_desc[irq].affinity, &map);
cpumask_and(&mask, desc->affinity, &map);
if (any_online_cpu(mask) == NR_CPUS) {
printk("Breaking affinity for irq %i\n", irq);
mask = map;
}
if (irq_desc[irq].chip->set_affinity)
irq_desc[irq].chip->set_affinity(irq, &mask);
else if (irq_desc[irq].action && !(warned++))
if (desc->chip->set_affinity)
desc->chip->set_affinity(irq, &mask);
else if (desc->action && !(warned++))
printk("Cannot set affinity for irq %i\n", irq);
}

Expand All @@ -273,7 +275,7 @@ static inline void handle_one_irq(unsigned int irq)
return;
}

desc = irq_desc + irq;
desc = irq_to_desc(irq);
saved_sp_limit = current->thread.ksp_limit;

irqtp->task = curtp->task;
Expand Down Expand Up @@ -535,7 +537,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
smp_wmb();

/* Clear norequest flags */
get_irq_desc(i)->status &= ~IRQ_NOREQUEST;
irq_to_desc(i)->status &= ~IRQ_NOREQUEST;

/* Legacy flags are left to default at this point,
* one can then use irq_create_mapping() to
Expand Down Expand Up @@ -602,7 +604,7 @@ static int irq_setup_virq(struct irq_host *host, unsigned int virq,
irq_hw_number_t hwirq)
{
/* Clear IRQ_NOREQUEST flag */
get_irq_desc(virq)->status &= ~IRQ_NOREQUEST;
irq_to_desc(virq)->status &= ~IRQ_NOREQUEST;

/* map it */
smp_wmb();
Expand Down Expand Up @@ -732,7 +734,7 @@ unsigned int irq_create_of_mapping(struct device_node *controller,

/* Set type if specified and different than the current one */
if (type != IRQ_TYPE_NONE &&
type != (get_irq_desc(virq)->status & IRQF_TRIGGER_MASK))
type != (irq_to_desc(virq)->status & IRQF_TRIGGER_MASK))
set_irq_type(virq, type);
return virq;
}
Expand Down Expand Up @@ -804,7 +806,7 @@ void irq_dispose_mapping(unsigned int virq)
irq_map[virq].hwirq = host->inval_irq;

/* Set some flags */
get_irq_desc(virq)->status |= IRQ_NOREQUEST;
irq_to_desc(virq)->status |= IRQ_NOREQUEST;

/* Free it */
irq_free_virt(virq, 1);
Expand Down Expand Up @@ -1001,7 +1003,7 @@ void irq_early_init(void)
unsigned int i;

for (i = 0; i < NR_IRQS; i++)
get_irq_desc(i)->status |= IRQ_NOREQUEST;
irq_to_desc(i)->status |= IRQ_NOREQUEST;
}

/* We need to create the radix trees late */
Expand Down Expand Up @@ -1064,7 +1066,7 @@ static int virq_debug_show(struct seq_file *m, void *private)
"chip name", "host name");

for (i = 1; i < NR_IRQS; i++) {
desc = get_irq_desc(i);
desc = irq_to_desc(i);
spin_lock_irqsave(&desc->lock, flags);

if (desc->action && desc->action->handler) {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/512x/mpc5121_ads_cpld.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int
cpld_pic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &cpld_pic, handle_level_irq);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/52xx/media5200.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void media5200_irq_cascade(unsigned int virq, struct irq_desc *desc)
static int media5200_irq_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);

pr_debug("%s: h=%p, virq=%i, hwirq=%i\n", __func__, h, virq, (int)hw);
set_irq_chip_data(virq, &media5200_irq);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void pq2ads_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_data(virq, h->host_data);
set_irq_chip_and_handler(virq, &pq2ads_pci_ic, handle_level_irq);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/85xx/socrates_fpga_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static int socrates_fpga_pic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hwirq)
{
/* All interrupts are LEVEL sensitive */
get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &socrates_fpga_pic_chip,
handle_fasteoi_irq);

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/86xx/gef_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static int gef_pic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hwirq)
{
/* All interrupts are LEVEL sensitive */
get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &gef_pic_chip, handle_level_irq);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/beat_interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void beatic_pic_host_unmap(struct irq_host *h, unsigned int virq)
static int beatic_pic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);
int64_t err;

err = beat_construct_and_connect_irq_plug(virq, hw);
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/cell/spider-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static void spider_ack_irq(unsigned int virq)

/* Reset edge detection logic if necessary
*/
if (get_irq_desc(virq)->status & IRQ_LEVEL)
if (irq_to_desc(virq)->status & IRQ_LEVEL)
return;

/* Only interrupts 47 to 50 can be set to edge */
Expand All @@ -119,7 +119,7 @@ static int spider_set_irq_type(unsigned int virq, unsigned int type)
struct spider_pic *pic = spider_virq_to_pic(virq);
unsigned int hw = irq_map[virq].hwirq;
void __iomem *cfg = spider_get_irq_config(pic, hw);
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);
u32 old_mask;
u32 ic;

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/iseries/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void __init iSeries_activate_IRQs()
unsigned long flags;

for_each_irq (irq) {
struct irq_desc *desc = get_irq_desc(irq);
struct irq_desc *desc = irq_to_desc(irq);

if (desc && desc->chip && desc->chip->startup) {
spin_lock_irqsave(&desc->lock, flags);
Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/platforms/powermac/pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ static unsigned int pmac_startup_irq(unsigned int virq)
unsigned long bit = 1UL << (src & 0x1f);
int i = src >> 5;

spin_lock_irqsave(&pmac_pic_lock, flags);
if ((irq_desc[virq].status & IRQ_LEVEL) == 0)
spin_lock_irqsave(&pmac_pic_lock, flags);
if ((irq_to_desc(virq)->status & IRQ_LEVEL) == 0)
out_le32(&pmac_irq_hw[i]->ack, bit);
__set_bit(src, ppc_cached_irq_mask);
__pmac_set_irq_mask(src, 0);
spin_unlock_irqrestore(&pmac_pic_lock, flags);
spin_unlock_irqrestore(&pmac_pic_lock, flags);

return 0;
}
Expand Down Expand Up @@ -285,7 +285,7 @@ static int pmac_pic_host_match(struct irq_host *h, struct device_node *node)
static int pmac_pic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
{
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);
int level;

if (hw >= max_irqs)
Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/platforms/pseries/xics.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check)
cpumask_t cpumask;
cpumask_t tmp = CPU_MASK_NONE;

cpumask_copy(&cpumask, irq_desc[virq].affinity);
cpumask_copy(&cpumask, irq_to_desc(virq)->affinity);
if (!distribute_irqs)
return default_server;

Expand Down Expand Up @@ -419,7 +419,7 @@ static int xics_host_map(struct irq_host *h, unsigned int virq,
/* Insert the interrupt mapping into the radix tree for fast lookup */
irq_radix_revmap_insert(xics_host, virq, hw);

get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
return 0;
}
Expand Down Expand Up @@ -843,7 +843,7 @@ void xics_migrate_irqs_away(void)
/* We need to get IPIs still. */
if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
continue;
desc = get_irq_desc(virq);
desc = irq_to_desc(virq);

/* We only need to migrate enabled IRQS */
if (desc == NULL || desc->chip == NULL
Expand Down Expand Up @@ -872,7 +872,7 @@ void xics_migrate_irqs_away(void)
virq, cpu);

/* Reset affinity to all cpus */
cpumask_setall(irq_desc[virq].affinity);
cpumask_setall(irq_to_desc(virq)->affinity);
desc->chip->set_affinity(virq, cpu_all_mask);
unlock:
spin_unlock_irqrestore(&desc->lock, flags);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/cpm1.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static int cpm_pic_host_map(struct irq_host *h, unsigned int virq,
{
pr_debug("cpm_pic_host_map(%d, 0x%lx)\n", virq, hw);

get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &cpm_pic, handle_fasteoi_irq);
return 0;
}
Expand Down
10 changes: 6 additions & 4 deletions arch/powerpc/sysdev/cpm2_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ static void cpm2_ack(unsigned int virq)

static void cpm2_end_irq(unsigned int virq)
{
struct irq_desc *desc;
int bit, word;
unsigned int irq_nr = virq_to_hw(virq);

if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
&& irq_desc[irq_nr].action) {
desc = irq_to_desc(irq_nr);
if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))
&& desc->action) {

bit = irq_to_siubit[irq_nr];
word = irq_to_siureg[irq_nr];
Expand All @@ -138,7 +140,7 @@ static void cpm2_end_irq(unsigned int virq)
static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
{
unsigned int src = virq_to_hw(virq);
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);
unsigned int vold, vnew, edibit;

if (flow_type == IRQ_TYPE_NONE)
Expand Down Expand Up @@ -210,7 +212,7 @@ static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq,
{
pr_debug("cpm2_pic_host_map(%d, 0x%lx)\n", virq, hw);

get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &cpm2_pic, handle_level_irq);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/fsl_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int fsl_msi_host_map(struct irq_host *h, unsigned int virq,
{
struct irq_chip *chip = &fsl_msi_chip;

get_irq_desc(virq)->status |= IRQ_TYPE_EDGE_FALLING;
irq_to_desc(virq)->status |= IRQ_TYPE_EDGE_FALLING;

set_irq_chip_and_handler(virq, chip, handle_edge_irq);

Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/sysdev/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ static int i8259_host_map(struct irq_host *h, unsigned int virq,

/* We block the internal cascade */
if (hw == 2)
get_irq_desc(virq)->status |= IRQ_NOREQUEST;
irq_to_desc(virq)->status |= IRQ_NOREQUEST;

/* We use the level handler only for now, we might want to
* be more cautious here but that works for now
*/
get_irq_desc(virq)->status |= IRQ_LEVEL;
irq_to_desc(virq)->status |= IRQ_LEVEL;
set_irq_chip_and_handler(virq, &i8259_pic, handle_level_irq);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/ipic.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ static int ipic_set_irq_type(unsigned int virq, unsigned int flow_type)
{
struct ipic *ipic = ipic_from_irq(virq);
unsigned int src = ipic_irq_to_hw(virq);
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);
unsigned int vold, vnew, edibit;

if (flow_type == IRQ_TYPE_NONE)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/mpc8xx_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void mpc8xx_end_irq(unsigned int virq)

static int mpc8xx_set_irq_type(unsigned int virq, unsigned int flow_type)
{
struct irq_desc *desc = get_irq_desc(virq);
struct irq_desc *desc = irq_to_desc(virq);

desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
Expand Down
Loading

0 comments on commit 6cff46f

Please sign in to comment.