linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] spi/s3c64xx: Fix handling of errors in gpio_request()
@ 2012-07-18 11:28 Mark Brown
  2012-07-18 11:28 ` [PATCH 2/4] spi/s3c64xx: Put the /CS GPIO into output mode Mark Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mark Brown @ 2012-07-18 11:28 UTC (permalink / raw)
  To: Grant Likely, Kukjin Kim
  Cc: linux-arm-kernel, linux-samsung-soc, spi-devel-general, Mark Brown

When gpio_request() fails the driver logged the failure but while it'd
try to print an error code in the non-DT case it didn't pass the error
code in so garbage would be logged and in the DT case the error wasn't
logged.

Further, in the non-DT case the error code was then overwritten with -EBUSY
depriving the caller of information and breaking automatic probe deferral
pushing back from the GPIO level.  Also reformat the non-DT log message
so it's not word wrapped and we can grep for it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/spi/spi-s3c64xx.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 999154a0..7258b18 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -894,9 +894,9 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 	if (!spi_get_ctldata(spi)) {
 		err = gpio_request(cs->line, dev_name(&spi->dev));
 		if (err) {
-			dev_err(&spi->dev, "request for slave select gpio "
-					"line [%d] failed\n", cs->line);
-			err = -EBUSY;
+			dev_err(&spi->dev,
+				"Failed to get /CS gpio [%d]: %d\n",
+				cs->line, err);
 			goto err_gpio_req;
 		}
 		spi_set_ctldata(spi, cs);
@@ -1114,7 +1114,8 @@ static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd)
 
 		ret = gpio_request(gpio, "spi-bus");
 		if (ret) {
-			dev_err(dev, "gpio [%d] request failed\n", gpio);
+			dev_err(dev, "gpio [%d] request failed: %d\n",
+				gpio, ret);
 			goto free_gpio;
 		}
 	}
-- 
1.7.10.4

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

end of thread, other threads:[~2012-07-19  6:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18 11:28 [PATCH 1/4] spi/s3c64xx: Fix handling of errors in gpio_request() Mark Brown
2012-07-18 11:28 ` [PATCH 2/4] spi/s3c64xx: Put the /CS GPIO into output mode Mark Brown
2012-07-18 11:28 ` [PATCH 3/4] spi/s3c64xx: Convert to devm_request_and_ioremap() Mark Brown
2012-07-18 11:28 ` [PATCH 4/4] spi/s3c64xx: Expand S3C64XX_SPI_{DE,}ACT macros at call sites Mark Brown
2012-07-19  6:46 ` [PATCH 1/4] spi/s3c64xx: Fix handling of errors in gpio_request() Kukjin Kim

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).