aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
commit2be4ff2f084842839b041b793ed6237e8d1d315a (patch)
tree1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/parport
parentcf2fa66055d718ae13e62451bb546505f63906a2 (diff)
parenta45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits) pcmcia: ioctl-internal definitions pcmcia: cistpl header cleanup pcmcia: remove unused argument to pcmcia_parse_tuple() pcmcia: card services header cleanup pcmcia: device_id header cleanup pcmcia: encapsulate ioaddr_t pcmcia: cleanup device driver header file pcmcia: cleanup socket services header file pcmcia: merge ds_internal.h into cs_internal.h pcmcia: cleanup cs_internal.h pcmcia: cs_internal.h is internal pcmcia: use dev_printk for cs_error() pcmcia: remove CS_ error codes alltogether pcmcia: deprecate CS_BAD_TUPLE pcmcia: deprecate CS_BAD_ARGS pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE pcmcia: deprecate CS_NO_MORE_ITEMS pcmcia: deprecate CS_IN_USE pcmcia: deprecate CS_CONFIGURATION_LOCKED ... Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/parport')
-rw-r--r--drivers/parport/parport_cs.c70
1 files changed, 31 insertions, 39 deletions
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 00e1d9620f7c..b1899e9c1f65 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -149,52 +149,44 @@ static void parport_detach(struct pcmcia_device *link)
149#define CS_CHECK(fn, ret) \ 149#define CS_CHECK(fn, ret) \
150do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 150do { 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,
153 cistpl_cftable_entry_t *cfg,
154 cistpl_cftable_entry_t *dflt,
155 unsigned int vcc,
156 void *priv_data)
157{
158 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
159 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
160 if (epp_mode)
161 p_dev->conf.ConfigIndex |= FORCE_EPP_MODE;
162 p_dev->io.BasePort1 = io->win[0].base;
163 p_dev->io.NumPorts1 = io->win[0].len;
164 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
165 if (io->nwin == 2) {
166 p_dev->io.BasePort2 = io->win[1].base;
167 p_dev->io.NumPorts2 = io->win[1].len;
168 }
169 if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
170 return -ENODEV;
171 return 0;
172 }
173 return -ENODEV;
174}
175
152static int parport_config(struct pcmcia_device *link) 176static int parport_config(struct pcmcia_device *link)
153{ 177{
154 parport_info_t *info = link->priv; 178 parport_info_t *info = link->priv;
155 tuple_t tuple;
156 u_short buf[128];
157 cisparse_t parse;
158 cistpl_cftable_entry_t *cfg = &parse.cftable_entry;
159 cistpl_cftable_entry_t dflt = { 0 };
160 struct parport *p; 179 struct parport *p;
161 int last_ret, last_fn; 180 int last_ret, last_fn;
162 181
163 DEBUG(0, "parport_config(0x%p)\n", link); 182 DEBUG(0, "parport_config(0x%p)\n", link);
164 183
165 tuple.TupleData = (cisdata_t *)buf; 184 last_ret = pcmcia_loop_config(link, parport_config_check, NULL);
166 tuple.TupleOffset = 0; tuple.TupleDataMax = 255; 185 if (last_ret) {
167 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 186 cs_error(link, RequestIO, last_ret);
168 tuple.Attributes = 0; 187 goto failed;
169 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
170 while (1) {
171 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
172 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
173 goto next_entry;
174
175 if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
176 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
177 link->conf.ConfigIndex = cfg->index;
178 if (epp_mode)
179 link->conf.ConfigIndex |= FORCE_EPP_MODE;
180 link->io.BasePort1 = io->win[0].base;
181 link->io.NumPorts1 = io->win[0].len;
182 link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
183 if (io->nwin == 2) {
184 link->io.BasePort2 = io->win[1].base;
185 link->io.NumPorts2 = io->win[1].len;
186 }
187 if (pcmcia_request_io(link, &link->io) != 0)
188 goto next_entry;
189 /* If we've got this far, we're done */
190 break;
191 }
192
193 next_entry:
194 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
195 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
196 } 188 }
197 189
198 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 190 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
199 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 191 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
200 192