From: Kenji Kaneshige 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 Signed-off-by: Andrew Morton --- 25-akpm/arch/alpha/kernel/pci.c | 5 +++++ 25-akpm/arch/arm/kernel/bios32.c | 4 ++++ 25-akpm/arch/i386/pci/common.c | 4 ++++ 25-akpm/arch/ia64/pci/pci.c | 5 +++++ 25-akpm/arch/m68knommu/kernel/comempci.c | 4 ++++ 25-akpm/arch/mips/pci/pci.c | 4 ++++ 25-akpm/arch/mips/pmc-sierra/yosemite/ht.c | 5 +++++ 25-akpm/arch/parisc/kernel/pci.c | 6 ++++++ 25-akpm/arch/ppc/kernel/pci.c | 5 +++++ 25-akpm/arch/ppc64/kernel/pci.c | 5 +++++ 25-akpm/arch/sh/boards/overdrive/galileo.c | 4 ++++ 25-akpm/arch/sh/drivers/pci/pci.c | 4 ++++ 25-akpm/arch/sh64/kernel/pcibios.c | 5 +++++ 25-akpm/arch/sparc/kernel/pcic.c | 4 ++++ 25-akpm/arch/sparc64/kernel/pci.c | 4 ++++ 25-akpm/arch/v850/kernel/rte_mb_a_pci.c | 6 ++++++ 25-akpm/drivers/pci/pci.c | 2 ++ 25-akpm/include/linux/pci.h | 1 + 18 files changed, 77 insertions(+) diff -puN arch/alpha/kernel/pci.c~add-hook-for-pci-resource-deallocation arch/alpha/kernel/pci.c --- 25/arch/alpha/kernel/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/alpha/kernel/pci.c Thu Sep 16 14:45:07 2004 @@ -381,6 +381,11 @@ pcibios_enable_device(struct pci_dev *de return 0; } +void +pcibios_disable_device(struct pci_dev *dev) +{ +} + /* * If we set up a device for bus mastering, we need to check the latency * timer as certain firmware forgets to set it properly, as seen diff -puN arch/arm/kernel/bios32.c~add-hook-for-pci-resource-deallocation arch/arm/kernel/bios32.c --- 25/arch/arm/kernel/bios32.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/arm/kernel/bios32.c Thu Sep 16 14:45:07 2004 @@ -672,6 +672,10 @@ int pcibios_enable_device(struct pci_dev return 0; } +void pcibios_disable_device(struct pci_dev *dev) +{ +} + int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine) { diff -puN arch/i386/pci/common.c~add-hook-for-pci-resource-deallocation arch/i386/pci/common.c --- 25/arch/i386/pci/common.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/i386/pci/common.c Thu Sep 16 14:45:07 2004 @@ -249,3 +249,7 @@ int pcibios_enable_device(struct pci_dev return pcibios_enable_irq(dev); } + +void pcibios_disable_device(struct pci_dev *dev) +{ +} diff -puN arch/ia64/pci/pci.c~add-hook-for-pci-resource-deallocation arch/ia64/pci/pci.c --- 25/arch/ia64/pci/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/ia64/pci/pci.c Thu Sep 16 14:45:07 2004 @@ -449,6 +449,11 @@ pcibios_enable_device (struct pci_dev *d } void +pcibios_disable_device (struct pci_dev *dev) +{ +} + +void pcibios_align_resource (void *data, struct resource *res, unsigned long size, unsigned long align) { diff -puN arch/m68knommu/kernel/comempci.c~add-hook-for-pci-resource-deallocation arch/m68knommu/kernel/comempci.c --- 25/arch/m68knommu/kernel/comempci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/m68knommu/kernel/comempci.c Thu Sep 16 14:45:07 2004 @@ -373,6 +373,10 @@ int pcibios_enable_device(struct pci_dev return(0); } +void pcibios_disable_device(struct pci_dev *dev) +{ +} + /*****************************************************************************/ void pcibios_update_resource(struct pci_dev *dev, struct resource *root, struct resource *r, int resource) diff -puN arch/mips/pci/pci.c~add-hook-for-pci-resource-deallocation arch/mips/pci/pci.c --- 25/arch/mips/pci/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/mips/pci/pci.c Thu Sep 16 14:45:07 2004 @@ -226,6 +226,10 @@ int pcibios_enable_device(struct pci_dev return 0; } +void pcibios_disable_device(struct pci_dev *dev) +{ +} + static void __init pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus) { diff -puN arch/mips/pmc-sierra/yosemite/ht.c~add-hook-for-pci-resource-deallocation arch/mips/pmc-sierra/yosemite/ht.c --- 25/arch/mips/pmc-sierra/yosemite/ht.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/mips/pmc-sierra/yosemite/ht.c Thu Sep 16 14:45:07 2004 @@ -348,6 +348,11 @@ int pcibios_enable_device(struct pci_dev } +void pcibios_disable_device(struct pci_dev *dev) +{ +} + + void pcibios_update_resource(struct pci_dev *dev, struct resource *root, struct resource *res, int resource) diff -puN arch/parisc/kernel/pci.c~add-hook-for-pci-resource-deallocation arch/parisc/kernel/pci.c --- 25/arch/parisc/kernel/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/parisc/kernel/pci.c Thu Sep 16 14:45:07 2004 @@ -331,6 +331,12 @@ int pcibios_enable_device(struct pci_dev } +void +pcibios_disable_device(struct pci_dev *dev) +{ +} + + /* PA-RISC specific */ void pcibios_register_hba(struct pci_hba_data *hba) { diff -puN arch/ppc64/kernel/pci.c~add-hook-for-pci-resource-deallocation arch/ppc64/kernel/pci.c --- 25/arch/ppc64/kernel/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/ppc64/kernel/pci.c Thu Sep 16 14:45:07 2004 @@ -345,6 +345,11 @@ int pcibios_enable_device(struct pci_dev return 0; } +void +pcibios_disable_device(struct pci_dev *dev) +{ +} + /* * Return the domain number for this bus. */ diff -puN arch/ppc/kernel/pci.c~add-hook-for-pci-resource-deallocation arch/ppc/kernel/pci.c --- 25/arch/ppc/kernel/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/ppc/kernel/pci.c Thu Sep 16 14:45:07 2004 @@ -1420,6 +1420,11 @@ int pcibios_enable_device(struct pci_dev return 0; } +void +pcibios_disable_device(struct pci_dev *dev) +{ +} + struct pci_controller* pci_bus_to_hose(int bus) { diff -puN arch/sh64/kernel/pcibios.c~add-hook-for-pci-resource-deallocation arch/sh64/kernel/pcibios.c --- 25/arch/sh64/kernel/pcibios.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/sh64/kernel/pcibios.c Thu Sep 16 14:45:07 2004 @@ -142,6 +142,11 @@ int pcibios_enable_device(struct pci_dev return 0; } +void +pcibios_disable_device(struct pci_dev *dev) +{ +} + /* * If we set up a device for bus mastering, we need to check and set * the latency timer as it may not be properly set. diff -puN arch/sh/boards/overdrive/galileo.c~add-hook-for-pci-resource-deallocation arch/sh/boards/overdrive/galileo.c --- 25/arch/sh/boards/overdrive/galileo.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/sh/boards/overdrive/galileo.c Thu Sep 16 14:45:07 2004 @@ -529,6 +529,10 @@ int pcibios_enable_device(struct pci_dev } +void pcibios_disable_device(struct pci_dev *dev) +{ +} + /* We should do some optimisation work here I think. Ok for now though */ void __init pcibios_fixup_bus(struct pci_bus *bus) { diff -puN arch/sh/drivers/pci/pci.c~add-hook-for-pci-resource-deallocation arch/sh/drivers/pci/pci.c --- 25/arch/sh/drivers/pci/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/sh/drivers/pci/pci.c Thu Sep 16 14:45:07 2004 @@ -127,6 +127,10 @@ int pcibios_enable_device(struct pci_dev return 0; } +void pcibios_disable_device(struct pci_dev *dev) +{ +} + /* * If we set up a device for bus mastering, we need to check and set * the latency timer as it may not be properly set. diff -puN arch/sparc64/kernel/pci.c~add-hook-for-pci-resource-deallocation arch/sparc64/kernel/pci.c --- 25/arch/sparc64/kernel/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/sparc64/kernel/pci.c Thu Sep 16 14:45:07 2004 @@ -502,6 +502,10 @@ int pcibios_enable_device(struct pci_dev return 0; } +void pcibios_disable_device(struct pci_dev *pdev) +{ +} + void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region, struct resource *res) { diff -puN arch/sparc/kernel/pcic.c~add-hook-for-pci-resource-deallocation arch/sparc/kernel/pcic.c --- 25/arch/sparc/kernel/pcic.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/sparc/kernel/pcic.c Thu Sep 16 14:45:07 2004 @@ -869,6 +869,10 @@ int pcibios_enable_device(struct pci_dev return 0; } +void pcibios_disable_device(struct pci_dev *pdev) +{ +} + /* * NMI */ diff -puN arch/v850/kernel/rte_mb_a_pci.c~add-hook-for-pci-resource-deallocation arch/v850/kernel/rte_mb_a_pci.c --- 25/arch/v850/kernel/rte_mb_a_pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/arch/v850/kernel/rte_mb_a_pci.c Thu Sep 16 14:45:07 2004 @@ -247,6 +247,12 @@ int __nomods_init pcibios_enable_device return 0; } + +void +pcibios_disable_device(struct pci_dev *dev) +{ +} + /* Resource allocation. */ static void __devinit pcibios_assign_resources (void) diff -puN drivers/pci/pci.c~add-hook-for-pci-resource-deallocation drivers/pci/pci.c --- 25/drivers/pci/pci.c~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/drivers/pci/pci.c Thu Sep 16 14:45:07 2004 @@ -411,6 +411,8 @@ pci_disable_device(struct pci_dev *dev) pci_command &= ~PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); } + + pcibios_disable_device(dev); } /** diff -puN include/linux/pci.h~add-hook-for-pci-resource-deallocation include/linux/pci.h --- 25/include/linux/pci.h~add-hook-for-pci-resource-deallocation Thu Sep 16 14:45:07 2004 +++ 25-akpm/include/linux/pci.h Thu Sep 16 14:45:07 2004 @@ -687,6 +687,7 @@ extern struct list_head pci_devices; /* void pcibios_fixup_bus(struct pci_bus *); int pcibios_enable_device(struct pci_dev *, int mask); +void pcibios_disable_device(struct pci_dev *); char *pcibios_setup (char *str); /* Used only when drivers/pci/setup.c is used */ _