aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cavium-octeon/octeon-irq.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-03-27 10:04:30 -0400
committerThomas Gleixner <tglx@linutronix.de>2011-03-29 08:48:07 -0400
commit5b7cd6fd8278a754df6495fcc5cfa4dd3df42206 (patch)
tree6c9024d27194ba92dc548bd0deea29eaa0664012 /arch/mips/cavium-octeon/octeon-irq.c
parent0c3263870f5f80cf7b6cb322bd8e708ce568d36b (diff)
MIPS: Octeon: Simplify irq_cpu_on/offline irq chip functions
Make use of the IRQCHIP_ONOFFLINE_ENABLED flag and remove the wrappers. Use irqd_irq_disabled() instead of desc->status, which will go away. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: David Daney <ddaney@caviumnetworks.com>
Diffstat (limited to 'arch/mips/cavium-octeon/octeon-irq.c')
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c71
1 files changed, 17 insertions, 54 deletions
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 03c081da3df4..ffd4ae660f79 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -152,19 +152,6 @@ static void octeon_irq_core_bus_sync_unlock(struct irq_data *data)
152 mutex_unlock(&cd->core_irq_mutex); 152 mutex_unlock(&cd->core_irq_mutex);
153} 153}
154 154
155
156static void octeon_irq_core_cpu_online(struct irq_data *data)
157{
158 if (irqd_irq_disabled(data))
159 octeon_irq_core_eoi(data);
160}
161
162static void octeon_irq_core_cpu_offline(struct irq_data *data)
163{
164 if (irqd_irq_disabled(data))
165 octeon_irq_core_ack(data);
166}
167
168static struct irq_chip octeon_irq_chip_core = { 155static struct irq_chip octeon_irq_chip_core = {
169 .name = "Core", 156 .name = "Core",
170 .irq_enable = octeon_irq_core_enable, 157 .irq_enable = octeon_irq_core_enable,
@@ -174,8 +161,9 @@ static struct irq_chip octeon_irq_chip_core = {
174 .irq_bus_lock = octeon_irq_core_bus_lock, 161 .irq_bus_lock = octeon_irq_core_bus_lock,
175 .irq_bus_sync_unlock = octeon_irq_core_bus_sync_unlock, 162 .irq_bus_sync_unlock = octeon_irq_core_bus_sync_unlock,
176 163
177 .irq_cpu_online = octeon_irq_core_cpu_online, 164 .irq_cpu_online = octeon_irq_core_eoi,
178 .irq_cpu_offline = octeon_irq_core_cpu_offline, 165 .irq_cpu_offline = octeon_irq_core_ack,
166 .flags = IRQCHIP_ONOFFLINE_ENABLED,
179}; 167};
180 168
181static void __init octeon_irq_init_core(void) 169static void __init octeon_irq_init_core(void)
@@ -517,30 +505,6 @@ static void octeon_irq_ciu_enable_all_v2(struct irq_data *data)
517 } 505 }
518} 506}
519 507
520static void octeon_irq_cpu_online_mbox(struct irq_data *data)
521{
522 if (irqd_irq_disabled(data))
523 octeon_irq_ciu_enable_local(data);
524}
525
526static void octeon_irq_cpu_online_mbox_v2(struct irq_data *data)
527{
528 if (irqd_irq_disabled(data))
529 octeon_irq_ciu_enable_local_v2(data);
530}
531
532static void octeon_irq_cpu_offline_mbox(struct irq_data *data)
533{
534 if (irqd_irq_disabled(data))
535 octeon_irq_ciu_disable_local(data);
536}
537
538static void octeon_irq_cpu_offline_mbox_v2(struct irq_data *data)
539{
540 if (irqd_irq_disabled(data))
541 octeon_irq_ciu_disable_local_v2(data);
542}
543
544#ifdef CONFIG_SMP 508#ifdef CONFIG_SMP
545 509
546static void octeon_irq_cpu_offline_ciu(struct irq_data *data) 510static void octeon_irq_cpu_offline_ciu(struct irq_data *data)
@@ -570,8 +534,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data,
570 const struct cpumask *dest, bool force) 534 const struct cpumask *dest, bool force)
571{ 535{
572 int cpu; 536 int cpu;
573 struct irq_desc *desc = irq_to_desc(data->irq); 537 bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data);
574 int enable_one = (desc->status & IRQ_DISABLED) == 0;
575 unsigned long flags; 538 unsigned long flags;
576 union octeon_ciu_chip_data cd; 539 union octeon_ciu_chip_data cd;
577 540
@@ -585,7 +548,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data,
585 if (cpumask_weight(dest) != 1) 548 if (cpumask_weight(dest) != 1)
586 return -EINVAL; 549 return -EINVAL;
587 550
588 if (desc->status & IRQ_DISABLED) 551 if (!enable_one)
589 return 0; 552 return 0;
590 553
591 if (cd.s.line == 0) { 554 if (cd.s.line == 0) {
@@ -595,7 +558,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data,
595 unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); 558 unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
596 559
597 if (cpumask_test_cpu(cpu, dest) && enable_one) { 560 if (cpumask_test_cpu(cpu, dest) && enable_one) {
598 enable_one = 0; 561 enable_one = false;
599 set_bit(cd.s.bit, pen); 562 set_bit(cd.s.bit, pen);
600 } else { 563 } else {
601 clear_bit(cd.s.bit, pen); 564 clear_bit(cd.s.bit, pen);
@@ -610,7 +573,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data,
610 unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); 573 unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
611 574
612 if (cpumask_test_cpu(cpu, dest) && enable_one) { 575 if (cpumask_test_cpu(cpu, dest) && enable_one) {
613 enable_one = 0; 576 enable_one = false;
614 set_bit(cd.s.bit, pen); 577 set_bit(cd.s.bit, pen);
615 } else { 578 } else {
616 clear_bit(cd.s.bit, pen); 579 clear_bit(cd.s.bit, pen);
@@ -631,12 +594,11 @@ static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data,
631 bool force) 594 bool force)
632{ 595{
633 int cpu; 596 int cpu;
634 struct irq_desc *desc = irq_to_desc(data->irq); 597 bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data);
635 int enable_one = (desc->status & IRQ_DISABLED) == 0;
636 u64 mask; 598 u64 mask;
637 union octeon_ciu_chip_data cd; 599 union octeon_ciu_chip_data cd;
638 600
639 if (desc->status & IRQ_DISABLED) 601 if (!enable_one)
640 return 0; 602 return 0;
641 603
642 cd.p = data->chip_data; 604 cd.p = data->chip_data;
@@ -647,7 +609,7 @@ static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data,
647 unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); 609 unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
648 int index = octeon_coreid_for_cpu(cpu) * 2; 610 int index = octeon_coreid_for_cpu(cpu) * 2;
649 if (cpumask_test_cpu(cpu, dest) && enable_one) { 611 if (cpumask_test_cpu(cpu, dest) && enable_one) {
650 enable_one = 0; 612 enable_one = false;
651 set_bit(cd.s.bit, pen); 613 set_bit(cd.s.bit, pen);
652 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); 614 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
653 } else { 615 } else {
@@ -660,7 +622,7 @@ static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data,
660 unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); 622 unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
661 int index = octeon_coreid_for_cpu(cpu) * 2 + 1; 623 int index = octeon_coreid_for_cpu(cpu) * 2 + 1;
662 if (cpumask_test_cpu(cpu, dest) && enable_one) { 624 if (cpumask_test_cpu(cpu, dest) && enable_one) {
663 enable_one = 0; 625 enable_one = false;
664 set_bit(cd.s.bit, pen); 626 set_bit(cd.s.bit, pen);
665 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); 627 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
666 } else { 628 } else {
@@ -679,7 +641,6 @@ static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data,
679 */ 641 */
680static void octeon_irq_dummy_mask(struct irq_data *data) 642static void octeon_irq_dummy_mask(struct irq_data *data)
681{ 643{
682 return;
683} 644}
684 645
685/* 646/*
@@ -741,8 +702,9 @@ static struct irq_chip octeon_irq_chip_ciu_mbox_v2 = {
741 .irq_ack = octeon_irq_ciu_disable_local_v2, 702 .irq_ack = octeon_irq_ciu_disable_local_v2,
742 .irq_eoi = octeon_irq_ciu_enable_local_v2, 703 .irq_eoi = octeon_irq_ciu_enable_local_v2,
743 704
744 .irq_cpu_online = octeon_irq_cpu_online_mbox_v2, 705 .irq_cpu_online = octeon_irq_ciu_enable_local_v2,
745 .irq_cpu_offline = octeon_irq_cpu_offline_mbox_v2, 706 .irq_cpu_offline = octeon_irq_ciu_disable_local_v2,
707 .flags = IRQCHIP_ONOFFLINE_ENABLED,
746}; 708};
747 709
748static struct irq_chip octeon_irq_chip_ciu_mbox = { 710static struct irq_chip octeon_irq_chip_ciu_mbox = {
@@ -750,8 +712,9 @@ static struct irq_chip octeon_irq_chip_ciu_mbox = {
750 .irq_enable = octeon_irq_ciu_enable_all, 712 .irq_enable = octeon_irq_ciu_enable_all,
751 .irq_disable = octeon_irq_ciu_disable_all, 713 .irq_disable = octeon_irq_ciu_disable_all,
752 714
753 .irq_cpu_online = octeon_irq_cpu_online_mbox, 715 .irq_cpu_online = octeon_irq_ciu_enable_local,
754 .irq_cpu_offline = octeon_irq_cpu_offline_mbox, 716 .irq_cpu_offline = octeon_irq_ciu_disable_local,
717 .flags = IRQCHIP_ONOFFLINE_ENABLED,
755}; 718};
756 719
757/* 720/*