* [PATCH 0/2] can: kvaser_usb: Small fixes
@ 2017-10-24 10:23 Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 1/2] can: kvaser_usb: Correct return value in printout Jimmy Assarsson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jimmy Assarsson @ 2017-10-24 10:23 UTC (permalink / raw)
To: linux-can; +Cc: Jimmy Assarsson
Fix two issues in the kvaser_usb driver.
Jimmy Assarsson (2):
can: kvaser_usb: Correct return value in printout
can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages
drivers/net/can/usb/kvaser_usb.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.14.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] can: kvaser_usb: Correct return value in printout
2017-10-24 10:23 [PATCH 0/2] can: kvaser_usb: Small fixes Jimmy Assarsson
@ 2017-10-24 10:23 ` Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 2/2] can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages Jimmy Assarsson
2017-10-24 11:03 ` [PATCH 0/2] can: kvaser_usb: Small fixes Marc Kleine-Budde
2 siblings, 0 replies; 4+ messages in thread
From: Jimmy Assarsson @ 2017-10-24 10:23 UTC (permalink / raw)
To: linux-can; +Cc: Jimmy Assarsson
If the return value from kvaser_usb_send_simple_msg() was non-zero, the
return value from kvaser_usb_flush_queue() was printed in the kernel
warning.
Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
---
| 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 18cc529fb807..861e90efab86 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1609,7 +1609,8 @@ static int kvaser_usb_close(struct net_device *netdev)
if (err)
netdev_warn(netdev, "Cannot flush queue, error %d\n", err);
- if (kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel))
+ err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel);
+ if (err)
netdev_warn(netdev, "Cannot reset card, error %d\n", err);
err = kvaser_usb_stop_chip(priv);
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages
2017-10-24 10:23 [PATCH 0/2] can: kvaser_usb: Small fixes Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 1/2] can: kvaser_usb: Correct return value in printout Jimmy Assarsson
@ 2017-10-24 10:23 ` Jimmy Assarsson
2017-10-24 11:03 ` [PATCH 0/2] can: kvaser_usb: Small fixes Marc Kleine-Budde
2 siblings, 0 replies; 4+ messages in thread
From: Jimmy Assarsson @ 2017-10-24 10:23 UTC (permalink / raw)
To: linux-can; +Cc: Jimmy Assarsson
To avoid kernel warning "Unhandled message (68)", ignore the
CMD_FLUSH_QUEUE_REPLY message for now.
As of Leaf v2 firmware version v4.1.844 (2017-02-15), flush tx queue is
synchronous. There is a capability bit indicating whether flushing tx queue
is synchronous or asynchronous.
A proper solution would be to query the device for capabilities. If the
synchronous tx flush capability bit is set, we should wait for
CMD_FLUSH_QUEUE_REPLY message, while flushing the tx queue.
Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
---
| 6 ++++++
1 file changed, 6 insertions(+)
--git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 861e90efab86..9b18d96ef526 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -137,6 +137,7 @@ static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
#define CMD_RESET_ERROR_COUNTER 49
#define CMD_TX_ACKNOWLEDGE 50
#define CMD_CAN_ERROR_EVENT 51
+#define CMD_FLUSH_QUEUE_REPLY 68
#define CMD_LEAF_USB_THROTTLE 77
#define CMD_LEAF_LOG_MESSAGE 106
@@ -1301,6 +1302,11 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev,
goto warn;
break;
+ case CMD_FLUSH_QUEUE_REPLY:
+ if (dev->family != KVASER_LEAF)
+ goto warn;
+ break;
+
default:
warn: dev_warn(dev->udev->dev.parent,
"Unhandled message (%d)\n", msg->id);
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] can: kvaser_usb: Small fixes
2017-10-24 10:23 [PATCH 0/2] can: kvaser_usb: Small fixes Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 1/2] can: kvaser_usb: Correct return value in printout Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 2/2] can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages Jimmy Assarsson
@ 2017-10-24 11:03 ` Marc Kleine-Budde
2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-10-24 11:03 UTC (permalink / raw)
To: Jimmy Assarsson, linux-can
[-- Attachment #1.1: Type: text/plain, Size: 673 bytes --]
On 10/24/2017 12:23 PM, Jimmy Assarsson wrote:
> Fix two issues in the kvaser_usb driver.
>
> Jimmy Assarsson (2):
> can: kvaser_usb: Correct return value in printout
> can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages
>
> drivers/net/can/usb/kvaser_usb.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Both applied to can and added stable on Cc.
Marc
--
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-24 11:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-24 10:23 [PATCH 0/2] can: kvaser_usb: Small fixes Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 1/2] can: kvaser_usb: Correct return value in printout Jimmy Assarsson
2017-10-24 10:23 ` [PATCH 2/2] can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages Jimmy Assarsson
2017-10-24 11:03 ` [PATCH 0/2] can: kvaser_usb: Small fixes 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).