Skip to contentSkip to conversation

ata: macio: Use non-hybrid PCI devres API

PATCH In review Philipp Stanner 4 participants 4 messages Jun 4, 2025 – Jun 10, 2025 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ata: macio: Use non-hybrid PCI devres API

macio 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.

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

---
Hi,
seems I forgot sending this patch out a while ago. Mea culpa.

PCI has currently chained the changes mentioned above queued up for Linus, so it's probably a good idea to get this into macio relatively soonish. Otherwise the driver would likely fail to reload in v6.16, because the device's PCI regions remain blocked.

Thx
P.

---
 drivers/ata/pata_macio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_macio.c +1 -1
index fbf5f07ea357..f7a933eefe05 100644
@@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
 	priv->dev = &pdev->dev;
 
 	/* Get MMIO regions */
-	if (pci_request_regions(pdev, "pata-macio")) {
+	if (pcim_request_all_regions(pdev, "pata-macio")) {
 		dev_err(&pdev->dev,
 			"Cannot obtain PCI resources\n");
 		return -EBUSY;
Signature · 1 line
2.48.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Philipp Stanner

macio 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.

Quoted 8 lines

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.

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

Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer
#2 lore raw
In reply to Philipp Stanner

Hello Philipp,

Quoted 11 lines · Philipp Stanner

macio 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.

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

Quoted 6 lines

---
Hi,
seems I forgot sending this patch out a while ago. Mea culpa.

PCI has currently chained the changes mentioned above queued up for

chained?

Quoted 3 lines

Linus, so it's probably a good idea to get this into macio relatively soonish. Otherwise the driver would likely fail to reload in v6.16, because the device's PCI regions remain blocked.

I can queue this up for 6.16, but then I think you need to rewrite the commit message to motivate why it is a fix (i.e. why it deserves to go in to 6.16-rc2).

Or, I can just queue it up for 6.17.

What do you prefer?

Kind regards,
Niklas

#3 lore raw
Quoted 16 lines · Niklas Cassel

Hello Philipp,

Quoted 13 lines · Philipp Stanner

macio 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.

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

Quoted 8 lines
Quoted 6 lines

---
Hi,
seems I forgot sending this patch out a while ago. Mea culpa.

PCI has currently chained the changes mentioned above queued up for

chained?

"Queued up for the merge window".

Now it's already in Linus's tree.

Quoted 7 lines
Quoted 6 lines

Linus, so it's probably a good idea to get this into macio relatively
soonish. Otherwise the driver would likely fail to reload in v6.16, because the device's PCI regions remain blocked.

Quoted 7 lines

I can queue this up for 6.16, but then I think you need to rewrite the
commit message to motivate why it is a fix (i.e. why it deserves to go
in to 6.16-rc2).

Or, I can just queue it up for 6.17.

No, this needs to go into 6.16. As I state above, all kernels from 6.16 onwards which don't have this patch will see pata_macio fail in case of a driver-reload, because the PCI regions remain blocked.

I can fish out the commit ID and provide an adjusted descrption with
Fixes: tag as a v2.

Thx
P.

Quoted 6 lines

What do you prefer?

Kind regards,
Niklas