All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] timer: nomadik-mtu: Use dev_read_addr_ptr()
@ 2021-07-02 16:00 Stephan Gerhold
  2021-07-02 16:35 ` Linus Walleij
  2021-07-14 20:52 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Stephan Gerhold @ 2021-07-02 16:00 UTC (permalink / raw)
  To: u-boot; +Cc: Stephan Gerhold, Linus Walleij

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>
---

 drivers/timer/nomadik-mtu-timer.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/timer/nomadik-mtu-timer.c b/drivers/timer/nomadik-mtu-timer.c
index 417b419d46..4d24de14ae 100644
--- a/drivers/timer/nomadik-mtu-timer.c
+++ b/drivers/timer/nomadik-mtu-timer.c
@@ -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)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] timer: nomadik-mtu: Use dev_read_addr_ptr()
  2021-07-02 16:00 [PATCH] timer: nomadik-mtu: Use dev_read_addr_ptr() Stephan Gerhold
@ 2021-07-02 16:35 ` Linus Walleij
  2021-07-14 20:52 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-07-02 16:35 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: U-Boot Mailing List

On Fri, Jul 2, 2021 at 6:00 PM Stephan Gerhold <stephan@gerhold.net> wrote:

> 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>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] timer: nomadik-mtu: Use dev_read_addr_ptr()
  2021-07-02 16:00 [PATCH] timer: nomadik-mtu: Use dev_read_addr_ptr() Stephan Gerhold
  2021-07-02 16:35 ` Linus Walleij
@ 2021-07-14 20:52 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-07-14 20:52 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: u-boot, Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

On Fri, Jul 02, 2021 at 06:00:13PM +0200, Stephan Gerhold wrote:

> 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>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-14 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 16:00 [PATCH] timer: nomadik-mtu: Use dev_read_addr_ptr() Stephan Gerhold
2021-07-02 16:35 ` Linus Walleij
2021-07-14 20:52 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.