mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] spi: Probe spi devices without alias
@ 2025-06-10 15:24 Jonas Rebmann
  2025-06-11  6:37 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Rebmann @ 2025-06-10 15:24 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann

Continue probing spi connected devices without an alias. Setting bus_num
to -1 will assign numbers automatically.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 drivers/spi/imx_spi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index bfb4b413ebab0e62e92f61db52a866a1d55b9ae3..14c4baada8e03ce1b38031afc68de7b261d43e78 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -604,9 +604,10 @@ static int imx_spi_probe(struct device *dev)
 		imx->cs_array = pdata->chipselect;
 	} else if (IS_ENABLED(CONFIG_OFDEVICE)) {
 		ret = of_alias_get_id(dev->of_node, "spi");
-		if (ret < 0)
-			goto err_free;
-		master->bus_num = ret;
+		if (ret >= 0)
+			master->bus_num = ret;
+		else
+			master->bus_num = -1;
 		imx_spi_dt_probe(imx);
 	}
 

---
base-commit: 508059d413816818905f86c64145f6a7a1a1f998
change-id: 20250610-imx_spi_alias-0a09ae52cbaf

Best regards,
-- 
Jonas Rebmann <jre@pengutronix.de>




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

* Re: [PATCH] spi: Probe spi devices without alias
  2025-06-10 15:24 [PATCH] spi: Probe spi devices without alias Jonas Rebmann
@ 2025-06-11  6:37 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-06-11  6:37 UTC (permalink / raw)
  To: Jonas Rebmann; +Cc: BAREBOX

Hi Jonas,

On Tue, Jun 10, 2025 at 05:24:56PM +0200, Jonas Rebmann wrote:
> Continue probing spi connected devices without an alias. Setting bus_num
> to -1 will assign numbers automatically.
> 
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
>  drivers/spi/imx_spi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
> index bfb4b413ebab0e62e92f61db52a866a1d55b9ae3..14c4baada8e03ce1b38031afc68de7b261d43e78 100644
> --- a/drivers/spi/imx_spi.c
> +++ b/drivers/spi/imx_spi.c
> @@ -604,9 +604,10 @@ static int imx_spi_probe(struct device *dev)
>  		imx->cs_array = pdata->chipselect;
>  	} else if (IS_ENABLED(CONFIG_OFDEVICE)) {
>  		ret = of_alias_get_id(dev->of_node, "spi");
> -		if (ret < 0)
> -			goto err_free;
> -		master->bus_num = ret;
> +		if (ret >= 0)
> +			master->bus_num = ret;
> +		else
> +			master->bus_num = -1;

Calling of_alias_get_id() is unnecessary. Just set bus_num = -1, in that
case this is in spi_register_controller() should trigger:

	if ((ctrl->bus_num < 0) && ctrl->dev->of_node)
		ctrl->bus_num = of_alias_get_id(ctrl->dev->of_node, "spi");

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2025-06-11  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-10 15:24 [PATCH] spi: Probe spi devices without alias Jonas Rebmann
2025-06-11  6:37 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox