From: Ed Spiridonov <edo.rus@gmail.com>
To: mkl@pengutronix.de
Cc: linux-can@vger.kernel.org, Ed Spiridonov <edo.rus@gmail.com>
Subject: [PATCH v2] can: mcp251x: add message about sucessful/unsuccessful probe
Date: Mon, 20 Jun 2016 21:40:15 +0300 [thread overview]
Message-ID: <1466448015-20392-1-git-send-email-edo.rus@gmail.com> (raw)
Silent ignorance of errors during probe procedure is a bad thing, this patch fixes it.
Extra message added for hardware initialization failure. Such common issues are mostly caused by wrong wiring.
Message about success added as well, it should be useful to debug new hardware configuration, especially in case of several CAN buses.
Signed-off-by: Ed Spiridonov <edo.rus@gmail.com>
---
drivers/net/can/spi/mcp251x.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index cf36d26..f3f05fe 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -1145,8 +1145,11 @@ static int mcp251x_can_probe(struct spi_device *spi)
/* Here is OK to not lock the MCP, no one knows about it yet */
ret = mcp251x_hw_probe(spi);
- if (ret)
+ if (ret) {
+ if (ret == -ENODEV)
+ dev_err(&spi->dev, "Cannot initialize MCP%x. Wrong wiring?\n", priv->model);
goto error_probe;
+ }
mcp251x_hw_sleep(spi);
@@ -1156,6 +1159,7 @@ static int mcp251x_can_probe(struct spi_device *spi)
devm_can_led_init(net);
+ netdev_info(net, "MCP%x successfully initialized.\n", priv->model);
return 0;
error_probe:
@@ -1168,6 +1172,7 @@ out_clk:
out_free:
free_candev(net);
+ dev_err(&spi->dev, "Probe failed, err=%d\n", -ret);
return ret;
}
--
2.8.1
next reply other threads:[~2016-06-20 18:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 18:40 Ed Spiridonov [this message]
2016-06-22 20:38 ` [PATCH v2] can: mcp251x: add message about sucessful/unsuccessful probe Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466448015-20392-1-git-send-email-edo.rus@gmail.com \
--to=edo.rus@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).