From patchwork Thu Dec 25 00:02:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ahmed S. Darwish" X-Patchwork-Id: 424029 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0130A14007D for ; Thu, 25 Dec 2014 13:03:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752097AbaLYCDO (ORCPT ); Wed, 24 Dec 2014 21:03:14 -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 Received: by mail-wi0-f172.google.com with SMTP id n3so14706836wiv.5; Wed, 24 Dec 2014 18:03:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=quWnLF3YIgq4Mtdko2y0eFH1uLGOWHTm41ysZYNprJA=; b=wgHGy+Mz4WzGm8MHvy1x0E9+24cTLfjiq7GIoRXlXbZ21ut1rB1ga1jmZhzq7U+vmd abRlSwrWEmqgkRoKe3FtHiW9P/PW1Gm6SF9uRG7uu0i8uAPKtv9CR6xV+rC8HoP9OW9e dxrpcOFFRueClxS875XWT9Usp6Ch2R6WdTLQ8mbHE2t9Vla1qnIwc3HoA6WaFP2MTTQK +P1iCzhZSpyfHbUGgtb0EV793kWpX3vq1D+8QWdMTS4f2iGdsTBmUGC0P8tIxQKg/PHf cK29/3HtNeWVeh47JENCDeC1wHK10Wbal4IPa+63NhzPJwsald88d3XciaDStMT2PcYs QvPw== X-Received: by 10.180.205.177 with SMTP id lh17mr55353394wic.75.1419472991797; Wed, 24 Dec 2014 18:03:11 -0800 (PST) Received: from vivalin-002 ([197.135.45.116]) by mx.google.com with ESMTPSA id e18sm33526676wjz.27.2014.12.24.18.03.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 24 Dec 2014 18:03:11 -0800 (PST) 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-Disposition: inline In-Reply-To: <20141224235954.GA24302@vivalin-002> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 Reported-by: Christopher Storah Signed-off-by: Olivier Sobrie --- drivers/net/can/usb/kvaser_usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 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 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,