diff options
-rw-r--r-- | drivers/sh/intc.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c index d5d7f23c19a5..7d286aedaeeb 100644 --- a/drivers/sh/intc.c +++ b/drivers/sh/intc.c | |||
@@ -872,7 +872,7 @@ device_initcall(register_intc_sysdevs); | |||
872 | /* | 872 | /* |
873 | * Dynamic IRQ allocation and deallocation | 873 | * Dynamic IRQ allocation and deallocation |
874 | */ | 874 | */ |
875 | static unsigned int create_irq_on_node(unsigned int irq_want, int node) | 875 | unsigned int create_irq_nr(unsigned int irq_want, int node) |
876 | { | 876 | { |
877 | unsigned int irq = 0, new; | 877 | unsigned int irq = 0, new; |
878 | unsigned long flags; | 878 | unsigned long flags; |
@@ -881,24 +881,28 @@ static unsigned int create_irq_on_node(unsigned int irq_want, int node) | |||
881 | spin_lock_irqsave(&vector_lock, flags); | 881 | spin_lock_irqsave(&vector_lock, flags); |
882 | 882 | ||
883 | /* | 883 | /* |
884 | * First try the wanted IRQ, then scan. | 884 | * First try the wanted IRQ |
885 | */ | 885 | */ |
886 | if (test_and_set_bit(irq_want, intc_irq_map)) { | 886 | if (test_and_set_bit(irq_want, intc_irq_map) == 0) { |
887 | new = irq_want; | ||
888 | } else { | ||
889 | /* .. then fall back to scanning. */ | ||
887 | new = find_first_zero_bit(intc_irq_map, nr_irqs); | 890 | new = find_first_zero_bit(intc_irq_map, nr_irqs); |
888 | if (unlikely(new == nr_irqs)) | 891 | if (unlikely(new == nr_irqs)) |
889 | goto out_unlock; | 892 | goto out_unlock; |
890 | 893 | ||
891 | desc = irq_to_desc_alloc_node(new, node); | ||
892 | if (unlikely(!desc)) { | ||
893 | pr_info("can't get irq_desc for %d\n", new); | ||
894 | goto out_unlock; | ||
895 | } | ||
896 | |||
897 | desc = move_irq_desc(desc, node); | ||
898 | __set_bit(new, intc_irq_map); | 894 | __set_bit(new, intc_irq_map); |
899 | irq = new; | ||
900 | } | 895 | } |
901 | 896 | ||
897 | desc = irq_to_desc_alloc_node(new, node); | ||
898 | if (unlikely(!desc)) { | ||
899 | pr_info("can't get irq_desc for %d\n", new); | ||
900 | goto out_unlock; | ||
901 | } | ||
902 | |||
903 | desc = move_irq_desc(desc, node); | ||
904 | irq = new; | ||
905 | |||
902 | out_unlock: | 906 | out_unlock: |
903 | spin_unlock_irqrestore(&vector_lock, flags); | 907 | spin_unlock_irqrestore(&vector_lock, flags); |
904 | 908 | ||
@@ -913,7 +917,7 @@ int create_irq(void) | |||
913 | int nid = cpu_to_node(smp_processor_id()); | 917 | int nid = cpu_to_node(smp_processor_id()); |
914 | int irq; | 918 | int irq; |
915 | 919 | ||
916 | irq = create_irq_on_node(NR_IRQS_LEGACY, nid); | 920 | irq = create_irq_nr(NR_IRQS_LEGACY, nid); |
917 | if (irq == 0) | 921 | if (irq == 0) |
918 | irq = -1; | 922 | irq = -1; |
919 | 923 | ||