aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/ide-cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 10:12:00 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 19:22:52 -0400
commitad913c11928f51abb6174f165db8d8d205b22e21 (patch)
treea8542c846afb4950a12f46b16c1eacfa2280971a /drivers/ide/legacy/ide-cs.c
parent8e2fc39ddea7fe8c6798837da282db88a09af793 (diff)
pcmcia: pcmcia_config_loop() improvement by passing vcc
By passing the current Vcc setting to the pcmcia_config_loop callback function, we can remove pcmcia_get_configuration_info() calls from many drivers. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/ide/legacy/ide-cs.c')
-rw-r--r--drivers/ide/legacy/ide-cs.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index cc8eeaf80275..6472cd8231f7 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -221,7 +221,6 @@ out_release:
221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
222 222
223struct pcmcia_config_check { 223struct pcmcia_config_check {
224 config_info_t conf;
225 unsigned long ctl_base; 224 unsigned long ctl_base;
226 int skip_vcc; 225 int skip_vcc;
227 int is_kme; 226 int is_kme;
@@ -230,6 +229,7 @@ struct pcmcia_config_check {
230static int pcmcia_check_one_config(struct pcmcia_device *pdev, 229static int pcmcia_check_one_config(struct pcmcia_device *pdev,
231 cistpl_cftable_entry_t *cfg, 230 cistpl_cftable_entry_t *cfg,
232 cistpl_cftable_entry_t *dflt, 231 cistpl_cftable_entry_t *dflt,
232 unsigned int vcc,
233 void *priv_data) 233 void *priv_data)
234{ 234{
235 struct pcmcia_config_check *stk = priv_data; 235 struct pcmcia_config_check *stk = priv_data;
@@ -237,12 +237,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
237 /* Check for matching Vcc, unless we're desperate */ 237 /* Check for matching Vcc, unless we're desperate */
238 if (!stk->skip_vcc) { 238 if (!stk->skip_vcc) {
239 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 239 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
240 if (stk->conf.Vcc != 240 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
241 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
242 return -ENODEV; 241 return -ENODEV;
243 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { 242 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
244 if (stk->conf.Vcc != 243 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
245 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
246 return -ENODEV; 244 return -ENODEV;
247 } 245 }
248 } 246 }
@@ -298,10 +296,8 @@ static int ide_config(struct pcmcia_device *link)
298 if (!stk) 296 if (!stk)
299 goto err_mem; 297 goto err_mem;
300 stk->is_kme = is_kme; 298 stk->is_kme = is_kme;
301
302 /* Not sure if this is right... look up the current Vcc */
303 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
304 stk->skip_vcc = io_base = ctl_base = 0; 299 stk->skip_vcc = io_base = ctl_base = 0;
300
305 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { 301 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
306 stk->skip_vcc = 1; 302 stk->skip_vcc = 1;
307 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 303 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))