linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] spi: Fix error code checking in spi_mem_exec_op()
@ 2024-03-13 19:45 Florian Fainelli
  2024-03-14  5:41 ` Mika Westerberg
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-03-13 19:45 UTC (permalink / raw)
  To: linux-spi
  Cc: Florian Fainelli, Michael Walle, Pratyush Yadav, Mark Brown,
	Michael Walle, Chia-Lin Kao (AceLan),
	Mika Westerberg, Miquel Raynal, open list

After commit cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with
-EOPNOTSUPP"), our SPI NOR flashes would stop probing with the following
visible in the kernel log:

[    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
[    2.210295] spi-nor: probe of spi1.0 failed with error -95

It turns out that the check in spi_mem_exec_op() was changed to check
for -ENOTSUPP (old error code) or -EOPNOTSUPP (new error code), but this
means that for drivers that were converted, the second condition is now
true, and we stop falling through like we used to. Fix the error to
check for neither error being neither -ENOTSUPP *nor* -EOPNOTSUPP.

Fixes: cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP")
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
Changes in v2:

- collected R-by tags from Michael and Pratyush
- rebased against spi/for-next

 drivers/spi/spi-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index c9d6d42a88f5..17b8baf749e6 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -382,7 +382,7 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 		 * read path) and expect the core to use the regular SPI
 		 * interface in other cases.
 		 */
-		if (!ret || ret != -ENOTSUPP || ret != -EOPNOTSUPP) {
+		if (!ret || (ret != -ENOTSUPP && ret != -EOPNOTSUPP)) {
 			spi_mem_add_op_stats(ctlr->pcpu_statistics, op, ret);
 			spi_mem_add_op_stats(mem->spi->pcpu_statistics, op, ret);
 
-- 
2.34.1


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

* Re: [PATCH v2] spi: Fix error code checking in spi_mem_exec_op()
  2024-03-13 19:45 [PATCH v2] spi: Fix error code checking in spi_mem_exec_op() Florian Fainelli
@ 2024-03-14  5:41 ` Mika Westerberg
  2024-03-14  7:05 ` Tudor Ambarus
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2024-03-14  5:41 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-spi, Michael Walle, Pratyush Yadav, Mark Brown,
	Michael Walle, Chia-Lin Kao (AceLan),
	Miquel Raynal, open list

On Wed, Mar 13, 2024 at 12:45:30PM -0700, Florian Fainelli wrote:
> After commit cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with
> -EOPNOTSUPP"), our SPI NOR flashes would stop probing with the following
> visible in the kernel log:
> 
> [    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
> [    2.210295] spi-nor: probe of spi1.0 failed with error -95
> 
> It turns out that the check in spi_mem_exec_op() was changed to check
> for -ENOTSUPP (old error code) or -EOPNOTSUPP (new error code), but this
> means that for drivers that were converted, the second condition is now
> true, and we stop falling through like we used to. Fix the error to
> check for neither error being neither -ENOTSUPP *nor* -EOPNOTSUPP.
> 
> Fixes: cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP")
> Reviewed-by: Michael Walle <mwalle@kernel.org>
> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v2] spi: Fix error code checking in spi_mem_exec_op()
  2024-03-13 19:45 [PATCH v2] spi: Fix error code checking in spi_mem_exec_op() Florian Fainelli
  2024-03-14  5:41 ` Mika Westerberg
@ 2024-03-14  7:05 ` Tudor Ambarus
  2024-03-14  7:07 ` Miquel Raynal
  2024-03-15 17:13 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Tudor Ambarus @ 2024-03-14  7:05 UTC (permalink / raw)
  To: Florian Fainelli, linux-spi
  Cc: Michael Walle, Pratyush Yadav, Mark Brown, Michael Walle,
	Chia-Lin Kao (AceLan),
	Mika Westerberg, Miquel Raynal, open list

Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>

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

* Re: [PATCH v2] spi: Fix error code checking in spi_mem_exec_op()
  2024-03-13 19:45 [PATCH v2] spi: Fix error code checking in spi_mem_exec_op() Florian Fainelli
  2024-03-14  5:41 ` Mika Westerberg
  2024-03-14  7:05 ` Tudor Ambarus
@ 2024-03-14  7:07 ` Miquel Raynal
  2024-03-15 17:13 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2024-03-14  7:07 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-spi, Michael Walle, Pratyush Yadav, Mark Brown,
	Michael Walle, Chia-Lin Kao (AceLan),
	Mika Westerberg, open list

Hi Florian,

florian.fainelli@broadcom.com wrote on Wed, 13 Mar 2024 12:45:30 -0700:

> After commit cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with
> -EOPNOTSUPP"), our SPI NOR flashes would stop probing with the following
> visible in the kernel log:
> 
> [    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
> [    2.210295] spi-nor: probe of spi1.0 failed with error -95
> 
> It turns out that the check in spi_mem_exec_op() was changed to check
> for -ENOTSUPP (old error code) or -EOPNOTSUPP (new error code), but this
> means that for drivers that were converted, the second condition is now
> true, and we stop falling through like we used to. Fix the error to
> check for neither error being neither -ENOTSUPP *nor* -EOPNOTSUPP.
> 
> Fixes: cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP")
> Reviewed-by: Michael Walle <mwalle@kernel.org>
> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>

Thanks for the fix!

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>


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

* Re: [PATCH v2] spi: Fix error code checking in spi_mem_exec_op()
  2024-03-13 19:45 [PATCH v2] spi: Fix error code checking in spi_mem_exec_op() Florian Fainelli
                   ` (2 preceding siblings ...)
  2024-03-14  7:07 ` Miquel Raynal
@ 2024-03-15 17:13 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2024-03-15 17:13 UTC (permalink / raw)
  To: linux-spi, Florian Fainelli
  Cc: Michael Walle, Pratyush Yadav, Michael Walle,
	Chia-Lin Kao (AceLan),
	Mika Westerberg, Miquel Raynal, linux-kernel

On Wed, 13 Mar 2024 12:45:30 -0700, Florian Fainelli wrote:
> After commit cff49d58f57e ("spi: Unify error codes by replacing -ENOTSUPP with
> -EOPNOTSUPP"), our SPI NOR flashes would stop probing with the following
> visible in the kernel log:
> 
> [    2.196300] brcmstb_qspi f0440920.qspi: using bspi-mspi mode
> [    2.210295] spi-nor: probe of spi1.0 failed with error -95
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: Fix error code checking in spi_mem_exec_op()
      commit: 29895ce18311ddd702973ddb3a6c687db663e0fb

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2024-03-15 17:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 19:45 [PATCH v2] spi: Fix error code checking in spi_mem_exec_op() Florian Fainelli
2024-03-14  5:41 ` Mika Westerberg
2024-03-14  7:05 ` Tudor Ambarus
2024-03-14  7:07 ` Miquel Raynal
2024-03-15 17:13 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).