diff options
-rw-r--r-- | drivers/char/pcmcia/ipwireless/main.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 94b8eb4d691d..444155a305ae 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c | |||
@@ -78,7 +78,6 @@ static void signalled_reboot_callback(void *callback_data) | |||
78 | static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | 78 | static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
79 | { | 79 | { |
80 | struct ipw_dev *ipw = priv_data; | 80 | struct ipw_dev *ipw = priv_data; |
81 | struct resource *io_resource; | ||
82 | int ret; | 81 | int ret; |
83 | 82 | ||
84 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | 83 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
@@ -92,9 +91,12 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
92 | if (ret) | 91 | if (ret) |
93 | return ret; | 92 | return ret; |
94 | 93 | ||
95 | io_resource = request_region(p_dev->resource[0]->start, | 94 | if (!request_region(p_dev->resource[0]->start, |
96 | resource_size(p_dev->resource[0]), | 95 | resource_size(p_dev->resource[0]), |
97 | IPWIRELESS_PCCARD_NAME); | 96 | IPWIRELESS_PCCARD_NAME)) { |
97 | ret = -EBUSY; | ||
98 | goto exit; | ||
99 | } | ||
98 | 100 | ||
99 | p_dev->resource[2]->flags |= | 101 | p_dev->resource[2]->flags |= |
100 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; | 102 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
@@ -105,22 +107,25 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
105 | 107 | ||
106 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); | 108 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); |
107 | if (ret != 0) | 109 | if (ret != 0) |
108 | goto exit2; | 110 | goto exit1; |
109 | 111 | ||
110 | ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; | 112 | ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; |
111 | 113 | ||
112 | ipw->attr_memory = ioremap(p_dev->resource[2]->start, | 114 | ipw->common_memory = ioremap(p_dev->resource[2]->start, |
113 | resource_size(p_dev->resource[2])); | 115 | resource_size(p_dev->resource[2])); |
114 | request_mem_region(p_dev->resource[2]->start, | 116 | if (!request_mem_region(p_dev->resource[2]->start, |
115 | resource_size(p_dev->resource[2]), | 117 | resource_size(p_dev->resource[2]), |
116 | IPWIRELESS_PCCARD_NAME); | 118 | IPWIRELESS_PCCARD_NAME)) { |
119 | ret = -EBUSY; | ||
120 | goto exit2; | ||
121 | } | ||
117 | 122 | ||
118 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | | 123 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | |
119 | WIN_ENABLE; | 124 | WIN_ENABLE; |
120 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ | 125 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ |
121 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); | 126 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); |
122 | if (ret != 0) | 127 | if (ret != 0) |
123 | goto exit2; | 128 | goto exit3; |
124 | 129 | ||
125 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); | 130 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); |
126 | if (ret != 0) | 131 | if (ret != 0) |
@@ -128,23 +133,28 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
128 | 133 | ||
129 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, | 134 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
130 | resource_size(p_dev->resource[3])); | 135 | resource_size(p_dev->resource[3])); |
131 | request_mem_region(p_dev->resource[3]->start, | 136 | if (!request_mem_region(p_dev->resource[3]->start, |
132 | resource_size(p_dev->resource[3]), | 137 | resource_size(p_dev->resource[3]), |
133 | IPWIRELESS_PCCARD_NAME); | 138 | IPWIRELESS_PCCARD_NAME)) { |
139 | ret = -EBUSY; | ||
140 | goto exit4; | ||
141 | } | ||
134 | 142 | ||
135 | return 0; | 143 | return 0; |
136 | 144 | ||
145 | exit4: | ||
146 | iounmap(ipw->attr_memory); | ||
137 | exit3: | 147 | exit3: |
148 | release_mem_region(p_dev->resource[2]->start, | ||
149 | resource_size(p_dev->resource[2])); | ||
138 | exit2: | 150 | exit2: |
139 | if (ipw->common_memory) { | 151 | iounmap(ipw->common_memory); |
140 | release_mem_region(p_dev->resource[2]->start, | ||
141 | resource_size(p_dev->resource[2])); | ||
142 | iounmap(ipw->common_memory); | ||
143 | } | ||
144 | exit1: | 152 | exit1: |
145 | release_resource(io_resource); | 153 | release_region(p_dev->resource[0]->start, |
154 | resource_size(p_dev->resource[0])); | ||
155 | exit: | ||
146 | pcmcia_disable_device(p_dev); | 156 | pcmcia_disable_device(p_dev); |
147 | return -1; | 157 | return ret; |
148 | } | 158 | } |
149 | 159 | ||
150 | static int config_ipwireless(struct ipw_dev *ipw) | 160 | static int config_ipwireless(struct ipw_dev *ipw) |
@@ -219,6 +229,8 @@ exit: | |||
219 | 229 | ||
220 | static void release_ipwireless(struct ipw_dev *ipw) | 230 | static void release_ipwireless(struct ipw_dev *ipw) |
221 | { | 231 | { |
232 | release_region(ipw->link->resource[0]->start, | ||
233 | resource_size(ipw->link->resource[0])); | ||
222 | if (ipw->common_memory) { | 234 | if (ipw->common_memory) { |
223 | release_mem_region(ipw->link->resource[2]->start, | 235 | release_mem_region(ipw->link->resource[2]->start, |
224 | resource_size(ipw->link->resource[2])); | 236 | resource_size(ipw->link->resource[2])); |