diff mbox series

serial: s5p: Use dev_read_addr_ptr() to get base address

Message ID 20231107201349.5775-1-semen.protsenko@linaro.org
State Accepted
Commit 33e7ca5a9b6a0dc1c894c14fd8e29b816f9a6f55
Headers show
Series serial: s5p: Use dev_read_addr_ptr() to get base address | expand

Commit Message

Sam Protsenko Nov. 7, 2023, 8:13 p.m. UTC
As the address read from device tree is being cast to a pointer, it's
better to use dev_read_addr_ptr() API for getting that address. The more
detailed explanation can be found in commit a12a73b66476 ("drivers: use
dev_read_addr_ptr when cast to pointer").

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 drivers/serial/serial_s5p.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Simon Glass Nov. 8, 2023, 4:23 a.m. UTC | #1
On Tue, 7 Nov 2023 at 13:13, Sam Protsenko <semen.protsenko@linaro.org> wrote:
>
> As the address read from device tree is being cast to a pointer, it's
> better to use dev_read_addr_ptr() API for getting that address. The more
> detailed explanation can be found in commit a12a73b66476 ("drivers: use
> dev_read_addr_ptr when cast to pointer").
>
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>  drivers/serial/serial_s5p.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Minkyu Kang Nov. 28, 2023, 3 a.m. UTC | #2
Hi!


2023년 11월 8일 (수) 14:04, Simon Glass <sjg@chromium.org>님이 작성:

> On Tue, 7 Nov 2023 at 13:13, Sam Protsenko <semen.protsenko@linaro.org>
> wrote:
> >
> > As the address read from device tree is being cast to a pointer, it's
> > better to use dev_read_addr_ptr() API for getting that address. The more
> > detailed explanation can be found in commit a12a73b66476 ("drivers: use
> > dev_read_addr_ptr when cast to pointer").
> >
> > Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> > ---
> >  drivers/serial/serial_s5p.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>


applied to u-boot-samsung.

Thanks.
Minkyu Kang.
diff mbox series

Patch

diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index c24d9bca84c9..7d04dcff54fc 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -221,13 +221,11 @@  static int s5p_serial_of_to_plat(struct udevice *dev)
 {
 	struct s5p_serial_plat *plat = dev_get_plat(dev);
 	const ulong port_type = dev_get_driver_data(dev);
-	fdt_addr_t addr;
 
-	addr = dev_read_addr(dev);
-	if (addr == FDT_ADDR_T_NONE)
+	plat->reg = dev_read_addr_ptr(dev);
+	if (!plat->reg)
 		return -EINVAL;
 
-	plat->reg = (struct s5p_uart *)addr;
 	plat->reg_width = dev_read_u32_default(dev, "reg-io-width", 1);
 	plat->port_id = dev_read_u8_default(dev, "id", dev_seq(dev));