On Thu, Sep 10, 2026 at 04:43:12PM +0200, Marek Vasut wrote:
> On 9/10/26 2:52 PM, Neil Armstrong wrote:
> > On 8/9/26 03:31, Marek Vasut wrote:
> > > Iterate over busses using uclass_foreach_dev_probe() instead of ad-hoc
> > > loop. The uclass_get_device_by_seq(UCLASS_PCI, busnum, &bus) == 0 in
> > > the ad-hoc loop would break on first controller that does not link up
> > > in its .probe() function, which is undesired, as it prevents listing
> > > of PCIe devices on other controllers. Using uclass_get_device_by_seq()
> > > mitigates that problem, and, at the same time, simplifies the code.
> > > 
> > > Signed-off-by: Marek Vasut <[email protected]>
> > > ---
> > > Cc: Neil Armstrong <[email protected]>
> > > Cc: Tom Rini <[email protected]>
> > > Cc: [email protected]
> > > ---
> > >   cmd/pci.c | 8 ++------
> > >   1 file changed, 2 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/cmd/pci.c b/cmd/pci.c
> > > index 3c0aed50cae..d2a10aec41a 100644
> > > --- a/cmd/pci.c
> > > +++ b/cmd/pci.c
> > > @@ -550,14 +550,10 @@ static int do_pci(struct cmd_tbl *cmdtp, int
> > > flag, int argc, char *const argv[])
> > >           }
> > >           if (busnum == -1) {
> > >               if (cmd != 'r') {
> > > -                for (busnum = 0;
> > > -                     uclass_get_device_by_seq(UCLASS_PCI, busnum,
> > > &bus) == 0;
> > > -                     busnum++)
> > > +                uclass_foreach_dev_probe(UCLASS_PCI, bus)
> > >                       pciinfo(bus, value, true);
> > >               } else {
> > > -                for (busnum = 0;
> > > -                     uclass_get_device_by_seq(UCLASS_PCI, busnum,
> > > &bus) == 0;
> > > -                     busnum++) {
> > > +                uclass_foreach_dev_probe(UCLASS_PCI, bus) {
> > >                       /* Regions are controller specific so skip
> > > non- root buses */
> > >                       if (device_is_on_pci_bus(bus))
> > >                           continue;
> > 
> > Reviewed-by: Neil Armstrong <[email protected]>
> Tom, could you please add this into next?
> 
> Thank you both.

Neil volunteered to be PCI custodian a while ago, I'll let him grab it
with the other stuff he's been reviewing :)

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to