diff mbox

[07/18] isdn: avm: call disable_pci_device() if pci_probe() failed

Message ID 1281124303-13537-1-git-send-email-segooon@gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Kulikov Vasiliy Aug. 6, 2010, 7:51 p.m. UTC
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.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/isdn/hardware/avm/t1pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

David Miller Aug. 8, 2010, 5:34 a.m. UTC | #1
From: Kulikov Vasiliy <segooon@gmail.com>
Date: Fri,  6 Aug 2010 23:51:41 +0400

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

"pci_disable_device()"

> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c
index 5a3f830..e891ed6 100644
--- a/drivers/isdn/hardware/avm/t1pci.c
+++ b/drivers/isdn/hardware/avm/t1pci.c
@@ -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;