提交 682fdc96 编写于 作者: B Benoit Cousson 提交者: Paul Walmsley

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: NBenoit Cousson <b-cousson@ti.com>
Signed-off-by: NPaul Walmsley <paul@pwsan.com>
上级 33f7ec81
...@@ -432,7 +432,6 @@ static int _init_main_clk(struct omap_hwmod *oh) ...@@ -432,7 +432,6 @@ static int _init_main_clk(struct omap_hwmod *oh)
*/ */
static int _init_interface_clks(struct omap_hwmod *oh) static int _init_interface_clks(struct omap_hwmod *oh)
{ {
struct omap_hwmod_ocp_if *os;
struct clk *c; struct clk *c;
int i; int i;
int ret = 0; int ret = 0;
...@@ -440,7 +439,9 @@ static int _init_interface_clks(struct omap_hwmod *oh) ...@@ -440,7 +439,9 @@ static int _init_interface_clks(struct omap_hwmod *oh)
if (oh->slaves_cnt == 0) if (oh->slaves_cnt == 0)
return 0; return 0;
for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { for (i = 0; i < oh->slaves_cnt; i++) {
struct omap_hwmod_ocp_if *os = oh->slaves[i];
if (!os->clk) if (!os->clk)
continue; continue;
...@@ -490,7 +491,6 @@ static int _init_opt_clks(struct omap_hwmod *oh) ...@@ -490,7 +491,6 @@ static int _init_opt_clks(struct omap_hwmod *oh)
*/ */
static int _enable_clocks(struct omap_hwmod *oh) static int _enable_clocks(struct omap_hwmod *oh)
{ {
struct omap_hwmod_ocp_if *os;
int i; int i;
pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name);
...@@ -499,7 +499,8 @@ static int _enable_clocks(struct omap_hwmod *oh) ...@@ -499,7 +499,8 @@ static int _enable_clocks(struct omap_hwmod *oh)
clk_enable(oh->_clk); clk_enable(oh->_clk);
if (oh->slaves_cnt > 0) { if (oh->slaves_cnt > 0) {
for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { for (i = 0; i < oh->slaves_cnt; i++) {
struct omap_hwmod_ocp_if *os = oh->slaves[i];
struct clk *c = os->_clk; struct clk *c = os->_clk;
if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE)) if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE))
...@@ -520,7 +521,6 @@ static int _enable_clocks(struct omap_hwmod *oh) ...@@ -520,7 +521,6 @@ static int _enable_clocks(struct omap_hwmod *oh)
*/ */
static int _disable_clocks(struct omap_hwmod *oh) static int _disable_clocks(struct omap_hwmod *oh)
{ {
struct omap_hwmod_ocp_if *os;
int i; int i;
pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name);
...@@ -529,7 +529,8 @@ static int _disable_clocks(struct omap_hwmod *oh) ...@@ -529,7 +529,8 @@ static int _disable_clocks(struct omap_hwmod *oh)
clk_disable(oh->_clk); clk_disable(oh->_clk);
if (oh->slaves_cnt > 0) { if (oh->slaves_cnt > 0) {
for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { for (i = 0; i < oh->slaves_cnt; i++) {
struct omap_hwmod_ocp_if *os = oh->slaves[i];
struct clk *c = os->_clk; struct clk *c = os->_clk;
if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE)) if (c && !IS_ERR(c) && (os->flags & OCPIF_SWSUP_IDLE))
...@@ -551,14 +552,15 @@ static int _disable_clocks(struct omap_hwmod *oh) ...@@ -551,14 +552,15 @@ static int _disable_clocks(struct omap_hwmod *oh)
*/ */
static int _find_mpu_port_index(struct omap_hwmod *oh) static int _find_mpu_port_index(struct omap_hwmod *oh)
{ {
struct omap_hwmod_ocp_if *os;
int i; int i;
int found = 0; int found = 0;
if (!oh || oh->slaves_cnt == 0) if (!oh || oh->slaves_cnt == 0)
return -EINVAL; return -EINVAL;
for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { for (i = 0; i < oh->slaves_cnt; i++) {
struct omap_hwmod_ocp_if *os = oh->slaves[i];
if (os->user & OCP_USER_MPU) { if (os->user & OCP_USER_MPU) {
found = 1; found = 1;
break; break;
...@@ -593,7 +595,7 @@ static void __iomem *_find_mpu_rt_base(struct omap_hwmod *oh, u8 index) ...@@ -593,7 +595,7 @@ static void __iomem *_find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
if (!oh || oh->slaves_cnt == 0) if (!oh || oh->slaves_cnt == 0)
return NULL; return NULL;
os = *oh->slaves + index; os = oh->slaves[index];
for (i = 0, mem = os->addr; i < os->addr_cnt; i++, mem++) { for (i = 0, mem = os->addr; i < os->addr_cnt; i++, mem++) {
if (mem->flags & ADDR_TYPE_RT) { if (mem->flags & ADDR_TYPE_RT) {
...@@ -806,7 +808,7 @@ static int _wait_target_ready(struct omap_hwmod *oh) ...@@ -806,7 +808,7 @@ static int _wait_target_ready(struct omap_hwmod *oh)
if (oh->_int_flags & _HWMOD_NO_MPU_PORT) if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
return 0; return 0;
os = *oh->slaves + oh->_mpu_port_index; os = oh->slaves[oh->_mpu_port_index];
if (oh->flags & HWMOD_NO_IDLEST) if (oh->flags & HWMOD_NO_IDLEST)
return 0; return 0;
...@@ -1000,7 +1002,6 @@ static int _shutdown(struct omap_hwmod *oh) ...@@ -1000,7 +1002,6 @@ static int _shutdown(struct omap_hwmod *oh)
*/ */
static int _setup(struct omap_hwmod *oh) static int _setup(struct omap_hwmod *oh)
{ {
struct omap_hwmod_ocp_if *os;
int i, r; int i, r;
if (!oh) if (!oh)
...@@ -1008,7 +1009,8 @@ static int _setup(struct omap_hwmod *oh) ...@@ -1008,7 +1009,8 @@ static int _setup(struct omap_hwmod *oh)
/* Set iclk autoidle mode */ /* Set iclk autoidle mode */
if (oh->slaves_cnt > 0) { if (oh->slaves_cnt > 0) {
for (i = 0, os = *oh->slaves; i < oh->slaves_cnt; i++, os++) { for (i = 0; i < oh->slaves_cnt; i++) {
struct omap_hwmod_ocp_if *os = oh->slaves[i];
struct clk *c = os->_clk; struct clk *c = os->_clk;
if (!c || IS_ERR(c)) if (!c || IS_ERR(c))
...@@ -1438,7 +1440,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh) ...@@ -1438,7 +1440,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh)
ret = oh->mpu_irqs_cnt + oh->sdma_chs_cnt; ret = oh->mpu_irqs_cnt + oh->sdma_chs_cnt;
for (i = 0; i < oh->slaves_cnt; i++) for (i = 0; i < oh->slaves_cnt; i++)
ret += (*oh->slaves + i)->addr_cnt; ret += oh->slaves[i]->addr_cnt;
return ret; return ret;
} }
...@@ -1479,7 +1481,7 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) ...@@ -1479,7 +1481,7 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
for (i = 0; i < oh->slaves_cnt; i++) { for (i = 0; i < oh->slaves_cnt; i++) {
struct omap_hwmod_ocp_if *os; struct omap_hwmod_ocp_if *os;
os = *oh->slaves + i; os = oh->slaves[i];
for (j = 0; j < os->addr_cnt; j++) { for (j = 0; j < os->addr_cnt; j++) {
(res + r)->start = (os->addr + j)->pa_start; (res + r)->start = (os->addr + j)->pa_start;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册