aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorBenoit Cousson <b-cousson@ti.com>2010-05-20 14:31:09 -0400
committerPaul Walmsley <paul@pwsan.com>2010-05-20 14:31:09 -0400
commit682fdc96f3afb5ec34e4893fae41d09346d656ed (patch)
tree89b6fe2029f78934e0fe002426ef05599fa868c8 /arch/arm/mach-omap2
parent33f7ec81fb3e525eec0575f33dbab02240eda6d4 (diff)
OMAP: hwmod: Fix wrong pointer iteration in oh->slaves
The iteration is currently done on the omap_hwmod_ocp_if pointer and not on the table pointer that reference them. It worked most of the time because the structure are contiguous in memory. Signed-off-by: Benoit Cousson <b-cousson@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 6459d07785b7..a280ccc31a7f 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -432,7 +432,6 @@ static int _init_main_clk(struct omap_hwmod *oh)
432 */ 432 */
433static int _init_interface_clks(struct omap_hwmod *oh) 433static int _init_interface_clks(struct omap_hwmod *oh)
434{ 434{
435 struct omap_hwmod_ocp_if *os;
436 struct clk *c; 435 struct clk *c;
437 int i; 436 int i;
438 int ret = 0; 437 int ret = 0;
@@ -440,7 +439,9 @@ static int _init_interface_clks(struct omap_hwmod *oh)
440 if (oh->slaves_cnt == 0) 439 if (oh->slaves_cnt == 0)
441 return 0; 440 return 0;
442 441
443 for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { 442 for (i = 0; i < oh->slaves_cnt; i++) {
443 struct omap_hwmod_ocp_if *os = oh->slaves[i];
444
444 if (!os->clk) 445 if (!os->clk)
445 continue; 446 continue;
446 447
@@ -490,7 +491,6 @@ static int _init_opt_clks(struct omap_hwmod *oh)
490 */ 491 */
491static int _enable_clocks(struct omap_hwmod *oh) 492static int _enable_clocks(struct omap_hwmod *oh)
492{ 493{
493 struct omap_hwmod_ocp_if *os;
494 int i; 494 int i;
495 495
496 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); 496 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name);
@@ -499,7 +499,8 @@ static int _enable_clocks(struct omap_hwmod *oh)
499 clk_enable(oh->_clk); 499 clk_enable(oh->_clk);
500 500
501 if (oh->slaves_cnt > 0) { 501 if (oh->slaves_cnt > 0) {
502 for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { 502 for (i = 0; i < oh->slaves_cnt; i++) {
503 struct omap_hwmod_ocp_if *os = oh->slaves[i];
503 struct clk *c = os->_clk; 504 struct clk *c = os->_clk;
504 505
505 if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE)) 506 if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE))
@@ -520,7 +521,6 @@ static int _enable_clocks(struct omap_hwmod *oh)
520 */ 521 */
521static int _disable_clocks(struct omap_hwmod *oh) 522static int _disable_clocks(struct omap_hwmod *oh)
522{ 523{
523 struct omap_hwmod_ocp_if *os;
524 int i; 524 int i;
525 525
526 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); 526 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name);
@@ -529,7 +529,8 @@ static int _disable_clocks(struct omap_hwmod *oh)
529 clk_disable(oh->_clk); 529 clk_disable(oh->_clk);
530 530
531 if (oh->slaves_cnt > 0) { 531 if (oh->slaves_cnt > 0) {
532 for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { 532 for (i = 0; i < oh->slaves_cnt; i++) {
533 struct omap_hwmod_ocp_if *os = oh->slaves[i];
533 struct clk *c = os->_clk; 534 struct clk *c = os->_clk;
534 535
535 if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE)) 536 if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE))
@@ -551,14 +552,15 @@ static int _disable_clocks(struct omap_hwmod *oh)
551 */ 552 */
552static int _find_mpu_port_index(struct omap_hwmod *oh) 553static int _find_mpu_port_index(struct omap_hwmod *oh)
553{ 554{
554 struct omap_hwmod_ocp_if *os;
555 int i; 555 int i;
556 int found = 0; 556 int found = 0;
557 557
558 if (!oh || oh->slaves_cnt == 0) 558 if (!oh || oh->slaves_cnt == 0)
559 return -EINVAL; 559 return -EINVAL;
560 560
561 for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { 561 for (i = 0; i < oh->slaves_cnt; i++) {
562 struct omap_hwmod_ocp_if *os = oh->slaves[i];
563
562 if (os->user & OCP_USER_MPU) { 564 if (os->user & OCP_USER_MPU) {
563 found = 1; 565 found = 1;
564 break; 566 break;
@@ -593,7 +595,7 @@ static void __iomem *_find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
593 if (!oh || oh->slaves_cnt == 0) 595 if (!oh || oh->slaves_cnt == 0)
594 return NULL; 596 return NULL;
595 597
596 os = *oh->slaves + index; 598 os = oh->slaves[index];
597 599
598 for (i = 0, mem = os->addr; i < os->addr_cnt; i++, mem++) { 600 for (i = 0, mem = os->addr; i < os->addr_cnt; i++, mem++) {
599 if (mem->flags & ADDR_TYPE_RT) { 601 if (mem->flags & ADDR_TYPE_RT) {
@@ -806,7 +808,7 @@ static int _wait_target_ready(struct omap_hwmod *oh)
806 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 808 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
807 return 0; 809 return 0;
808 810
809 os = *oh->slaves + oh->_mpu_port_index; 811 os = oh->slaves[oh->_mpu_port_index];
810 812
811 if (oh->flags & HWMOD_NO_IDLEST) 813 if (oh->flags & HWMOD_NO_IDLEST)
812 return 0; 814 return 0;
@@ -1000,7 +1002,6 @@ static int _shutdown(struct omap_hwmod *oh)
1000 */ 1002 */
1001static int _setup(struct omap_hwmod *oh) 1003static int _setup(struct omap_hwmod *oh)
1002{ 1004{
1003 struct omap_hwmod_ocp_if *os;
1004 int i, r; 1005 int i, r;
1005 1006
1006 if (!oh) 1007 if (!oh)
@@ -1008,7 +1009,8 @@ static int _setup(struct omap_hwmod *oh)
1008 1009
1009 /* Set iclk autoidle mode */ 1010 /* Set iclk autoidle mode */
1010 if (oh->slaves_cnt > 0) { 1011 if (oh->slaves_cnt > 0) {
1011 for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { 1012 for (i = 0; i < oh->slaves_cnt; i++) {
1013 struct omap_hwmod_ocp_if *os = oh->slaves[i];
1012 struct clk *c = os->_clk; 1014 struct clk *c = os->_clk;
1013 1015
1014 if (!c || IS_ERR(c)) 1016 if (!c || IS_ERR(c))
@@ -1438,7 +1440,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh)
1438 ret = oh->mpu_irqs_cnt + oh->sdma_chs_cnt; 1440 ret = oh->mpu_irqs_cnt + oh->sdma_chs_cnt;
1439 1441
1440 for (i = 0; i < oh->slaves_cnt; i++) 1442 for (i = 0; i < oh->slaves_cnt; i++)
1441 ret += (*oh->slaves + i)->addr_cnt; 1443 ret += oh->slaves[i]->addr_cnt;
1442 1444
1443 return ret; 1445 return ret;
1444} 1446}
@@ -1479,7 +1481,7 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
1479 for (i = 0; i < oh->slaves_cnt; i++) { 1481 for (i = 0; i < oh->slaves_cnt; i++) {
1480 struct omap_hwmod_ocp_if *os; 1482 struct omap_hwmod_ocp_if *os;
1481 1483
1482 os = *oh->slaves + i; 1484 os = oh->slaves[i];
1483 1485
1484 for (j = 0; j < os->addr_cnt; j++) { 1486 for (j = 0; j < os->addr_cnt; j++) {
1485 (res + r)->start = (os->addr + j)->pa_start; 1487 (res + r)->start = (os->addr + j)->pa_start;