On Thu, Nov 03, 2022 at 01:06:20PM +0200, Mika Westerberg wrote: > 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. Thanks! But this has one subtle difference to what I suggested, see below. ... > +/** > + * pci_dev_for_each_resource() - Iterate over each PCI device resource > + * @dev: PCI device > + * @res: Variable that holds the current resource > + * @i: Iterator > + */ > +#define pci_dev_for_each_resource(dev, res, i) \ > + for (i = 0; \ unsigned int i = 0; > + res = &(dev)->resource[i], i < PCI_NUM_RESOURCES; \ > + i++) That's the idea to hide the iterator variable inside the loop. It might be though needed in some cases, so for them this conversion can't be done right now. -- With Best Regards, Andy Shevchenko