提交 c8920f0c 编写于 作者: B Bjorn Helgaas 提交者: Greg Kroah-Hartman

[PATCH] cpcihp_zt5550: add pci_enable_device()

Add pci_{enable,disable}_device() calls.  Without pci_enable_device(),
dev->irq is garbage, and cpcihp_zt5550 relies on it.

Compiled but untested, since I don't have the hardware.
Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: NScott Murray <scottm@somanetworks.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>

 drivers/pci/hotplug/cpcihp_zt5550.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
上级 d3535fbb
...@@ -78,11 +78,20 @@ static void __iomem *csr_int_mask; ...@@ -78,11 +78,20 @@ static void __iomem *csr_int_mask;
static int zt5550_hc_config(struct pci_dev *pdev) static int zt5550_hc_config(struct pci_dev *pdev)
{ {
int ret;
/* Since we know that no boards exist with two HC chips, treat it as an error */ /* Since we know that no boards exist with two HC chips, treat it as an error */
if(hc_dev) { if(hc_dev) {
err("too many host controller devices?"); err("too many host controller devices?");
return -EBUSY; return -EBUSY;
} }
ret = pci_enable_device(pdev);
if(ret) {
err("cannot enable %s\n", pci_name(pdev));
return ret;
}
hc_dev = pdev; hc_dev = pdev;
dbg("hc_dev = %p", hc_dev); dbg("hc_dev = %p", hc_dev);
dbg("pci resource start %lx", pci_resource_start(hc_dev, 1)); dbg("pci resource start %lx", pci_resource_start(hc_dev, 1));
...@@ -91,7 +100,8 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -91,7 +100,8 @@ static int zt5550_hc_config(struct pci_dev *pdev)
if(!request_mem_region(pci_resource_start(hc_dev, 1), if(!request_mem_region(pci_resource_start(hc_dev, 1),
pci_resource_len(hc_dev, 1), MY_NAME)) { pci_resource_len(hc_dev, 1), MY_NAME)) {
err("cannot reserve MMIO region"); err("cannot reserve MMIO region");
return -ENOMEM; ret = -ENOMEM;
goto exit_disable_device;
} }
hc_registers = hc_registers =
...@@ -99,9 +109,8 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -99,9 +109,8 @@ static int zt5550_hc_config(struct pci_dev *pdev)
if(!hc_registers) { if(!hc_registers) {
err("cannot remap MMIO region %lx @ %lx", err("cannot remap MMIO region %lx @ %lx",
pci_resource_len(hc_dev, 1), pci_resource_start(hc_dev, 1)); pci_resource_len(hc_dev, 1), pci_resource_start(hc_dev, 1));
release_mem_region(pci_resource_start(hc_dev, 1), ret = -ENODEV;
pci_resource_len(hc_dev, 1)); goto exit_release_region;
return -ENODEV;
} }
csr_hc_index = hc_registers + CSR_HCINDEX; csr_hc_index = hc_registers + CSR_HCINDEX;
...@@ -124,6 +133,13 @@ static int zt5550_hc_config(struct pci_dev *pdev) ...@@ -124,6 +133,13 @@ static int zt5550_hc_config(struct pci_dev *pdev)
writeb((u8) ALL_DIRECT_INTS_MASK, csr_int_mask); writeb((u8) ALL_DIRECT_INTS_MASK, csr_int_mask);
dbg("disabled timer0, timer1 and ENUM interrupts"); dbg("disabled timer0, timer1 and ENUM interrupts");
return 0; return 0;
exit_release_region:
release_mem_region(pci_resource_start(hc_dev, 1),
pci_resource_len(hc_dev, 1));
exit_disable_device:
pci_disable_device(hc_dev);
return ret;
} }
static int zt5550_hc_cleanup(void) static int zt5550_hc_cleanup(void)
...@@ -134,6 +150,7 @@ static int zt5550_hc_cleanup(void) ...@@ -134,6 +150,7 @@ static int zt5550_hc_cleanup(void)
iounmap(hc_registers); iounmap(hc_registers);
release_mem_region(pci_resource_start(hc_dev, 1), release_mem_region(pci_resource_start(hc_dev, 1),
pci_resource_len(hc_dev, 1)); pci_resource_len(hc_dev, 1));
pci_disable_device(hc_dev);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册