From mboxrd@z Thu Jan 1 00:00:00 1970 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 CBDE1C433FE for ; Thu, 29 Sep 2022 11:39:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D4F884D80; Thu, 29 Sep 2022 13:38: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="bZOb1rZy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5E2B84CD7; Thu, 29 Sep 2022 12:01:20 +0200 (CEST) Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) (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 9DBC784CA9 for ; Thu, 29 Sep 2022 12:01:14 +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@google.com Received: by mail-oi1-x22d.google.com with SMTP id m81so1100864oia.1 for ; Thu, 29 Sep 2022 03:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=wfL8EkXN2Obld+a1ZchtD6jaTDC3WwRJ+IoEhhkIfmg=; b=bZOb1rZyvuCUXY6+0GPr77XylSP3cr+Rqoe2k7x9/UA9fEcwgJRdNaxRZESYe1MgU+ 2hiZvhh2nL8reCdOGHibTseFXa04+xFL7cRVkxv1a1H1NI//yy4PENV3BY69GnU1LmOq bjUqIB+4ch7iDqz7dosFrkM19PrKXE6IysHC8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=wfL8EkXN2Obld+a1ZchtD6jaTDC3WwRJ+IoEhhkIfmg=; b=j0jqZDgflFM0zr3TTAMd77jChTAeRlc6pKQxE27+fUgHC+6vIF9KI7iGtXDaQNcqbw USyWn5MiLGUqyIIoAEOR8RwqcHzgV3yT66DlHIXKSh1vngpnEdxqx8rUoB9V5KSz532M TMSlZzjIMnrTgAIWJpzYEpRxF1hXlTLC02sY8Sn2vEyBii6GPCDeTjXYfuuo9cq6+8dq rKb4I23QMUN2Mm+C1W9AbJ1WL+CaYV7OZHVODKeG4Fy87ozY8gVwyJsRbBAOTL0RL7JW adtVjpfUyQdpGKSXqvXhiaM/eCNqhoHzwtvyLbqqNJF+U8UZzj4J/Em8C40XOBhNInD7 FnWg== X-Gm-Message-State: ACrzQf3MVirVXVoG6ZWN1wB1mGgZ/EgDAY7nRZlphxCSHqnif+g/Xxbb 2XCdidePJTwQgubtX3SqXrWPpwsGjAMncPg9EAOKXA== X-Google-Smtp-Source: AMsMyM4EyYWUzy6KAu12Xgyx0vQNBkP0r0MMwze71HTwka+ax0SlH5no032m+tFePKWFijdKuoQFbHNY/rPuzDLHwbI= X-Received: by 2002:a05:6808:d53:b0:351:1cab:9c29 with SMTP id w19-20020a0568080d5300b003511cab9c29mr1151333oik.64.1664445672921; Thu, 29 Sep 2022 03:01:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Simon Glass Date: Thu, 29 Sep 2022 04:00:55 -0600 Message-ID: Subject: Re: [PATCH v5 00/15] Do not stop uclass iteration on error To: Michal Suchanek Cc: U-Boot Mailing List , Sean Anderson , Stefan Roese , Vabhav Sharma , Bin Meng , Ovidiu Panait , Michal Simek , Heinrich Schuchardt , Andrew Scull , Vladimir Oltean , =?UTF-8?Q?Pali_Roh=C3=A1r?= , =?UTF-8?Q?Pierre=2DCl=C3=A9ment_Tosi?= , Lukasz Majewski , Marek Vasut , Jason Liu , Loic Poulain , Anatolij Gustschin , Heiko Schocher , Maxime Ripard , Eugen Hristev , Samuel Dionne-Riel , Vyacheslav Bocharov , Diego Rondini , Peng Fan , Jaehoon Chung , Matthias Brugger , Liviu Dudau , Patrick Delaunay , Patrice Chotard , Ilias Apalodimas , Joe Hershberger , Ramon Fried , Sean Anderson , Mark Kettenis , Peter Robinson , Tom Warren , "moderated list:ARM STM STM32MP" , AKASHI Takahiro , Alexander Dahl , Samuel Holland , Eddie James , Andrew Jeffery , Tomas Hlavacek , =?UTF-8?B?VmlrdG9yIEvFmWl2w6Fr?= , Pavel Herrmann Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Thu, 29 Sep 2022 13:38:11 +0200 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Michal, On Tue, 27 Sept 2022 at 15:38, Michal Suchanek wrote: > > Hello, > > this patch series fixes the simple uclass iterators to be usable for > iterating uclasses even if some devices fail to probe. > > Before this series when a probe error happens an error is returned > without any device pointer, and iteration cannot continue to devices > that happen to be after the failing device in the uclass list. > > This is rarely expected, nor clearly documented, and for the most part > not useful in any way. > > All but the last patch are new in v4 removing problematic iterator use. Thank you for taking this on. It has been bugging me for about 6 years. It is not an easy task and you have dug in and carefully looked at each situation and how to fix it. Regards, Simon > > v5: > > Split off patches that can be applied independently > > Fix uclass_foreach_dev_probe, pci_sriov_init, and sysinfo_get to work > after the uclass_first_device_err change. > > Document that uclass_first_device_err and uclass_first_device_check can > return non-activated device on error. > > Consolidate multiple similar cleanups into one patch. > > Thanks > > Michal > > Michal Suchanek (15): > dm: core: Fix uclass_probe_all to really probe all devices > dm: treewide: Do not opencode uclass_probe_all() > dm: pci: Fix device PCI iteration > bootstd: Fix listing boot devices > usb: ether: Fix error handling in usb_ether_init > stdio: Fix class iteration in stdio_add_devices() > video: ipuv3: Fix error handling when getting the display > w1: Fix bus counting in w1_get_bus > cmd: List all uclass devices regardless of probe error > dm: treewide: Use uclass_first_device_err when accessing one device > dm: treewide: Use uclass_next_device_err when accessing second device > dm: blk: Do not use uclass_next_device_err > dm: core: Switch uclass_*_device_err to use uclass_*_device_check > dm: treewide: Do not use the return value of simple uclass iterator > dm: core: Do not stop uclass iteration on error > > arch/arm/mach-k3/j721s2_init.c | 2 +- > arch/arm/mach-omap2/am33xx/board.c | 4 +- > arch/x86/cpu/broadwell/cpu.c | 4 +- > arch/x86/cpu/intel_common/cpu.c | 4 +- > arch/x86/lib/pinctrl_ich6.c | 4 +- > board/atmel/common/mac_eeprom.c | 2 +- > board/intel/cougarcanyon2/cougarcanyon2.c | 4 +- > boot/bootdev-uclass.c | 7 +-- > cmd/adc.c | 22 ++++----- > cmd/demo.c | 16 ++++--- > cmd/gpio.c | 15 ++++-- > cmd/pmic.c | 15 +++--- > cmd/regulator.c | 13 +++--- > cmd/virtio.c | 9 ++-- > common/stdio.c | 33 ++++++------- > drivers/block/blk-uclass.c | 16 +++---- > drivers/core/uclass.c | 56 ++++++++++++----------- > drivers/cpu/cpu-uclass.c | 20 ++------ > drivers/dma/dma-uclass.c | 7 ++- > drivers/gpio/gpio-uclass.c | 14 +++--- > drivers/mmc/omap_hsmmc.c | 2 +- > drivers/pci/pci-uclass.c | 26 ++++------- > drivers/serial/serial-uclass.c | 2 +- > drivers/serial/serial_bcm283x_mu.c | 2 +- > drivers/serial/serial_bcm283x_pl011.c | 2 +- > drivers/sysinfo/sysinfo-uclass.c | 10 +++- > drivers/sysreset/sysreset_ast.c | 2 +- > drivers/usb/gadget/ether.c | 11 ++--- > drivers/video/exynos/exynos_fb.c | 24 ++++------ > drivers/video/imx/mxc_ipuv3_fb.c | 9 ++-- > drivers/video/mali_dp.c | 2 +- > drivers/video/stm32/stm32_dsi.c | 6 ++- > drivers/video/tegra124/dp.c | 7 +-- > drivers/virtio/virtio-uclass.c | 15 +----- > drivers/w1/w1-uclass.c | 29 ++++++------ > include/dm/uclass.h | 49 ++++++++++---------- > lib/acpi/acpi_table.c | 2 +- > lib/efi_loader/efi_gop.c | 2 +- > net/eth-uclass.c | 6 ++- > test/boot/bootmeth.c | 2 +- > test/dm/acpi.c | 14 +++--- > test/dm/core.c | 27 +++-------- > test/dm/devres.c | 4 +- > test/dm/i2c.c | 8 ++-- > test/dm/test-fdt.c | 27 ++++++++--- > test/dm/virtio_device.c | 8 ++-- > test/dm/virtio_rng.c | 2 +- > test/fuzz/cmd_fuzz.c | 2 +- > test/fuzz/virtio.c | 2 +- > test/test-main.c | 11 +---- > 50 files changed, 269 insertions(+), 313 deletions(-) > > -- > 2.37.3 >