[PATCH 1/3] spi: tegra210-quad: use device_reset_optional() instead of device_reset()

From: Breno Leitao
Date: Mon Mar 17 2025 - 11:48:23 EST


My UEFI machines with tegra210-quad consistently report "device reset
failed". Investigation showed this isn't an actual failure
- __device_reset() returns -ENOENT because ACPI has no "*_RST" method.

Replace device_reset() with device_reset_optional() to prevent
errors when the reset method doesn't exist. With this change, the
function only fails if the actual device reset operation fails when
called.

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
drivers/spi/spi-tegra210-quad.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index 08e49a8768943..9027f995a6669 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -999,7 +999,7 @@ static void tegra_qspi_handle_error(struct tegra_qspi *tqspi)
dev_err(tqspi->dev, "error in transfer, fifo status 0x%08x\n", tqspi->status_reg);
tegra_qspi_dump_regs(tqspi);
tegra_qspi_flush_fifos(tqspi, true);
- if (device_reset(tqspi->dev) < 0)
+ if (device_reset_optional(tqspi->dev) < 0)
dev_warn_once(tqspi->dev, "device reset failed\n");
}

@@ -1149,7 +1149,7 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
}

/* Reset controller if timeout happens */
- if (device_reset(tqspi->dev) < 0)
+ if (device_reset_optional(tqspi->dev) < 0)
dev_warn_once(tqspi->dev,
"device reset failed\n");
ret = -EIO;
@@ -1606,7 +1606,7 @@ static int tegra_qspi_probe(struct platform_device *pdev)
goto exit_pm_disable;
}

- if (device_reset(tqspi->dev) < 0)
+ if (device_reset_optional(tqspi->dev) < 0)
dev_warn_once(tqspi->dev, "device reset failed\n");

tqspi->def_command1_reg = QSPI_M_S | QSPI_CS_SW_HW | QSPI_CS_SW_VAL;

--
2.47.1