From patchwork Wed Jul 18 11:28:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 1210481 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 1005ADFFFD for ; Wed, 18 Jul 2012 11:28:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1SrSR1-0001Xy-DB; Wed, 18 Jul 2012 11:28:51 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1SrSR0-0001Xi-5F for spi-devel-general@lists.sourceforge.net; Wed, 18 Jul 2012 11:28:50 +0000 X-ACL-Warn: Received: from opensource.wolfsonmicro.com ([80.75.67.52]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1SrSQz-0007qb-9m for spi-devel-general@lists.sourceforge.net; Wed, 18 Jul 2012 11:28:50 +0000 Received: from finisterre.wolfsonmicro.main (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id 881CB1109D2; Wed, 18 Jul 2012 12:28:42 +0100 (BST) Received: from broonie by finisterre.wolfsonmicro.main with local (Exim 4.80) (envelope-from ) id 1SrSQr-0008KV-Td; Wed, 18 Jul 2012 12:28:41 +0100 From: Mark Brown To: Grant Likely , Kukjin Kim Subject: [PATCH 1/4] spi/s3c64xx: Fix handling of errors in gpio_request() Date: Wed, 18 Jul 2012 12:28:38 +0100 Message-Id: <1342610921-31986-1-git-send-email-broonie@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.10.4 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1SrSQz-0007qb-9m Cc: spi-devel-general@lists.sourceforge.net, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Brown X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net 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 --- 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; } }