All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mailbox: stm32_ipcc: Convert to use APIs which support live DT
@ 2020-09-09 15:48 Patrick Delaunay
  2020-10-02  9:42 ` Patrice CHOTARD
  2020-10-02 13:11 ` Patrick DELAUNAY
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2020-09-09 15:48 UTC (permalink / raw)
  To: u-boot

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/mailbox/stm32-ipcc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index b8bf356b4a..81a4115986 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -101,9 +101,8 @@ static int stm32_ipcc_probe(struct udevice *dev)
 {
 	struct stm32_ipcc *ipcc = dev_get_priv(dev);
 	fdt_addr_t addr;
-	const fdt32_t *cell;
 	struct clk clk;
-	int len, ret;
+	int ret;
 
 	debug("%s(dev=%p)\n", __func__, dev);
 
@@ -114,14 +113,12 @@ static int stm32_ipcc_probe(struct udevice *dev)
 	ipcc->reg_base = (void __iomem *)addr;
 
 	/* proc_id */
-	cell = dev_read_prop(dev, "st,proc_id", &len);
-	if (len < sizeof(fdt32_t)) {
+	ret = dev_read_u32_index(dev, "st,proc_id", 1, &ipcc->proc_id);
+	if (ret) {
 		dev_dbg(dev, "Missing st,proc_id\n");
 		return -EINVAL;
 	}
 
-	ipcc->proc_id = fdtdec_get_number(cell, 1);
-
 	if (ipcc->proc_id >= STM32_MAX_PROCS) {
 		dev_err(dev, "Invalid proc_id (%d)\n", ipcc->proc_id);
 		return -EINVAL;
-- 
2.17.1

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

* [PATCH] mailbox: stm32_ipcc: Convert to use APIs which support live DT
  2020-09-09 15:48 [PATCH] mailbox: stm32_ipcc: Convert to use APIs which support live DT Patrick Delaunay
@ 2020-10-02  9:42 ` Patrice CHOTARD
  2020-10-02 13:11 ` Patrick DELAUNAY
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2020-10-02  9:42 UTC (permalink / raw)
  To: u-boot

Hi Patrick

On 9/9/20 5:48 PM, Patrick Delaunay wrote:
> Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
> driver can support live DT.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  drivers/mailbox/stm32-ipcc.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
> index b8bf356b4a..81a4115986 100644
> --- a/drivers/mailbox/stm32-ipcc.c
> +++ b/drivers/mailbox/stm32-ipcc.c
> @@ -101,9 +101,8 @@ static int stm32_ipcc_probe(struct udevice *dev)
>  {
>  	struct stm32_ipcc *ipcc = dev_get_priv(dev);
>  	fdt_addr_t addr;
> -	const fdt32_t *cell;
>  	struct clk clk;
> -	int len, ret;
> +	int ret;
>  
>  	debug("%s(dev=%p)\n", __func__, dev);
>  
> @@ -114,14 +113,12 @@ static int stm32_ipcc_probe(struct udevice *dev)
>  	ipcc->reg_base = (void __iomem *)addr;
>  
>  	/* proc_id */
> -	cell = dev_read_prop(dev, "st,proc_id", &len);
> -	if (len < sizeof(fdt32_t)) {
> +	ret = dev_read_u32_index(dev, "st,proc_id", 1, &ipcc->proc_id);
> +	if (ret) {
>  		dev_dbg(dev, "Missing st,proc_id\n");
>  		return -EINVAL;
>  	}
>  
> -	ipcc->proc_id = fdtdec_get_number(cell, 1);
> -
>  	if (ipcc->proc_id >= STM32_MAX_PROCS) {
>  		dev_err(dev, "Invalid proc_id (%d)\n", ipcc->proc_id);
>  		return -EINVAL;

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

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

* [PATCH] mailbox: stm32_ipcc: Convert to use APIs which support live DT
  2020-09-09 15:48 [PATCH] mailbox: stm32_ipcc: Convert to use APIs which support live DT Patrick Delaunay
  2020-10-02  9:42 ` Patrice CHOTARD
@ 2020-10-02 13:11 ` Patrick DELAUNAY
  1 sibling, 0 replies; 3+ messages in thread
From: Patrick DELAUNAY @ 2020-10-02 13:11 UTC (permalink / raw)
  To: u-boot

Hi,

> From: Patrick DELAUNAY <patrick.delaunay@st.com>
> Sent: mercredi 9 septembre 2020 17:48
> 
> Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the driver can
> support live DT.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> 
>  drivers/mailbox/stm32-ipcc.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 

Applied to u-boot-stm/next, thanks!

Regards

Patrick

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

end of thread, other threads:[~2020-10-02 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 15:48 [PATCH] mailbox: stm32_ipcc: Convert to use APIs which support live DT Patrick Delaunay
2020-10-02  9:42 ` Patrice CHOTARD
2020-10-02 13:11 ` Patrick DELAUNAY

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.