Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: cardreader: Use non-hybrid PCI devres API

cardreader enables its PCI device with pcim_enable_device(). This,
implicitly, switches the function pci_request_regions() into managed
mode, where it becomes a devres function.

The PCI subsystem wants to remove this hybrid nature from its
interfaces. To do so, users of the aforementioned combination of
functions must be ported to non-hybrid functions.

Moreover, since both functions are already managed in this driver, the
calls to pci_release_regions() are unnecessary.

Remove the calls to pci_release_regions().

Replace the call to sometimes-managed pci_request_regions() with one to
the always-managed pcim_request_all_regions().

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20250417091532.26520-2-phasta@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Philipp Stanner and committed by
Greg Kroah-Hartman
6813fc8d dbc8c84d

+4 -7
+4 -7
drivers/misc/cardreader/alcor_pci.c
··· 121 121 priv->cfg = cfg; 122 122 priv->irq = pdev->irq; 123 123 124 - ret = pci_request_regions(pdev, DRV_NAME_ALCOR_PCI); 124 + ret = pcim_request_all_regions(pdev, DRV_NAME_ALCOR_PCI); 125 125 if (ret) { 126 126 dev_err(&pdev->dev, "Cannot request region\n"); 127 127 ret = -ENOMEM; ··· 131 131 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { 132 132 dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar); 133 133 ret = -ENODEV; 134 - goto error_release_regions; 134 + goto error_free_ida; 135 135 } 136 136 137 137 priv->iobase = pcim_iomap(pdev, bar, 0); 138 138 if (!priv->iobase) { 139 139 ret = -ENOMEM; 140 - goto error_release_regions; 140 + goto error_free_ida; 141 141 } 142 142 143 143 /* make sure irqs are disabled */ ··· 147 147 ret = dma_set_mask_and_coherent(priv->dev, AU6601_SDMA_MASK); 148 148 if (ret) { 149 149 dev_err(priv->dev, "Failed to set DMA mask\n"); 150 - goto error_release_regions; 150 + goto error_free_ida; 151 151 } 152 152 153 153 pci_set_master(pdev); ··· 169 169 error_clear_drvdata: 170 170 pci_clear_master(pdev); 171 171 pci_set_drvdata(pdev, NULL); 172 - error_release_regions: 173 - pci_release_regions(pdev); 174 172 error_free_ida: 175 173 ida_free(&alcor_pci_idr, priv->id); 176 174 return ret; ··· 184 186 185 187 ida_free(&alcor_pci_idr, priv->id); 186 188 187 - pci_release_regions(pdev); 188 189 pci_clear_master(pdev); 189 190 pci_set_drvdata(pdev, NULL); 190 191 }