Commit fab88a83 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] CardServices removal for ide-cs

From: Arjan van de Ven <arjanv@redhat.com>
parent fbb3bc6f
...@@ -152,7 +152,7 @@ static dev_link_t *ide_attach(void) ...@@ -152,7 +152,7 @@ static dev_link_t *ide_attach(void)
client_reg.event_handler = &ide_event; client_reg.event_handler = &ide_event;
client_reg.Version = 0x0210; client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link; client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg); ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) { if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
ide_detach(link); ide_detach(link);
...@@ -188,7 +188,7 @@ static void ide_detach(dev_link_t *link) ...@@ -188,7 +188,7 @@ static void ide_detach(dev_link_t *link)
ide_release(link); ide_release(link);
if (link->handle) { if (link->handle) {
ret = CardServices(DeregisterClient, link->handle); ret = pcmcia_deregister_client(link->handle);
if (ret != CS_SUCCESS) if (ret != CS_SUCCESS)
cs_error(link->handle, DeregisterClient, ret); cs_error(link->handle, DeregisterClient, ret);
} }
...@@ -207,11 +207,8 @@ static void ide_detach(dev_link_t *link) ...@@ -207,11 +207,8 @@ static void ide_detach(dev_link_t *link)
======================================================================*/ ======================================================================*/
#define CS_CHECK(fn, args...) \ #define CS_CHECK(fn, ret) \
while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
#define CFG_CHECK(fn, args...) \
if (CardServices(fn, args) != 0) goto next_entry
static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq) static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq)
{ {
...@@ -241,16 +238,16 @@ void ide_config(dev_link_t *link) ...@@ -241,16 +238,16 @@ void ide_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, handle, &tuple); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, handle, &tuple, &parse); CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
tuple.DesiredTuple = CISTPL_MANFID; tuple.DesiredTuple = CISTPL_MANFID;
if (!CardServices(GetFirstTuple, handle, &tuple) && if (!pcmcia_get_first_tuple(handle, &tuple) &&
!CardServices(GetTupleData, handle, &tuple) && !pcmcia_get_tuple_data(handle, &tuple) &&
!CardServices(ParseTuple, handle, &tuple, &parse)) !pcmcia_parse_tuple(handle, &tuple, &parse))
is_kme = ((parse.manfid.manf == MANFID_KME) && is_kme = ((parse.manfid.manf == MANFID_KME) &&
((parse.manfid.card == PRODID_KME_KXLC005_A) || ((parse.manfid.card == PRODID_KME_KXLC005_A) ||
(parse.manfid.card == PRODID_KME_KXLC005_B))); (parse.manfid.card == PRODID_KME_KXLC005_B)));
...@@ -259,16 +256,16 @@ void ide_config(dev_link_t *link) ...@@ -259,16 +256,16 @@ void ide_config(dev_link_t *link)
link->state |= DEV_CONFIG; link->state |= DEV_CONFIG;
/* Not sure if this is right... look up the current Vcc */ /* Not sure if this is right... look up the current Vcc */
CS_CHECK(GetConfigurationInfo, handle, &conf); CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf));
link->conf.Vcc = conf.Vcc; link->conf.Vcc = conf.Vcc;
pass = io_base = ctl_base = 0; pass = io_base = ctl_base = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0; tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
while (1) { while (1) {
CFG_CHECK(GetTupleData, handle, &tuple); if (pcmcia_get_tuple_data(handle, &tuple) != 0) goto next_entry;
CFG_CHECK(ParseTuple, handle, &tuple, &parse); if (pcmcia_parse_tuple(handle, &tuple, &parse) != 0) goto next_entry;
/* Check for matching Vcc, unless we're desperate */ /* Check for matching Vcc, unless we're desperate */
if (!pass) { if (!pass) {
...@@ -299,13 +296,15 @@ void ide_config(dev_link_t *link) ...@@ -299,13 +296,15 @@ void ide_config(dev_link_t *link)
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->io.BasePort2 = io->win[1].base; link->io.BasePort2 = io->win[1].base;
link->io.NumPorts2 = (is_kme) ? 2 : 1; link->io.NumPorts2 = (is_kme) ? 2 : 1;
CFG_CHECK(RequestIO, link->handle, &link->io); if (pcmcia_request_io(link->handle, &link->io) != 0)
goto next_entry;
io_base = link->io.BasePort1; io_base = link->io.BasePort1;
ctl_base = link->io.BasePort2; ctl_base = link->io.BasePort2;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) { } else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
link->io.NumPorts1 = io->win[0].len; link->io.NumPorts1 = io->win[0].len;
link->io.NumPorts2 = 0; link->io.NumPorts2 = 0;
CFG_CHECK(RequestIO, link->handle, &link->io); if (pcmcia_request_io(link->handle, &link->io) != 0)
goto next_entry;
io_base = link->io.BasePort1; io_base = link->io.BasePort1;
ctl_base = link->io.BasePort1+0x0e; ctl_base = link->io.BasePort1+0x0e;
} else goto next_entry; } else goto next_entry;
...@@ -316,16 +315,16 @@ void ide_config(dev_link_t *link) ...@@ -316,16 +315,16 @@ void ide_config(dev_link_t *link)
next_entry: next_entry:
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
if (pass) { if (pass) {
CS_CHECK(GetNextTuple, handle, &tuple); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
} else if (CardServices(GetNextTuple, handle, &tuple) != 0) { } else if (pcmcia_get_next_tuple(handle, &tuple) != 0) {
CS_CHECK(GetFirstTuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
memset(&dflt, 0, sizeof(dflt)); memset(&dflt, 0, sizeof(dflt));
pass++; pass++;
} }
} }
CS_CHECK(RequestIRQ, handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
CS_CHECK(RequestConfiguration, handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
/* deal with brain dead IDE resource management */ /* deal with brain dead IDE resource management */
release_region(link->io.BasePort1, link->io.NumPorts1); release_region(link->io.BasePort1, link->io.NumPorts1);
...@@ -413,9 +412,9 @@ void ide_release(dev_link_t *link) ...@@ -413,9 +412,9 @@ void ide_release(dev_link_t *link)
info->ndev = 0; info->ndev = 0;
link->dev = NULL; link->dev = NULL;
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
CardServices(ReleaseIO, link->handle, &link->io); pcmcia_release_io(link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
...@@ -452,14 +451,14 @@ int ide_event(event_t event, int priority, ...@@ -452,14 +451,14 @@ int ide_event(event_t event, int priority,
/* Fall through... */ /* Fall through... */
case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_RESET_PHYSICAL:
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
break; break;
case CS_EVENT_PM_RESUME: case CS_EVENT_PM_RESUME:
link->state &= ~DEV_SUSPEND; link->state &= ~DEV_SUSPEND;
/* Fall through... */ /* Fall through... */
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
if (DEV_OK(link)) if (DEV_OK(link))
CardServices(RequestConfiguration, link->handle, &link->conf); pcmcia_request_configuration(link->handle, &link->conf);
break; break;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment