aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport
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 /drivers/parport
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>
Diffstat (limited to 'drivers/parport')
-rw-r--r--drivers/parport/parport_cs.c12
1 files changed, 3 insertions, 9 deletions
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;