linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] can: mcp251x: add message about sucessful/unsuccessful probe
@ 2016-06-20 18:40 Ed Spiridonov
  2016-06-22 20:38 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Ed Spiridonov @ 2016-06-20 18:40 UTC (permalink / raw)
  To: mkl; +Cc: linux-can, Ed Spiridonov

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


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

end of thread, other threads:[~2016-06-22 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-20 18:40 [PATCH v2] can: mcp251x: add message about sucessful/unsuccessful probe Ed Spiridonov
2016-06-22 20:38 ` Marc Kleine-Budde

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