Message ID | 20150120214834.GD16828@linux |
---|---|
State | Awaiting Upstream, archived |
Delegated to: | David Miller |
Headers | show |
Hello. On 1/21/2015 12:48 AM, Ahmed S. Darwish wrote: > From: Ahmed S. Darwish <ahmed.darwish@valeo.com> > 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 > completly exiting the driver init code. Completely. > Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com> > --- > drivers/net/can/usb/kvaser_usb.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c > index 640b0eb..068e76c 100644 > --- a/drivers/net/can/usb/kvaser_usb.c > +++ b/drivers/net/can/usb/kvaser_usb.c [...] > @@ -1632,7 +1632,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 completly exiting the driver. Completely. [...] WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jan 21, 2015 at 03:24:46PM +0300, Sergei Shtylyov wrote: > Hello. > > On 1/21/2015 12:48 AM, Ahmed S. Darwish wrote: > > >From: Ahmed S. Darwish <ahmed.darwish@valeo.com> > > >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 > >completly exiting the driver init code. > > Completely. > > >Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com> > >--- > > drivers/net/can/usb/kvaser_usb.c | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > >diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c > >index 640b0eb..068e76c 100644 > >--- a/drivers/net/can/usb/kvaser_usb.c > >+++ b/drivers/net/can/usb/kvaser_usb.c > [...] > >@@ -1632,7 +1632,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 completly exiting the driver. > > Completely. > Thanks, both fixed in the next submission :-D Regards, Darwish -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 640b0eb..068e76c 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -1614,7 +1614,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) @@ -1632,7 +1632,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 completly 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);