Skip to content

Commit

Permalink
irqchip: crossbar: Change allocation logic by reversing search for fr…
Browse files Browse the repository at this point in the history
…ee irqs

Reverse the search algorithm to ensure that address mapping and IRQ
allocation logics are proper. This makes the below bugs visible sooner.

class 1. address space errors -> example:
reg = <a size_b>
ti,max-irqs =  is a wrong parameter

class 2: irq-reserved list - which decides which entries in the
address space is not actually wired in

class 3: wrong list of routable-irqs.

In general allocating from max to min tends to have benefits in
ensuring the different issues that may be present in dts is easily
caught at definition time, rather than at a later point in time.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sricharan R <r.sricharan@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Link: https://lkml.kernel.org/r/1403766634-18543-6-git-send-email-r.sricharan@ti.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
  • Loading branch information
Nishanth Menon authored and Jason Cooper committed Jun 30, 2014
1 parent a35057d commit ddee0fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/irqchip/irq-crossbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static inline int get_prev_map_irq(int cb_no)
{
int i;

for (i = 0; i < cb->int_max; i++)
for (i = cb->int_max - 1; i >= 0; i--)
if (cb->irq_map[i] == cb_no)
return i;

Expand All @@ -69,7 +69,7 @@ static inline int allocate_free_irq(int cb_no)
{
int i;

for (i = 0; i < cb->int_max; i++) {
for (i = cb->int_max - 1; i >= 0; i--) {
if (cb->irq_map[i] == IRQ_FREE) {
cb->irq_map[i] = cb_no;
return i;
Expand Down

0 comments on commit ddee0fb

Please sign in to comment.