diff options
author | Rob Herring <robh@kernel.org> | 2023-03-19 19:32:26 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-06-21 07:08:54 +0300 |
commit | 93cfa6fb9f78f472862240208ef6e5a65f58f775 (patch) | |
tree | 894ba2bca4f86120f571f6190e45fb0801c862f1 /drivers/macintosh/via-cuda.c | |
parent | bc1cf75027585f8d87f94e464ee5909acf885a8c (diff) | |
download | linux-93cfa6fb9f78f472862240208ef6e5a65f58f775.tar.xz |
macintosh: Use of_address_to_resource()
Replace open coded reading of "reg" and of_translate_address() calls with
single call to of_address_to_resource().
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230319163226.226583-1-robh@kernel.org
Diffstat (limited to 'drivers/macintosh/via-cuda.c')
-rw-r--r-- | drivers/macintosh/via-cuda.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index 5071289063f0..f8dd1e831530 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c @@ -235,8 +235,7 @@ int __init find_via_cuda(void) int __init find_via_cuda(void) { struct adb_request req; - phys_addr_t taddr; - const u32 *reg; + struct resource res; int err; if (vias) @@ -245,17 +244,12 @@ int __init find_via_cuda(void) if (!vias) return 0; - reg = of_get_property(vias, "reg", NULL); - if (reg == NULL) { - printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); - goto fail; - } - taddr = of_translate_address(vias, reg); - if (taddr == 0) { - printk(KERN_ERR "via-cuda: Can't translate address !\n"); + err = of_address_to_resource(vias, 0, &res); + if (err) { + printk(KERN_ERR "via-cuda: Error getting \"reg\" property !\n"); goto fail; } - via = ioremap(taddr, 0x2000); + via = ioremap(res.start, 0x2000); if (via == NULL) { printk(KERN_ERR "via-cuda: Can't map address !\n"); goto fail; |