From patchwork Sat Apr 2 18:46:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 605451 X-Patchwork-Delegate: hdegoede@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qcnKN1wQcz9sCj for ; Sun, 3 Apr 2016 04:46:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0360DA7620; Sat, 2 Apr 2016 20:46:43 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6-x9Cy-70HJP; Sat, 2 Apr 2016 20:46:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B5440A7624; Sat, 2 Apr 2016 20:46:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A238AA75FB for ; Sat, 2 Apr 2016 20:46:29 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AxBHZPXA5lAn for ; Sat, 2 Apr 2016 20:46:29 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id C7143A75FA for ; Sat, 2 Apr 2016 20:46:27 +0200 (CEST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8667C049E15; Sat, 2 Apr 2016 18:46:25 +0000 (UTC) Received: from localhost.localdomain.com (vpn1-6-73.ams2.redhat.com [10.36.6.73]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u32IkFWj019789; Sat, 2 Apr 2016 14:46:23 -0400 From: Hans de Goede To: Ian Campbell , Simon Glass , Marek Vasut Date: Sat, 2 Apr 2016 20:46:11 +0200 Message-Id: <1459622771-12704-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1459622771-12704-1-git-send-email-hdegoede@redhat.com> References: <1459622771-12704-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/3] dm: usb: Do not reprobe usb hosts on "usb tree" command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" Some usb hosts may have failed to probe on "usb start", i.e. an otg host without an otg-host cable plugged in. "usb tree" would cause the probe method of these hosts to get called again, something which should only happen on "usb reset". This commit fixes this. Signed-off-by: Hans de Goede --- cmd/usb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/usb.c b/cmd/usb.c index 9ed5dc6..8741088 100644 --- a/cmd/usb.c +++ b/cmd/usb.c @@ -442,12 +442,15 @@ void usb_show_tree(void) #ifdef CONFIG_DM_USB struct udevice *bus; - for (uclass_first_device(UCLASS_USB, &bus); + for (uclass_find_first_device(UCLASS_USB, &bus); bus; - uclass_next_device(&bus)) { + uclass_find_next_device(&bus)) { struct usb_device *udev; struct udevice *dev; + if (!device_active(bus)) + continue; + device_find_first_child(bus, &dev); if (dev && device_active(dev)) { udev = dev_get_parent_priv(dev);