timer: nomadik-mtu: Use dev_read_addr_ptr()
PATCH 1/1 timer: nomadik-mtu: Use dev_read_addr_ptr()
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 <[email protected]>
---
drivers/timer/nomadik-mtu-timer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/timer/nomadik-mtu-timer.c +2 -5
@@ -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)
Signature · 1 line
2.32.0
Quoted 5 lines · Stephan Gerhold
Simplify the code a bit by using
dev_read_addr_ptr()instead ofdev_read_addr(). This avoids having to cast explicitly to the structnomadik_mtu_regs.Signed-off-by Stephan Gerhold <[email protected]>
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij
Quoted 6 lines · Stephan Gerhold
Simplify the code a bit by using
dev_read_addr_ptr()instead ofdev_read_addr(). This avoids having to cast explicitly to the structnomadik_mtu_regs.Signed-off-by Stephan Gerhold <[email protected]>Reviewed-by Linus Walleij <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom