can: kvaser_usb: Retry the first bulk transfer on -ETIMEDOUT
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> Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
committed by
Marc Kleine-Budde
parent
3803fa6977
commit
14c10c2a1d
@@ -1585,7 +1585,7 @@ static int kvaser_usb_probe(struct usb_interface *intf,
|
|||||||
{
|
{
|
||||||
struct kvaser_usb *dev;
|
struct kvaser_usb *dev;
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
int i;
|
int i, retry = 3;
|
||||||
|
|
||||||
dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL);
|
dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
@@ -1603,7 +1603,15 @@ static int kvaser_usb_probe(struct usb_interface *intf,
|
|||||||
|
|
||||||
usb_set_intfdata(intf, dev);
|
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) {
|
if (err) {
|
||||||
dev_err(&intf->dev,
|
dev_err(&intf->dev,
|
||||||
"Cannot get software infos, error %d\n", err);
|
"Cannot get software infos, error %d\n", err);
|
||||||
|
Reference in New Issue
Block a user