Skip to contentSkip to conversation

isdn: avm: call disable_pci_device() if pci_probe() failed

PATCH Superseded Kulikov Vasiliy 2 participants 2 messages Aug 6, 2010 – Aug 8, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 7/18 isdn: avm: call disable_pci_device() if pci_probe() failed

Driver should call disable_pci_device() if it returns from pci_probe() with error. Also it must not be called if request_region() fails as it means that somebody uses device resources and rules the device.

---
 drivers/isdn/hardware/avm/t1pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/isdn/hardware/avm/t1pci.c +2 -0
index 5a3f830..e891ed6 100644
@@ -210,6 +210,8 @@ static int __devinit t1pci_probe(struct pci_dev *dev,
 	if (retval != 0) {
 		printk(KERN_ERR "t1pci: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x\n",
 		       param.port, param.irq, param.membase);
+		if (retval != -EBUSY)
+			pci_disable_device(dev);
 		return -ENODEV;
 	}
 	return 0;
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw

From: Kulikov Vasiliy <[email protected]>
Date: Fri, 6 Aug 2010 23:51:41 +0400

Quoted 1 line

Driver should call disable_pci_device() if it returns from pci_probe()

"pci_disable_device()"

Quoted 2 lines

with error. Also it must not be called if request_region() fails as it means that somebody uses device resources and rules the device.

This interface, frankly, sucks.

If this is what we want then pci_enable_device() and pci_disable_device() should maintain a reference count, so that device drivers need not be mindful of what arbitrary special circumstances they should make the disable call or not. They can make it unconditionally and the PCI layer makes sure the device doesn't get disabled unintentionally.

This is software interface design 101.

The current requirements are beyond unreasonable and should be fixed before we apply patches like this.

I'm tossing all of these patches, sorry.