mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jonas Rebmann <jre@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH] spi: Probe spi devices without alias
Date: Wed, 11 Jun 2025 08:37:07 +0200	[thread overview]
Message-ID: <aEkkE2Lsw7eHhH9R@pengutronix.de> (raw)
In-Reply-To: <20250610-imx_spi_alias-v1-1-fc23f2f143ea@pengutronix.de>

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 |



      reply	other threads:[~2025-06-11  6:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 15:24 Jonas Rebmann
2025-06-11  6:37 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aEkkE2Lsw7eHhH9R@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jre@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox