Skip to content

Commit d981e7b

Browse files
Philipp Stannerbroonie
authored andcommitted
spi: pci1xxxx: Use non-hybrid PCI devres API
pci1xxxx 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 call to pci_release_regions() is unnecessary. Remove the call 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://patch.msgid.link/20250417083902.23483-4-phasta@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 23812bb commit d981e7b

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

drivers/spi/spi-pci1xxxx.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -741,21 +741,19 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
741741
if (ret)
742742
return -ENOMEM;
743743

744-
ret = pci_request_regions(pdev, DRV_NAME);
744+
ret = pcim_request_all_regions(pdev, DRV_NAME);
745745
if (ret)
746746
return -ENOMEM;
747747

748748
spi_bus->reg_base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0));
749-
if (!spi_bus->reg_base) {
750-
ret = -EINVAL;
751-
goto error;
752-
}
749+
if (!spi_bus->reg_base)
750+
return -EINVAL;
753751

754752
ret = pci_alloc_irq_vectors(pdev, hw_inst_cnt, hw_inst_cnt,
755753
PCI_IRQ_ALL_TYPES);
756754
if (ret < 0) {
757755
dev_err(&pdev->dev, "Error allocating MSI vectors\n");
758-
goto error;
756+
return ret;
759757
}
760758

761759
init_completion(&spi_sub_ptr->spi_xfer_done);
@@ -773,13 +771,12 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
773771
if (ret < 0) {
774772
dev_err(&pdev->dev, "Unable to request irq : %d",
775773
spi_sub_ptr->irq);
776-
ret = -ENODEV;
777-
goto error;
774+
return -ENODEV;
778775
}
779776

780777
ret = pci1xxxx_spi_dma_init(spi_bus, spi_sub_ptr->irq);
781778
if (ret && ret != -EOPNOTSUPP)
782-
goto error;
779+
return ret;
783780

784781
/* This register is only applicable for 1st instance */
785782
regval = readl(spi_bus->reg_base + SPI_PCI_CTRL_REG_OFFSET(0));
@@ -808,8 +805,7 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
808805
if (ret < 0) {
809806
dev_err(&pdev->dev, "Unable to request irq : %d",
810807
spi_sub_ptr->irq);
811-
ret = -ENODEV;
812-
goto error;
808+
return -ENODEV;
813809
}
814810
}
815811

@@ -828,15 +824,11 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
828824
spi_controller_set_devdata(spi_host, spi_sub_ptr);
829825
ret = devm_spi_register_controller(dev, spi_host);
830826
if (ret)
831-
goto error;
827+
return ret;
832828
}
833829
pci_set_drvdata(pdev, spi_bus);
834830

835831
return 0;
836-
837-
error:
838-
pci_release_regions(pdev);
839-
return ret;
840832
}
841833

842834
static void store_restore_config(struct pci1xxxx_spi *spi_ptr,

0 commit comments

Comments
 (0)