diff options
author | Ahmed S. Darwish <ahmed.darwish@valeo.com> | 2015-01-26 07:24:06 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-05 22:35:36 -0800 |
commit | 7d5c90471fd3b7f51877665c2ba9987acd64b100 (patch) | |
tree | 9487aeccc72b540cdf74975d8fb1e572281d6c83 | |
parent | 1098d7d7c95106e8bdca6265a9297294c7441cdc (diff) | |
download | lwn-7d5c90471fd3b7f51877665c2ba9987acd64b100.tar.gz lwn-7d5c90471fd3b7f51877665c2ba9987acd64b100.zip |
can: kvaser_usb: Retry the first bulk transfer on -ETIMEDOUT
commit 14c10c2a1dd8eb8e00b750b521753260befa2789 upstream.
On some x86 laptops, plugging a Kvaser device again after an
unplug makes the firmware always ignore the very first command.
For such a case, provide some room for retries instead of
completely exiting the driver init code.
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/net/can/usb/kvaser_usb.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index b91f58efec93..5ea0de87514b 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -1578,7 +1578,7 @@ static int kvaser_usb_probe(struct usb_interface *intf, { struct kvaser_usb *dev; int err = -ENOMEM; - int i; + int i, retry = 3; dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL); if (!dev) @@ -1596,7 +1596,15 @@ static int kvaser_usb_probe(struct usb_interface *intf, usb_set_intfdata(intf, dev); - err = kvaser_usb_get_software_info(dev); + /* On some x86 laptops, plugging a Kvaser device again after + * an unplug makes the firmware always ignore the very first + * command. For such a case, provide some room for retries + * instead of completely exiting the driver. + */ + do { + err = kvaser_usb_get_software_info(dev); + } while (--retry && err == -ETIMEDOUT); + if (err) { dev_err(&intf->dev, "Cannot get software infos, error %d\n", err); |