aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax
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/isdn/hisax
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/isdn/hisax')
-rw-r--r--drivers/isdn/hisax/avma1_cs.c1
-rw-r--r--drivers/isdn/hisax/elsa_cs.c1
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c42
-rw-r--r--drivers/isdn/hisax/teles_cs.c1
4 files changed, 19 insertions, 26 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 7ce1aabb0aeb..8fd3ca0fb93a 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -177,6 +177,7 @@ static void avma1cs_detach(struct pcmcia_device *link)
177static int avma1cs_configcheck(struct pcmcia_device *p_dev, 177static int avma1cs_configcheck(struct pcmcia_device *p_dev,
178 cistpl_cftable_entry_t *cf, 178 cistpl_cftable_entry_t *cf,
179 cistpl_cftable_entry_t *dflt, 179 cistpl_cftable_entry_t *dflt,
180 unsigned int vcc,
180 void *priv_data) 181 void *priv_data)
181{ 182{
182 if (cf->io.nwin <= 0) 183 if (cf->io.nwin <= 0)
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 29c55b0b86b4..2bf0016dea5e 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -207,6 +207,7 @@ static void elsa_cs_detach(struct pcmcia_device *link)
207static int elsa_cs_configcheck(struct pcmcia_device *p_dev, 207static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
208 cistpl_cftable_entry_t *cf, 208 cistpl_cftable_entry_t *cf,
209 cistpl_cftable_entry_t *dflt, 209 cistpl_cftable_entry_t *dflt,
210 unsigned int vcc,
210 void *priv_data) 211 void *priv_data)
211{ 212{
212 int j; 213 int j;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 2746acbd8b70..9a3c9f5e4fe8 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -217,17 +217,13 @@ static void sedlbauer_detach(struct pcmcia_device *link)
217#define CS_CHECK(fn, ret) \ 217#define CS_CHECK(fn, ret) \
218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
219 219
220struct sedlbauer_config_data {
221 config_info_t conf;
222 win_req_t req;
223};
224
225static int sedlbauer_config_check(struct pcmcia_device *p_dev, 220static int sedlbauer_config_check(struct pcmcia_device *p_dev,
226 cistpl_cftable_entry_t *cfg, 221 cistpl_cftable_entry_t *cfg,
227 cistpl_cftable_entry_t *dflt, 222 cistpl_cftable_entry_t *dflt,
223 unsigned int vcc,
228 void *priv_data) 224 void *priv_data)
229{ 225{
230 struct sedlbauer_config_data *cfg_mem = priv_data; 226 win_req_t *req = priv_data;
231 227
232 if (cfg->index == 0) 228 if (cfg->index == 0)
233 return -ENODEV; 229 return -ENODEV;
@@ -241,12 +237,10 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
241 /* Use power settings for Vcc and Vpp if present */ 237 /* Use power settings for Vcc and Vpp if present */
242 /* Note that the CIS values need to be rescaled */ 238 /* Note that the CIS values need to be rescaled */
243 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 239 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
244 if (cfg_mem->conf.Vcc != 240 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
245 cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
246 return -ENODEV; 241 return -ENODEV;
247 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { 242 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
248 if (cfg_mem->conf.Vcc != 243 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
249 dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
250 return -ENODEV; 244 return -ENODEV;
251 } 245 }
252 246
@@ -294,12 +288,12 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
294 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 288 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
295 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 289 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
296 memreq_t map; 290 memreq_t map;
297 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 291 req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
298 cfg_mem->req.Attributes |= WIN_ENABLE; 292 req->Attributes |= WIN_ENABLE;
299 cfg_mem->req.Base = mem->win[0].host_addr; 293 req->Base = mem->win[0].host_addr;
300 cfg_mem->req.Size = mem->win[0].len; 294 req->Size = mem->win[0].len;
301 cfg_mem->req.AccessSpeed = 0; 295 req->AccessSpeed = 0;
302 if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) 296 if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0)
303 return -ENODEV; 297 return -ENODEV;
304 map.Page = 0; 298 map.Page = 0;
305 map.CardOffset = mem->win[0].card_addr; 299 map.CardOffset = mem->win[0].card_addr;
@@ -314,20 +308,16 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
314static int sedlbauer_config(struct pcmcia_device *link) 308static int sedlbauer_config(struct pcmcia_device *link)
315{ 309{
316 local_info_t *dev = link->priv; 310 local_info_t *dev = link->priv;
317 struct sedlbauer_config_data *cfg_mem; 311 win_req_t *req;
318 int last_fn, last_ret; 312 int last_fn, last_ret;
319 IsdnCard_t icard; 313 IsdnCard_t icard;
320 314
321 DEBUG(0, "sedlbauer_config(0x%p)\n", link); 315 DEBUG(0, "sedlbauer_config(0x%p)\n", link);
322 316
323 cfg_mem = kzalloc(sizeof(struct sedlbauer_config_data), GFP_KERNEL); 317 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
324 if (!cfg_mem) 318 if (!req)
325 return -ENOMEM; 319 return -ENOMEM;
326 320
327 /* Look up the current Vcc */
328 CS_CHECK(GetConfigurationInfo,
329 pcmcia_get_configuration_info(link, &cfg_mem->conf));
330
331 /* 321 /*
332 In this loop, we scan the CIS for configuration table entries, 322 In this loop, we scan the CIS for configuration table entries,
333 each of which describes a valid card configuration, including 323 each of which describes a valid card configuration, including
@@ -340,7 +330,7 @@ static int sedlbauer_config(struct pcmcia_device *link)
340 these things without consulting the CIS, and most client drivers 330 these things without consulting the CIS, and most client drivers
341 will only use the CIS to fill in implementation-defined details. 331 will only use the CIS to fill in implementation-defined details.
342 */ 332 */
343 last_ret = pcmcia_loop_config(link, sedlbauer_config_check, cfg_mem); 333 last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req);
344 if (last_ret) 334 if (last_ret)
345 goto failed; 335 goto failed;
346 336
@@ -381,8 +371,8 @@ static int sedlbauer_config(struct pcmcia_device *link)
381 printk(" & 0x%04x-0x%04x", link->io.BasePort2, 371 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
382 link->io.BasePort2+link->io.NumPorts2-1); 372 link->io.BasePort2+link->io.NumPorts2-1);
383 if (link->win) 373 if (link->win)
384 printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 374 printk(", mem 0x%06lx-0x%06lx", req->Base,
385 cfg_mem->req.Base+cfg_mem->req.Size-1); 375 req->Base+req->Size-1);
386 printk("\n"); 376 printk("\n");
387 377
388 icard.para[0] = link->irq.AssignedIRQ; 378 icard.para[0] = link->irq.AssignedIRQ;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index f4f2e2231a9b..21cabd0aadbe 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -197,6 +197,7 @@ static void teles_detach(struct pcmcia_device *link)
197static int teles_cs_configcheck(struct pcmcia_device *p_dev, 197static int teles_cs_configcheck(struct pcmcia_device *p_dev,
198 cistpl_cftable_entry_t *cf, 198 cistpl_cftable_entry_t *cf,
199 cistpl_cftable_entry_t *dflt, 199 cistpl_cftable_entry_t *dflt,
200 unsigned int vcc,
200 void *priv_data) 201 void *priv_data)
201{ 202{
202 int j; 203 int j;