Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: webgeek1234@gmail.com, Laxman Dewangan <ldewangan@nvidia.com>,
	Mark Brown <broonie@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Mason Zhang <Mason.Zhang@mediatek.com>
Cc: linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] spi: tegra114: Don't fail set_cs_timing when delays are zero
Date: Tue, 6 May 2025 10:26:50 +0100	[thread overview]
Message-ID: <00b119fb-1cbb-432d-a884-5b33696461e6@nvidia.com> (raw)
In-Reply-To: <20250423-spi-tegra114-v1-1-2d608bcc12f9@gmail.com>


On 24/04/2025 03:03, Aaron Kling via B4 Relay wrote:
> From: Aaron Kling <webgeek1234@gmail.com>
> 
> The original code would skip null delay pointers, but when the pointers
> were converted to point within the spi_device struct, the check was not
> updated to skip delays of zero. Hence all spi devices that didn't set
> delays would fail to probe.
> 
> Fixes: 04e6bb0d6bb1 ("spi: modify set_cs_timing parameter")
> Cc: stable@vger.kernel.org
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
>   drivers/spi/spi-tegra114.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
> index 3822d7c8d8edb9730e937df50d1c75e095dd18ec..2a8bb798e95b954fe573f1c50445ed2e7fcbfd78 100644
> --- a/drivers/spi/spi-tegra114.c
> +++ b/drivers/spi/spi-tegra114.c
> @@ -728,9 +728,9 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi)
>   	u32 inactive_cycles;
>   	u8 cs_state;
>   
> -	if (setup->unit != SPI_DELAY_UNIT_SCK ||
> -	    hold->unit != SPI_DELAY_UNIT_SCK ||
> -	    inactive->unit != SPI_DELAY_UNIT_SCK) {
> +	if ((setup->unit && setup->unit != SPI_DELAY_UNIT_SCK) ||
> +	    (hold->unit && hold->unit != SPI_DELAY_UNIT_SCK) ||
> +	    (inactive->unit && inactive->unit != SPI_DELAY_UNIT_SCK)) {

The above does not look correct to me. For example, if 'setup->unit' is 
0, this means that the unit is 'SPI_DELAY_UNIT_USECS' and does not 
indicate that the delay is 0.

Shouldn't the above be ...

  if ((setup && setup->unit != SPI_DELAY_UNIT_SCK) ||
      (hold && hold->unit != SPI_DELAY_UNIT_SCK) ||
      (inactive && inactive->unit != SPI_DELAY_UNIT_SCK)) {

Jon

-- 
nvpublic


  parent reply	other threads:[~2025-05-06  9:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24  2:03 [PATCH] spi: tegra114: Don't fail set_cs_timing when delays are zero Aaron Kling via B4 Relay
2025-05-02 22:21 ` Mark Brown
2025-05-06  9:26 ` Jon Hunter [this message]
2025-05-06  9:50   ` Aaron Kling
2025-05-06 10:06     ` Jon Hunter
2025-05-06 10:12       ` Aaron Kling
2025-05-06 10:31         ` Jon Hunter

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=00b119fb-1cbb-432d-a884-5b33696461e6@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=Mason.Zhang@mediatek.com \
    --cc=broonie@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=webgeek1234@gmail.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