Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA6E4C001E0 for ; Fri, 28 Jul 2023 02:39:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B99386885; Fri, 28 Jul 2023 04:39:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="N9tFsvE1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 50372867D8; Fri, 28 Jul 2023 04:39:09 +0200 (CEST) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CDA2F867E6 for ; Fri, 28 Jul 2023 04:38:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-78666994bc2so66644639f.0 for ; Thu, 27 Jul 2023 19:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690511934; x=1691116734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OtyUq4CQ4Mkvci0zKz8u3z/cizOztWg2fLlISu48gwY=; b=N9tFsvE1J5+gu15QUPNVDNcrG3o8qAtzj89ea9OlND1y1mC3NKFcRUqSx0y+kG3ANf lWugJ1tUjCX4CFU7SlrEog18AA/THcSMSYSBCHwBziFvwGh0ooaKebD+OKnpDXkxKCEc AzfD0dle7lxoOKywTgZAwGm5Kxni1PBGSWPrA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690511934; x=1691116734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OtyUq4CQ4Mkvci0zKz8u3z/cizOztWg2fLlISu48gwY=; b=K7tGOknEUUKBOvSPYmssvU23v7k6y5pFjKpBl4i5WILVQTFfCd/as0+I0AddPIdB5L R4cYiHaGPWzb8f5GyagGkcsF8ZG0eg4hfHMviZFXdPWf/YY/1YlI2hqNOEj4eumUUC8u vkW+VN7/jFVAilLQ2DH5sEQLZ0S0L/A7hdkTuBWzEsidDQmW4cwKA6mQFyXB06QZNV4B iidVCL354SDxCDZRVpCsPBy/3IgygdEghxjFTVZvOoJV5jnsqxvRIAZ0afzNkdvMuDMp Z5fsGFOzy4ZaO2kVhY84F+zP8gYsVOnrLpOj9jPdtjsnTNT83xpZzOXdPfj20s1rEf+M v0Zg== X-Gm-Message-State: ABy/qLZaYszVWUDHby+Fqu972dLBG0SdBZX1o9gxChkU3Rkx88kRUn86 WN4I0hOGOfLrjFhUs2DmyXfk9KlVJ6tVfeLsktk= X-Google-Smtp-Source: APBJJlGLJWwJFfRdKqzFUiD9yf/UyFxRv3p585HGUtucRaS+qySTwrR63TLTiozKFMwhG4o791Ul5A== X-Received: by 2002:a5d:94d0:0:b0:786:71d0:ff9b with SMTP id y16-20020a5d94d0000000b0078671d0ff9bmr1556387ior.10.1690511934413; Thu, 27 Jul 2023 19:38:54 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id g18-20020a0566380c5200b0042acf389acesm799266jal.71.2023.07.27.19.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 19:38:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Simon Glass , Fabrice Gasnier , Marek Vasut , Patrice Chotard , Patrick Delaunay Subject: [PATCH 1/8] usb: Return -ENOENT when no devices are found Date: Thu, 27 Jul 2023 20:37:44 -0600 Message-ID: <20230728023755.680278-2-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230728023755.680278-1-sjg@chromium.org> References: <20230728023755.680278-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When USB finds no devices it currently returns -EPERM which bootstd does not understand. This causes other bootdevs of the same priority to be skipped. Fix this by returning the correct error code. Signed-off-by: Simon Glass --- drivers/usb/host/usb-uclass.c | 2 +- include/usb.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c index 02c0138a2065..7a03435ba773 100644 --- a/drivers/usb/host/usb-uclass.c +++ b/drivers/usb/host/usb-uclass.c @@ -346,7 +346,7 @@ int usb_init(void) if (controllers_initialized == 0) printf("No working controllers found\n"); - return usb_started ? 0 : -1; + return usb_started ? 0 : -ENOENT; } int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp) diff --git a/include/usb.h b/include/usb.h index 42b001c3dd5e..09e3f0cb309c 100644 --- a/include/usb.h +++ b/include/usb.h @@ -257,7 +257,14 @@ int usb_kbd_deregister(int force); #endif /* routines */ -int usb_init(void); /* initialize the USB Controller */ + +/* + * usb_init() - initialize the USB Controllers + * + * Returns: 0 if OK, -ENOENT if there are no USB devices + */ +int usb_init(void); + int usb_stop(void); /* stop the USB Controller */ int usb_detect_change(void); /* detect if a USB device has been (un)plugged */ -- 2.41.0.487.g6d72f3e995-goog