From patchwork Tue Sep 19 03:05:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suneel Garapati X-Patchwork-Id: 815263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RAGCclb8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xx76H44q4z9rxm for ; Tue, 19 Sep 2017 13:05:27 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1AF99C21DD9; Tue, 19 Sep 2017 03:05:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 98E96C21C3F; Tue, 19 Sep 2017 03:05:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A5F30C21C3F; Tue, 19 Sep 2017 03:05:18 +0000 (UTC) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by lists.denx.de (Postfix) with ESMTPS id 0DE3AC21C34 for ; Tue, 19 Sep 2017 03:05:18 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id f84so945570pfj.3 for ; Mon, 18 Sep 2017 20:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=wW8Xo12xcQ6EAhR9YndtygSZk1Qz4aK7ZfziFT+duLk=; b=RAGCclb8qLuTeQjxmlZywl9slmgsgZn2I/ITj8EqNxUb2Gp7bVPX8QqtIJmIwHyKzO v1ZPuBsfmuM6bxDVV+K76vc9DWH3MnILO/YbHqDTHkFzKZ64hUquQ0oJEwx2jT/sQkV9 YJ64WYa1XhteXKub2k+6r3PrXnld5mPUm7fmpUNABXiN59hFVmRTGLjoFHxpv6pC2jES PDHNitq/2X/xb/6a2x7kR/T1+chhESrNMarS5tsU+3U2s7mOpv8bWxgFvBqbSmzsGd1q +vZT8M8CNhj6fWPVTUZGsxX4vRve++a6vKdQ6HNiIAms2UEXbC0oEqPg4xn1dvktAh1n CI0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wW8Xo12xcQ6EAhR9YndtygSZk1Qz4aK7ZfziFT+duLk=; b=Mx+zoduww4CVWgMhMBs5DvNF9H9pMNFGXI/jmzAsykfl7JiURQg4DQGAhAv+hfuXF3 jWWKdKwwvl1KI4vAfl6pfUMpsa0c1RXVok27Wq5plBnhaDK8z+Q7/1cPvCFBi/XPa5xf oGCP2+jZN5NucyoWDMwIxFAcJ4se4707bQTQTCjr7taVOaw2Qrbo5aLt9xkgEdRY356v KKOo+JQjlrTpDfh+/eVYoTzHI8NBycxz8eIDOmS9PCBZG3knPS0m/WmXgf3omaiS44zm caXD5O9PqEzTusbn0wwljHzQ6SHRS1RezkRNF2mxiEu8ZKdA5VOEpAIQiAMAJ3FoREX7 IdAg== X-Gm-Message-State: AHPjjUh/55FtYvdxr0sunm50LWQiWLCRhj4aTWaLucLW5uS+SgCxrJ2F EHmlqdOnKS8QVA== X-Google-Smtp-Source: AOwi7QBhbR8OK9ZZXatHWO9i+EwH76Uxt9ntyYwT3ctMs2NpdXyc2nLnAF6GpwWQcjgo2H7i95FAXA== X-Received: by 10.101.89.11 with SMTP id f11mr628294pgu.393.1505790316775; Mon, 18 Sep 2017 20:05:16 -0700 (PDT) Received: from suneel.hsd1.ca.comcast.net ([2601:646:8e00:e521:9471:9261:7a36:b20e]) by smtp.gmail.com with ESMTPSA id z24sm975204pfk.3.2017.09.18.20.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 20:05:16 -0700 (PDT) From: Suneel Garapati To: Stefan Roese Date: Mon, 18 Sep 2017 20:05:10 -0700 Message-Id: <1505790310-31106-1-git-send-email-suneelglinux@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: u-boot@lists.denx.de, Michal Simek Subject: [U-Boot] [PATCH v2] cmd: usb: add blk devices to ignore list in tree graph X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" add blk child devices to ignore list while displaying usb tree graph, otherwise usb tree and info commands may cause crash treating blk as usb device. Signed-off-by: Suneel Garapati Tested-by: Stefan Roese --- Changes v2: - remove check on parent uclass Changes v1: - add separate check on blk uclass - modify description - add separate check on parent uclass as usb cmd/usb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/usb.c b/cmd/usb.c index d95bcf5..eb31353 100644 --- a/cmd/usb.c +++ b/cmd/usb.c @@ -414,8 +414,12 @@ static void usb_show_tree_graph(struct usb_device *dev, char *pre) udev = dev_get_parent_priv(child); - /* Ignore emulators, we only want real devices */ - if (device_get_uclass_id(child) != UCLASS_USB_EMUL) { + /* + * Ignore emulators and block child devices, with check on + * parent uclass as usb, we only want real devices + */ + if ((device_get_uclass_id(child) != UCLASS_USB_EMUL) && + (device_get_uclass_id(child) != UCLASS_BLK)) { usb_show_tree_graph(udev, pre); pre[index] = 0; } @@ -605,7 +609,8 @@ static void usb_show_info(struct usb_device *udev) for (device_find_first_child(udev->dev, &child); child; device_find_next_child(&child)) { - if (device_active(child)) { + if (device_active(child) && + (device_get_uclass_id(child) != UCLASS_BLK)) { udev = dev_get_parent_priv(child); usb_show_info(udev); }