From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Richard Henderson <richard.henderson@linaro.org>,
Russell King <linux@armlinux.org.uk>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Michael Ellerman <mpe@ellerman.id.au>,
"David S . Miller" <davem@davemloft.net>,
Juergen Gross <jgross@suse.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: Introduce pci_dev_for_each_resource()
Date: Thu, 3 Nov 2022 14:09:31 +0200 [thread overview]
Message-ID: <Y2Ove2wE/OUNT0cq@black.fi.intel.com> (raw)
In-Reply-To: <Y2OsGJ5y8llo7L9R@smile.fi.intel.com>
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.
next prev parent reply other threads:[~2022-11-03 12:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 11:06 [PATCH] PCI: Introduce pci_dev_for_each_resource() Mika Westerberg
2022-11-03 11:55 ` Andy Shevchenko
2022-11-03 12:09 ` Mika Westerberg [this message]
2022-11-03 14:45 ` Andy Shevchenko
2022-11-03 16:49 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2Ove2wE/OUNT0cq@black.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=jgross@suse.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mpe@ellerman.id.au \
--cc=richard.henderson@linaro.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox