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

Andy Shevchenko
2024-08-21T08:20:07Z

On Wed, Aug 21, 2024 at 10:19 AM Philipp Stanner <pstanner@redhat.com> 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