aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 09:30:31 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 19:22:00 -0400
commit8e2fc39ddea7fe8c6798837da282db88a09af793 (patch)
tree7cba37b5b86f4ff25562012a14e29424e3872de0
parent498ac1899b62626bf6879a251d75c22ec564c559 (diff)
pcmcia: pcmcia_config_loop() default CIS entry handling
Many drivers use the default CIS entry within their pcmcia_config_loop() callback function. Therefore, factor the default CIS entry handling out. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/ata/pata_pcmcia.c33
-rw-r--r--drivers/bluetooth/bt3c_cs.c2
-rw-r--r--drivers/bluetooth/btuart_cs.c2
-rw-r--r--drivers/bluetooth/dtl1_cs.c1
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c1
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c1
-rw-r--r--drivers/ide/legacy/ide-cs.c33
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c1
-rw-r--r--drivers/isdn/hisax/avma1_cs.c5
-rw-r--r--drivers/isdn/hisax/elsa_cs.c1
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c26
-rw-r--r--drivers/isdn/hisax/teles_cs.c1
-rw-r--r--drivers/net/pcmcia/axnet_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/wireless/airo_cs.c51
-rw-r--r--drivers/net/wireless/atmel_cs.c9
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c24
-rw-r--r--drivers/net/wireless/orinoco_cs.c18
-rw-r--r--drivers/net/wireless/spectrum_cs.c18
-rw-r--r--drivers/parport/parport_cs.c12
-rw-r--r--drivers/pcmcia/pcmcia_resource.c7
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c5
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c5
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c23
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c5
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c1
-rw-r--r--drivers/serial/serial_cs.c4
-rw-r--r--drivers/telephony/ixj_pcmcia.c8
-rw-r--r--drivers/usb/host/sl811_cs.c19
-rw-r--r--include/pcmcia/cistpl.h1
32 files changed, 158 insertions, 165 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 4b8bd2021a9c..20982065a494 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -151,7 +151,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
151 151
152struct pcmcia_config_check { 152struct pcmcia_config_check {
153 config_info_t conf; 153 config_info_t conf;
154 cistpl_cftable_entry_t dflt;
155 unsigned long ctl_base; 154 unsigned long ctl_base;
156 int skip_vcc; 155 int skip_vcc;
157 int is_kme; 156 int is_kme;
@@ -159,6 +158,7 @@ struct pcmcia_config_check {
159 158
160static int pcmcia_check_one_config(struct pcmcia_device *pdev, 159static int pcmcia_check_one_config(struct pcmcia_device *pdev,
161 cistpl_cftable_entry_t *cfg, 160 cistpl_cftable_entry_t *cfg,
161 cistpl_cftable_entry_t *dflt,
162 void *priv_data) 162 void *priv_data)
163{ 163{
164 struct pcmcia_config_check *stk = priv_data; 164 struct pcmcia_config_check *stk = priv_data;
@@ -166,21 +166,23 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
166 /* Check for matching Vcc, unless we're desperate */ 166 /* Check for matching Vcc, unless we're desperate */
167 if (!stk->skip_vcc) { 167 if (!stk->skip_vcc) {
168 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { 168 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
169 if (stk->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) 169 if (stk->conf.Vcc !=
170 goto next_entry; 170 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
171 } else if (stk->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 171 return -ENODEV;
172 if (stk->conf.Vcc != stk->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) 172 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
173 goto next_entry; 173 if (stk->conf.Vcc !=
174 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
175 return -ENODEV;
174 } 176 }
175 } 177 }
176 178
177 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 179 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
178 pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 180 pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
179 else if (stk->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 181 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
180 pdev->conf.Vpp = stk->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 182 pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
181 183
182 if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) { 184 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
183 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io; 185 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
184 pdev->io.BasePort1 = io->win[0].base; 186 pdev->io.BasePort1 = io->win[0].base;
185 pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 187 pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
186 if (!(io->flags & CISTPL_IO_16BIT)) 188 if (!(io->flags & CISTPL_IO_16BIT))
@@ -190,23 +192,19 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
190 pdev->io.BasePort2 = io->win[1].base; 192 pdev->io.BasePort2 = io->win[1].base;
191 pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; 193 pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
192 if (pcmcia_request_io(pdev, &pdev->io) != 0) 194 if (pcmcia_request_io(pdev, &pdev->io) != 0)
193 goto next_entry; 195 return -ENODEV;
194 stk->ctl_base = pdev->io.BasePort2; 196 stk->ctl_base = pdev->io.BasePort2;
195 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 197 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
196 pdev->io.NumPorts1 = io->win[0].len; 198 pdev->io.NumPorts1 = io->win[0].len;
197 pdev->io.NumPorts2 = 0; 199 pdev->io.NumPorts2 = 0;
198 if (pcmcia_request_io(pdev, &pdev->io) != 0) 200 if (pcmcia_request_io(pdev, &pdev->io) != 0)
199 goto next_entry; 201 return -ENODEV;
200 stk->ctl_base = pdev->io.BasePort1 + 0x0e; 202 stk->ctl_base = pdev->io.BasePort1 + 0x0e;
201 } else 203 } else
202 goto next_entry; 204 return -ENODEV;
203 /* If we've got this far, we're done */ 205 /* If we've got this far, we're done */
204 return 0; 206 return 0;
205 } 207 }
206next_entry:
207 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
208 memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
209
210 return -ENODEV; 208 return -ENODEV;
211} 209}
212 210
@@ -264,7 +262,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
264 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); 262 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf));
265 stk->skip_vcc = io_base = ctl_base = 0; 263 stk->skip_vcc = io_base = ctl_base = 0;
266 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { 264 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
267 memset(&stk->dflt, 0, sizeof(stk->dflt));
268 stk->skip_vcc = 1; 265 stk->skip_vcc = 1;
269 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) 266 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
270 goto failed; /* No suitable config found */ 267 goto failed; /* No suitable config found */
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 3436be152485..794a5ef9ea22 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -680,6 +680,7 @@ static void bt3c_detach(struct pcmcia_device *link)
680 680
681static int bt3c_check_config(struct pcmcia_device *p_dev, 681static int bt3c_check_config(struct pcmcia_device *p_dev,
682 cistpl_cftable_entry_t *cf, 682 cistpl_cftable_entry_t *cf,
683 cistpl_cftable_entry_t *dflt,
683 void *priv_data) 684 void *priv_data)
684{ 685{
685 unsigned long try = (unsigned long) priv_data; 686 unsigned long try = (unsigned long) priv_data;
@@ -699,6 +700,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
699 700
700static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, 701static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
701 cistpl_cftable_entry_t *cf, 702 cistpl_cftable_entry_t *cf,
703 cistpl_cftable_entry_t *dflt,
702 void *priv_data) 704 void *priv_data)
703{ 705{
704 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 706 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 5e31ea2f2d6f..32017f96067c 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -609,6 +609,7 @@ static void btuart_detach(struct pcmcia_device *link)
609 609
610static int btuart_check_config(struct pcmcia_device *p_dev, 610static int btuart_check_config(struct pcmcia_device *p_dev,
611 cistpl_cftable_entry_t *cf, 611 cistpl_cftable_entry_t *cf,
612 cistpl_cftable_entry_t *dflt,
612 void *priv_data) 613 void *priv_data)
613{ 614{
614 unsigned long try = (unsigned long) priv_data; 615 unsigned long try = (unsigned long) priv_data;
@@ -628,6 +629,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
628 629
629static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, 630static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
630 cistpl_cftable_entry_t *cf, 631 cistpl_cftable_entry_t *cf,
632 cistpl_cftable_entry_t *dflt,
631 void *priv_data) 633 void *priv_data)
632{ 634{
633 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 635 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 1846e2aa9d4a..1830ebd6ca7b 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -592,6 +592,7 @@ static void dtl1_detach(struct pcmcia_device *link)
592 592
593static int dtl1_confcheck(struct pcmcia_device *p_dev, 593static int dtl1_confcheck(struct pcmcia_device *p_dev,
594 cistpl_cftable_entry_t *cf, 594 cistpl_cftable_entry_t *cf,
595 cistpl_cftable_entry_t *dflt,
595 void *priv_data) 596 void *priv_data)
596{ 597{
597 if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { 598 if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 7eafd2f4dbb9..7785fbb4c0f6 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1761,6 +1761,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
1761 1761
1762static int cm4000_config_check(struct pcmcia_device *p_dev, 1762static int cm4000_config_check(struct pcmcia_device *p_dev,
1763 cistpl_cftable_entry_t *cfg, 1763 cistpl_cftable_entry_t *cfg,
1764 cistpl_cftable_entry_t *dflt,
1764 void *priv_data) 1765 void *priv_data)
1765{ 1766{
1766 if (!cfg->io.nwin) 1767 if (!cfg->io.nwin)
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 71ca8c474c89..468ddef916b3 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -528,6 +528,7 @@ static void cm4040_reader_release(struct pcmcia_device *link)
528 528
529static int cm4040_config_check(struct pcmcia_device *p_dev, 529static int cm4040_config_check(struct pcmcia_device *p_dev,
530 cistpl_cftable_entry_t *cfg, 530 cistpl_cftable_entry_t *cfg,
531 cistpl_cftable_entry_t *dflt,
531 void *priv_data) 532 void *priv_data)
532{ 533{
533 int rc; 534 int rc;
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 8580becf226a..cc8eeaf80275 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -222,7 +222,6 @@ do { 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; 224 config_info_t conf;
225 cistpl_cftable_entry_t dflt;
226 unsigned long ctl_base; 225 unsigned long ctl_base;
227 int skip_vcc; 226 int skip_vcc;
228 int is_kme; 227 int is_kme;
@@ -230,6 +229,7 @@ struct pcmcia_config_check {
230 229
231static int pcmcia_check_one_config(struct pcmcia_device *pdev, 230static int pcmcia_check_one_config(struct pcmcia_device *pdev,
232 cistpl_cftable_entry_t *cfg, 231 cistpl_cftable_entry_t *cfg,
232 cistpl_cftable_entry_t *dflt,
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,21 +237,23 @@ 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 != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) 240 if (stk->conf.Vcc !=
241 goto next_entry; 241 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
242 } else if (stk->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 242 return -ENODEV;
243 if (stk->conf.Vcc != stk->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) 243 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
244 goto next_entry; 244 if (stk->conf.Vcc !=
245 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
246 return -ENODEV;
245 } 247 }
246 } 248 }
247 249
248 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 250 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
249 pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 251 pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
250 else if (stk->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 252 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
251 pdev->conf.Vpp = stk->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 253 pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
252 254
253 if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) { 255 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
254 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io; 256 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
255 pdev->conf.ConfigIndex = cfg->index; 257 pdev->conf.ConfigIndex = cfg->index;
256 pdev->io.BasePort1 = io->win[0].base; 258 pdev->io.BasePort1 = io->win[0].base;
257 pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 259 pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
@@ -262,23 +264,19 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
262 pdev->io.BasePort2 = io->win[1].base; 264 pdev->io.BasePort2 = io->win[1].base;
263 pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; 265 pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
264 if (pcmcia_request_io(pdev, &pdev->io) != 0) 266 if (pcmcia_request_io(pdev, &pdev->io) != 0)
265 goto next_entry; 267 return -ENODEV;
266 stk->ctl_base = pdev->io.BasePort2; 268 stk->ctl_base = pdev->io.BasePort2;
267 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 269 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
268 pdev->io.NumPorts1 = io->win[0].len; 270 pdev->io.NumPorts1 = io->win[0].len;
269 pdev->io.NumPorts2 = 0; 271 pdev->io.NumPorts2 = 0;
270 if (pcmcia_request_io(pdev, &pdev->io) != 0) 272 if (pcmcia_request_io(pdev, &pdev->io) != 0)
271 goto next_entry; 273 return -ENODEV;
272 stk->ctl_base = pdev->io.BasePort1 + 0x0e; 274 stk->ctl_base = pdev->io.BasePort1 + 0x0e;
273 } else 275 } else
274 goto next_entry; 276 return -ENODEV;
275 /* If we've got this far, we're done */ 277 /* If we've got this far, we're done */
276 return 0; 278 return 0;
277 } 279 }
278next_entry:
279 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
280 memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
281
282 return -ENODEV; 280 return -ENODEV;
283} 281}
284 282
@@ -305,7 +303,6 @@ static int ide_config(struct pcmcia_device *link)
305 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); 303 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
306 stk->skip_vcc = io_base = ctl_base = 0; 304 stk->skip_vcc = io_base = ctl_base = 0;
307 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { 305 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
308 memset(&stk->dflt, 0, sizeof(stk->dflt));
309 stk->skip_vcc = 1; 306 stk->skip_vcc = 1;
310 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 307 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
311 goto failed; /* No suitable config found */ 308 goto failed; /* No suitable config found */
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 3569c68dc942..a8d6949338cd 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -156,6 +156,7 @@ static void avmcs_detach(struct pcmcia_device *link)
156 156
157static int avmcs_configcheck(struct pcmcia_device *p_dev, 157static int avmcs_configcheck(struct pcmcia_device *p_dev,
158 cistpl_cftable_entry_t *cf, 158 cistpl_cftable_entry_t *cf,
159 cistpl_cftable_entry_t *dflt,
159 void *priv_data) 160 void *priv_data)
160{ 161{
161 if (cf->io.nwin <= 0) 162 if (cf->io.nwin <= 0)
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 76164d6a3c89..7ce1aabb0aeb 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -175,8 +175,9 @@ static void avma1cs_detach(struct pcmcia_device *link)
175======================================================================*/ 175======================================================================*/
176 176
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 void *priv_data) 179 cistpl_cftable_entry_t *dflt,
180 void *priv_data)
180{ 181{
181 if (cf->io.nwin <= 0) 182 if (cf->io.nwin <= 0)
182 return -ENODEV; 183 return -ENODEV;
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index c9899e51a262..29c55b0b86b4 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -206,6 +206,7 @@ static void elsa_cs_detach(struct pcmcia_device *link)
206 206
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 void *priv_data) 210 void *priv_data)
210{ 211{
211 int j; 212 int j;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 2c611f91cfba..2746acbd8b70 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -218,19 +218,17 @@ static void sedlbauer_detach(struct pcmcia_device *link)
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 { 220struct sedlbauer_config_data {
221 cistpl_cftable_entry_t dflt;
222 config_info_t conf; 221 config_info_t conf;
223 win_req_t req; 222 win_req_t req;
224}; 223};
225 224
226static int sedlbauer_config_check(struct pcmcia_device *p_dev, 225static int sedlbauer_config_check(struct pcmcia_device *p_dev,
227 cistpl_cftable_entry_t *cfg, 226 cistpl_cftable_entry_t *cfg,
227 cistpl_cftable_entry_t *dflt,
228 void *priv_data) 228 void *priv_data)
229{ 229{
230 struct sedlbauer_config_data *cfg_mem = priv_data; 230 struct sedlbauer_config_data *cfg_mem = priv_data;
231 231
232 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
233 cfg_mem->dflt = *cfg;
234 if (cfg->index == 0) 232 if (cfg->index == 0)
235 return -ENODEV; 233 return -ENODEV;
236 234
@@ -243,26 +241,28 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
243 /* Use power settings for Vcc and Vpp if present */ 241 /* Use power settings for Vcc and Vpp if present */
244 /* Note that the CIS values need to be rescaled */ 242 /* Note that the CIS values need to be rescaled */
245 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 243 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
246 if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) 244 if (cfg_mem->conf.Vcc !=
245 cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
247 return -ENODEV; 246 return -ENODEV;
248 } else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { 247 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
249 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000) 248 if (cfg_mem->conf.Vcc !=
249 dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
250 return -ENODEV; 250 return -ENODEV;
251 } 251 }
252 252
253 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 253 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
254 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 254 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
255 else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 255 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
256 p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 256 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
257 257
258 /* Do we need to allocate an interrupt? */ 258 /* Do we need to allocate an interrupt? */
259 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 259 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
260 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 260 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
261 261
262 /* IO window settings */ 262 /* IO window settings */
263 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 263 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
264 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 264 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
265 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 265 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
266 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 266 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
267 if (!(io->flags & CISTPL_IO_8BIT)) 267 if (!(io->flags & CISTPL_IO_8BIT))
268 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 268 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
@@ -291,8 +291,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
291 needs to be mapped to virtual space with ioremap() before it 291 needs to be mapped to virtual space with ioremap() before it
292 is used. 292 is used.
293 */ 293 */
294 if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { 294 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
295 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; 295 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
296 memreq_t map; 296 memreq_t map;
297 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 297 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
298 cfg_mem->req.Attributes |= WIN_ENABLE; 298 cfg_mem->req.Attributes |= WIN_ENABLE;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ecb75ae8a399..f4f2e2231a9b 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -196,6 +196,7 @@ static void teles_detach(struct pcmcia_device *link)
196 196
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 void *priv_data) 200 void *priv_data)
200{ 201{
201 int j; 202 int j;
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 04ece0b77d1d..c99dc5d54d19 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -286,6 +286,7 @@ static int try_io_port(struct pcmcia_device *link)
286 286
287static int axnet_configcheck(struct pcmcia_device *p_dev, 287static int axnet_configcheck(struct pcmcia_device *p_dev,
288 cistpl_cftable_entry_t *cfg, 288 cistpl_cftable_entry_t *cfg,
289 cistpl_cftable_entry_t *dflt,
289 void *priv_data) 290 void *priv_data)
290{ 291{
291 int i; 292 int i;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index a60608722495..10fc537804b0 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -514,6 +514,7 @@ static int try_io_port(struct pcmcia_device *link)
514 514
515static int pcnet_confcheck(struct pcmcia_device *p_dev, 515static int pcnet_confcheck(struct pcmcia_device *p_dev,
516 cistpl_cftable_entry_t *cfg, 516 cistpl_cftable_entry_t *cfg,
517 cistpl_cftable_entry_t *dflt,
517 void *priv_data) 518 void *priv_data)
518{ 519{
519 int *has_shmem = priv_data; 520 int *has_shmem = priv_data;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 1e595038a492..05bca83c5e27 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -461,6 +461,7 @@ static int mhz_3288_power(struct pcmcia_device *link)
461 461
462static int mhz_mfc_config_check(struct pcmcia_device *p_dev, 462static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
463 cistpl_cftable_entry_t *cf, 463 cistpl_cftable_entry_t *cf,
464 cistpl_cftable_entry_t *dflt,
464 void *priv_data) 465 void *priv_data)
465{ 466{
466 int k; 467 int k;
@@ -651,6 +652,7 @@ static int mot_setup(struct pcmcia_device *link)
651 652
652static int smc_configcheck(struct pcmcia_device *p_dev, 653static int smc_configcheck(struct pcmcia_device *p_dev,
653 cistpl_cftable_entry_t *cf, 654 cistpl_cftable_entry_t *cf,
655 cistpl_cftable_entry_t *dflt,
654 void *priv_data) 656 void *priv_data)
655{ 657{
656 p_dev->io.BasePort1 = cf->io.win[0].base; 658 p_dev->io.BasePort1 = cf->io.win[0].base;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index b0de704f229c..a16efa49b855 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -718,6 +718,7 @@ has_ce2_string(struct pcmcia_device * p_dev)
718static int 718static int
719xirc2ps_config_modem(struct pcmcia_device *p_dev, 719xirc2ps_config_modem(struct pcmcia_device *p_dev,
720 cistpl_cftable_entry_t *cf, 720 cistpl_cftable_entry_t *cf,
721 cistpl_cftable_entry_t *dflt,
721 void *priv_data) 722 void *priv_data)
722{ 723{
723 unsigned int ioaddr; 724 unsigned int ioaddr;
@@ -736,6 +737,7 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev,
736static int 737static int
737xirc2ps_config_check(struct pcmcia_device *p_dev, 738xirc2ps_config_check(struct pcmcia_device *p_dev,
738 cistpl_cftable_entry_t *cf, 739 cistpl_cftable_entry_t *cf,
740 cistpl_cftable_entry_t *dflt,
739 void *priv_data) 741 void *priv_data)
740{ 742{
741 int *pass = priv_data; 743 int *pass = priv_data;
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index d7216730f18e..657adf85ab77 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -206,19 +206,12 @@ static void airo_detach(struct pcmcia_device *link)
206#define CS_CHECK(fn, ret) \ 206#define CS_CHECK(fn, ret) \
207do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 207do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
208 208
209struct airo_cs_config_data {
210 cistpl_cftable_entry_t dflt;
211 win_req_t req;
212};
213
214static int airo_cs_config_check(struct pcmcia_device *p_dev, 209static int airo_cs_config_check(struct pcmcia_device *p_dev,
215 cistpl_cftable_entry_t *cfg, 210 cistpl_cftable_entry_t *cfg,
211 cistpl_cftable_entry_t *dflt,
216 void *priv_data) 212 void *priv_data)
217{ 213{
218 struct airo_cs_config_data *cfg_mem = priv_data; 214 win_req_t *req = priv_data;
219
220 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
221 cfg_mem->dflt = *cfg;
222 215
223 if (cfg->index == 0) 216 if (cfg->index == 0)
224 return -ENODEV; 217 return -ENODEV;
@@ -233,17 +226,17 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
233 /* Note that the CIS values need to be rescaled */ 226 /* Note that the CIS values need to be rescaled */
234 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 227 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
235 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 228 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
236 else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 229 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
237 p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 230 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
238 231
239 /* Do we need to allocate an interrupt? */ 232 /* Do we need to allocate an interrupt? */
240 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 233 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
241 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 234 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
242 235
243 /* IO window settings */ 236 /* IO window settings */
244 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 237 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
245 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 238 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
246 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 239 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
247 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 240 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
248 if (!(io->flags & CISTPL_IO_8BIT)) 241 if (!(io->flags & CISTPL_IO_8BIT))
249 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 242 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
@@ -273,14 +266,14 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
273 needs to be mapped to virtual space with ioremap() before it 266 needs to be mapped to virtual space with ioremap() before it
274 is used. 267 is used.
275 */ 268 */
276 if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { 269 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
277 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; 270 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
278 memreq_t map; 271 memreq_t map;
279 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 272 req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
280 cfg_mem->req.Base = mem->win[0].host_addr; 273 req->Base = mem->win[0].host_addr;
281 cfg_mem->req.Size = mem->win[0].len; 274 req->Size = mem->win[0].len;
282 cfg_mem->req.AccessSpeed = 0; 275 req->AccessSpeed = 0;
283 if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) 276 if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0)
284 return -ENODEV; 277 return -ENODEV;
285 map.Page = 0; 278 map.Page = 0;
286 map.CardOffset = mem->win[0].card_addr; 279 map.CardOffset = mem->win[0].card_addr;
@@ -295,15 +288,15 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
295static int airo_config(struct pcmcia_device *link) 288static int airo_config(struct pcmcia_device *link)
296{ 289{
297 local_info_t *dev; 290 local_info_t *dev;
298 struct airo_cs_config_data *cfg_mem; 291 win_req_t *req;
299 int last_fn, last_ret; 292 int last_fn, last_ret;
300 293
301 dev = link->priv; 294 dev = link->priv;
302 295
303 DEBUG(0, "airo_config(0x%p)\n", link); 296 DEBUG(0, "airo_config(0x%p)\n", link);
304 297
305 cfg_mem = kzalloc(sizeof(struct airo_cs_config_data), GFP_KERNEL); 298 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
306 if (!cfg_mem) 299 if (!req)
307 return -ENOMEM; 300 return -ENOMEM;
308 301
309 /* 302 /*
@@ -320,7 +313,7 @@ static int airo_config(struct pcmcia_device *link)
320 * and most client drivers will only use the CIS to fill in 313 * and most client drivers will only use the CIS to fill in
321 * implementation-defined details. 314 * implementation-defined details.
322 */ 315 */
323 last_ret = pcmcia_loop_config(link, airo_cs_config_check, cfg_mem); 316 last_ret = pcmcia_loop_config(link, airo_cs_config_check, req);
324 if (last_ret) 317 if (last_ret)
325 goto failed; 318 goto failed;
326 319
@@ -365,17 +358,17 @@ static int airo_config(struct pcmcia_device *link)
365 printk(" & 0x%04x-0x%04x", link->io.BasePort2, 358 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
366 link->io.BasePort2+link->io.NumPorts2-1); 359 link->io.BasePort2+link->io.NumPorts2-1);
367 if (link->win) 360 if (link->win)
368 printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, 361 printk(", mem 0x%06lx-0x%06lx", req->Base,
369 cfg_mem->req.Base+cfg_mem->req.Size-1); 362 req->Base+req->Size-1);
370 printk("\n"); 363 printk("\n");
371 kfree(cfg_mem); 364 kfree(req);
372 return 0; 365 return 0;
373 366
374 cs_failed: 367 cs_failed:
375 cs_error(link, last_fn, last_ret); 368 cs_error(link, last_fn, last_ret);
376 failed: 369 failed:
377 airo_release(link); 370 airo_release(link);
378 kfree(cfg_mem); 371 kfree(req);
379 return -ENODEV; 372 return -ENODEV;
380} /* airo_config */ 373} /* airo_config */
381 374
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 12efd44d64a1..c71aae992ecc 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -226,14 +226,12 @@ static int card_present(void *arg)
226 226
227static int atmel_config_check(struct pcmcia_device *p_dev, 227static int atmel_config_check(struct pcmcia_device *p_dev,
228 cistpl_cftable_entry_t *cfg, 228 cistpl_cftable_entry_t *cfg,
229 cistpl_cftable_entry_t *dflt,
229 void *priv_data) 230 void *priv_data)
230{ 231{
231 cistpl_cftable_entry_t *dflt = priv_data;
232
233 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
234 *dflt = *cfg;
235 if (cfg->index == 0) 232 if (cfg->index == 0)
236 return -ENODEV; 233 return -ENODEV;
234
237 /* Does this card need audio output? */ 235 /* Does this card need audio output? */
238 if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 236 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
239 p_dev->conf.Attributes |= CONF_ENABLE_SPKR; 237 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
@@ -278,7 +276,6 @@ static int atmel_config(struct pcmcia_device *link)
278 local_info_t *dev; 276 local_info_t *dev;
279 int last_fn, last_ret; 277 int last_fn, last_ret;
280 struct pcmcia_device_id *did; 278 struct pcmcia_device_id *did;
281 cistpl_cftable_entry_t dflt = { 0 };
282 279
283 dev = link->priv; 280 dev = link->priv;
284 did = handle_to_dev(link).driver_data; 281 did = handle_to_dev(link).driver_data;
@@ -297,7 +294,7 @@ static int atmel_config(struct pcmcia_device *link)
297 these things without consulting the CIS, and most client drivers 294 these things without consulting the CIS, and most client drivers
298 will only use the CIS to fill in implementation-defined details. 295 will only use the CIS to fill in implementation-defined details.
299 */ 296 */
300 if (pcmcia_loop_config(link, atmel_config_check, &dflt)) 297 if (pcmcia_loop_config(link, atmel_config_check, NULL))
301 goto failed; 298 goto failed;
302 299
303 /* 300 /*
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 2abaa90b799d..f9595ca71a06 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -537,23 +537,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
537 * socket and make the device available to the system */ 537 * socket and make the device available to the system */
538 538
539struct prism2_config_data { 539struct prism2_config_data {
540 cistpl_cftable_entry_t dflt;
541 config_info_t conf; 540 config_info_t conf;
542}; 541};
543 542
544static int prism2_config_check(struct pcmcia_device *p_dev, 543static int prism2_config_check(struct pcmcia_device *p_dev,
545 cistpl_cftable_entry_t *cfg, 544 cistpl_cftable_entry_t *cfg,
545 cistpl_cftable_entry_t *dflt,
546 void *priv_data) 546 void *priv_data)
547{ 547{
548 struct prism2_config_data *cfg_mem = priv_data; 548 struct prism2_config_data *cfg_mem = priv_data;
549 549
550 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
551 cfg_mem->dflt = *cfg;
552 if (cfg->index == 0) 550 if (cfg->index == 0)
553 return -ENODEV; 551 return -ENODEV;
554 552
555 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " 553 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
556 "(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index); 554 "(default 0x%02X)\n", cfg->index, dflt->index);
557 555
558 /* Does this card need audio output? */ 556 /* Does this card need audio output? */
559 if (cfg->flags & CISTPL_CFTABLE_AUDIO) { 557 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
@@ -570,8 +568,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
570 " this entry\n"); 568 " this entry\n");
571 return -ENODEV; 569 return -ENODEV;
572 } 570 }
573 } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 571 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
574 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 572 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
575 10000 && !ignore_cis_vcc) { 573 10000 && !ignore_cis_vcc) {
576 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " 574 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
577 "- skipping this entry\n"); 575 "- skipping this entry\n");
@@ -581,11 +579,11 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
581 579
582 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 580 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
583 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 581 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
584 else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 582 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
585 p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 583 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
586 584
587 /* Do we need to allocate an interrupt? */ 585 /* Do we need to allocate an interrupt? */
588 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 586 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
589 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 587 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
590 else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) { 588 else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) {
591 /* At least Compaq WL200 does not have IRQInfo1 set, 589 /* At least Compaq WL200 does not have IRQInfo1 set,
@@ -597,11 +595,11 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
597 595
598 /* IO window settings */ 596 /* IO window settings */
599 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " 597 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
600 "cfg_mem->dflt.io.nwin=%d\n", 598 "dflt->io.nwin=%d\n",
601 cfg->io.nwin, cfg_mem->dflt.io.nwin); 599 cfg->io.nwin, dflt->io.nwin);
602 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 600 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
603 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 601 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
604 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 602 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
605 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 603 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
606 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " 604 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
607 "io.base=0x%04x, len=%d\n", io->flags, 605 "io.base=0x%04x, len=%d\n", io->flags,
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 67a172dfb2db..8a367f96db37 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -165,18 +165,16 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
165 } while (0) 165 } while (0)
166 166
167struct orinoco_cs_config_data { 167struct orinoco_cs_config_data {
168 cistpl_cftable_entry_t dflt;
169 config_info_t conf; 168 config_info_t conf;
170}; 169};
171 170
172static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 171static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
173 cistpl_cftable_entry_t *cfg, 172 cistpl_cftable_entry_t *cfg,
173 cistpl_cftable_entry_t *dflt,
174 void *priv_data) 174 void *priv_data)
175{ 175{
176 struct orinoco_cs_config_data *cfg_mem = priv_data; 176 struct orinoco_cs_config_data *cfg_mem = priv_data;
177 177
178 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
179 cfg_mem->dflt = *cfg;
180 if (cfg->index == 0) 178 if (cfg->index == 0)
181 goto next_entry; 179 goto next_entry;
182 180
@@ -188,9 +186,9 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
188 if (!ignore_cis_vcc) 186 if (!ignore_cis_vcc)
189 goto next_entry; 187 goto next_entry;
190 } 188 }
191 } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 189 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
192 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { 190 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
193 DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); 191 DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
194 if (!ignore_cis_vcc) 192 if (!ignore_cis_vcc)
195 goto next_entry; 193 goto next_entry;
196 } 194 }
@@ -199,17 +197,17 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
199 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 197 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
200 p_dev->conf.Vpp = 198 p_dev->conf.Vpp =
201 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 199 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
202 else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 200 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
203 p_dev->conf.Vpp = 201 p_dev->conf.Vpp =
204 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 202 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
205 203
206 /* Do we need to allocate an interrupt? */ 204 /* Do we need to allocate an interrupt? */
207 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 205 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
208 206
209 /* IO window settings */ 207 /* IO window settings */
210 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 208 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
211 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 209 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
212 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 210 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
213 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 211 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
214 if (!(io->flags & CISTPL_IO_8BIT)) 212 if (!(io->flags & CISTPL_IO_8BIT))
215 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 213 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 7536aa91dad7..e28878dfaba3 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -634,18 +634,16 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
634 */ 634 */
635 635
636struct spectrum_cs_config_data { 636struct spectrum_cs_config_data {
637 cistpl_cftable_entry_t dflt;
638 config_info_t conf; 637 config_info_t conf;
639}; 638};
640 639
641static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 640static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
642 cistpl_cftable_entry_t *cfg, 641 cistpl_cftable_entry_t *cfg,
642 cistpl_cftable_entry_t *dflt,
643 void *priv_data) 643 void *priv_data)
644{ 644{
645 struct spectrum_cs_config_data *cfg_mem = priv_data; 645 struct spectrum_cs_config_data *cfg_mem = priv_data;
646 646
647 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
648 cfg_mem->dflt = *cfg;
649 if (cfg->index == 0) 647 if (cfg->index == 0)
650 goto next_entry; 648 goto next_entry;
651 649
@@ -657,9 +655,9 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
657 if (!ignore_cis_vcc) 655 if (!ignore_cis_vcc)
658 goto next_entry; 656 goto next_entry;
659 } 657 }
660 } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { 658 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
661 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { 659 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
662 DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); 660 DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
663 if (!ignore_cis_vcc) 661 if (!ignore_cis_vcc)
664 goto next_entry; 662 goto next_entry;
665 } 663 }
@@ -668,17 +666,17 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
668 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 666 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
669 p_dev->conf.Vpp = 667 p_dev->conf.Vpp =
670 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 668 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
671 else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) 669 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
672 p_dev->conf.Vpp = 670 p_dev->conf.Vpp =
673 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 671 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
674 672
675 /* Do we need to allocate an interrupt? */ 673 /* Do we need to allocate an interrupt? */
676 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 674 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
677 675
678 /* IO window settings */ 676 /* IO window settings */
679 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 677 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
680 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 678 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
681 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 679 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
682 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 680 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
683 if (!(io->flags & CISTPL_IO_8BIT)) 681 if (!(io->flags & CISTPL_IO_8BIT))
684 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 682 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 814c5252d703..05f34e73694b 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -151,9 +151,9 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
151 151
152static int parport_config_check(struct pcmcia_device *p_dev, 152static int parport_config_check(struct pcmcia_device *p_dev,
153 cistpl_cftable_entry_t *cfg, 153 cistpl_cftable_entry_t *cfg,
154 cistpl_cftable_entry_t *dflt,
154 void *priv_data) 155 void *priv_data)
155{ 156{
156 cistpl_cftable_entry_t *dflt = priv_data;
157 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 157 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
158 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 158 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
159 if (epp_mode) 159 if (epp_mode)
@@ -166,26 +166,20 @@ static int parport_config_check(struct pcmcia_device *p_dev,
166 p_dev->io.NumPorts2 = io->win[1].len; 166 p_dev->io.NumPorts2 = io->win[1].len;
167 } 167 }
168 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 168 if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
169 goto next_entry; 169 return -ENODEV;
170 return 0; 170 return 0;
171 } 171 }
172
173next_entry:
174 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
175 *dflt = *cfg;
176 return -ENODEV;
177} 172}
178 173
179static int parport_config(struct pcmcia_device *link) 174static int parport_config(struct pcmcia_device *link)
180{ 175{
181 parport_info_t *info = link->priv; 176 parport_info_t *info = link->priv;
182 cistpl_cftable_entry_t dflt = { 0 };
183 struct parport *p; 177 struct parport *p;
184 int last_ret, last_fn; 178 int last_ret, last_fn;
185 179
186 DEBUG(0, "parport_config(0x%p)\n", link); 180 DEBUG(0, "parport_config(0x%p)\n", link);
187 181
188 last_ret = pcmcia_loop_config(link, parport_config_check, &dflt); 182 last_ret = pcmcia_loop_config(link, parport_config_check, NULL);
189 if (last_ret) { 183 if (last_ret) {
190 cs_error(link, RequestIO, last_ret); 184 cs_error(link, RequestIO, last_ret);
191 goto failed; 185 goto failed;
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index ba34ac8876ff..5ddfd46dea65 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -915,6 +915,7 @@ struct pcmcia_cfg_mem {
915 tuple_t tuple; 915 tuple_t tuple;
916 cisparse_t parse; 916 cisparse_t parse;
917 u8 buf[256]; 917 u8 buf[256];
918 cistpl_cftable_entry_t dflt;
918}; 919};
919 920
920/** 921/**
@@ -933,10 +934,12 @@ struct pcmcia_cfg_mem {
933int pcmcia_loop_config(struct pcmcia_device *p_dev, 934int pcmcia_loop_config(struct pcmcia_device *p_dev,
934 int (*conf_check) (struct pcmcia_device *p_dev, 935 int (*conf_check) (struct pcmcia_device *p_dev,
935 cistpl_cftable_entry_t *cfg, 936 cistpl_cftable_entry_t *cfg,
937 cistpl_cftable_entry_t *dflt,
936 void *priv_data), 938 void *priv_data),
937 void *priv_data) 939 void *priv_data)
938{ 940{
939 struct pcmcia_cfg_mem *cfg_mem; 941 struct pcmcia_cfg_mem *cfg_mem;
942
940 tuple_t *tuple; 943 tuple_t *tuple;
941 int ret = -ENODEV; 944 int ret = -ENODEV;
942 945
@@ -963,8 +966,10 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
963 966
964 /* default values */ 967 /* default values */
965 p_dev->conf.ConfigIndex = cfg->index; 968 p_dev->conf.ConfigIndex = cfg->index;
969 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
970 cfg_mem->dflt = *cfg;
966 971
967 ret = conf_check(p_dev, cfg, priv_data); 972 ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data);
968 if (!ret) 973 if (!ret)
969 break; 974 break;
970 975
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 5e4d8e42ba0b..2ed3077b826a 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -141,8 +141,9 @@ static void aha152x_detach(struct pcmcia_device *link)
141do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 141do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
142 142
143static int aha152x_config_check(struct pcmcia_device *p_dev, 143static int aha152x_config_check(struct pcmcia_device *p_dev,
144 cistpl_cftable_entry_t *cfg, 144 cistpl_cftable_entry_t *cfg,
145 void *priv_data) 145 cistpl_cftable_entry_t *dflt,
146 void *priv_data)
146{ 147{
147 /* For New Media T&J, look for a SCSI window */ 148 /* For New Media T&J, look for a SCSI window */
148 if (cfg->io.win[0].len >= 0x20) 149 if (cfg->io.win[0].len >= 0x20)
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index e3d6937c9200..2b6e92d7be07 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -124,8 +124,9 @@ static void fdomain_detach(struct pcmcia_device *link)
124do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 124do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
125 125
126static int fdomain_config_check(struct pcmcia_device *p_dev, 126static int fdomain_config_check(struct pcmcia_device *p_dev,
127 cistpl_cftable_entry_t *cfg, 127 cistpl_cftable_entry_t *cfg,
128 void *priv_data) 128 cistpl_cftable_entry_t *dflt,
129 void *priv_data)
129{ 130{
130 p_dev->io.BasePort1 = cfg->io.win[0].base; 131 p_dev->io.BasePort1 = cfg->io.win[0].base;
131 return pcmcia_request_io(p_dev, &p_dev->io); 132 return pcmcia_request_io(p_dev, &p_dev->io);
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index aee24b745dc9..aa4523462578 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1612,17 +1612,15 @@ struct nsp_cs_configdata {
1612 nsp_hw_data *data; 1612 nsp_hw_data *data;
1613 win_req_t req; 1613 win_req_t req;
1614 config_info_t conf; 1614 config_info_t conf;
1615 cistpl_cftable_entry_t dflt;
1616}; 1615};
1617 1616
1618static int nsp_cs_config_check(struct pcmcia_device *p_dev, 1617static int nsp_cs_config_check(struct pcmcia_device *p_dev,
1619 cistpl_cftable_entry_t *cfg, 1618 cistpl_cftable_entry_t *cfg,
1619 cistpl_cftable_entry_t *dflt,
1620 void *priv_data) 1620 void *priv_data)
1621{ 1621{
1622 struct nsp_cs_configdata *cfg_mem = priv_data; 1622 struct nsp_cs_configdata *cfg_mem = priv_data;
1623 1623
1624 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
1625 memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t));
1626 if (cfg->index == 0) 1624 if (cfg->index == 0)
1627 return -ENODEV; 1625 return -ENODEV;
1628 1626
@@ -1637,28 +1635,27 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
1637 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 1635 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
1638 if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) 1636 if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
1639 return -ENODEV; 1637 return -ENODEV;
1640 else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { 1638 else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
1641 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000) 1639 if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
1642 return -ENODEV; 1640 return -ENODEV;
1643 } 1641 }
1644 1642
1645 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { 1643 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
1646 p_dev->conf.Vpp = 1644 p_dev->conf.Vpp =
1647 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 1645 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
1648 } else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) { 1646 } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
1649 p_dev->conf.Vpp = 1647 p_dev->conf.Vpp =
1650 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; 1648 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
1651 } 1649 }
1652 1650
1653 /* Do we need to allocate an interrupt? */ 1651 /* Do we need to allocate an interrupt? */
1654 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) { 1652 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
1655 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 1653 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
1656 }
1657 1654
1658 /* IO window settings */ 1655 /* IO window settings */
1659 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 1656 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
1660 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 1657 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
1661 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 1658 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
1662 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 1659 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
1663 if (!(io->flags & CISTPL_IO_8BIT)) 1660 if (!(io->flags & CISTPL_IO_8BIT))
1664 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 1661 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
@@ -1677,10 +1674,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
1677 goto next_entry; 1674 goto next_entry;
1678 } 1675 }
1679 1676
1680 if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { 1677 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
1681 memreq_t map; 1678 memreq_t map;
1682 cistpl_mem_t *mem = 1679 cistpl_mem_t *mem =
1683 (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; 1680 (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
1684 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 1681 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
1685 cfg_mem->req.Attributes |= WIN_ENABLE; 1682 cfg_mem->req.Attributes |= WIN_ENABLE;
1686 cfg_mem->req.Base = mem->win[0].host_addr; 1683 cfg_mem->req.Base = mem->win[0].host_addr;
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index a361275b20a3..da6b3603198b 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -196,8 +196,9 @@ static void qlogic_detach(struct pcmcia_device *link)
196do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 196do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
197 197
198static int qlogic_config_check(struct pcmcia_device *p_dev, 198static int qlogic_config_check(struct pcmcia_device *p_dev,
199 cistpl_cftable_entry_t *cfg, 199 cistpl_cftable_entry_t *cfg,
200 void *priv_data) 200 cistpl_cftable_entry_t *dflt,
201 void *priv_data)
201{ 202{
202 p_dev->io.BasePort1 = cfg->io.win[0].base; 203 p_dev->io.BasePort1 = cfg->io.win[0].base;
203 p_dev->io.NumPorts1 = cfg->io.win[0].len; 204 p_dev->io.NumPorts1 = cfg->io.win[0].len;
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 23a5219051a9..eba193134dfa 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -702,6 +702,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
702 702
703static int SYM53C500_config_check(struct pcmcia_device *p_dev, 703static int SYM53C500_config_check(struct pcmcia_device *p_dev,
704 cistpl_cftable_entry_t *cfg, 704 cistpl_cftable_entry_t *cfg,
705 cistpl_cftable_entry_t *dflt,
705 void *priv_data) 706 void *priv_data)
706{ 707{
707 p_dev->io.BasePort1 = cfg->io.win[0].base; 708 p_dev->io.BasePort1 = cfg->io.win[0].base;
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 693738160010..f8658686439d 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -443,6 +443,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse)
443 443
444static int simple_config_check(struct pcmcia_device *p_dev, 444static int simple_config_check(struct pcmcia_device *p_dev,
445 cistpl_cftable_entry_t *cf, 445 cistpl_cftable_entry_t *cf,
446 cistpl_cftable_entry_t *dflt,
446 void *priv_data) 447 void *priv_data)
447{ 448{
448 static const int size_table[2] = { 8, 16 }; 449 static const int size_table[2] = { 8, 16 };
@@ -465,6 +466,7 @@ static int simple_config_check(struct pcmcia_device *p_dev,
465 466
466static int simple_config_check_notpicky(struct pcmcia_device *p_dev, 467static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
467 cistpl_cftable_entry_t *cf, 468 cistpl_cftable_entry_t *cf,
469 cistpl_cftable_entry_t *dflt,
468 void *priv_data) 470 void *priv_data)
469{ 471{
470 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 472 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
@@ -546,6 +548,7 @@ found_port:
546 548
547static int multi_config_check(struct pcmcia_device *p_dev, 549static int multi_config_check(struct pcmcia_device *p_dev,
548 cistpl_cftable_entry_t *cf, 550 cistpl_cftable_entry_t *cf,
551 cistpl_cftable_entry_t *dflt,
549 void *priv_data) 552 void *priv_data)
550{ 553{
551 int *base2 = priv_data; 554 int *base2 = priv_data;
@@ -565,6 +568,7 @@ static int multi_config_check(struct pcmcia_device *p_dev,
565 568
566static int multi_config_check_notpicky(struct pcmcia_device *p_dev, 569static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
567 cistpl_cftable_entry_t *cf, 570 cistpl_cftable_entry_t *cf,
571 cistpl_cftable_entry_t *dflt,
568 void *priv_data) 572 void *priv_data)
569{ 573{
570 int *base2 = priv_data; 574 int *base2 = priv_data;
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index ba2c7a2125a0..b41df211b786 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -126,10 +126,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j)
126 126
127static int ixj_config_check(struct pcmcia_device *p_dev, 127static int ixj_config_check(struct pcmcia_device *p_dev,
128 cistpl_cftable_entry_t *cfg, 128 cistpl_cftable_entry_t *cfg,
129 cistpl_cftable_entry_t *dflt,
129 void *priv_data) 130 void *priv_data)
130{ 131{
131 cistpl_cftable_entry_t *dflt = priv_data;
132
133 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 132 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
134 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 133 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
135 p_dev->io.BasePort1 = io->win[0].base; 134 p_dev->io.BasePort1 = io->win[0].base;
@@ -138,10 +137,7 @@ static int ixj_config_check(struct pcmcia_device *p_dev,
138 p_dev->io.BasePort2 = io->win[1].base; 137 p_dev->io.BasePort2 = io->win[1].base;
139 p_dev->io.NumPorts2 = io->win[1].len; 138 p_dev->io.NumPorts2 = io->win[1].len;
140 } 139 }
141 if (pcmcia_request_io(p_dev, &p_dev->io)) { 140 if (!pcmcia_request_io(p_dev, &p_dev->io))
142 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
143 *dflt = *cfg;
144 } else
145 return 0; 141 return 0;
146 } 142 }
147 return -ENODEV; 143 return -ENODEV;
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 5b55c72c710b..78cc32e7b014 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -156,19 +156,16 @@ static void sl811_cs_release(struct pcmcia_device * link)
156} 156}
157 157
158struct sl811_css_cfg { 158struct sl811_css_cfg {
159 cistpl_cftable_entry_t dflt;
160 config_info_t conf; 159 config_info_t conf;
161}; 160};
162 161
163static int sl811_cs_config_check(struct pcmcia_device *p_dev, 162static int sl811_cs_config_check(struct pcmcia_device *p_dev,
164 cistpl_cftable_entry_t *cfg, 163 cistpl_cftable_entry_t *cfg,
164 cistpl_cftable_entry_t *dflt,
165 void *priv_data) 165 void *priv_data)
166{ 166{
167 struct sl811_css_cfg *cfg_mem = priv_data; 167 struct sl811_css_cfg *cfg_mem = priv_data;
168 168
169 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
170 memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t));
171
172 if (cfg->index == 0) 169 if (cfg->index == 0)
173 return -ENODEV; 170 return -ENODEV;
174 171
@@ -178,8 +175,8 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
178 if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != 175 if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 !=
179 cfg_mem->conf.Vcc) 176 cfg_mem->conf.Vcc)
180 return -ENODEV; 177 return -ENODEV;
181 } else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { 178 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
182 if (cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000 179 if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000
183 != cfg_mem->conf.Vcc) 180 != cfg_mem->conf.Vcc)
184 return -ENODEV; 181 return -ENODEV;
185 } 182 }
@@ -187,18 +184,18 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
187 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 184 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
188 p_dev->conf.Vpp = 185 p_dev->conf.Vpp =
189 cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 186 cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
190 else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 187 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
191 p_dev->conf.Vpp = 188 p_dev->conf.Vpp =
192 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 189 dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
193 190
194 /* we need an interrupt */ 191 /* we need an interrupt */
195 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 192 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
196 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 193 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
197 194
198 /* IO window settings */ 195 /* IO window settings */
199 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 196 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
200 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 197 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
201 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 198 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
202 199
203 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 200 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
204 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 201 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h
index b2eb914a18df..0aa702705d00 100644
--- a/include/pcmcia/cistpl.h
+++ b/include/pcmcia/cistpl.h
@@ -616,6 +616,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
616int pcmcia_loop_config(struct pcmcia_device *p_dev, 616int pcmcia_loop_config(struct pcmcia_device *p_dev,
617 int (*conf_check) (struct pcmcia_device *p_dev, 617 int (*conf_check) (struct pcmcia_device *p_dev,
618 cistpl_cftable_entry_t *cf, 618 cistpl_cftable_entry_t *cf,
619 cistpl_cftable_entry_t *dflt,
619 void *priv_data), 620 void *priv_data),
620 void *priv_data); 621 void *priv_data);
621 622