Re: [PATCH v6 1/4] PCI: Introduce pci_dev_for_each_resource()

2023-03-23 Thread Geert Uytterhoeven
Hi Andy, On Thu, Mar 23, 2023 at 4:15 PM Andy Shevchenko wrote: > On Thu, Mar 23, 2023 at 10:02:38AM -0500, Bjorn Helgaas wrote: > > I poked around looking for similar patterns elsewhere with: > > git grep "#define.*for_each_.*_p(" > > git grep "#define.*for_each_.*_idx(" > > > > I didn't

Re: [PATCH v6 1/4] PCI: Introduce pci_dev_for_each_resource()

2023-03-23 Thread Andy Shevchenko
On Thu, Mar 23, 2023 at 10:02:38AM -0500, Bjorn Helgaas wrote: > On Thu, Mar 23, 2023 at 04:30:01PM +0200, Andy Shevchenko wrote: ... > I poked around looking for similar patterns elsewhere with: > > git grep "#define.*for_each_.*_p(" > git grep "#define.*for_each_.*_idx(" > > I didn't

Re: [PATCH v6 1/4] PCI: Introduce pci_dev_for_each_resource()

2023-03-23 Thread Bjorn Helgaas
On Thu, Mar 23, 2023 at 04:30:01PM +0200, Andy Shevchenko wrote: > On Wed, Mar 22, 2023 at 02:28:04PM -0500, Bjorn Helgaas wrote: > > On Mon, Mar 20, 2023 at 03:16:30PM +0200, Andy Shevchenko wrote: > ... > > > > + pci_dev_for_each_resource_p(dev, r) { > > > /* zap the 2nd function of

Re: [PATCH v6 1/4] PCI: Introduce pci_dev_for_each_resource()

2023-03-23 Thread Andy Shevchenko
On Wed, Mar 22, 2023 at 02:28:04PM -0500, Bjorn Helgaas wrote: > On Mon, Mar 20, 2023 at 03:16:30PM +0200, Andy Shevchenko wrote: ... > > + pci_dev_for_each_resource_p(dev, r) { > > /* zap the 2nd function of the winbond chip */ > > - if (dev->resource[i].flags &

Re: [PATCH v6 1/4] PCI: Introduce pci_dev_for_each_resource()

2023-03-22 Thread Bjorn Helgaas
Hi Andy and Mika, I really like the improvements here. They make the code read much better. On Mon, Mar 20, 2023 at 03:16:30PM +0200, Andy Shevchenko wrote: > From: Mika Westerberg > ... > static void fixup_winbond_82c105(struct pci_dev* dev) > { > - int i; > + struct resource *r; >

[PATCH v6 1/4] PCI: Introduce pci_dev_for_each_resource()

2023-03-20 Thread Andy Shevchenko
From: Mika Westerberg Instead of open-coding it everywhere introduce a tiny helper that can be used to iterate over each resource of a PCI device, and convert the most obvious users into it. While at it drop doubled empty line before pdev_sort_resources(). No functional changes intended.