mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russ Weight <russell.h.weight@intel.com>
To: <broonie@kernel.org>, <linux-spi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <trix@redhat.com>, <lgoncalv@redhat.com>, <yilun.xu@intel.com>,
	<hao.wu@intel.com>, <matthew.gerlach@intel.com>
Subject: Re: [PATCH 1/1] spi: altera: Change to dynamic allocation of spi id
Date: Mon, 18 Oct 2021 17:27:38 -0700	[thread overview]
Message-ID: <278aa054-9710-440e-df6e-96c7b835e2ab@intel.com> (raw)
In-Reply-To: <20211019002401.24041-1-russell.h.weight@intel.com>

If there are no concerns with this patch, it will need to have the "cc stable"
tag added for earlier kernels.

I don't think it needs a "Fixes" tag, as the problem has been there since the
driver was introduced.

Thanks,
- Russ

On 10/18/21 5:24 PM, Russ Weight wrote:
> The spi-altera driver has two flavors: platform and dfl. I'm seeing
> a case where I have both device types in the same machine, and they
> are conflicting on the SPI ID:
>
> ... kernel: couldn't get idr
> ... kernel: WARNING: CPU: 28 PID: 912 at drivers/spi/spi.c:2920 spi_register_controller.cold+0x84/0xc0a
>
> Both the platform and dfl drivers use the parent's driver ID as the SPI
> ID. In the error case, the parent devices are dfl_dev.4 and
> subdev_spi_altera.4.auto. When the second spi-master is created, the
> failure occurs because the SPI ID of 4 has already been allocated.
>
> Change the ID allocation to dynamic (by initializing bus_num to -1) to
> avoid duplicate SPI IDs.
>
> Signed-off-by: Russ Weight <russell.h.weight@intel.com>
> ---
>  drivers/spi/spi-altera-dfl.c      | 2 +-
>  drivers/spi/spi-altera-platform.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-altera-dfl.c b/drivers/spi/spi-altera-dfl.c
> index 44fc9ee13fc7..ca40923258af 100644
> --- a/drivers/spi/spi-altera-dfl.c
> +++ b/drivers/spi/spi-altera-dfl.c
> @@ -134,7 +134,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)
>  	if (!master)
>  		return -ENOMEM;
>  
> -	master->bus_num = dfl_dev->id;
> +	master->bus_num = -1;
>  
>  	hw = spi_master_get_devdata(master);
>  
> diff --git a/drivers/spi/spi-altera-platform.c b/drivers/spi/spi-altera-platform.c
> index f7a7c14e3679..65147aae82a1 100644
> --- a/drivers/spi/spi-altera-platform.c
> +++ b/drivers/spi/spi-altera-platform.c
> @@ -48,7 +48,7 @@ static int altera_spi_probe(struct platform_device *pdev)
>  		return err;
>  
>  	/* setup the master state. */
> -	master->bus_num = pdev->id;
> +	master->bus_num = -1;
>  
>  	if (pdata) {
>  		if (pdata->num_chipselect > ALTERA_SPI_MAX_CS) {


  reply	other threads:[~2021-10-19  0:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  0:24 Russ Weight
2021-10-19  0:27 ` Russ Weight [this message]
2021-10-20  1:02   ` Mark Brown
2021-10-20  1:39     ` Xu Yilun
2021-10-20  1:35   ` Xu Yilun
2021-10-20 10:40 ` Mark Brown
2021-10-20 11:28 ` Mark Brown

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=278aa054-9710-440e-df6e-96c7b835e2ab@intel.com \
    --to=russell.h.weight@intel.com \
    --cc=broonie@kernel.org \
    --cc=hao.wu@intel.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matthew.gerlach@intel.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /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

all inboxes | Powered by JetHome®