aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/fdomain_stub.c
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/scsi/pcmcia/fdomain_stub.c
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/scsi/pcmcia/fdomain_stub.c')
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index d8b99351b053..06254f46a0dd 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -123,34 +123,30 @@ static void fdomain_detach(struct pcmcia_device *link)
123#define CS_CHECK(fn, ret) \ 123#define CS_CHECK(fn, ret) \
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,
127 cistpl_cftable_entry_t *cfg,
128 cistpl_cftable_entry_t *dflt,
129 unsigned int vcc,
130 void *priv_data)
131{
132 p_dev->io.BasePort1 = cfg->io.win[0].base;
133 return pcmcia_request_io(p_dev, &p_dev->io);
134}
135
136
126static int fdomain_config(struct pcmcia_device *link) 137static int fdomain_config(struct pcmcia_device *link)
127{ 138{
128 scsi_info_t *info = link->priv; 139 scsi_info_t *info = link->priv;
129 tuple_t tuple; 140 int last_ret, last_fn;
130 cisparse_t parse;
131 int i, last_ret, last_fn;
132 u_char tuple_data[64];
133 char str[22]; 141 char str[22];
134 struct Scsi_Host *host; 142 struct Scsi_Host *host;
135 143
136 DEBUG(0, "fdomain_config(0x%p)\n", link); 144 DEBUG(0, "fdomain_config(0x%p)\n", link);
137 145
138 tuple.TupleData = tuple_data; 146 last_ret = pcmcia_loop_config(link, fdomain_config_check, NULL);
139 tuple.TupleDataMax = 64; 147 if (last_ret) {
140 tuple.TupleOffset = 0; 148 cs_error(link, RequestIO, last_ret);
141 149 goto failed;
142 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
143 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
144 while (1) {
145 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
146 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
147 goto next_entry;
148 link->conf.ConfigIndex = parse.cftable_entry.index;
149 link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
150 i = pcmcia_request_io(link, &link->io);
151 if (i == CS_SUCCESS) break;
152 next_entry:
153 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
154 } 150 }
155 151
156 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 152 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
@@ -181,6 +177,7 @@ static int fdomain_config(struct pcmcia_device *link)
181 177
182cs_failed: 178cs_failed:
183 cs_error(link, last_fn, last_ret); 179 cs_error(link, last_fn, last_ret);
180failed:
184 fdomain_release(link); 181 fdomain_release(link);
185 return -ENODEV; 182 return -ENODEV;
186} /* fdomain_config */ 183} /* fdomain_config */