Skip to content

Commit 6eaf5d9

Browse files
robherringtmlind
authored andcommitted
ARM: OMAP2+: Use of_address_to_resource()
Replace open coded parsing of "reg" with of_address_to_resource(). Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20230319163135.225076-1-robh@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
1 parent d26f059 commit 6eaf5d9

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

arch/arm/mach-omap2/omap_hwmod.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,7 @@ static const struct of_device_id ti_clkctrl_match_table[] __initconst = {
706706

707707
static int __init _setup_clkctrl_provider(struct device_node *np)
708708
{
709-
const __be32 *addrp;
710709
struct clkctrl_provider *provider;
711-
u64 size;
712710
int i;
713711

714712
provider = memblock_alloc(sizeof(*provider), SMP_CACHE_BYTES);
@@ -717,8 +715,7 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
717715

718716
provider->node = np;
719717

720-
provider->num_addrs =
721-
of_property_count_elems_of_size(np, "reg", sizeof(u32)) / 2;
718+
provider->num_addrs = of_address_count(np);
722719

723720
provider->addr =
724721
memblock_alloc(sizeof(void *) * provider->num_addrs,
@@ -733,11 +730,11 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
733730
return -ENOMEM;
734731

735732
for (i = 0; i < provider->num_addrs; i++) {
736-
addrp = of_get_address(np, i, &size, NULL);
737-
provider->addr[i] = (u32)of_translate_address(np, addrp);
738-
provider->size[i] = size;
739-
pr_debug("%s: %pOF: %x...%x\n", __func__, np, provider->addr[i],
740-
provider->addr[i] + provider->size[i]);
733+
struct resource res;
734+
of_address_to_resource(np, i, &res);
735+
provider->addr[i] = res.start;
736+
provider->size[i] = resource_size(&res);
737+
pr_debug("%s: %pOF: %pR\n", __func__, np, &res);
741738
}
742739

743740
list_add(&provider->link, &clkctrl_providers);

0 commit comments

Comments
 (0)