]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
timer: nomadik-mtu: Use dev_read_addr_ptr()
authorStephan Gerhold <stephan@gerhold.net>
Fri, 2 Jul 2021 16:00:13 +0000 (18:00 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 14 Jul 2021 20:47:57 +0000 (16:47 -0400)
Simplify the code a bit by using dev_read_addr_ptr() instead of
dev_read_addr(). This avoids having to cast explicitly to the
struct nomadik_mtu_regs.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
drivers/timer/nomadik-mtu-timer.c

index 417b419d467cdfd2c426b0f0166044bcb60346f6..4d24de14ae69f99b9828397cf677439a42bf2122 100644 (file)
@@ -67,14 +67,11 @@ static int nomadik_mtu_probe(struct udevice *dev)
        struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
        struct nomadik_mtu_priv *priv = dev_get_priv(dev);
        struct nomadik_mtu_regs *mtu;
-       fdt_addr_t addr;
        u32 prescale;
 
-       addr = dev_read_addr(dev);
-       if (addr == FDT_ADDR_T_NONE)
+       mtu = dev_read_addr_ptr(dev);
+       if (!mtu)
                return -EINVAL;
-
-       mtu = (struct nomadik_mtu_regs *)addr;
        priv->timer = mtu->timers; /* Use first timer */
 
        if (!uc_priv->clock_rate)