Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbaLYCDP (ORCPT ); Wed, 24 Dec 2014 21:03:15 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:58590 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751625AbaLYCDN (ORCPT ); Wed, 24 Dec 2014 21:03:13 -0500 Date: Thu, 25 Dec 2014 02:02:56 +0200 From: "Ahmed S. Darwish" To: Olivier Sobrie , Oliver Hartkopp , Wolfgang Grandegger , Marc Kleine-Budde Cc: "David S. Miller" , Paul Gortmaker , Greg KH , Linux-CAN , netdev , LKML Subject: [PATCH v2 3/4] can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels Message-ID: <20141225000256.GB24302@vivalin-002> References: <20141223154654.GB6460@vivalin-002> <20141224235644.GA3778@vivalin-002> <20141224235954.GA24302@vivalin-002> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141224235954.GA24302@vivalin-002> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ahmed S. Darwish "Someone reported me that recent leaf firmwares go in trouble when you send a command for a channel that does not exist. Instead ... you can move the reset command to kvaser_usb_init_one() function." Suggested-by: Olivier Sobrie Signed-off-by: Ahmed S. Darwish --- drivers/net/can/usb/kvaser_usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 598e251..2791501 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -1505,6 +1505,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf, struct kvaser_usb_net_priv *priv; int i, err; + err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); + if (err) + return err; + netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); if (!netdev) { dev_err(&intf->dev, "Cannot alloc candev\n"); @@ -1609,9 +1613,6 @@ static int kvaser_usb_probe(struct usb_interface *intf, usb_set_intfdata(intf, dev); - for (i = 0; i < MAX_NET_DEVICES; i++) - kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i); - err = kvaser_usb_get_software_info(dev); if (err) { dev_err(&intf->dev, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/