From: Russell King Ok, this is the last patch for removal of CardServices() drivers/serial/serial_cs.c | 59 ++++++++++++++++++++++----------------------- 1 files changed, 29 insertions(+), 30 deletions(-) diff -puN drivers/serial/serial_cs.c~remove-CardServices-from-drivers-serial drivers/serial/serial_cs.c --- 25/drivers/serial/serial_cs.c~remove-CardServices-from-drivers-serial 2003-12-24 02:49:32.000000000 -0800 +++ 25-akpm/drivers/serial/serial_cs.c 2003-12-24 02:49:32.000000000 -0800 @@ -149,9 +149,9 @@ static void serial_remove(dev_link_t *li info->link.dev = NULL; if (!info->slave) { - CardServices(ReleaseConfiguration, info->link.handle); - CardServices(ReleaseIO, info->link.handle, &info->link.io); - CardServices(ReleaseIRQ, info->link.handle, &info->link.irq); + pcmcia_release_configuration(info->link.handle); + pcmcia_release_io(info->link.handle, &info->link.io); + pcmcia_release_irq(info->link.handle, &info->link.irq); } info->link.state &= ~DEV_CONFIG; @@ -211,7 +211,7 @@ static dev_link_t *serial_attach(void) client_reg.event_handler = &serial_event; client_reg.Version = 0x0210; 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) { cs_error(link->handle, RegisterClient, ret); serial_detach(link); @@ -256,7 +256,7 @@ static void serial_detach(dev_link_t * l serial_remove(link); if (link->handle) { - ret = CardServices(DeregisterClient, link->handle); + ret = pcmcia_deregister_client(link->handle); if (ret != CS_SUCCESS) cs_error(link->handle, DeregisterClient, ret); } @@ -306,10 +306,10 @@ get_tuple(int fn, client_handle_t handle i = CardServices(fn, handle, tuple); if (i != CS_SUCCESS) return CS_NO_MORE_ITEMS; - i = CardServices(GetTupleData, handle, tuple); + i = pcmcia_get_tuple_data(handle, tuple); if (i != CS_SUCCESS) return i; - return CardServices(ParseTuple, handle, tuple, parse); + return pcmcia_parse_tuple(handle, tuple, parse); } #define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) @@ -330,7 +330,7 @@ static int simple_config(dev_link_t * li int i, j, try; /* If the card is already configured, look up the port and irq */ - i = CardServices(GetConfigurationInfo, handle, &config); + i = pcmcia_get_configuration_info(handle, &config); if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { ioaddr_t port = 0; if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { @@ -367,9 +367,7 @@ static int simple_config(dev_link_t * li link->io.BasePort1 = cf->io.win[0].base; link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; - i = - CardServices(RequestIO, link->handle, - &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) goto found_port; } @@ -389,8 +387,7 @@ static int simple_config(dev_link_t * li for (j = 0; j < 5; j++) { link->io.BasePort1 = base[j]; link->io.IOAddrLines = base[j] ? 16 : 3; - i = CardServices(RequestIO, link->handle, - &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) goto found_port; } @@ -406,14 +403,14 @@ static int simple_config(dev_link_t * li return -1; } - i = CardServices(RequestIRQ, link->handle, &link->irq); + i = pcmcia_request_irq(link->handle, &link->irq); if (i != CS_SUCCESS) { cs_error(link->handle, RequestIRQ, i); link->irq.AssignedIRQ = 0; } if (info->multi && (info->manfid == MANFID_3COM)) link->conf.ConfigIndex &= ~(0x08); - i = CardServices(RequestConfiguration, link->handle, &link->conf); + i = pcmcia_request_configuration(link->handle, &link->conf); if (i != CS_SUCCESS) { cs_error(link->handle, RequestConfiguration, i); return -1; @@ -433,7 +430,7 @@ static int multi_config(dev_link_t * lin config_info_t config; int i, base2 = 0; - i = CardServices(GetConfigurationInfo, handle, &config); + i = pcmcia_get_configuration_info(handle, &config); if (i != CS_SUCCESS) { cs_error(handle, GetConfigurationInfo, i); return -1; @@ -458,7 +455,7 @@ static int multi_config(dev_link_t * lin link->io.BasePort1 = cf->io.win[0].base; link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; - i = CardServices(RequestIO, link->handle, &link->io); + i = pcmcia_request_io(link->handle, &link->io); base2 = link->io.BasePort1 + 8; if (i == CS_SUCCESS) break; @@ -478,9 +475,7 @@ static int multi_config(dev_link_t * lin link->io.BasePort2 = cf->io.win[1].base; link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; - i = - CardServices(RequestIO, link->handle, - &link->io); + i = pcmcia_request_io(link->handle, &link->io); base2 = link->io.BasePort2; if (i == CS_SUCCESS) break; @@ -494,7 +489,7 @@ static int multi_config(dev_link_t * lin return -1; } - i = CardServices(RequestIRQ, link->handle, &link->irq); + i = pcmcia_request_irq(link->handle, &link->irq); if (i != CS_SUCCESS) { printk(KERN_NOTICE "serial_cs: no usable port range found, giving up\n"); @@ -506,7 +501,7 @@ static int multi_config(dev_link_t * lin link->conf.Present |= PRESENT_EXT_STATUS; link->conf.ExtStatus = ESR_REQ_ATTN_ENA; } - i = CardServices(RequestConfiguration, link->handle, &link->conf); + i = pcmcia_request_configuration(link->handle, &link->conf); if (i != CS_SUCCESS) { cs_error(link->handle, RequestConfiguration, i); return -1; @@ -543,9 +538,6 @@ static int multi_config(dev_link_t * lin ======================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed - void serial_config(dev_link_t * link) { client_handle_t handle = link->handle; @@ -619,10 +611,18 @@ void serial_config(dev_link_t * link) if (info->manfid == MANFID_IBM) { conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; - CS_CHECK(AccessConfigurationRegister, link->handle, ®); + last_ret = pcmcia_access_configuration_register(link->handle, ®); + if (last_ret) { + last_fn = AccessConfigurationRegister; + goto cs_failed; + } reg.Action = CS_WRITE; reg.Value = reg.Value | 1; - CS_CHECK(AccessConfigurationRegister, link->handle, ®); + last_ret = pcmcia_access_configuration_register(link->handle, ®); + if (last_ret) { + last_fn = AccessConfigurationRegister; + goto cs_failed; + } } link->dev = &info->node[0]; @@ -668,7 +668,7 @@ serial_event(event_t event, int priority /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if ((link->state & DEV_CONFIG) && !info->slave) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: @@ -676,8 +676,7 @@ serial_event(event_t event, int priority /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link) && !info->slave) - CardServices(RequestConfiguration, link->handle, - &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } return 0; _