diff options
Diffstat (limited to 'drivers/pci/hotplug/cpcihp_zt5550.c')
-rw-r--r-- | drivers/pci/hotplug/cpcihp_zt5550.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c index e9928024be78..f7cb00da38df 100644 --- a/drivers/pci/hotplug/cpcihp_zt5550.c +++ b/drivers/pci/hotplug/cpcihp_zt5550.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/signal.h> /* SA_SHIRQ */ | ||
39 | #include "cpci_hotplug.h" | 40 | #include "cpci_hotplug.h" |
40 | #include "cpcihp_zt5550.h" | 41 | #include "cpcihp_zt5550.h" |
41 | 42 | ||
@@ -78,11 +79,20 @@ static void __iomem *csr_int_mask; | |||
78 | 79 | ||
79 | static int zt5550_hc_config(struct pci_dev *pdev) | 80 | static int zt5550_hc_config(struct pci_dev *pdev) |
80 | { | 81 | { |
82 | int ret; | ||
83 | |||
81 | /* Since we know that no boards exist with two HC chips, treat it as an error */ | 84 | /* Since we know that no boards exist with two HC chips, treat it as an error */ |
82 | if(hc_dev) { | 85 | if(hc_dev) { |
83 | err("too many host controller devices?"); | 86 | err("too many host controller devices?"); |
84 | return -EBUSY; | 87 | return -EBUSY; |
85 | } | 88 | } |
89 | |||
90 | ret = pci_enable_device(pdev); | ||
91 | if(ret) { | ||
92 | err("cannot enable %s\n", pci_name(pdev)); | ||
93 | return ret; | ||
94 | } | ||
95 | |||
86 | hc_dev = pdev; | 96 | hc_dev = pdev; |
87 | dbg("hc_dev = %p", hc_dev); | 97 | dbg("hc_dev = %p", hc_dev); |
88 | dbg("pci resource start %lx", pci_resource_start(hc_dev, 1)); | 98 | dbg("pci resource start %lx", pci_resource_start(hc_dev, 1)); |
@@ -91,7 +101,8 @@ static int zt5550_hc_config(struct pci_dev *pdev) | |||
91 | if(!request_mem_region(pci_resource_start(hc_dev, 1), | 101 | if(!request_mem_region(pci_resource_start(hc_dev, 1), |
92 | pci_resource_len(hc_dev, 1), MY_NAME)) { | 102 | pci_resource_len(hc_dev, 1), MY_NAME)) { |
93 | err("cannot reserve MMIO region"); | 103 | err("cannot reserve MMIO region"); |
94 | return -ENOMEM; | 104 | ret = -ENOMEM; |
105 | goto exit_disable_device; | ||
95 | } | 106 | } |
96 | 107 | ||
97 | hc_registers = | 108 | hc_registers = |
@@ -99,9 +110,8 @@ static int zt5550_hc_config(struct pci_dev *pdev) | |||
99 | if(!hc_registers) { | 110 | if(!hc_registers) { |
100 | err("cannot remap MMIO region %lx @ %lx", | 111 | err("cannot remap MMIO region %lx @ %lx", |
101 | pci_resource_len(hc_dev, 1), pci_resource_start(hc_dev, 1)); | 112 | pci_resource_len(hc_dev, 1), pci_resource_start(hc_dev, 1)); |
102 | release_mem_region(pci_resource_start(hc_dev, 1), | 113 | ret = -ENODEV; |
103 | pci_resource_len(hc_dev, 1)); | 114 | goto exit_release_region; |
104 | return -ENODEV; | ||
105 | } | 115 | } |
106 | 116 | ||
107 | csr_hc_index = hc_registers + CSR_HCINDEX; | 117 | csr_hc_index = hc_registers + CSR_HCINDEX; |
@@ -124,6 +134,13 @@ static int zt5550_hc_config(struct pci_dev *pdev) | |||
124 | writeb((u8) ALL_DIRECT_INTS_MASK, csr_int_mask); | 134 | writeb((u8) ALL_DIRECT_INTS_MASK, csr_int_mask); |
125 | dbg("disabled timer0, timer1 and ENUM interrupts"); | 135 | dbg("disabled timer0, timer1 and ENUM interrupts"); |
126 | return 0; | 136 | return 0; |
137 | |||
138 | exit_release_region: | ||
139 | release_mem_region(pci_resource_start(hc_dev, 1), | ||
140 | pci_resource_len(hc_dev, 1)); | ||
141 | exit_disable_device: | ||
142 | pci_disable_device(hc_dev); | ||
143 | return ret; | ||
127 | } | 144 | } |
128 | 145 | ||
129 | static int zt5550_hc_cleanup(void) | 146 | static int zt5550_hc_cleanup(void) |
@@ -134,6 +151,7 @@ static int zt5550_hc_cleanup(void) | |||
134 | iounmap(hc_registers); | 151 | iounmap(hc_registers); |
135 | release_mem_region(pci_resource_start(hc_dev, 1), | 152 | release_mem_region(pci_resource_start(hc_dev, 1), |
136 | pci_resource_len(hc_dev, 1)); | 153 | pci_resource_len(hc_dev, 1)); |
154 | pci_disable_device(hc_dev); | ||
137 | return 0; | 155 | return 0; |
138 | } | 156 | } |
139 | 157 | ||