On Thu, Nov 03, 2022 at 01:55:04PM +0200, Andy Shevchenko wrote: > 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. Yes, some of the cases need the iterator so that's why I left it (and therefore it cannot be 'unsigned int' either). I'm fine if this patch gets ignored ;-) Sorry about the noise then.