diff options
Diffstat (limited to 'drivers/usb/host/sl811_cs.c')
-rw-r--r-- | drivers/usb/host/sl811_cs.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 78cc32e7b014..ca733b7caea4 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -155,29 +155,22 @@ static void sl811_cs_release(struct pcmcia_device * link) | |||
155 | platform_device_unregister(&platform_dev); | 155 | platform_device_unregister(&platform_dev); |
156 | } | 156 | } |
157 | 157 | ||
158 | struct sl811_css_cfg { | ||
159 | config_info_t conf; | ||
160 | }; | ||
161 | |||
162 | static int sl811_cs_config_check(struct pcmcia_device *p_dev, | 158 | static int sl811_cs_config_check(struct pcmcia_device *p_dev, |
163 | cistpl_cftable_entry_t *cfg, | 159 | cistpl_cftable_entry_t *cfg, |
164 | cistpl_cftable_entry_t *dflt, | 160 | cistpl_cftable_entry_t *dflt, |
161 | unsigned int vcc, | ||
165 | void *priv_data) | 162 | void *priv_data) |
166 | { | 163 | { |
167 | struct sl811_css_cfg *cfg_mem = priv_data; | ||
168 | |||
169 | if (cfg->index == 0) | 164 | if (cfg->index == 0) |
170 | return -ENODEV; | 165 | return -ENODEV; |
171 | 166 | ||
172 | /* Use power settings for Vcc and Vpp if present */ | 167 | /* Use power settings for Vcc and Vpp if present */ |
173 | /* Note that the CIS values need to be rescaled */ | 168 | /* Note that the CIS values need to be rescaled */ |
174 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 169 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
175 | if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != | 170 | if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) |
176 | cfg_mem->conf.Vcc) | ||
177 | return -ENODEV; | 171 | return -ENODEV; |
178 | } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 172 | } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
179 | if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 | 173 | if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) |
180 | != cfg_mem->conf.Vcc) | ||
181 | return -ENODEV; | 174 | return -ENODEV; |
182 | } | 175 | } |
183 | 176 | ||
@@ -214,29 +207,20 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
214 | struct device *parent = &handle_to_dev(link); | 207 | struct device *parent = &handle_to_dev(link); |
215 | local_info_t *dev = link->priv; | 208 | local_info_t *dev = link->priv; |
216 | int last_fn, last_ret; | 209 | int last_fn, last_ret; |
217 | struct sl811_css_cfg *cfg_mem; | ||
218 | 210 | ||
219 | DBG(0, "sl811_cs_config(0x%p)\n", link); | 211 | DBG(0, "sl811_cs_config(0x%p)\n", link); |
220 | 212 | ||
221 | cfg_mem = kzalloc(sizeof(struct sl811_css_cfg), GFP_KERNEL); | 213 | if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) |
222 | if (!cfg_mem) | 214 | goto failed; |
223 | return -ENOMEM; | ||
224 | |||
225 | /* Look up the current Vcc */ | ||
226 | CS_CHECK(GetConfigurationInfo, | ||
227 | pcmcia_get_configuration_info(link, &cfg_mem->conf)); | ||
228 | |||
229 | if (pcmcia_loop_config(link, sl811_cs_config_check, cfg_mem)) | ||
230 | return -ENODEV; | ||
231 | 215 | ||
232 | /* require an IRQ and two registers */ | 216 | /* require an IRQ and two registers */ |
233 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) | 217 | if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) |
234 | goto cs_failed; | 218 | goto failed; |
235 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 219 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
236 | CS_CHECK(RequestIRQ, | 220 | CS_CHECK(RequestIRQ, |
237 | pcmcia_request_irq(link, &link->irq)); | 221 | pcmcia_request_irq(link, &link->irq)); |
238 | else | 222 | else |
239 | goto cs_failed; | 223 | goto failed; |
240 | 224 | ||
241 | CS_CHECK(RequestConfiguration, | 225 | CS_CHECK(RequestConfiguration, |
242 | pcmcia_request_configuration(link, &link->conf)); | 226 | pcmcia_request_configuration(link, &link->conf)); |
@@ -257,13 +241,12 @@ static int sl811_cs_config(struct pcmcia_device *link) | |||
257 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) | 241 | if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) |
258 | < 0) { | 242 | < 0) { |
259 | cs_failed: | 243 | cs_failed: |
260 | printk("sl811_cs_config failed\n"); | ||
261 | cs_error(link, last_fn, last_ret); | 244 | cs_error(link, last_fn, last_ret); |
245 | failed: | ||
246 | printk(KERN_WARNING "sl811_cs_config failed\n"); | ||
262 | sl811_cs_release(link); | 247 | sl811_cs_release(link); |
263 | kfree(cfg_mem); | ||
264 | return -ENODEV; | 248 | return -ENODEV; |
265 | } | 249 | } |
266 | kfree(cfg_mem); | ||
267 | return 0; | 250 | return 0; |
268 | } | 251 | } |
269 | 252 | ||