Commit 8dc4be8e6a9b3d217307dfb469f3a7a552a8324b

Authored by sricharan
Committed by Vaibhav Hiremath
1 parent d13a90752d
Exists in master

ARM: OMAP: hwmod: Fix the addr space, irq, dma count APIs

The address spaces, irqs and dma reqs count APIs return the
number of corresponding entries in a hwmod including a additional
null value or a -1 terminator in the structure introduced recently.
More information here:

- 212738a4: omap_hwmod: use a terminator record with omap_hwmod_mpu_irqs
  arrays

- 78183f3f: omap_hwmod: use a null structure record to terminate
  omap_hwmod_addr_space arrays

- bc614958: omap_hwmod: use a terminator record with omap_hwmod_dma_info
  arrays

The issue with irqs and dma info was originally reported by Benoit Cousson.

The devices which have multiple hwmods and use device_build_ss are
broken with this, as their resources are populated with a extra null
value, subsequently the probe fails. So fix the API not to include
the array terminator in the count.

Reported-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimar@ti.com>
Signed-off-by: sricharan <r.sricharan@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

arch/arm/mach-omap2/omap_hwmod.c
... ... @@ -763,7 +763,7 @@
763 763 ohii = &oh->mpu_irqs[i++];
764 764 } while (ohii->irq != -1);
765 765  
766   - return i;
  766 + return i-1;
767 767 }
768 768  
769 769 /**
... ... @@ -786,7 +786,7 @@
786 786 ohdi = &oh->sdma_reqs[i++];
787 787 } while (ohdi->dma_req != -1);
788 788  
789   - return i;
  789 + return i-1;
790 790 }
791 791  
792 792 /**
... ... @@ -809,7 +809,7 @@
809 809 mem = &os->addr[i++];
810 810 } while (mem->pa_start != mem->pa_end);
811 811  
812   - return i;
  812 + return i-1;
813 813 }
814 814  
815 815 /**