summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/spi
diff options
context:
space:
mode:
authorEd Spiridonov <edo.rus@gmail.com>2016-06-20 20:40:15 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2016-06-23 11:23:49 +0200
commitb63f69d0fc1fa1e25842a2266633862d523c380f (patch)
tree8e45b802e2283d14d89fdf4dbf3a81f224a54494 /drivers/net/can/spi
parentcan: rcar_canfd: Add back-to-error-active support (diff)
downloadlinux-b63f69d0fc1fa1e25842a2266633862d523c380f.tar.xz
linux-b63f69d0fc1fa1e25842a2266633862d523c380f.zip
can: mcp251x: add message about sucessful/unsuccessful probe
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> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/spi')
-rw-r--r--drivers/net/can/spi/mcp251x.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index cf36d26ef002..f3f05fea8e1f 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;
}