Skip to contentSkip to conversation

spi: tegra20-slink: cleanup wait_for_completion return handling

PATCH In review Nicholas Mc Guire 2 participants 2 messages Feb 1, 2015 – Feb 2, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 spi: tegra20-slink: cleanup wait_for_completion return handling

return type of wait_for_completion_timeout is unsigned long not int, this patch adds an appropriate variable and fixes up the assignment. As the string in dev_err already states "timeout" there is little point in printing the 0 here as it just restates "timeout".

---

This patch was only compile tested with tegra_defconfig (implies CONFIG_SPI_TEGRA20_SLINK=y)

Patch is against 3.19.0-rc6 -next-20150130

 drivers/spi/spi-tegra20-slink.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-tegra20-slink.c +4 -4
index 85c91f5..106afe1 100644
@@ -811,6 +811,7 @@ static int tegra_slink_transfer_one(struct spi_master *master,
 {
 	struct tegra_slink_data *tspi = spi_master_get_devdata(master);
 	int ret;
+	unsigned long dma_timeout;
 
 	reinit_completion(&tspi->xfer_completion);
 	ret = tegra_slink_start_transfer_one(spi, xfer);
@@ -820,11 +821,10 @@ static int tegra_slink_transfer_one(struct spi_master *master,
 		return ret;
 	}
 
-	ret = wait_for_completion_timeout(&tspi->xfer_completion,
+	dma_timeout = wait_for_completion_timeout(&tspi->xfer_completion,
 					  SLINK_DMA_TIMEOUT);
-	if (WARN_ON(ret == 0)) {
-		dev_err(tspi->dev,
-			"spi trasfer timeout, err %d\n", ret);
+	if (WARN_ON(dma_timeout == 0)) {
+		dev_err(tspi->dev, "spi trasfer timeout\n");
 		return -EIO;
 	}
 
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Acked-by on v1 2/2
#1 lore raw
Quoted 4 lines · Nicholas Mc Guire

return type of wait_for_completion_timeout is unsigned long not int, this patch adds an appropriate variable and fixes up the assignment. As the string in dev_err already states "timeout" there is little point in printing the 0 here as it just restates "timeout".

Looks good to me. Thanks for fixing this.
I think it is good if we fix the typo here also.

drivers/spi/spi-tegra20-slink.c static int tegra_slink_transfer_one(struct spi_master *master, · line 827

Quoted 5 lines
drivers/spi/spi-tegra20-slink.c +2 -3
-	if (WARN_ON(ret == 0)) {
-		dev_err(tspi->dev,
-			"spi trasfer timeout, err %d\n", ret);
+	if (WARN_ON(dma_timeout == 0)) {
+		dev_err(tspi->dev, "spi trasfer timeout\n");

trasfer->transfer