Commit 6eaf5d97 authored by Rob Herring's avatar Rob Herring Committed by Tony Lindgren

ARM: OMAP2+: Use of_address_to_resource()

Replace open coded parsing of "reg" with of_address_to_resource().
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Message-Id: <20230319163135.225076-1-robh@kernel.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent d26f0593
...@@ -706,9 +706,7 @@ static const struct of_device_id ti_clkctrl_match_table[] __initconst = { ...@@ -706,9 +706,7 @@ static const struct of_device_id ti_clkctrl_match_table[] __initconst = {
static int __init _setup_clkctrl_provider(struct device_node *np) static int __init _setup_clkctrl_provider(struct device_node *np)
{ {
const __be32 *addrp;
struct clkctrl_provider *provider; struct clkctrl_provider *provider;
u64 size;
int i; int i;
provider = memblock_alloc(sizeof(*provider), SMP_CACHE_BYTES); provider = memblock_alloc(sizeof(*provider), SMP_CACHE_BYTES);
...@@ -717,8 +715,7 @@ static int __init _setup_clkctrl_provider(struct device_node *np) ...@@ -717,8 +715,7 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
provider->node = np; provider->node = np;
provider->num_addrs = provider->num_addrs = of_address_count(np);
of_property_count_elems_of_size(np, "reg", sizeof(u32)) / 2;
provider->addr = provider->addr =
memblock_alloc(sizeof(void *) * provider->num_addrs, memblock_alloc(sizeof(void *) * provider->num_addrs,
...@@ -733,11 +730,11 @@ static int __init _setup_clkctrl_provider(struct device_node *np) ...@@ -733,11 +730,11 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < provider->num_addrs; i++) { for (i = 0; i < provider->num_addrs; i++) {
addrp = of_get_address(np, i, &size, NULL); struct resource res;
provider->addr[i] = (u32)of_translate_address(np, addrp); of_address_to_resource(np, i, &res);
provider->size[i] = size; provider->addr[i] = res.start;
pr_debug("%s: %pOF: %x...%x\n", __func__, np, provider->addr[i], provider->size[i] = resource_size(&res);
provider->addr[i] + provider->size[i]); pr_debug("%s: %pOF: %pR\n", __func__, np, &res);
} }
list_add(&provider->link, &clkctrl_providers); list_add(&provider->link, &clkctrl_providers);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment