Commit 477792e7 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] remove CardServices() from drivers/net/wireless

From: Andres Salomon <dilinger@voxel.net>

This wraps up drivers/net/wireless.  Still remaining:

- sound/pcmcia/vx
- drivers/{bluetooth,isdn,parport,telephony}
- drivers/mtd/maps
- drivers/scsi/pcmcia
- drivers/char/pcmcia/synclink_cs.c
parent fab88a83
...@@ -233,7 +233,7 @@ static dev_link_t *airo_attach(void) ...@@ -233,7 +233,7 @@ static dev_link_t *airo_attach(void)
client_reg.event_handler = &airo_event; client_reg.event_handler = &airo_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 != 0) { if (ret != 0) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
airo_detach(link); airo_detach(link);
...@@ -277,7 +277,7 @@ static void airo_detach(dev_link_t *link) ...@@ -277,7 +277,7 @@ static void airo_detach(dev_link_t *link)
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
CardServices(DeregisterClient, link->handle); pcmcia_deregister_client(link->handle);
...@@ -298,11 +298,8 @@ static void airo_detach(dev_link_t *link) ...@@ -298,11 +298,8 @@ static void airo_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 void airo_config(dev_link_t *link) static void airo_config(dev_link_t *link)
{ {
...@@ -329,9 +326,9 @@ static void airo_config(dev_link_t *link) ...@@ -329,9 +326,9 @@ static void airo_config(dev_link_t *link)
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
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];
...@@ -351,12 +348,13 @@ static void airo_config(dev_link_t *link) ...@@ -351,12 +348,13 @@ static void airo_config(dev_link_t *link)
will only use the CIS to fill in implementation-defined details. will only use the CIS to fill in implementation-defined details.
*/ */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
while (1) { while (1) {
cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t dflt = { 0 };
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
CFG_CHECK(GetTupleData, handle, &tuple); if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
CFG_CHECK(ParseTuple, handle, &tuple, &parse); pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
goto next_entry;
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
if (cfg->index == 0) goto next_entry; if (cfg->index == 0) goto next_entry;
...@@ -405,7 +403,8 @@ static void airo_config(dev_link_t *link) ...@@ -405,7 +403,8 @@ static void airo_config(dev_link_t *link)
} }
/* This reserves IO space but doesn't actually enable it */ /* This reserves IO space but doesn't actually enable it */
CFG_CHECK(RequestIO, link->handle, &link->io); if (pcmcia_request_io(link->handle, &link->io) != 0)
goto next_entry;
/* /*
Now set up a common memory window, if needed. There is room Now set up a common memory window, if needed. There is room
...@@ -425,16 +424,17 @@ static void airo_config(dev_link_t *link) ...@@ -425,16 +424,17 @@ static void airo_config(dev_link_t *link)
req.Base = mem->win[0].host_addr; req.Base = mem->win[0].host_addr;
req.Size = mem->win[0].len; req.Size = mem->win[0].len;
req.AccessSpeed = 0; req.AccessSpeed = 0;
link->win = (window_handle_t)link->handle; if (pcmcia_request_window(&link->handle, &req, &link->win) != 0)
CFG_CHECK(RequestWindow, &link->win, &req); goto next_entry;
map.Page = 0; map.CardOffset = mem->win[0].card_addr; map.Page = 0; map.CardOffset = mem->win[0].card_addr;
CFG_CHECK(MapMemPage, link->win, &map); if (pcmcia_map_mem_page(link->win, &map) != 0)
goto next_entry;
} }
/* If we got this far, we're cool! */ /* If we got this far, we're cool! */
break; break;
next_entry: next_entry:
CS_CHECK(GetNextTuple, handle, &tuple); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
} }
/* /*
...@@ -443,14 +443,14 @@ static void airo_config(dev_link_t *link) ...@@ -443,14 +443,14 @@ static void airo_config(dev_link_t *link)
irq structure is initialized. irq structure is initialized.
*/ */
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ)
CS_CHECK(RequestIRQ, link->handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
/* /*
This actually configures the PCMCIA socket -- setting up This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode. card and host interface into "Memory and IO" mode.
*/ */
CS_CHECK(RequestConfiguration, link->handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
((local_info_t*)link->priv)->eth_dev = ((local_info_t*)link->priv)->eth_dev =
init_airo_card( link->irq.AssignedIRQ, init_airo_card( link->irq.AssignedIRQ,
link->io.BasePort1, 1 ); link->io.BasePort1, 1 );
...@@ -526,12 +526,12 @@ static void airo_release(dev_link_t *link) ...@@ -526,12 +526,12 @@ static void airo_release(dev_link_t *link)
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
if (link->win) if (link->win)
CardServices(ReleaseWindow, link->win); pcmcia_release_window(link->win);
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1) if (link->io.NumPorts1)
CardServices(ReleaseIO, link->handle, &link->io); pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ) if (link->irq.AssignedIRQ)
CardServices(ReleaseIRQ, link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_CONFIG) if (link->state & DEV_STALE_CONFIG)
...@@ -576,7 +576,7 @@ static int airo_event(event_t event, int priority, ...@@ -576,7 +576,7 @@ static int airo_event(event_t event, int priority,
case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_RESET_PHYSICAL:
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
netif_device_detach(local->eth_dev); netif_device_detach(local->eth_dev);
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
} }
break; break;
case CS_EVENT_PM_RESUME: case CS_EVENT_PM_RESUME:
...@@ -584,7 +584,7 @@ static int airo_event(event_t event, int priority, ...@@ -584,7 +584,7 @@ static int airo_event(event_t event, int priority,
/* Fall through... */ /* Fall through... */
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf); pcmcia_request_configuration(link->handle, &link->conf);
reset_airo_card(local->eth_dev); reset_airo_card(local->eth_dev);
netif_device_attach(local->eth_dev); netif_device_attach(local->eth_dev);
} }
......
...@@ -246,7 +246,7 @@ static dev_link_t *atmel_attach(void) ...@@ -246,7 +246,7 @@ static dev_link_t *atmel_attach(void)
client_reg.event_handler = &atmel_event; client_reg.event_handler = &atmel_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 != 0) { if (ret != 0) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
atmel_detach(link); atmel_detach(link);
...@@ -282,7 +282,7 @@ static void atmel_detach(dev_link_t *link) ...@@ -282,7 +282,7 @@ static void atmel_detach(dev_link_t *link)
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
CardServices(DeregisterClient, link->handle); pcmcia_deregister_client(link->handle);
/* Unlink device structure, free pieces */ /* Unlink device structure, free pieces */
*linkp = link->next; *linkp = link->next;
...@@ -299,11 +299,8 @@ static void atmel_detach(dev_link_t *link) ...@@ -299,11 +299,8 @@ static void atmel_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
/* Call-back function to interrogate PCMCIA-specific information /* Call-back function to interrogate PCMCIA-specific information
about the current existance of the card */ about the current existance of the card */
...@@ -372,11 +369,11 @@ static void atmel_config(dev_link_t *link) ...@@ -372,11 +369,11 @@ static void atmel_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_MANFID; tuple.DesiredTuple = CISTPL_MANFID;
if (CardServices(GetFirstTuple, handle, &tuple) == 0) { if (pcmcia_get_first_tuple(handle, &tuple) == 0) {
int i; int i;
cistpl_manfid_t *manfid; cistpl_manfid_t *manfid;
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));
manfid = &(parse.manfid); manfid = &(parse.manfid);
for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) {
if (!card_table[i].ver1 && if (!card_table[i].ver1 &&
...@@ -389,11 +386,11 @@ static void atmel_config(dev_link_t *link) ...@@ -389,11 +386,11 @@ static void atmel_config(dev_link_t *link)
} }
tuple.DesiredTuple = CISTPL_VERS_1; tuple.DesiredTuple = CISTPL_VERS_1;
if (!done && (CardServices(GetFirstTuple, handle, &tuple) == 0)) { if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) {
int i, j, k; int i, j, k;
cistpl_vers_1_t *ver1; cistpl_vers_1_t *ver1;
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));
ver1 = &(parse.version_1); ver1 = &(parse.version_1);
for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) { for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) {
...@@ -429,9 +426,9 @@ static void atmel_config(dev_link_t *link) ...@@ -429,9 +426,9 @@ static void atmel_config(dev_link_t *link)
registers. registers.
*/ */
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];
...@@ -451,12 +448,13 @@ static void atmel_config(dev_link_t *link) ...@@ -451,12 +448,13 @@ static void atmel_config(dev_link_t *link)
will only use the CIS to fill in implementation-defined details. will only use the CIS to fill in implementation-defined details.
*/ */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
while (1) { while (1) {
cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t dflt = { 0 };
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
CFG_CHECK(GetTupleData, handle, &tuple); if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
CFG_CHECK(ParseTuple, handle, &tuple, &parse); pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
goto next_entry;
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
if (cfg->index == 0) goto next_entry; if (cfg->index == 0) goto next_entry;
...@@ -505,12 +503,14 @@ static void atmel_config(dev_link_t *link) ...@@ -505,12 +503,14 @@ static void atmel_config(dev_link_t *link)
} }
/* This reserves IO space but doesn't actually enable it */ /* This reserves IO space but doesn't actually enable it */
CFG_CHECK(RequestIO, link->handle, &link->io); if (pcmcia_request_io(link->handle, &link->io) != 0)
goto next_entry;
/* If we got this far, we're cool! */ /* If we got this far, we're cool! */
break; break;
next_entry: next_entry:
CS_CHECK(GetNextTuple, handle, &tuple); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
} }
/* /*
...@@ -519,14 +519,14 @@ static void atmel_config(dev_link_t *link) ...@@ -519,14 +519,14 @@ static void atmel_config(dev_link_t *link)
irq structure is initialized. irq structure is initialized.
*/ */
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ)
CS_CHECK(RequestIRQ, link->handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
/* /*
This actually configures the PCMCIA socket -- setting up This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode. card and host interface into "Memory and IO" mode.
*/ */
CS_CHECK(RequestConfiguration, link->handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
if (link->irq.AssignedIRQ == 0) { if (link->irq.AssignedIRQ == 0) {
printk(KERN_ALERT printk(KERN_ALERT
...@@ -602,11 +602,11 @@ static void atmel_release(dev_link_t *link) ...@@ -602,11 +602,11 @@ static void atmel_release(dev_link_t *link)
((local_info_t*)link->priv)->eth_dev = 0; ((local_info_t*)link->priv)->eth_dev = 0;
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1) if (link->io.NumPorts1)
CardServices(ReleaseIO, link->handle, &link->io); pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ) if (link->irq.AssignedIRQ)
CardServices(ReleaseIRQ, link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} }
...@@ -648,7 +648,7 @@ static int atmel_event(event_t event, int priority, ...@@ -648,7 +648,7 @@ static int atmel_event(event_t event, int priority,
case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_RESET_PHYSICAL:
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
netif_device_detach(local->eth_dev); netif_device_detach(local->eth_dev);
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
} }
break; break;
case CS_EVENT_PM_RESUME: case CS_EVENT_PM_RESUME:
...@@ -656,7 +656,7 @@ static int atmel_event(event_t event, int priority, ...@@ -656,7 +656,7 @@ static int atmel_event(event_t event, int priority,
/* Fall through... */ /* Fall through... */
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf); pcmcia_request_configuration(link->handle, &link->conf);
reset_atmel_card(local->eth_dev); reset_atmel_card(local->eth_dev);
netif_device_attach(local->eth_dev); netif_device_attach(local->eth_dev);
} }
......
...@@ -513,7 +513,7 @@ static dev_link_t *netwave_attach(void) ...@@ -513,7 +513,7 @@ static dev_link_t *netwave_attach(void)
client_reg.event_handler = &netwave_event; client_reg.event_handler = &netwave_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 != 0) { if (ret != 0) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
netwave_detach(link); netwave_detach(link);
...@@ -555,7 +555,7 @@ static void netwave_detach(dev_link_t *link) ...@@ -555,7 +555,7 @@ static void netwave_detach(dev_link_t *link)
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
CardServices(DeregisterClient, link->handle); pcmcia_deregister_client(link->handle);
/* Locate device structure */ /* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
...@@ -998,8 +998,8 @@ static int netwave_ioctl(struct net_device *dev, /* ioctl device */ ...@@ -998,8 +998,8 @@ static int netwave_ioctl(struct net_device *dev, /* ioctl device */
* *
*/ */
#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)
static void netwave_pcmcia_config(dev_link_t *link) { static void netwave_pcmcia_config(dev_link_t *link) {
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
...@@ -1024,9 +1024,9 @@ static void netwave_pcmcia_config(dev_link_t *link) { ...@@ -1024,9 +1024,9 @@ static void netwave_pcmcia_config(dev_link_t *link) {
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 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];
...@@ -1040,7 +1040,7 @@ static void netwave_pcmcia_config(dev_link_t *link) { ...@@ -1040,7 +1040,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
*/ */
for (i = j = 0x0; j < 0x400; j += 0x20) { for (i = j = 0x0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300; link->io.BasePort1 = j ^ 0x300;
i = CardServices(RequestIO, link->handle, &link->io); i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
...@@ -1052,13 +1052,13 @@ static void netwave_pcmcia_config(dev_link_t *link) { ...@@ -1052,13 +1052,13 @@ static void netwave_pcmcia_config(dev_link_t *link) {
* Now allocate an interrupt line. Note that this does not * Now allocate an interrupt line. Note that this does not
* actually assign a handler to the interrupt. * actually assign a handler to the interrupt.
*/ */
CS_CHECK(RequestIRQ, handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
/* /*
* This actually configures the PCMCIA socket -- setting up * This actually configures the PCMCIA socket -- setting up
* the I/O windows and the interrupt mapping. * the I/O windows and the interrupt mapping.
*/ */
CS_CHECK(RequestConfiguration, handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
/* /*
* Allocate a 32K memory window. Note that the dev_link_t * Allocate a 32K memory window. Note that the dev_link_t
...@@ -1071,10 +1071,9 @@ static void netwave_pcmcia_config(dev_link_t *link) { ...@@ -1071,10 +1071,9 @@ static void netwave_pcmcia_config(dev_link_t *link) {
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
req.Base = 0; req.Size = 0x8000; req.Base = 0; req.Size = 0x8000;
req.AccessSpeed = mem_speed; req.AccessSpeed = mem_speed;
link->win = (window_handle_t)link->handle; CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win));
CS_CHECK(RequestWindow, &link->win, &req);
mem.CardOffset = 0x20000; mem.Page = 0; mem.CardOffset = 0x20000; mem.Page = 0;
CS_CHECK(MapMemPage, link->win, &mem); CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
/* Store base address of the common window frame */ /* Store base address of the common window frame */
ramBase = ioremap(req.Base, 0x8000); ramBase = ioremap(req.Base, 0x8000);
...@@ -1145,11 +1144,11 @@ static void netwave_release(dev_link_t *link) ...@@ -1145,11 +1144,11 @@ static void netwave_release(dev_link_t *link)
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
if (link->win) { if (link->win) {
iounmap(priv->ramBase); iounmap(priv->ramBase);
CardServices(ReleaseWindow, link->win); pcmcia_release_window(link->win);
} }
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;
...@@ -1201,7 +1200,7 @@ static int netwave_event(event_t event, int priority, ...@@ -1201,7 +1200,7 @@ static int netwave_event(event_t event, int priority,
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
if (link->open) if (link->open)
netif_device_detach(dev); netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
} }
break; break;
case CS_EVENT_PM_RESUME: case CS_EVENT_PM_RESUME:
...@@ -1209,7 +1208,7 @@ static int netwave_event(event_t event, int priority, ...@@ -1209,7 +1208,7 @@ static int netwave_event(event_t event, int priority,
/* Fall through... */ /* Fall through... */
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, &link->conf); pcmcia_request_configuration(link->handle, &link->conf);
if (link->open) { if (link->open) {
netwave_reset(dev); netwave_reset(dev);
netif_device_attach(dev); netif_device_attach(dev);
......
...@@ -131,7 +131,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) ...@@ -131,7 +131,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
/* We need atomic ops here, because we're not holding the lock */ /* We need atomic ops here, because we're not holding the lock */
set_bit(0, &card->hard_reset_in_progress); set_bit(0, &card->hard_reset_in_progress);
err = CardServices(ResetCard, link->handle, NULL); err = pcmcia_reset_card(link->handle, NULL);
if (err) if (err)
return err; return err;
...@@ -150,7 +150,7 @@ static void ...@@ -150,7 +150,7 @@ static void
orinoco_cs_error(client_handle_t handle, int func, int ret) orinoco_cs_error(client_handle_t handle, int func, int ret)
{ {
error_info_t err = { func, ret }; error_info_t err = { func, ret };
CardServices(ReportError, handle, &err); pcmcia_report_error(handle, &err);
} }
/* /*
...@@ -214,7 +214,7 @@ orinoco_cs_attach(void) ...@@ -214,7 +214,7 @@ orinoco_cs_attach(void)
client_reg.Version = 0x0210; /* FIXME: what does this mean? */ client_reg.Version = 0x0210; /* FIXME: what does this mean? */
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) {
orinoco_cs_error(link->handle, RegisterClient, ret); orinoco_cs_error(link->handle, RegisterClient, ret);
orinoco_cs_detach(link); orinoco_cs_detach(link);
...@@ -250,7 +250,7 @@ orinoco_cs_detach(dev_link_t * link) ...@@ -250,7 +250,7 @@ orinoco_cs_detach(dev_link_t * link)
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
CardServices(DeregisterClient, link->handle); pcmcia_deregister_client(link->handle);
/* Unlink device structure, and free it */ /* Unlink device structure, and free it */
*linkp = link->next; *linkp = link->next;
...@@ -269,11 +269,8 @@ orinoco_cs_detach(dev_link_t * link) ...@@ -269,11 +269,8 @@ orinoco_cs_detach(dev_link_t * link)
* device available to the system. * device available to the system.
*/ */
#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 void static void
orinoco_cs_config(dev_link_t *link) orinoco_cs_config(dev_link_t *link)
...@@ -290,7 +287,7 @@ orinoco_cs_config(dev_link_t *link) ...@@ -290,7 +287,7 @@ orinoco_cs_config(dev_link_t *link)
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
CS_CHECK(ValidateCIS, handle, &info); CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
/* /*
* This reads the card's CONFIG tuple to find its * This reads the card's CONFIG tuple to find its
...@@ -301,9 +298,9 @@ orinoco_cs_config(dev_link_t *link) ...@@ -301,9 +298,9 @@ orinoco_cs_config(dev_link_t *link)
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
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];
...@@ -311,7 +308,7 @@ orinoco_cs_config(dev_link_t *link) ...@@ -311,7 +308,7 @@ orinoco_cs_config(dev_link_t *link)
link->state |= DEV_CONFIG; link->state |= DEV_CONFIG;
/* Look up the current Vcc */ /* 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;
/* /*
...@@ -329,13 +326,14 @@ orinoco_cs_config(dev_link_t *link) ...@@ -329,13 +326,14 @@ orinoco_cs_config(dev_link_t *link)
* implementation-defined details. * implementation-defined details.
*/ */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
while (1) { while (1) {
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
cistpl_cftable_entry_t dflt = { .index = 0 }; cistpl_cftable_entry_t dflt = { .index = 0 };
CFG_CHECK(GetTupleData, handle, &tuple); if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
CFG_CHECK(ParseTuple, handle, &tuple, &parse); pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
goto next_entry;
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
dflt = *cfg; dflt = *cfg;
...@@ -400,7 +398,8 @@ orinoco_cs_config(dev_link_t *link) ...@@ -400,7 +398,8 @@ orinoco_cs_config(dev_link_t *link)
} }
/* This reserves IO space but doesn't actually enable it */ /* This reserves IO space but doesn't actually enable it */
CFG_CHECK(RequestIO, link->handle, &link->io); if (pcmcia_request_io(link->handle, &link->io) != 0)
goto next_entry;
} }
...@@ -410,8 +409,8 @@ orinoco_cs_config(dev_link_t *link) ...@@ -410,8 +409,8 @@ orinoco_cs_config(dev_link_t *link)
next_entry: next_entry:
if (link->io.NumPorts1) if (link->io.NumPorts1)
CardServices(ReleaseIO, link->handle, &link->io); pcmcia_release_io(link->handle, &link->io);
last_ret = CardServices(GetNextTuple, handle, &tuple); last_ret = pcmcia_get_next_tuple(handle, &tuple);
if (last_ret == CS_NO_MORE_ITEMS) { if (last_ret == CS_NO_MORE_ITEMS) {
printk(KERN_ERR "GetNextTuple(). No matching CIS configuration, " printk(KERN_ERR "GetNextTuple(). No matching CIS configuration, "
"maybe you need the ignore_cis_vcc=1 parameter.\n"); "maybe you need the ignore_cis_vcc=1 parameter.\n");
...@@ -438,7 +437,7 @@ orinoco_cs_config(dev_link_t *link) ...@@ -438,7 +437,7 @@ orinoco_cs_config(dev_link_t *link)
link->irq.Handler = orinoco_interrupt; link->irq.Handler = orinoco_interrupt;
link->irq.Instance = dev; link->irq.Instance = dev;
CS_CHECK(RequestIRQ, link->handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
} }
/* We initialize the hermes structure before completing PCMCIA /* We initialize the hermes structure before completing PCMCIA
...@@ -452,7 +451,7 @@ orinoco_cs_config(dev_link_t *link) ...@@ -452,7 +451,7 @@ orinoco_cs_config(dev_link_t *link)
* the I/O windows and the interrupt mapping, and putting the * the I/O windows and the interrupt mapping, and putting the
* card and host interface into "Memory and IO" mode. * card and host interface into "Memory and IO" mode.
*/ */
CS_CHECK(RequestConfiguration, link->handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
/* Ok, we have the configuration, prepare to register the netdev */ /* Ok, we have the configuration, prepare to register the netdev */
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -521,11 +520,11 @@ orinoco_cs_release(dev_link_t *link) ...@@ -521,11 +520,11 @@ orinoco_cs_release(dev_link_t *link)
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1) if (link->io.NumPorts1)
CardServices(ReleaseIO, link->handle, &link->io); pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ) if (link->irq.AssignedIRQ)
CardServices(ReleaseIRQ, link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* orinoco_cs_release */ } /* orinoco_cs_release */
...@@ -587,7 +586,7 @@ orinoco_cs_event(event_t event, int priority, ...@@ -587,7 +586,7 @@ orinoco_cs_event(event_t event, int priority,
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
} }
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
} }
break; break;
...@@ -598,8 +597,7 @@ orinoco_cs_event(event_t event, int priority, ...@@ -598,8 +597,7 @@ orinoco_cs_event(event_t event, int priority,
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
/* FIXME: should we double check that this is /* FIXME: should we double check that this is
* the same card as we had before */ * the same card as we had before */
CardServices(RequestConfiguration, link->handle, pcmcia_request_configuration(link->handle, &link->conf);
&link->conf);
if (! test_bit(0, &card->hard_reset_in_progress)) { if (! test_bit(0, &card->hard_reset_in_progress)) {
err = orinoco_reinit_firmware(dev); err = orinoco_reinit_firmware(dev);
......
...@@ -420,7 +420,7 @@ static dev_link_t *ray_attach(void) ...@@ -420,7 +420,7 @@ static dev_link_t *ray_attach(void)
client_reg.Version = 0x0210; client_reg.Version = 0x0210;
client_reg.event_callback_args.client_data = link; client_reg.event_callback_args.client_data = link;
DEBUG(2,"ray_cs ray_attach calling CardServices(RegisterClient...)\n"); DEBUG(2,"ray_cs ray_attach calling pcmcia_register_client(...)\n");
init_timer(&local->timer); init_timer(&local->timer);
...@@ -490,8 +490,8 @@ static void ray_detach(dev_link_t *link) ...@@ -490,8 +490,8 @@ static void ray_detach(dev_link_t *link)
is received, to configure the PCMCIA socket, and to make the is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system. ethernet device available to the system.
=============================================================================*/ =============================================================================*/
#define CS_CHECK(fn, args...) \ #define CS_CHECK(fn, ret) \
while ((last_ret=fn(args))!=0) goto cs_failed do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
#define MAX_TUPLE_SIZE 128 #define MAX_TUPLE_SIZE 128
static void ray_config(dev_link_t *link) static void ray_config(dev_link_t *link)
{ {
...@@ -510,23 +510,23 @@ static void ray_config(dev_link_t *link) ...@@ -510,23 +510,23 @@ static void ray_config(dev_link_t *link)
/* This reads the card's CONFIG tuple to find its configuration regs */ /* This reads the card's CONFIG tuple to find its configuration regs */
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(pcmcia_get_first_tuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = MAX_TUPLE_SIZE; tuple.TupleDataMax = MAX_TUPLE_SIZE;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(pcmcia_get_tuple_data, handle, &tuple); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(pcmcia_parse_tuple, 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];
/* Determine card type and firmware version */ /* Determine card type and firmware version */
buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0; buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
tuple.DesiredTuple = CISTPL_VERS_1; tuple.DesiredTuple = CISTPL_VERS_1;
CS_CHECK(pcmcia_get_first_tuple, handle, &tuple); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = MAX_TUPLE_SIZE; tuple.TupleDataMax = MAX_TUPLE_SIZE;
tuple.TupleOffset = 2; tuple.TupleOffset = 2;
CS_CHECK(pcmcia_get_tuple_data, handle, &tuple); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
for (i=0; i<tuple.TupleDataLen - 4; i++) for (i=0; i<tuple.TupleDataLen - 4; i++)
if (buf[i] == 0) buf[i] = ' '; if (buf[i] == 0) buf[i] = ' ';
...@@ -538,22 +538,22 @@ static void ray_config(dev_link_t *link) ...@@ -538,22 +538,22 @@ static void ray_config(dev_link_t *link)
/* Now allocate an interrupt line. Note that this does not /* Now allocate an interrupt line. Note that this does not
actually assign a handler to the interrupt. actually assign a handler to the interrupt.
*/ */
CS_CHECK(pcmcia_request_irq, link->handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
/* This actually configures the PCMCIA socket -- setting up /* This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping. the I/O windows and the interrupt mapping.
*/ */
CS_CHECK(pcmcia_request_configuration, link->handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
/*** Set up 32k window for shared memory (transmit and control) ************/ /*** Set up 32k window for shared memory (transmit and control) ************/
req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
req.Base = 0; req.Base = 0;
req.Size = 0x8000; req.Size = 0x8000;
req.AccessSpeed = ray_mem_speed; req.AccessSpeed = ray_mem_speed;
CS_CHECK(pcmcia_request_window, &link->handle, &req, &link->win); CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win));
mem.CardOffset = 0x0000; mem.Page = 0; mem.CardOffset = 0x0000; mem.Page = 0;
CS_CHECK(pcmcia_map_mem_page, link->win, &mem); CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
local->sram = (UCHAR *)(ioremap(req.Base,req.Size)); local->sram = (UCHAR *)(ioremap(req.Base,req.Size));
/*** Set up 16k window for shared memory (receive buffer) ***************/ /*** Set up 16k window for shared memory (receive buffer) ***************/
...@@ -561,9 +561,9 @@ static void ray_config(dev_link_t *link) ...@@ -561,9 +561,9 @@ static void ray_config(dev_link_t *link)
req.Base = 0; req.Base = 0;
req.Size = 0x4000; req.Size = 0x4000;
req.AccessSpeed = ray_mem_speed; req.AccessSpeed = ray_mem_speed;
CS_CHECK(pcmcia_request_window, &link->handle, &req, &local->rmem_handle); CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &local->rmem_handle));
mem.CardOffset = 0x8000; mem.Page = 0; mem.CardOffset = 0x8000; mem.Page = 0;
CS_CHECK(pcmcia_map_mem_page, local->rmem_handle, &mem); CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem));
local->rmem = (UCHAR *)(ioremap(req.Base,req.Size)); local->rmem = (UCHAR *)(ioremap(req.Base,req.Size));
/*** Set up window for attribute memory ***********************************/ /*** Set up window for attribute memory ***********************************/
...@@ -571,9 +571,9 @@ static void ray_config(dev_link_t *link) ...@@ -571,9 +571,9 @@ static void ray_config(dev_link_t *link)
req.Base = 0; req.Base = 0;
req.Size = 0x1000; req.Size = 0x1000;
req.AccessSpeed = ray_mem_speed; req.AccessSpeed = ray_mem_speed;
CS_CHECK(pcmcia_request_window, &link->handle, &req, &local->amem_handle); CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &local->amem_handle));
mem.CardOffset = 0x0000; mem.Page = 0; mem.CardOffset = 0x0000; mem.Page = 0;
CS_CHECK(pcmcia_map_mem_page, local->amem_handle, &mem); CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem));
local->amem = (UCHAR *)(ioremap(req.Base,req.Size)); local->amem = (UCHAR *)(ioremap(req.Base,req.Size));
DEBUG(3,"ray_config sram=%p\n",local->sram); DEBUG(3,"ray_config sram=%p\n",local->sram);
......
...@@ -1586,7 +1586,7 @@ static void wl3501_detach(dev_link_t *link) ...@@ -1586,7 +1586,7 @@ static void wl3501_detach(dev_link_t *link)
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
CardServices(DeregisterClient, link->handle); pcmcia_deregister_client(link->handle);
/* Unlink device structure, free pieces */ /* Unlink device structure, free pieces */
*linkp = link->next; *linkp = link->next;
...@@ -2083,7 +2083,7 @@ static dev_link_t *wl3501_attach(void) ...@@ -2083,7 +2083,7 @@ static dev_link_t *wl3501_attach(void)
client_reg.event_handler = wl3501_event; client_reg.event_handler = wl3501_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) { if (ret) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
wl3501_detach(link); wl3501_detach(link);
...@@ -2097,8 +2097,8 @@ static dev_link_t *wl3501_attach(void) ...@@ -2097,8 +2097,8 @@ static dev_link_t *wl3501_attach(void)
goto out; goto out;
} }
#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)
/** /**
* wl3501_config - configure the PCMCIA socket and make eth device available * wl3501_config - configure the PCMCIA socket and make eth device available
...@@ -2121,12 +2121,12 @@ static void wl3501_config(dev_link_t *link) ...@@ -2121,12 +2121,12 @@ static void wl3501_config(dev_link_t *link)
/* This reads the card's CONFIG tuple to find its config registers. */ /* This reads the card's CONFIG tuple to find its config registers. */
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));
tuple.TupleData = bf; tuple.TupleData = bf;
tuple.TupleDataMax = sizeof(bf); tuple.TupleDataMax = sizeof(bf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
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];
...@@ -2142,7 +2142,7 @@ static void wl3501_config(dev_link_t *link) ...@@ -2142,7 +2142,7 @@ static void wl3501_config(dev_link_t *link)
* 0x200-0x2ff, and so on, because this seems safer */ * 0x200-0x2ff, and so on, because this seems safer */
link->io.BasePort1 = j; link->io.BasePort1 = j;
link->io.BasePort2 = link->io.BasePort1 + 0x10; link->io.BasePort2 = link->io.BasePort1 + 0x10;
i = CardServices(RequestIO, link->handle, &link->io); i = pcmcia_request_io(link->handle, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
break; break;
} }
...@@ -2154,12 +2154,12 @@ static void wl3501_config(dev_link_t *link) ...@@ -2154,12 +2154,12 @@ static void wl3501_config(dev_link_t *link)
/* Now allocate an interrupt line. Note that this does not actually /* Now allocate an interrupt line. Note that this does not actually
* assign a handler to the interrupt. */ * assign a handler to the interrupt. */
CS_CHECK(RequestIRQ, link->handle, &link->irq); CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
/* This actually configures the PCMCIA socket -- setting up the I/O /* This actually configures the PCMCIA socket -- setting up the I/O
* windows and the interrupt mapping. */ * windows and the interrupt mapping. */
CS_CHECK(RequestConfiguration, link->handle, &link->conf); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -2249,9 +2249,9 @@ static void wl3501_release(dev_link_t *link) ...@@ -2249,9 +2249,9 @@ static void wl3501_release(dev_link_t *link)
} }
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
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;
if (link->state & DEV_STALE_CONFIG) if (link->state & DEV_STALE_CONFIG)
...@@ -2301,7 +2301,7 @@ static int wl3501_event(event_t event, int pri, event_callback_args_t *args) ...@@ -2301,7 +2301,7 @@ static int wl3501_event(event_t event, int pri, event_callback_args_t *args)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
if (link->open) if (link->open)
netif_device_detach(dev); netif_device_detach(dev);
CardServices(ReleaseConfiguration, link->handle); pcmcia_release_configuration(link->handle);
} }
break; break;
case CS_EVENT_PM_RESUME: case CS_EVENT_PM_RESUME:
...@@ -2310,8 +2310,7 @@ static int wl3501_event(event_t event, int pri, event_callback_args_t *args) ...@@ -2310,8 +2310,7 @@ static int wl3501_event(event_t event, int pri, event_callback_args_t *args)
/* Fall through... */ /* Fall through... */
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
CardServices(RequestConfiguration, link->handle, pcmcia_request_configuration(link->handle, &link->conf);
&link->conf);
if (link->open) { if (link->open) {
wl3501_reset(dev); wl3501_reset(dev);
netif_device_attach(dev); netif_device_attach(dev);
......
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