Re: [PATCH] PCI fixes for 2.6.10-rc1

Greg KH
2004-11-13T00:55:28Z

ChangeSet 1.2026.35.5, 2004/10/28 16:25:06-05:00, akpm@osdl.org

[PATCH] PCI: add hook for PCI resource deallocation

From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

This patch adds a hook 'pcibios_disable_device()' into pci_disable_device()
to call architecture specific PCI resource deallocation code. It's a
opposite part of pcibios_enable_device(). We need this hook to deallocate
architecture specific PCI resource such as IRQ resource, etc.. This patch
is just for adding the hook, so 'pcibios_disable_device()' is defined as a
null function on all architecture so far.

I tested this patch on i386, x86_64 and ia64. But it has not been tested
on other architectures because I don't have these machines.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

drivers/pci/pci.c | 12 ++++++++++++
1 files changed, 12 insertions(+)

diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c 2004-11-12 15:14:21 -08:00
+++ b/drivers/pci/pci.c 2004-11-12 15:14:21 -08:00
@@ -375,6 +375,16 @@
}

/**
+ * pcibios_disable_device - disable arch specific PCI resources for device dev
+ * @dev: the PCI device to disable
+ *
+ * Disables architecture specific PCI resources for the device. This
+ * is the default implementation. Architecture implementations can
+ * override this.
+ */
+void __attribute__ ((weak)) pcibios_disable_device (struct pci_dev *dev) {}
+
+/**
* pci_disable_device - Disable PCI device after use
* @dev: PCI device to be disabled
*
@@ -394,6 +404,8 @@
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}
+
+ pcibios_disable_device(dev);
}

/**