From: Bjorn Helgaas <helgaas@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Philipp Stanner <pstanner@redhat.com>,
Hans de Goede <hdegoede@redhat.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Bjorn Helgaas <bhelgaas@google.com>,
Sam Ravnborg <sam@ravnborg.org>,
dakr@redhat.com, dri-devel@lists.freedesktop.org,
LKML <linux-kernel@vger.kernel.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v7 03/13] PCI: Reimplement plural devres functions
Date: Thu, 13 Jun 2024 13:45:14 -0500 [thread overview]
Message-ID: <20240613184514.GA1071919@bhelgaas> (raw)
In-Reply-To: <aa4e5dd8-2ac4-ae58-2b1b-8d05115ac769@linux.intel.com>
On Thu, Jun 13, 2024 at 07:54:38PM +0300, Ilpo Järvinen wrote:
> On Wed, 5 Jun 2024, Philipp Stanner wrote:
>
> > When the original PCI devres API was implemented, priority was given to
> > the creation of a set of "plural functions" such as
> > pcim_request_regions(). These functions have bit masks as parameters to
> > specify which BARs shall get mapped. Most users, however, only use those
> > to map 1-3 BARs.
> > +static int __pcim_request_region_range(struct pci_dev *pdev, int bar,
> > + unsigned long offset, unsigned long maxlen,
> > + const char *name, int req_flags)
> > +{
> > + resource_size_t start = pci_resource_start(pdev, bar);
> > + resource_size_t len = pci_resource_len(pdev, bar);
> > + unsigned long dev_flags = pci_resource_flags(pdev, bar);
> > +
> > + if (start == 0 || len == 0) /* That's an unused BAR. */
> > + return 0;
> > + if (len <= offset)
> > + return -EINVAL;
>
> Extra space.
Thanks for reviewing this. I dropped the space locally in the v9
series.
> > void pcim_iounmap_regions(struct pci_dev *pdev, int mask)
> > {
> > - void __iomem * const *iomap;
> > - int i;
> > -
> > - iomap = pcim_iomap_table(pdev);
> > - if (!iomap)
> > - return;
> > + short bar;
>
> The current best practice is to use unsigned for loop vars that will never
> be negative.
>
> I don't entirely follow what is reasoning behind making it short instead
> of unsigned int?
Existing interfaces like pcim_iomap() take "int bar". I locally
changed all the BAR indices to "int". We can make everything unsigned
later if worthwhile.
> > - for (i = 0; i < PCIM_IOMAP_MAX; i++) {
> > - if (!mask_contains_bar(mask, i))
> > + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
>
> Is this change minimal if it contains variable renames like this?
> Was "i" not "bar" even if it was given as a parameter to
> mask_contains_bar()?
Replaced locally with "i".
Bjorn
next prev parent reply other threads:[~2024-06-13 18:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 8:15 [PATCH v7 00/13] Make PCI's devres API more consistent Philipp Stanner
2024-06-05 8:15 ` [PATCH v7 01/13] PCI: Add and use devres helper for bit masks Philipp Stanner
2024-06-13 16:57 ` Ilpo Järvinen
2024-06-05 8:15 ` [PATCH v7 02/13] PCI: Add devres helpers for iomap table Philipp Stanner
2024-06-05 8:15 ` [PATCH v7 03/13] PCI: Reimplement plural devres functions Philipp Stanner
2024-06-13 16:54 ` Ilpo Järvinen
2024-06-13 18:45 ` Bjorn Helgaas [this message]
2024-06-05 8:15 ` [PATCH v7 04/13] PCI: Deprecate two surplus " Philipp Stanner
2024-06-05 8:15 ` [PATCH v7 05/13] PCI: Make devres region requests consistent Philipp Stanner
2024-06-05 8:15 ` [PATCH v7 06/13] PCI: Warn users about complicated devres nature Philipp Stanner
2024-06-05 8:15 ` [PATCH v7 07/13] PCI: Move dev-enabled status bit to struct pci_dev Philipp Stanner
2024-06-05 21:11 ` Bjorn Helgaas
2024-06-06 7:59 ` Philipp Stanner
2024-06-05 8:16 ` [PATCH v7 08/13] PCI: Move pinned " Philipp Stanner
2024-06-05 8:16 ` [PATCH v7 09/13] PCI: Give pcim_set_mwi() its own devres callback Philipp Stanner
2024-06-13 17:19 ` Ilpo Järvinen
2024-06-14 8:15 ` Philipp Stanner
2024-06-05 8:16 ` [PATCH v7 10/13] PCI: Give pci(m)_intx " Philipp Stanner
2024-06-13 17:23 ` Ilpo Järvinen
2024-06-13 18:47 ` Bjorn Helgaas
2024-06-05 8:16 ` [PATCH v7 11/13] PCI: Remove legacy pcim_release() Philipp Stanner
2024-06-05 8:16 ` [PATCH v7 12/13] PCI: Add pcim_iomap_range() Philipp Stanner
2024-06-05 8:16 ` [PATCH v7 13/13] drm/vboxvideo: fix mapping leaks Philipp Stanner
2024-06-07 19:40 ` [PATCH v7 00/13] Make PCI's devres API more consistent Bjorn Helgaas
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=20240613184514.GA1071919@bhelgaas \
--to=helgaas@kernel.org \
--cc=airlied@gmail.com \
--cc=bhelgaas@google.com \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=pstanner@redhat.com \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.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