From: Bjorn Helgaas <helgaas@kernel.org>
To: Denis Efremov <efremov@linux.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: use PCI_SRIOV_NUM_BARS in loops instead of PCI_IOV_RESOURCE_END
Date: Tue, 6 Aug 2019 15:45:02 -0500 [thread overview]
Message-ID: <20190806204502.GU151852@google.com> (raw)
In-Reply-To: <20190806140715.19847-1-efremov@linux.com>
On Tue, Aug 06, 2019 at 05:07:15PM +0300, Denis Efremov wrote:
> It's a general pattern to write loops with 'i < PCI_SRIOV_NUM_BARS'
> condition. This patch fixes remaining loops which violates this implicit
> agreement.
>
> Signed-off-by: Denis Efremov <efremov@linux.com>
Applied with Kuppuswamy's reviewed-by to pci/misc for v5.4, thanks!
> ---
> drivers/pci/iov.c | 4 ++--
> drivers/pci/setup-bus.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index 525fd3f272b3..9b48818ced01 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -557,8 +557,8 @@ static void sriov_restore_state(struct pci_dev *dev)
> ctrl |= iov->ctrl & PCI_SRIOV_CTRL_ARI;
> pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, ctrl);
>
> - for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++)
> - pci_update_resource(dev, i);
> + for (i = 0; i < PCI_SRIOV_NUM_BARS; i++)
> + pci_update_resource(dev, i + PCI_IOV_RESOURCES);
>
> pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz);
> pci_iov_set_numvfs(dev, iov->num_VFs);
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 79b1fa6519be..e7dbe21705ba 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -1662,8 +1662,8 @@ static int iov_resources_unassigned(struct pci_dev *dev, void *data)
> int i;
> bool *unassigned = data;
>
> - for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) {
> - struct resource *r = &dev->resource[i];
> + for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
> + struct resource *r = &dev->resource[i + PCI_IOV_RESOURCES];
> struct pci_bus_region region;
>
> /* Not assigned or rejected by kernel? */
> --
> 2.21.0
>
prev parent reply other threads:[~2019-08-06 20:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 14:07 [PATCH] PCI: use PCI_SRIOV_NUM_BARS in loops instead of PCI_IOV_RESOURCE_END Denis Efremov
2019-08-06 17:26 ` sathyanarayanan kuppuswamy
2019-08-06 20:45 ` Bjorn Helgaas [this message]
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=20190806204502.GU151852@google.com \
--to=helgaas@kernel.org \
--cc=efremov@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).