Skip to content

Commit

Permalink
can: kvaser_usb: Retry the first bulk transfer on -ETIMEDOUT
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: linux-stable <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
Ahmed S. Darwish authored and marckleinebudde committed Jan 27, 2015
1 parent 3803fa6 commit 14c10c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/net/can/usb/kvaser_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,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)
Expand All @@ -1603,7 +1603,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);
Expand Down

0 comments on commit 14c10c2

Please sign in to comment.