diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-07-29 06:38:55 (GMT) |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-22 23:21:23 (GMT) |
commit | 0e6f9d2708409cd8e864cdb94edbe599872a19d1 (patch) | |
tree | 398f993c6a50996483e9b48285f4971fa72e6e4e /drivers/scsi/pcmcia/fdomain_stub.c | |
parent | ed58872aa33e16a0d5352080e47c65fa14e6ad1c (diff) | |
download | linux-fsl-qoriq-0e6f9d2708409cd8e864cdb94edbe599872a19d1.tar.xz |
pcmcia: use pcmcia_loop_config in scsi pcmcia drivers
Use the config loop helper in scsi pcmcia drivers.
CC: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
CC: linux-scsi@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia/fdomain_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index d8b9935..fefef7d 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -123,34 +123,29 @@ static void fdomain_detach(struct pcmcia_device *link) #define CS_CHECK(fn, ret) \ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) +static int fdomain_config_check(struct pcmcia_device *p_dev, + cistpl_cftable_entry_t *cfg, + void *priv_data) +{ + p_dev->conf.ConfigIndex = cfg->index; + p_dev->io.BasePort1 = cfg->io.win[0].base; + return pcmcia_request_io(p_dev, &p_dev->io); +} + + static int fdomain_config(struct pcmcia_device *link) { scsi_info_t *info = link->priv; - tuple_t tuple; - cisparse_t parse; - int i, last_ret, last_fn; - u_char tuple_data[64]; + int last_ret, last_fn; char str[22]; struct Scsi_Host *host; DEBUG(0, "fdomain_config(0x%p)\n", link); - tuple.TupleData = tuple_data; - tuple.TupleDataMax = 64; - tuple.TupleOffset = 0; - - tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); - while (1) { - if (pcmcia_get_tuple_data(link, &tuple) != 0 || - pcmcia_parse_tuple(link, &tuple, &parse) != 0) - goto next_entry; - link->conf.ConfigIndex = parse.cftable_entry.index; - link->io.BasePort1 = parse.cftable_entry.io.win[0].base; - i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) break; - next_entry: - CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); + last_ret = pcmcia_loop_config(link, fdomain_config_check, NULL); + if (last_ret) { + cs_error(link, RequestIO, last_ret); + goto failed; } CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); @@ -181,6 +176,7 @@ static int fdomain_config(struct pcmcia_device *link) cs_failed: cs_error(link, last_fn, last_ret); +failed: fdomain_release(link); return -ENODEV; } /* fdomain_config */ |