From: Andres Salomon Remove calls to CardServices(); final. This removes the CardServices() calls the rest of the tree, as well as CardServices itself from cs.c and cs.h. My previous patches, along w/ Arjan's patch for ide-cs.c and Russell's patch for serial_cs.c should remove all traces of it. I've attached a gzipped tarball to hopefully make things easier. Files touched: = 201-cs_remove.patch:+++ mod/sound/pcmcia/vx/vx_entry.c 202-cs_remove.patch:+++ mod/drivers/bluetooth/bluecard_cs.c 202-cs_remove.patch:+++ mod/drivers/bluetooth/bt3c_cs.c 202-cs_remove.patch:+++ mod/drivers/bluetooth/btuart_cs.c 202-cs_remove.patch:+++ mod/drivers/bluetooth/dtl1_cs.c 203-cs_remove.patch:+++ mod/drivers/isdn/hardware/avm/avm_cs.c 203-cs_remove.patch:+++ mod/drivers/isdn/hisax/avma1_cs.c 203-cs_remove.patch:+++ mod/drivers/isdn/hisax/elsa_cs.c 203-cs_remove.patch:+++ mod/drivers/isdn/hisax/sedlbauer_cs.c 204-cs_remove.patch:+++ mod/drivers/parport/parport_cs.c 205-cs_remove.patch:+++ mod/drivers/telephony/ixj_pcmcia.c 206-cs_remove.patch:+++ mod/drivers/mtd/maps/pcmciamtd.c 207-cs_remove.patch:+++ mod/drivers/scsi/pcmcia/aha152x_stub.c 207-cs_remove.patch:+++ mod/drivers/scsi/pcmcia/fdomain_stub.c 207-cs_remove.patch:+++ mod/drivers/scsi/pcmcia/nsp_cs.c 207-cs_remove.patch:+++ mod/drivers/scsi/pcmcia/nsp_cs.h 207-cs_remove.patch:+++ mod/drivers/scsi/pcmcia/qlogic_stub.c 208-cs_remove.patch:+++ mod/drivers/char/pcmcia/synclink_cs.c 209-cs_remove.patch:+++ mod/drivers/pcmcia/cs.c 209-cs_remove.patch:+++ mod/include/pcmcia/cs.h drivers/bluetooth/bluecard_cs.c | 34 +++----- drivers/bluetooth/bt3c_cs.c | 49 ++++++------ drivers/bluetooth/btuart_cs.c | 49 ++++++------ drivers/bluetooth/dtl1_cs.c | 47 ++++++------ drivers/char/pcmcia/synclink_cs.c | 38 ++++----- drivers/isdn/hardware/avm/avm_cs.c | 56 ++++++++------ drivers/isdn/hisax/avma1_cs.c | 56 ++++++++------ drivers/isdn/hisax/elsa_cs.c | 48 +++++++----- drivers/isdn/hisax/sedlbauer_cs.c | 57 +++++++------- drivers/mtd/maps/pcmciamtd.c | 35 ++++---- drivers/parport/parport_cs.c | 45 +++++------ drivers/pcmcia/cs.c | 144 ------------------------------------- drivers/scsi/pcmcia/aha152x_stub.c | 42 +++++----- drivers/scsi/pcmcia/fdomain_stub.c | 42 +++++----- drivers/scsi/pcmcia/nsp_cs.c | 58 +++++++------- drivers/scsi/pcmcia/nsp_cs.h | 2 drivers/scsi/pcmcia/qlogic_stub.c | 44 +++++------ drivers/telephony/ixj_pcmcia.c | 45 +++++------ include/pcmcia/cs.h | 6 - sound/pcmcia/vx/vx_entry.c | 38 ++++----- 20 files changed, 408 insertions(+), 527 deletions(-) diff -puN drivers/bluetooth/bluecard_cs.c~remove-CardServices-final drivers/bluetooth/bluecard_cs.c --- 25/drivers/bluetooth/bluecard_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/bluetooth/bluecard_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -869,7 +869,7 @@ dev_link_t *bluecard_attach(void) 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); bluecard_detach(link); @@ -898,7 +898,7 @@ void bluecard_detach(dev_link_t *link) bluecard_release(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); } @@ -910,25 +910,21 @@ void bluecard_detach(dev_link_t *link) } -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { int i; - i = CardServices(fn, handle, tuple); + i = pcmcia_get_first_tuple(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) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) - void bluecard_config(dev_link_t *link) { client_handle_t handle = link->handle; @@ -956,7 +952,7 @@ void bluecard_config(dev_link_t *link) /* Configure card */ link->state |= DEV_CONFIG; - i = CardServices(GetConfigurationInfo, handle, &config); + i = pcmcia_get_configuration_info(handle, &config); link->conf.Vcc = config.Vcc; link->conf.ConfigIndex = 0x20; @@ -965,7 +961,7 @@ void bluecard_config(dev_link_t *link) for (n = 0; n < 0x400; n += 0x40) { link->io.BasePort1 = n ^ 0x300; - i = CardServices(RequestIO, link->handle, &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) break; } @@ -975,13 +971,13 @@ void bluecard_config(dev_link_t *link) goto failed; } - 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; } - 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); goto failed; @@ -1013,9 +1009,9 @@ void bluecard_release(dev_link_t *link) link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; } @@ -1043,14 +1039,14 @@ int bluecard_event(event_t event, int pr /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link)) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } diff -puN drivers/bluetooth/bt3c_cs.c~remove-CardServices-final drivers/bluetooth/bt3c_cs.c --- 25/drivers/bluetooth/bt3c_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/bluetooth/bt3c_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -615,7 +615,7 @@ dev_link_t *bt3c_attach(void) 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); bt3c_detach(link); @@ -644,7 +644,7 @@ void bt3c_detach(dev_link_t *link) bt3c_release(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); } @@ -655,25 +655,30 @@ void bt3c_detach(dev_link_t *link) kfree(info); } - -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { int i; - 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); } +static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) + return CS_NO_MORE_ITEMS; + return get_tuple(handle, tuple, parse); +} -#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) +static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) + return CS_NO_MORE_ITEMS; + return get_tuple(handle, tuple, parse); +} void bt3c_config(dev_link_t *link) { @@ -704,7 +709,7 @@ void bt3c_config(dev_link_t *link) /* Configure card */ link->state |= DEV_CONFIG; - i = CardServices(GetConfigurationInfo, handle, &config); + i = pcmcia_get_configuration_info(handle, &config); link->conf.Vcc = config.Vcc; /* First pass: look for a config entry that looks normal. */ @@ -725,7 +730,7 @@ void bt3c_config(dev_link_t *link) link->conf.ConfigIndex = cf->index; 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; } @@ -744,7 +749,7 @@ next_entry: 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; } @@ -759,13 +764,13 @@ found_port: goto failed; } - 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; } - 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); goto failed; @@ -797,9 +802,9 @@ void bt3c_release(dev_link_t *link) link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; } @@ -827,14 +832,14 @@ int bt3c_event(event_t event, int priori /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link)) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } diff -puN drivers/bluetooth/btuart_cs.c~remove-CardServices-final drivers/bluetooth/btuart_cs.c --- 25/drivers/bluetooth/btuart_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/bluetooth/btuart_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -622,7 +622,7 @@ dev_link_t *btuart_attach(void) 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); btuart_detach(link); @@ -651,7 +651,7 @@ void btuart_detach(dev_link_t *link) btuart_release(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); } @@ -662,25 +662,30 @@ void btuart_detach(dev_link_t *link) kfree(info); } - -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { int i; - 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); } +static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) + return CS_NO_MORE_ITEMS; + return get_tuple(handle, tuple, parse); +} -#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) +static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) + return CS_NO_MORE_ITEMS; + return get_tuple(handle, tuple, parse); +} void btuart_config(dev_link_t *link) { @@ -711,7 +716,7 @@ void btuart_config(dev_link_t *link) /* Configure card */ link->state |= DEV_CONFIG; - i = CardServices(GetConfigurationInfo, handle, &config); + i = pcmcia_get_configuration_info(handle, &config); link->conf.Vcc = config.Vcc; /* First pass: look for a config entry that looks normal. */ @@ -732,7 +737,7 @@ void btuart_config(dev_link_t *link) link->conf.ConfigIndex = cf->index; 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; } @@ -752,7 +757,7 @@ next_entry: 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; } @@ -767,13 +772,13 @@ found_port: goto failed; } - 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; } - 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); goto failed; @@ -805,9 +810,9 @@ void btuart_release(dev_link_t *link) link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; } @@ -835,14 +840,14 @@ int btuart_event(event_t event, int prio /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link)) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } diff -puN drivers/bluetooth/dtl1_cs.c~remove-CardServices-final drivers/bluetooth/dtl1_cs.c --- 25/drivers/bluetooth/dtl1_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/bluetooth/dtl1_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -601,7 +601,7 @@ dev_link_t *dtl1_attach(void) 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); dtl1_detach(link); @@ -630,7 +630,7 @@ void dtl1_detach(dev_link_t *link) dtl1_release(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); } @@ -641,25 +641,30 @@ void dtl1_detach(dev_link_t *link) kfree(info); } - -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { int i; - 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); } +static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) + return CS_NO_MORE_ITEMS; + return get_tuple(handle, tuple, parse); +} -#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) +static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) +{ + if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) + return CS_NO_MORE_ITEMS; + return get_tuple(handle, tuple, parse); +} void dtl1_config(dev_link_t *link) { @@ -689,7 +694,7 @@ void dtl1_config(dev_link_t *link) /* Configure card */ link->state |= DEV_CONFIG; - i = CardServices(GetConfigurationInfo, handle, &config); + i = pcmcia_get_configuration_info(handle, &config); link->conf.Vcc = config.Vcc; tuple.TupleData = (cisdata_t *)buf; @@ -707,7 +712,7 @@ void dtl1_config(dev_link_t *link) link->io.BasePort1 = cf->io.win[0].base; link->io.NumPorts1 = cf->io.win[0].len; /*yo */ 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); if (i == CS_SUCCESS) break; } @@ -719,13 +724,13 @@ void dtl1_config(dev_link_t *link) goto failed; } - 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; } - 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); goto failed; @@ -757,9 +762,9 @@ void dtl1_release(dev_link_t *link) link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; } @@ -787,14 +792,14 @@ int dtl1_event(event_t event, int priori /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link)) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } diff -puN drivers/char/pcmcia/synclink_cs.c~remove-CardServices-final drivers/char/pcmcia/synclink_cs.c --- 25/drivers/char/pcmcia/synclink_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/char/pcmcia/synclink_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -591,7 +591,7 @@ static dev_link_t *mgslpc_attach(void) 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); mgslpc_detach(link); @@ -606,8 +606,8 @@ static dev_link_t *mgslpc_attach(void) /* Card has been inserted. */ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn),args))!=0) goto cs_failed +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void mgslpc_config(dev_link_t *link) { @@ -630,9 +630,9 @@ static void mgslpc_config(dev_link_t *li tuple.TupleData = buf; tuple.TupleDataMax = sizeof(buf); tuple.TupleOffset = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; @@ -640,17 +640,17 @@ static void mgslpc_config(dev_link_t *li link->state |= DEV_CONFIG; /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, handle, &conf); + CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); link->conf.Vcc = conf.Vcc; /* get CIS configuration entry */ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); cfg = &(parse.cftable_entry); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->index == 0) @@ -671,7 +671,7 @@ static void mgslpc_config(dev_link_t *li link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; link->io.BasePort1 = io->win[0].base; link->io.NumPorts1 = io->win[0].len; - CS_CHECK(RequestIO, link->handle, &link->io); + CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); } link->conf.Attributes = CONF_ENABLE_IRQ; @@ -683,9 +683,9 @@ static void mgslpc_config(dev_link_t *li link->irq.Attributes |= IRQ_HANDLE_PRESENT; link->irq.Handler = mgslpc_isr; link->irq.Instance = info; - CS_CHECK(RequestIRQ, link->handle, &link->irq); + CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); - CS_CHECK(RequestConfiguration, link->handle, &link->conf); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); info->io_base = link->io.BasePort1; info->irq_level = link->irq.AssignedIRQ; @@ -727,11 +727,11 @@ static void mgslpc_release(u_long arg) link->dev = NULL; link->state &= ~DEV_CONFIG; - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); if (link->io.NumPorts1) - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); if (link->irq.AssignedIRQ) - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_irq(link->handle, &link->irq); if (link->state & DEV_STALE_LINK) mgslpc_detach(link); } @@ -762,7 +762,7 @@ static void mgslpc_detach(dev_link_t *li /* Break the link with Card Services */ if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, and free it */ *linkp = link->next; @@ -797,14 +797,14 @@ static int mgslpc_event(event_t event, i /* Mark the device as stopped, to block IO until later */ info->stop = 1; if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); info->stop = 0; break; } diff -puN drivers/isdn/hardware/avm/avm_cs.c~remove-CardServices-final drivers/isdn/hardware/avm/avm_cs.c --- 25/drivers/isdn/hardware/avm/avm_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/isdn/hardware/avm/avm_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -186,7 +186,7 @@ static dev_link_t *avmcs_attach(void) client_reg.event_handler = &avmcs_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 != 0) { cs_error(link->handle, RegisterClient, ret); avmcs_detach(link); @@ -232,7 +232,7 @@ static void avmcs_detach(dev_link_t *lin /* Break the link with Card Services */ if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, free pieces */ *linkp = link->next; @@ -251,19 +251,29 @@ static void avmcs_detach(dev_link_t *lin ======================================================================*/ -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, +static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { - int i; - i = CardServices(fn, handle, tuple); + int i = pcmcia_get_tuple_data(handle, tuple); if (i != CS_SUCCESS) return i; - i = CardServices(GetTupleData, handle, tuple); + return pcmcia_parse_tuple(handle, tuple, parse); +} + +static int first_tuple(client_handle_t handle, tuple_t *tuple, + cisparse_t *parse) +{ + int i = pcmcia_get_first_tuple(handle, tuple); if (i != CS_SUCCESS) return i; - return CardServices(ParseTuple, handle, tuple, parse); + return get_tuple(handle, tuple, parse); } -#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) +static int next_tuple(client_handle_t handle, tuple_t *tuple, + cisparse_t *parse) +{ + int i = pcmcia_get_next_tuple(handle, tuple); + if (i != CS_SUCCESS) return i; + return get_tuple(handle, tuple, parse); +} static void avmcs_config(dev_link_t *link) { @@ -287,14 +297,14 @@ static void avmcs_config(dev_link_t *lin */ do { tuple.DesiredTuple = CISTPL_CONFIG; - i = CardServices(GetFirstTuple, handle, &tuple); + i = pcmcia_get_first_tuple(handle, &tuple); if (i != CS_SUCCESS) break; tuple.TupleData = buf; tuple.TupleDataMax = 64; tuple.TupleOffset = 0; - i = CardServices(GetTupleData, handle, &tuple); + i = pcmcia_get_tuple_data(handle, &tuple); if (i != CS_SUCCESS) break; - i = CardServices(ParseTuple, handle, &tuple, &parse); + i = pcmcia_parse_tuple(handle, &tuple, &parse); if (i != CS_SUCCESS) break; link->conf.ConfigBase = parse.config.base; } while (0); @@ -337,7 +347,7 @@ static void avmcs_config(dev_link_t *lin printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1-1); - i = CardServices(RequestIO, link->handle, &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) goto found_port; } i = next_tuple(handle, &tuple, &parse); @@ -352,21 +362,21 @@ found_port: /* * allocate an interrupt line */ - 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); - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); break; } /* * configure the PCMCIA socket */ - 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); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); break; } @@ -437,9 +447,9 @@ static void avmcs_release(dev_link_t *li link->dev = NULL; /* Don't bother checking to see if these succeed or not */ - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; if (link->state & DEV_STALE_LINK) @@ -481,14 +491,14 @@ static int avmcs_event(event_t event, in /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } return 0; diff -puN drivers/isdn/hisax/avma1_cs.c~remove-CardServices-final drivers/isdn/hisax/avma1_cs.c --- 25/drivers/isdn/hisax/avma1_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/isdn/hisax/avma1_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -204,7 +204,7 @@ static dev_link_t *avma1cs_attach(void) client_reg.event_handler = &avma1cs_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 != 0) { cs_error(link->handle, RegisterClient, ret); avma1cs_detach(link); @@ -252,7 +252,7 @@ static void avma1cs_detach(dev_link_t *l /* Break the link with Card Services */ if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, free pieces */ *linkp = link->next; @@ -271,19 +271,29 @@ static void avma1cs_detach(dev_link_t *l ======================================================================*/ -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, +static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { - int i; - i = CardServices(fn, handle, tuple); + int i = pcmcia_get_tuple_data(handle, tuple); if (i != CS_SUCCESS) return i; - i = CardServices(GetTupleData, handle, tuple); + return pcmcia_parse_tuple(handle, tuple, parse); +} + +static int first_tuple(client_handle_t handle, tuple_t *tuple, + cisparse_t *parse) +{ + int i = pcmcia_get_first_tuple(handle, tuple); if (i != CS_SUCCESS) return i; - return CardServices(ParseTuple, handle, tuple, parse); + return get_tuple(handle, tuple, parse); } -#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) +static int next_tuple(client_handle_t handle, tuple_t *tuple, + cisparse_t *parse) +{ + int i = pcmcia_get_next_tuple(handle, tuple); + if (i != CS_SUCCESS) return i; + return get_tuple(handle, tuple, parse); +} static void avma1cs_config(dev_link_t *link) { @@ -308,14 +318,14 @@ static void avma1cs_config(dev_link_t *l */ do { tuple.DesiredTuple = CISTPL_CONFIG; - i = CardServices(GetFirstTuple, handle, &tuple); + i = pcmcia_get_first_tuple(handle, &tuple); if (i != CS_SUCCESS) break; tuple.TupleData = buf; tuple.TupleDataMax = 64; tuple.TupleOffset = 0; - i = CardServices(GetTupleData, handle, &tuple); + i = pcmcia_get_tuple_data(handle, &tuple); if (i != CS_SUCCESS) break; - i = CardServices(ParseTuple, handle, &tuple, &parse); + i = pcmcia_parse_tuple(handle, &tuple, &parse); if (i != CS_SUCCESS) break; link->conf.ConfigBase = parse.config.base; } while (0); @@ -358,7 +368,7 @@ static void avma1cs_config(dev_link_t *l printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1 - 1); - i = CardServices(RequestIO, link->handle, &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) goto found_port; } i = next_tuple(handle, &tuple, &parse); @@ -373,21 +383,21 @@ found_port: /* * allocate an interrupt line */ - 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); - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); break; } /* * configure the PCMCIA socket */ - 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); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); break; } @@ -445,9 +455,9 @@ static void avma1cs_release(dev_link_t * link->dev = NULL; /* Don't bother checking to see if these succeed or not */ - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; if (link->state & DEV_STALE_LINK) @@ -490,14 +500,14 @@ static int avma1cs_event(event_t event, /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } return 0; diff -puN drivers/isdn/hisax/elsa_cs.c~remove-CardServices-final drivers/isdn/hisax/elsa_cs.c --- 25/drivers/isdn/hisax/elsa_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/isdn/hisax/elsa_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -235,7 +235,7 @@ static dev_link_t *elsa_cs_attach(void) client_reg.event_handler = &elsa_cs_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); elsa_cs_detach(link); @@ -286,7 +286,7 @@ static void elsa_cs_detach(dev_link_t *l /* Break the link with Card Services */ if (link->handle) { - ret = CardServices(DeregisterClient, link->handle); + ret = pcmcia_deregister_client(link->handle); if (ret != CS_SUCCESS) cs_error(link->handle, DeregisterClient, ret); } @@ -304,19 +304,29 @@ static void elsa_cs_detach(dev_link_t *l device available to the system. ======================================================================*/ -static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, +static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) { - int i; - i = CardServices(fn, handle, tuple); + int i = pcmcia_get_tuple_data(handle, tuple); if (i != CS_SUCCESS) return i; - i = CardServices(GetTupleData, handle, tuple); + return pcmcia_parse_tuple(handle, tuple, parse); +} + +static int first_tuple(client_handle_t handle, tuple_t *tuple, + cisparse_t *parse) +{ + int i = pcmcia_get_first_tuple(handle, tuple); if (i != CS_SUCCESS) return i; - return CardServices(ParseTuple, handle, tuple, parse); + return get_tuple(handle, tuple, parse); } -#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c) -#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c) +static int next_tuple(client_handle_t handle, tuple_t *tuple, + cisparse_t *parse) +{ + int i = pcmcia_get_next_tuple(handle, tuple); + if (i != CS_SUCCESS) return i; + return get_tuple(handle, tuple, parse); +} static void elsa_cs_config(dev_link_t *link) { @@ -362,14 +372,14 @@ static void elsa_cs_config(dev_link_t *l printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); link->conf.ConfigIndex = cf->index; link->io.BasePort1 = cf->io.win[0].base; - i = CardServices(RequestIO, link->handle, &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) break; } else { printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); link->conf.ConfigIndex = cf->index; for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { link->io.BasePort1 = j; - i = CardServices(RequestIO, link->handle, &link->io); + i = pcmcia_request_io(link->handle, &link->io); if (i == CS_SUCCESS) break; } break; @@ -382,14 +392,14 @@ static void elsa_cs_config(dev_link_t *l goto cs_failed; } - i = CardServices(RequestIRQ, link->handle, &link->irq); + i = pcmcia_request_irq(link->handle, &link->irq); if (i != CS_SUCCESS) { link->irq.AssignedIRQ = 0; last_fn = RequestIRQ; goto cs_failed; } - i = CardServices(RequestConfiguration, link->handle, &link->conf); + i = pcmcia_request_configuration(link->handle, &link->conf); if (i != CS_SUCCESS) { last_fn = RequestConfiguration; goto cs_failed; @@ -447,10 +457,10 @@ static void elsa_cs_release(dev_link_t * /* Don't bother checking to see if these succeed or not */ if (link->win) - CardServices(ReleaseWindow, link->win); - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_window(link->win); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; if (link->state & DEV_STALE_LINK) @@ -499,14 +509,14 @@ static int elsa_cs_event(event_t event, /* Mark the device as stopped, to block IO until later */ dev->busy = 1; if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); dev->busy = 0; break; } diff -puN drivers/isdn/hisax/sedlbauer_cs.c~remove-CardServices-final drivers/isdn/hisax/sedlbauer_cs.c --- 25/drivers/isdn/hisax/sedlbauer_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/isdn/hisax/sedlbauer_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -247,7 +247,7 @@ static dev_link_t *sedlbauer_attach(void client_reg.event_handler = &sedlbauer_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); sedlbauer_detach(link); @@ -295,7 +295,7 @@ static void sedlbauer_detach(dev_link_t /* Break the link with Card Services */ if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, and free it */ *linkp = link->next; @@ -310,12 +310,8 @@ static void sedlbauer_detach(dev_link_t device available to the system. ======================================================================*/ - -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn),args))!=0) goto cs_failed - -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void sedlbauer_config(dev_link_t *link) { @@ -341,9 +337,9 @@ static void sedlbauer_config(dev_link_t tuple.TupleData = buf; tuple.TupleDataMax = sizeof(buf); tuple.TupleOffset = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; @@ -351,7 +347,7 @@ static void sedlbauer_config(dev_link_t link->state |= DEV_CONFIG; /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, handle, &conf); + CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); link->conf.Vcc = conf.Vcc; /* @@ -367,12 +363,13 @@ static void sedlbauer_config(dev_link_t will only use the CIS to fill in implementation-defined details. */ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->index == 0) goto next_entry; @@ -425,7 +422,8 @@ static void sedlbauer_config(dev_link_t link->io.NumPorts2 = io->win[1].len; } /* 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; } /* @@ -451,10 +449,11 @@ static void sedlbauer_config(dev_link_t req.Size = 0x1000; */ req.AccessSpeed = 0; - link->win = (window_handle_t)link->handle; - CFG_CHECK(RequestWindow, &link->win, &req); + if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) + goto next_entry; 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! */ break; @@ -462,9 +461,9 @@ static void sedlbauer_config(dev_link_t next_entry: /* new in dummy.cs 2001/01/28 MN if (link->io.NumPorts1) - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); */ - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } /* @@ -473,14 +472,14 @@ static void sedlbauer_config(dev_link_t irq structure is initialized. */ 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 the I/O windows and the interrupt mapping, and putting the 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)); /* At this point, the dev_node_t structure(s) need to be @@ -545,12 +544,12 @@ static void sedlbauer_release(dev_link_t /* Don't bother checking to see if these succeed or not */ if (link->win) - CardServices(ReleaseWindow, link->win); - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_window(link->win); + pcmcia_release_configuration(link->handle); if (link->io.NumPorts1) - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); if (link->irq.AssignedIRQ) - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; if (link->state & DEV_STALE_LINK) @@ -597,14 +596,14 @@ static int sedlbauer_event(event_t event /* Mark the device as stopped, to block IO until later */ dev->stop = 1; if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); dev->stop = 0; /* In a normal driver, additional code may go here to restore diff -puN drivers/mtd/maps/pcmciamtd.c~remove-CardServices-final drivers/mtd/maps/pcmciamtd.c --- 25/drivers/mtd/maps/pcmciamtd.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/mtd/maps/pcmciamtd.c 2003-12-24 00:01:29.000000000 -0800 @@ -125,7 +125,7 @@ static caddr_t remap_window(struct map_i DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", dev->offset, mrq.CardOffset); mrq.Page = 0; - if( (ret = CardServices(MapMemPage, win, &mrq)) != CS_SUCCESS) { + if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { cs_error(dev->link.handle, MapMemPage, ret); return NULL; } @@ -332,7 +332,7 @@ static void pcmciamtd_set_vpp(struct map mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); - ret = CardServices(ModifyConfiguration, link->handle, &mod); + ret = pcmcia_modify_configuration(link->handle, &mod); if(ret != CS_SUCCESS) { cs_error(link->handle, ModifyConfiguration, ret); } @@ -355,9 +355,9 @@ static void pcmciamtd_release(dev_link_t iounmap(dev->win_base); dev->win_base = NULL; } - CardServices(ReleaseWindow, link->win); + pcmcia_release_window(link->win); } - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); link->state &= ~DEV_CONFIG; } @@ -375,14 +375,14 @@ static void card_settings(struct pcmciam tuple.TupleOffset = 0; tuple.DesiredTuple = RETURN_FIRST_TUPLE; - rc = CardServices(GetFirstTuple, link->handle, &tuple); + rc = pcmcia_get_first_tuple(link->handle, &tuple); while(rc == CS_SUCCESS) { - rc = CardServices(GetTupleData, link->handle, &tuple); + rc = pcmcia_get_tuple_data(link->handle, &tuple); if(rc != CS_SUCCESS) { cs_error(link->handle, GetTupleData, rc); break; } - rc = CardServices(ParseTuple, link->handle, &tuple, &parse); + rc = pcmcia_parse_tuple(link->handle, &tuple, &parse); if(rc != CS_SUCCESS) { cs_error(link->handle, ParseTuple, rc); break; @@ -455,7 +455,7 @@ static void card_settings(struct pcmciam DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); } - rc = CardServices(GetNextTuple, link->handle, &tuple, &parse); + rc = pcmcia_get_next_tuple(link->handle, &tuple); } if(!dev->pcmcia_map.size) dev->pcmcia_map.size = MAX_PCMCIA_ADDR; @@ -489,8 +489,8 @@ static void card_settings(struct pcmciam * MTD device available to the system. */ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void pcmciamtd_config(dev_link_t *link) { @@ -512,7 +512,7 @@ static void pcmciamtd_config(dev_link_t link->state |= DEV_CONFIG; DEBUG(2, "Validating CIS"); - ret = CardServices(ValidateCIS, link->handle, &cisinfo); + ret = pcmcia_validate_cis(link->handle, &cisinfo); if(ret != CS_SUCCESS) { cs_error(link->handle, GetTupleData, ret); } else { @@ -547,8 +547,7 @@ static void pcmciamtd_config(dev_link_t int ret; DEBUG(2, "requesting window with size = %dKiB memspeed = %d", req.Size >> 10, req.AccessSpeed); - link->win = (window_handle_t)link->handle; - ret = CardServices(RequestWindow, &link->win, &req); + ret = pcmcia_request_window(&link->handle, &req, &link->win); DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); if(ret) { req.Size >>= 1; @@ -569,7 +568,7 @@ static void pcmciamtd_config(dev_link_t DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); /* Get write protect status */ - CS_CHECK(GetStatus, link->handle, &status); + CS_CHECK(GetStatus, pcmcia_get_status(link->handle, &status)); DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", status.CardState, (unsigned long)link->win); dev->win_base = ioremap(req.Base, req.Size); @@ -586,7 +585,7 @@ static void pcmciamtd_config(dev_link_t dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; DEBUG(2, "Getting configuration"); - CS_CHECK(GetConfigurationInfo, link->handle, &t); + CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link->handle, &t)); DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2); dev->vpp = (vpp) ? vpp : t.Vpp1; link->conf.Attributes = 0; @@ -608,7 +607,7 @@ static void pcmciamtd_config(dev_link_t link->conf.ConfigIndex = 0; link->conf.Present = t.Present; DEBUG(2, "Setting Configuration"); - ret = CardServices(RequestConfiguration, link->handle, &link->conf); + ret = pcmcia_request_configuration(link->handle, &link->conf); if(ret != CS_SUCCESS) { cs_error(link->handle, RequestConfiguration, ret); } @@ -757,7 +756,7 @@ static void pcmciamtd_detach(dev_link_t if (link->handle) { int ret; DEBUG(2, "Deregistering with card services"); - ret = CardServices(DeregisterClient, link->handle); + ret = pcmcia_deregister_client(link->handle); if (ret != CS_SUCCESS) cs_error(link->handle, DeregisterClient, ret); } @@ -804,7 +803,7 @@ static dev_link_t *pcmciamtd_attach(void client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; DEBUG(2, "Calling RegisterClient"); - ret = CardServices(RegisterClient, &link->handle, &client_reg); + ret = pcmcia_register_client(&link->handle, &client_reg); if (ret != 0) { cs_error(link->handle, RegisterClient, ret); pcmciamtd_detach(link); diff -puN drivers/parport/parport_cs.c~remove-CardServices-final drivers/parport/parport_cs.c --- 25/drivers/parport/parport_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/parport/parport_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -151,7 +151,7 @@ static dev_link_t *parport_attach(void) client_reg.event_handler = &parport_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); parport_detach(link); @@ -187,7 +187,7 @@ static void parport_detach(dev_link_t *l parport_cs_release(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); } @@ -206,11 +206,8 @@ static void parport_detach(dev_link_t *l ======================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed - -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) void parport_config(dev_link_t *link) { @@ -231,9 +228,9 @@ void parport_config(dev_link_t *link) tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.Attributes = 0; tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; @@ -241,14 +238,15 @@ void parport_config(dev_link_t *link) link->state |= DEV_CONFIG; /* 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)); tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.Attributes = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; @@ -262,18 +260,19 @@ void parport_config(dev_link_t *link) link->io.BasePort2 = io->win[1].base; link->io.NumPorts2 = io->win[1].len; } - CFG_CHECK(RequestIO, link->handle, &link->io); + if (pcmcia_request_io(link->handle, &link->io) != 0) + goto next_entry; /* If we've got this far, we're done */ break; } next_entry: if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } - CS_CHECK(RequestIRQ, handle, &link->irq); - CS_CHECK(RequestConfiguration, handle, &link->conf); + CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); release_region(link->io.BasePort1, link->io.NumPorts1); if (link->io.NumPorts2) @@ -335,9 +334,9 @@ void parport_cs_release(dev_link_t *link info->ndev = 0; link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; @@ -372,14 +371,14 @@ int parport_event(event_t event, int pri /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link)) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } return 0; diff -puN drivers/pcmcia/cs.c~remove-CardServices-final drivers/pcmcia/cs.c --- 25/drivers/pcmcia/cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/pcmcia/cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -2289,149 +2289,6 @@ int pcmcia_report_error(client_handle_t return CS_SUCCESS; } /* report_error */ -/*====================================================================*/ - -int CardServices(int func, void *a1, void *a2, void *a3) -{ - -#ifdef PCMCIA_DEBUG - if (pc_debug > 2) { - int i; - for (i = 0; i < SERVICE_COUNT; i++) - if (service_table[i].key == func) break; - if (i < SERVICE_COUNT) - printk(KERN_DEBUG "cs: CardServices(%s, 0x%p, 0x%p)\n", - service_table[i].msg, a1, a2); - else - printk(KERN_DEBUG "cs: CardServices(Unknown func %d, " - "0x%p, 0x%p)\n", func, a1, a2); - } -#endif - switch (func) { - case AccessConfigurationRegister: - return pcmcia_access_configuration_register(a1, a2); break; - case AdjustResourceInfo: - return pcmcia_adjust_resource_info(a1, a2); break; - case CheckEraseQueue: - return pcmcia_check_erase_queue(a1); break; - case CloseMemory: - return pcmcia_close_memory(a1); break; - case CopyMemory: - return pcmcia_copy_memory(a1, a2); break; - case DeregisterClient: - return pcmcia_deregister_client(a1); break; - case DeregisterEraseQueue: - return pcmcia_deregister_erase_queue(a1); break; - case GetFirstClient: - return pcmcia_get_first_client(a1, a2); break; - case GetCardServicesInfo: - return pcmcia_get_card_services_info(a1); break; - case GetConfigurationInfo: - return pcmcia_get_configuration_info(a1, a2); break; - case GetNextClient: - return pcmcia_get_next_client(a1, a2); break; - case GetFirstRegion: - return pcmcia_get_first_region(a1, a2); break; - case GetFirstTuple: - return pcmcia_get_first_tuple(a1, a2); break; - case GetNextRegion: - return pcmcia_get_next_region(a1, a2); break; - case GetNextTuple: - return pcmcia_get_next_tuple(a1, a2); break; - case GetStatus: - return pcmcia_get_status(a1, a2); break; - case GetTupleData: - return pcmcia_get_tuple_data(a1, a2); break; - case MapMemPage: - return pcmcia_map_mem_page(a1, a2); break; - case ModifyConfiguration: - return pcmcia_modify_configuration(a1, a2); break; - case ModifyWindow: - return pcmcia_modify_window(a1, a2); break; - case OpenMemory: -/* return pcmcia_open_memory(a1, a2); */ - { - memory_handle_t m; - int ret = pcmcia_open_memory(a1, a2, &m); - *(memory_handle_t *)a1 = m; - return ret; - } - break; - case ParseTuple: - return pcmcia_parse_tuple(a1, a2, a3); break; - case ReadMemory: - return pcmcia_read_memory(a1, a2, a3); break; - case RegisterClient: - return pcmcia_register_client(a1, a2); break; - case RegisterEraseQueue: - { - eraseq_handle_t w; - int ret = pcmcia_register_erase_queue(a1, a2, &w); - *(eraseq_handle_t *)a1 = w; - return ret; - } - break; -/* return pcmcia_register_erase_queue(a1, a2); break; */ - - return pcmcia_register_mtd(a1, a2); break; - case ReleaseConfiguration: - return pcmcia_release_configuration(a1); break; - case ReleaseIO: - return pcmcia_release_io(a1, a2); break; - case ReleaseIRQ: - return pcmcia_release_irq(a1, a2); break; - case ReleaseWindow: - return pcmcia_release_window(a1); break; - case RequestConfiguration: - return pcmcia_request_configuration(a1, a2); break; - case RequestIO: - return pcmcia_request_io(a1, a2); break; - case RequestIRQ: - return pcmcia_request_irq(a1, a2); break; - case RequestWindow: - { - window_handle_t w; - int ret = pcmcia_request_window(a1, a2, &w); - *(window_handle_t *)a1 = w; - return ret; - } - break; - case ResetCard: - return pcmcia_reset_card(a1, a2); break; - case SetEventMask: - return pcmcia_set_event_mask(a1, a2); break; - case ValidateCIS: - return pcmcia_validate_cis(a1, a2); break; - case WriteMemory: - return pcmcia_write_memory(a1, a2, a3); break; - case BindDevice: - return pcmcia_bind_device(a1); break; - case BindMTD: - return pcmcia_bind_mtd(a1); break; - case ReportError: - return pcmcia_report_error(a1, a2); break; - case SuspendCard: - return pcmcia_suspend_card(a1, a2); break; - case ResumeCard: - return pcmcia_resume_card(a1, a2); break; - case EjectCard: - return pcmcia_eject_card(a1, a2); break; - case InsertCard: - return pcmcia_insert_card(a1, a2); break; - case ReplaceCIS: - return pcmcia_replace_cis(a1, a2); break; - case GetFirstWindow: - return pcmcia_get_first_window(a1, a2); break; - case GetNextWindow: - return pcmcia_get_next_window(a1, a2); break; - case GetMemPage: - return pcmcia_get_mem_page(a1, a2); break; - default: - return CS_UNSUPPORTED_FUNCTION; break; - } - -} /* CardServices */ - /*====================================================================== OS-specific module glue goes here @@ -2489,7 +2346,6 @@ EXPORT_SYMBOL(pcmcia_validate_cis); EXPORT_SYMBOL(pcmcia_write_memory); EXPORT_SYMBOL(dead_socket); -EXPORT_SYMBOL(CardServices); EXPORT_SYMBOL(MTDHelperEntry); EXPORT_SYMBOL(pcmcia_parse_events); diff -puN drivers/scsi/pcmcia/aha152x_stub.c~remove-CardServices-final drivers/scsi/pcmcia/aha152x_stub.c --- 25/drivers/scsi/pcmcia/aha152x_stub.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/scsi/pcmcia/aha152x_stub.c 2003-12-24 00:01:29.000000000 -0800 @@ -153,7 +153,7 @@ static dev_link_t *aha152x_attach(void) CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; 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 != 0) { cs_error(link->handle, RegisterClient, ret); aha152x_detach(link); @@ -181,7 +181,7 @@ static void aha152x_detach(dev_link_t *l aha152x_release_cs(link); if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, free bits */ *linkp = link->next; @@ -191,11 +191,8 @@ static void aha152x_detach(dev_link_t *l /*====================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed - -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void aha152x_config_cs(dev_link_t *link) { @@ -214,19 +211,20 @@ static void aha152x_config_cs(dev_link_t tuple.TupleData = tuple_data; tuple.TupleDataMax = 64; tuple.TupleOffset = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; /* Configure card */ link->state |= DEV_CONFIG; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; /* For New Media T&J, look for a SCSI window */ if (parse.cftable_entry.io.win[0].len >= 0x20) link->io.BasePort1 = parse.cftable_entry.io.win[0].base; @@ -236,15 +234,15 @@ static void aha152x_config_cs(dev_link_t if ((parse.cftable_entry.io.nwin > 0) && (link->io.BasePort1 < 0xffff)) { link->conf.ConfigIndex = parse.cftable_entry.index; - i = CardServices(RequestIO, handle, &link->io); + i = pcmcia_request_io(handle, &link->io); if (i == CS_SUCCESS) break; } next_entry: - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } - CS_CHECK(RequestIRQ, handle, &link->irq); - CS_CHECK(RequestConfiguration, handle, &link->conf); + CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); /* A bad hack... */ release_region(link->io.BasePort1, link->io.NumPorts1); @@ -291,9 +289,9 @@ static void aha152x_release_cs(dev_link_ scsi_remove_host(info->host); link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; scsi_unregister(info->host); @@ -322,7 +320,7 @@ static int aha152x_event(event_t event, /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; @@ -330,7 +328,7 @@ static int aha152x_event(event_t event, case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) { Scsi_Cmnd tmp; - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); tmp.device->host = info->host; aha152x_host_reset(&tmp); } diff -puN drivers/scsi/pcmcia/fdomain_stub.c~remove-CardServices-final drivers/scsi/pcmcia/fdomain_stub.c --- 25/drivers/scsi/pcmcia/fdomain_stub.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/scsi/pcmcia/fdomain_stub.c 2003-12-24 00:01:29.000000000 -0800 @@ -142,7 +142,7 @@ static dev_link_t *fdomain_attach(void) CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; 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 != 0) { cs_error(link->handle, RegisterClient, ret); fdomain_detach(link); @@ -170,7 +170,7 @@ static void fdomain_detach(dev_link_t *l fdomain_release(link); if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, free bits */ *linkp = link->next; @@ -180,11 +180,8 @@ static void fdomain_detach(dev_link_t *l /*====================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed - -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void fdomain_config(dev_link_t *link) { @@ -203,29 +200,30 @@ static void fdomain_config(dev_link_t *l tuple.TupleData = tuple_data; tuple.TupleDataMax = 64; tuple.TupleOffset = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; /* Configure card */ link->state |= DEV_CONFIG; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; link->conf.ConfigIndex = parse.cftable_entry.index; link->io.BasePort1 = parse.cftable_entry.io.win[0].base; - i = CardServices(RequestIO, handle, &link->io); + i = pcmcia_request_io(handle, &link->io); if (i == CS_SUCCESS) break; next_entry: - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } - CS_CHECK(RequestIRQ, handle, &link->irq); - CS_CHECK(RequestConfiguration, handle, &link->conf); + CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); /* A bad hack... */ release_region(link->io.BasePort1, link->io.NumPorts1); @@ -271,9 +269,9 @@ static void fdomain_release(dev_link_t * scsi_remove_host(info->host); link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); scsi_unregister(info->host); @@ -304,14 +302,14 @@ static int fdomain_event(event_t event, /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) { - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); fdomain_16x0_bus_reset(NULL); } break; diff -puN drivers/scsi/pcmcia/nsp_cs.c~remove-CardServices-final drivers/scsi/pcmcia/nsp_cs.c --- 25/drivers/scsi/pcmcia/nsp_cs.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/scsi/pcmcia/nsp_cs.c 2003-12-24 00:01:29.000000000 -0800 @@ -1681,7 +1681,7 @@ static dev_link_t *nsp_cs_attach(void) client_reg.event_handler = &nsp_cs_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); nsp_cs_detach(link); @@ -1721,7 +1721,7 @@ static void nsp_cs_detach(dev_link_t *li /* Break the link with Card Services */ if (link->handle) { - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); } /* Unlink device structure, free bits */ @@ -1737,10 +1737,8 @@ static void nsp_cs_detach(dev_link_t *li is received, to configure the PCMCIA socket, and to make the ethernet device available to the system. ======================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn),args))!=0) goto cs_failed -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) /*====================================================================*/ static void nsp_cs_config(dev_link_t *link) { @@ -1768,9 +1766,9 @@ static void nsp_cs_config(dev_link_t *li tuple.TupleData = tuple_data; tuple.TupleDataMax = sizeof(tuple_data); tuple.TupleOffset = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; @@ -1778,16 +1776,17 @@ static void nsp_cs_config(dev_link_t *li link->state |= DEV_CONFIG; /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, handle, &conf); + CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); link->conf.Vcc = conf.Vcc; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) { dflt = *cfg; } if (cfg->index == 0) { goto next_entry; } @@ -1842,7 +1841,8 @@ static void nsp_cs_config(dev_link_t *li link->io.NumPorts2 = io->win[1].len; } /* 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 ((cfg->mem.nwin > 0) || (dflt.mem.nwin > 0)) { @@ -1856,10 +1856,11 @@ static void nsp_cs_config(dev_link_t *li req.Size = 0x1000; } req.AccessSpeed = 0; - link->win = (window_handle_t)link->handle; - CFG_CHECK(RequestWindow, &link->win, &req); + if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) + goto next_entry; 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; data->MmioAddress = (unsigned long)ioremap_nocache(req.Base, req.Size); data->MmioLength = req.Size; @@ -1871,15 +1872,15 @@ static void nsp_cs_config(dev_link_t *li nsp_dbg(NSP_DEBUG_INIT, "next"); if (link->io.NumPorts1) { - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); } - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } if (link->conf.Attributes & CONF_ENABLE_IRQ) { - CS_CHECK(RequestIRQ, link->handle, &link->irq); + CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); } - CS_CHECK(RequestConfiguration, handle, &link->conf); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); if (free_ports) { if (link->io.BasePort1) { @@ -2007,7 +2008,6 @@ static void nsp_cs_config(dev_link_t *li return; } /* nsp_cs_config */ #undef CS_CHECK -#undef CFG_CHECK /*====================================================================== @@ -2042,14 +2042,14 @@ static void nsp_cs_release(dev_link_t *l if (data != NULL) { iounmap((void *)(data->MmioAddress)); } - CardServices(ReleaseWindow, link->win); + pcmcia_release_window(link->win); } - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); if (link->io.NumPorts1) { - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_io(link->handle, &link->io); } if (link->irq.AssignedIRQ) { - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_irq(link->handle, &link->irq); } link->state &= ~DEV_CONFIG; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)) @@ -2119,7 +2119,7 @@ static int nsp_cs_event(event_t info->stop = 1; if (link->state & DEV_CONFIG) { - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); } break; @@ -2130,7 +2130,7 @@ static int nsp_cs_event(event_t case CS_EVENT_CARD_RESET: nsp_dbg(NSP_DEBUG_INIT, "event: reset"); if (link->state & DEV_CONFIG) { - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); } info->stop = 0; @@ -2177,7 +2177,7 @@ static int __init nsp_cs_init(void) servinfo_t serv; nsp_msg(KERN_INFO, "loading..."); - CardServices(GetCardServicesInfo, &serv); + pcmcia_get_card_services_info(&serv); if (serv.Revision != CS_RELEASE_CODE) { nsp_msg(KERN_DEBUG, "Card Services release does not match!"); return -EINVAL; diff -puN drivers/scsi/pcmcia/nsp_cs.h~remove-CardServices-final drivers/scsi/pcmcia/nsp_cs.h --- 25/drivers/scsi/pcmcia/nsp_cs.h~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/scsi/pcmcia/nsp_cs.h 2003-12-24 00:01:29.000000000 -0800 @@ -457,7 +457,7 @@ static inline struct Scsi_Host *scsi_hos static void cs_error(client_handle_t handle, int func, int ret) { error_info_t err = { func, ret }; - CardServices(ReportError, handle, &err); + pcmcia_report_error(handle, &err); } /* scatter-gather table */ diff -puN drivers/scsi/pcmcia/qlogic_stub.c~remove-CardServices-final drivers/scsi/pcmcia/qlogic_stub.c --- 25/drivers/scsi/pcmcia/qlogic_stub.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/scsi/pcmcia/qlogic_stub.c 2003-12-24 00:01:29.000000000 -0800 @@ -140,7 +140,7 @@ static dev_link_t *qlogic_attach(void) client_reg.EventMask = CS_EVENT_RESET_REQUEST | CS_EVENT_CARD_RESET | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; 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 != 0) { cs_error(link->handle, RegisterClient, ret); qlogic_detach(link); @@ -169,7 +169,7 @@ static void qlogic_detach(dev_link_t * l qlogic_release(link); if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); /* Unlink device structure, free bits */ *linkp = link->next; @@ -179,11 +179,8 @@ static void qlogic_detach(dev_link_t * l /*====================================================================*/ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed - -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void qlogic_config(dev_link_t * link) { @@ -201,37 +198,38 @@ static void qlogic_config(dev_link_t * l tuple.TupleDataMax = 64; tuple.TupleOffset = 0; tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; tuple.DesiredTuple = CISTPL_MANFID; - if ((CardServices(GetFirstTuple, handle, &tuple) == CS_SUCCESS) && (CardServices(GetTupleData, handle, &tuple) == CS_SUCCESS)) + if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) info->manf_id = le16_to_cpu(tuple.TupleData[0]); /* Configure card */ link->state |= DEV_CONFIG; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; link->conf.ConfigIndex = parse.cftable_entry.index; link->io.BasePort1 = parse.cftable_entry.io.win[0].base; link->io.NumPorts1 = parse.cftable_entry.io.win[0].len; if (link->io.BasePort1 != 0) { - i = CardServices(RequestIO, handle, &link->io); + i = pcmcia_request_io(handle, &link->io); if (i == CS_SUCCESS) break; } next_entry: - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } - CS_CHECK(RequestIRQ, handle, &link->irq); - CS_CHECK(RequestConfiguration, handle, &link->conf); + CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { /* set ATAcmd */ @@ -284,9 +282,9 @@ static void qlogic_release(dev_link_t *l scsi_remove_host(info->host); link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); scsi_unregister(info->host); @@ -316,7 +314,7 @@ static int qlogic_event(event_t event, i /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; @@ -324,7 +322,7 @@ static int qlogic_event(event_t event, i case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) { scsi_info_t *info = link->priv; - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { outb(0x80, link->io.BasePort1 + 0xd); outb(0x24, link->io.BasePort1 + 0x9); diff -puN drivers/telephony/ixj_pcmcia.c~remove-CardServices-final drivers/telephony/ixj_pcmcia.c --- 25/drivers/telephony/ixj_pcmcia.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/drivers/telephony/ixj_pcmcia.c 2003-12-24 00:01:29.000000000 -0800 @@ -77,7 +77,7 @@ static dev_link_t *ixj_attach(void) client_reg.event_handler = &ixj_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); ixj_detach(link); @@ -100,7 +100,7 @@ static void ixj_detach(dev_link_t * link if (link->state & DEV_CONFIG) ixj_cs_release(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); } @@ -110,11 +110,8 @@ static void ixj_detach(dev_link_t * link kfree(link); } -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed - -#define CFG_CHECK(fn, args...) \ -if (CardServices(fn, args) != 0) goto next_entry +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void ixj_get_serial(dev_link_t * link, IXJ * j) { @@ -130,8 +127,8 @@ static void ixj_get_serial(dev_link_t * tuple.TupleDataMax = 80; tuple.Attributes = 0; tuple.DesiredTuple = CISTPL_VERS_1; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); str = (char *) buf; printk("PCMCIA Version %d.%d\n", str[0], str[1]); str += 2; @@ -202,19 +199,20 @@ static void ixj_config(dev_link_t * link tuple.TupleDataMax = 255; tuple.Attributes = 0; tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; link->state |= DEV_CONFIG; - CS_CHECK(GetConfigurationInfo, handle, &conf); + CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.Attributes = 0; - CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); while (1) { - CFG_CHECK(GetTupleData, handle, &tuple); - CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if (pcmcia_get_tuple_data(handle, &tuple) != 0 || + pcmcia_parse_tuple(handle, &tuple, &parse) != 0) + goto next_entry; if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; link->conf.ConfigIndex = cfg->index; @@ -224,17 +222,18 @@ static void ixj_config(dev_link_t * link link->io.BasePort2 = io->win[1].base; link->io.NumPorts2 = io->win[1].len; } - CFG_CHECK(RequestIO, link->handle, &link->io); + if (pcmcia_request_io(link->handle, &link->io) != 0) + goto next_entry; /* If we've got this far, we're done */ break; } next_entry: if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; - CS_CHECK(GetNextTuple, handle, &tuple); + CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); } - CS_CHECK(RequestConfiguration, handle, &link->conf); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); /* * Register the card with the core. @@ -258,8 +257,8 @@ static void ixj_cs_release(dev_link_t *l DEBUG(0, "ixj_cs_release(0x%p)\n", link); info->ndev = 0; link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); link->state &= ~DEV_CONFIG; } @@ -284,14 +283,14 @@ static int ixj_event(event_t event, int /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (DEV_OK(link)) - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); break; } return 0; diff -puN include/pcmcia/cs.h~remove-CardServices-final include/pcmcia/cs.h --- 25/include/pcmcia/cs.h~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/include/pcmcia/cs.h 2003-12-24 00:01:29.000000000 -0800 @@ -421,12 +421,6 @@ enum service { GetFirstWindow, GetNextWindow, GetMemPage }; -#ifdef IN_CARD_SERVICES -extern int CardServices(int func, void *a1, void *a2, void *a3); -#else -extern int CardServices(int func, ...); -#endif - int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg); int pcmcia_bind_device(bind_req_t *req); int pcmcia_bind_mtd(mtd_bind_t *req); diff -puN sound/pcmcia/vx/vx_entry.c~remove-CardServices-final sound/pcmcia/vx/vx_entry.c --- 25/sound/pcmcia/vx/vx_entry.c~remove-CardServices-final 2003-12-24 00:01:29.000000000 -0800 +++ 25-akpm/sound/pcmcia/vx/vx_entry.c 2003-12-24 00:01:29.000000000 -0800 @@ -38,9 +38,9 @@ static void vxpocket_release(dev_link_t { if (link->state & DEV_CONFIG) { /* release cs resources */ - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; } } @@ -58,7 +58,7 @@ static int snd_vxpocket_free(vx_core_t * /* Break the link with Card Services */ if (link->handle) - CardServices(DeregisterClient, link->handle); + pcmcia_deregister_client(link->handle); hw = vxp->hw_entry; if (hw) @@ -170,7 +170,7 @@ dev_link_t *snd_vxpocket_attach(struct s 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); snd_vxpocket_detach(hw, link); @@ -253,8 +253,8 @@ void snd_vxpocket_detach_all(struct snd_ * configuration callback */ -#define CS_CHECK(fn, args...) \ -while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed +#define CS_CHECK(fn, ret) \ +do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static void vxpocket_config(dev_link_t *link) { @@ -274,21 +274,21 @@ static void vxpocket_config(dev_link_t * tuple.TupleDataMax = sizeof(buf); tuple.TupleOffset = 0; tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, handle, &tuple); - CS_CHECK(GetTupleData, handle, &tuple); - CS_CHECK(ParseTuple, handle, &tuple, &parse); + CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); + CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); link->conf.ConfigBase = parse.config.base; link->conf.ConfigIndex = 1; - CS_CHECK(GetConfigurationInfo, handle, &conf); + CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); link->conf.Vcc = conf.Vcc; /* Configure card */ link->state |= DEV_CONFIG; - CS_CHECK(RequestIO, handle, &link->io); - CS_CHECK(RequestIRQ, link->handle, &link->irq); - CS_CHECK(RequestConfiguration, link->handle, &link->conf); + CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io)); + CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) goto failed; @@ -300,9 +300,9 @@ static void vxpocket_config(dev_link_t * cs_failed: cs_error(link->handle, last_fn, last_ret); failed: - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); + pcmcia_release_configuration(link->handle); + pcmcia_release_io(link->handle, &link->io); + pcmcia_release_irq(link->handle, &link->irq); } @@ -339,7 +339,7 @@ static int vxpocket_event(event_t event, case CS_EVENT_RESET_PHYSICAL: snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n"); if (link->state & DEV_CONFIG) - CardServices(ReleaseConfiguration, link->handle); + pcmcia_release_configuration(link->handle); break; case CS_EVENT_PM_RESUME: snd_printdd(KERN_DEBUG "RESUME\n"); @@ -350,7 +350,7 @@ static int vxpocket_event(event_t event, if (DEV_OK(link)) { //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; snd_printdd(KERN_DEBUG "requestconfig...\n"); - CardServices(RequestConfiguration, link->handle, &link->conf); + pcmcia_request_configuration(link->handle, &link->conf); if (chip) { snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); snd_vx_resume(chip); _