can: mcp251x: add some messages to mcp251x_can_probe()
PATCH 1/1 can: mcp251x: add some messages to mcp251x_can_probe()
Print error message if mcp251x_hw_probe() fails (e.g. MCP2515 isn't connected or other wiring issue). Print information message if mcp251x_can_probe() is successful.
--- drivers/net/can/spi/mcp251x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/can/spi/mcp251x.c +5 -1
@@ -1145,8 +1145,10 @@ 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) { +dev_err (&spi->dev,"hw_probe failed, err=%d (wrong wiring?)\n" , -ret); goto error_probe; + }mcp251x_hw_sleep (spi);
@@ -1156,6 +1158,8 @@ static int mcp251x_can_probe(struct spi_device *spi)devm_can_led_init (net); +netdev_info (net,"successfully initialized.\n" ); +return 0 ; error_probe:
Signature · 1 line
2.7.0
Marc Kleine-Budde
maintainerQuoted 2 lines · Ed Spiridonov
Print error message if
mcp251x_hw_probe()fails (e.g. MCP2515 isn't connected or other wiring issue). Print information message ifmcp251x_can_probe()is successful.
Can I add your S-o-b to the patch?
Quoted 21 lines
--- drivers/net/can/spi/mcp251x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/net/can/spi/mcp251x.c +3
-1@@ -1145,8 +1145,10 @@ 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) { +dev_err (&spi->dev,"hw_probe failed, err=%d (wrong wiring?)\n" , -ret); goto error_probe; + }mcp251x_hw_sleep (spi);
drivers/net/can/spi/mcp251x.c static int mcp251x_can_probe(struct spi_device *spi) · line 1161
Quoted 4 lines
drivers/net/can/spi/mcp251x.c +1
-0@@ -1156,6 +1158,8 @@ static int mcp251x_can_probe(struct spi_device *spi)devm_can_led_init (net); +netdev_info (net,"successfully initialized.\n" );
I'll remove this hunk, as we try to make the CAN devices as silent as possible in case of no errors.
drivers/net/can/spi/mcp251x.c static int mcp251x_can_probe(struct spi_device *spi) · line 1165
Quoted 5 lines
drivers/net/can/spi/mcp251x.c +1
-0+return 0 ; error_probe:
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
17.06.2016 12:22 пользователь "Marc Kleine-Budde" <[email protected]> написал:
Quoted 9 lines
drivers/net/can/spi/mcp251x.c static int mcp251x_can_probe(struct spi_device *spi) · line 1161
Quoted 6 lines
drivers/net/can/spi/mcp251x.c +1
-0@@ -1156,6 +1158,8 @@ static int mcp251x_can_probe(struct spi_device *spi)devm_can_led_init (net); +netdev_info (net,"successfully initialized.\n" );I'll remove this hunk, as we try to make the CAN devices as silent as possible in case of no errors.
Why it is so important to be totally silent? IMHO one line per CAN bus isn't too much.
But it could help to debug new configuration, e.g. to find wrong device tree configuration, especially with several CAN buses.
I made this patch because a lot of complains on Raspberry PI forum. Current module does not produce any message if module initializes MCP2510/2515 chip successfully or not. It could be confusing.
Hello Marc,
Quoted 10 lines · Ed Spiridonov
17.06.2016 12:22 пользователь "Marc Kleine-Budde" <[email protected]> написал:
Quoted 9 lines
drivers/net/can/spi/mcp251x.c static int mcp251x_can_probe(struct spi_device *spi) · line 1161
Quoted 6 lines
drivers/net/can/spi/mcp251x.c +1
-0@@ -1156,6 +1158,8 @@ static int mcp251x_can_probe(struct spi_device *spi)devm_can_led_init (net); +netdev_info (net,"successfully initialized.\n" );I'll remove this hunk, as we try to make the CAN devices as silent as possible in case of no errors.
I agree with Ed in this special case.
In opposite to CAN interfaces that reside on local busses or inside of SoCs the mcp251x is attached indirectly via SPI. This adds additional options to fail at initialization time.
As USB interfaces also tell about the USB plug-in and about their successful netdev initialization - the SPI based interfaces should be able to do it similarly.
Even the mcp251x stuff is not a very high performance CAN interface implementation many RasPi users do their first steps with SocketCAN using this tricky hardware setup.
That's why I vote for more information at initialization time too.
Regards,
Oliver
Quoted 15 lines
Why it is so important to be totally silent? IMHO one line per CAN bus isn't too much.
But it could help to debug new configuration, e.g. to find wrong device tree configuration, especially with several CAN buses.I made this patch because a lot of complains on Raspberry PI forum. Current module does not produce any message if module initializes MCP2510/2515 chip successfully or not. It could be confusing. --
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CACm0Nn320ry07YOuorrMO=u8Q4+JsOd9i3s7eFAwQ-L8AWGm=Q@mail.gmail.com
Marc Kleine-Budde
maintainerQuoted 14 lines · Ed Spiridonov
17.06.2016 12:22 пользователь "Marc Kleine-Budde" <[email protected] <mailto:[email protected]>> написал:
Review static int mcp251x_can_probe(struct
Quoted 1 line
(quoted diff) +0
-0@@ -1156,6 +1158,8 @@ static int mcp251x_can_probe(structspi_device *spi) > > devm_can_led_init(net); > > + netdev_info(net, "successfully initialized.\n"); I'll remove this hunk, as we try to make the CAN devices as silent as possible in case of no errors.
Quoted 8 lines
Why it is so important to be totally silent? IMHO one line per CAN bus isn't too much.
But it could help to debug new configuration, e.g. to find wrong device tree configuration, especially with several CAN buses.I made this patch because a lot of complains on Raspberry PI forum. Current module does not produce any message if module initializes MCP2510/2515 chip successfully or not. It could be confusing.
ok, can I have your S-o-b [1]?
Marc
[1]
http://lxr.free-electrons.com/source/Documentation/SubmittingPatches#L409
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
2016-06-20 11:47 GMT+03:00 Marc Kleine-Budde <[email protected]>:
Quoted 1 line
ok, can I have your S-o-b [1]?
I submitted new version of this patch.
I'm unsure if my english is good enough, you are welcome to fix it if you see fit..