Thread (19 messages) 19 messages, 4 authors, 2024-08-21

Re: [PATCH v2 8/9] vdap: solidrun: Replace deprecated PCI functions

From: Andy Shevchenko <hidden>
Date: 2024-08-21 08:20:07
Also in: linux-arm-kernel, linux-block, linux-doc, linux-fpga, linux-gpio, linux-pci, lkml, virtualization

On Wed, Aug 21, 2024 at 10:19 AM Philipp Stanner [off-list ref] wrote:
solidrun utilizes pcim_iomap_regions(), which has been deprecated by the
PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate
pcim_iomap_table(), pcim_iomap_regions_request_all()"), among other
things because it forces usage of quite a complicated bitmask mechanism.
The bitmask handling code can entirely be removed by replacing
pcim_iomap_regions() and pcim_iomap_table().

Replace pcim_iomap_regions() and pcim_iomap_table() with
pci_iomap_region().
...
 static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet)
 {
        char name[50];
-       int ret;

        snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev));
Shouldn't this be also devm_kasprintf()?
        /* Request and map BAR */
-       ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
-       if (ret) {
+       snet->bar = pcim_iomap_region(pdev, snet->psnet->cfg.vf_bar, name);
+       if (IS_ERR(snet->bar)) {
                SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n");
-               return ret;
+               return PTR_ERR(snet->bar);
        }

-       snet->bar = pcim_iomap_table(pdev)[snet->psnet->cfg.vf_bar];
-
        return 0;
 }
-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help