Commit fba395ee authored by Dominik Brodowski's avatar Dominik Brodowski

[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection

dev_link_t * and client_handle_t both mean struct pcmcai_device * by now.
Therefore, remove all such indirections.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent fd238232
...@@ -85,8 +85,8 @@ typedef struct bluecard_info_t { ...@@ -85,8 +85,8 @@ typedef struct bluecard_info_t {
} bluecard_info_t; } bluecard_info_t;
static void bluecard_config(dev_link_t *link); static void bluecard_config(struct pcmcia_device *link);
static void bluecard_release(dev_link_t *link); static void bluecard_release(struct pcmcia_device *link);
static void bluecard_detach(struct pcmcia_device *p_dev); static void bluecard_detach(struct pcmcia_device *p_dev);
...@@ -856,17 +856,16 @@ static int bluecard_close(bluecard_info_t *info) ...@@ -856,17 +856,16 @@ static int bluecard_close(bluecard_info_t *info)
return 0; return 0;
} }
static int bluecard_attach(struct pcmcia_device *p_dev) static int bluecard_attach(struct pcmcia_device *link)
{ {
bluecard_info_t *info; bluecard_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */ /* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
...@@ -887,9 +886,8 @@ static int bluecard_attach(struct pcmcia_device *p_dev) ...@@ -887,9 +886,8 @@ static int bluecard_attach(struct pcmcia_device *p_dev)
} }
static void bluecard_detach(struct pcmcia_device *p_dev) static void bluecard_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
bluecard_info_t *info = link->priv; bluecard_info_t *info = link->priv;
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -899,7 +897,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev) ...@@ -899,7 +897,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev)
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
int i; int i;
...@@ -914,9 +912,8 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse ...@@ -914,9 +912,8 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static void bluecard_config(dev_link_t *link) static void bluecard_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
bluecard_info_t *info = link->priv; bluecard_info_t *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_short buf[256]; u_short buf[256];
...@@ -930,7 +927,7 @@ static void bluecard_config(dev_link_t *link) ...@@ -930,7 +927,7 @@ static void bluecard_config(dev_link_t *link)
/* Get configuration register information */ /* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse); last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) { if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple; last_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -947,25 +944,25 @@ static void bluecard_config(dev_link_t *link) ...@@ -947,25 +944,25 @@ static void bluecard_config(dev_link_t *link)
for (n = 0; n < 0x400; n += 0x40) { for (n = 0; n < 0x400; n += 0x40) {
link->io.BasePort1 = n ^ 0x300; link->io.BasePort1 = n ^ 0x300;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
break; break;
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
goto failed; goto failed;
} }
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i); cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
} }
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i); cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
} }
...@@ -979,14 +976,14 @@ static void bluecard_config(dev_link_t *link) ...@@ -979,14 +976,14 @@ static void bluecard_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
bluecard_release(link); bluecard_release(link);
} }
static void bluecard_release(dev_link_t *link) static void bluecard_release(struct pcmcia_device *link)
{ {
bluecard_info_t *info = link->priv; bluecard_info_t *info = link->priv;
...@@ -995,7 +992,7 @@ static void bluecard_release(dev_link_t *link) ...@@ -995,7 +992,7 @@ static void bluecard_release(dev_link_t *link)
del_timer(&(info->timer)); del_timer(&(info->timer));
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static struct pcmcia_device_id bluecard_ids[] = { static struct pcmcia_device_id bluecard_ids[] = {
......
...@@ -88,8 +88,8 @@ typedef struct bt3c_info_t { ...@@ -88,8 +88,8 @@ typedef struct bt3c_info_t {
} bt3c_info_t; } bt3c_info_t;
static void bt3c_config(dev_link_t *link); static void bt3c_config(struct pcmcia_device *link);
static void bt3c_release(dev_link_t *link); static void bt3c_release(struct pcmcia_device *link);
static void bt3c_detach(struct pcmcia_device *p_dev); static void bt3c_detach(struct pcmcia_device *p_dev);
...@@ -645,17 +645,16 @@ static int bt3c_close(bt3c_info_t *info) ...@@ -645,17 +645,16 @@ static int bt3c_close(bt3c_info_t *info)
return 0; return 0;
} }
static int bt3c_attach(struct pcmcia_device *p_dev) static int bt3c_attach(struct pcmcia_device *link)
{ {
bt3c_info_t *info; bt3c_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */ /* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
...@@ -676,9 +675,8 @@ static int bt3c_attach(struct pcmcia_device *p_dev) ...@@ -676,9 +675,8 @@ static int bt3c_attach(struct pcmcia_device *p_dev)
} }
static void bt3c_detach(struct pcmcia_device *p_dev) static void bt3c_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
bt3c_info_t *info = link->priv; bt3c_info_t *info = link->priv;
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -687,7 +685,7 @@ static void bt3c_detach(struct pcmcia_device *p_dev) ...@@ -687,7 +685,7 @@ static void bt3c_detach(struct pcmcia_device *p_dev)
kfree(info); kfree(info);
} }
static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
int i; int i;
...@@ -698,24 +696,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) ...@@ -698,24 +696,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS)
return CS_NO_MORE_ITEMS; return CS_NO_MORE_ITEMS;
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS)
return CS_NO_MORE_ITEMS; return CS_NO_MORE_ITEMS;
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void bt3c_config(dev_link_t *link) static void bt3c_config(struct pcmcia_device *link)
{ {
static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
client_handle_t handle = link->handle;
bt3c_info_t *info = link->priv; bt3c_info_t *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_short buf[256]; u_short buf[256];
...@@ -730,7 +727,7 @@ static void bt3c_config(dev_link_t *link) ...@@ -730,7 +727,7 @@ static void bt3c_config(dev_link_t *link)
/* Get configuration register information */ /* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse); last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) { if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple; last_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -749,7 +746,7 @@ static void bt3c_config(dev_link_t *link) ...@@ -749,7 +746,7 @@ static void bt3c_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
/* Two tries: without IO aliases, then with aliases */ /* Two tries: without IO aliases, then with aliases */
for (try = 0; try < 2; try++) { for (try = 0; try < 2; try++) {
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) { while (i != CS_NO_MORE_ITEMS) {
if (i != CS_SUCCESS) if (i != CS_SUCCESS)
goto next_entry; goto next_entry;
...@@ -759,49 +756,49 @@ static void bt3c_config(dev_link_t *link) ...@@ -759,49 +756,49 @@ static void bt3c_config(dev_link_t *link)
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base; link->io.BasePort1 = cf->io.win[0].base;
link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
goto found_port; goto found_port;
} }
next_entry: next_entry:
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
} }
/* Second pass: try to find an entry that isn't picky about /* Second pass: try to find an entry that isn't picky about
its base address, then try to grab any standard serial port its base address, then try to grab any standard serial port
address, and finally try to get any free port. */ address, and finally try to get any free port. */
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) { while (i != CS_NO_MORE_ITEMS) {
if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
for (j = 0; j < 5; j++) { for (j = 0; j < 5; j++) {
link->io.BasePort1 = base[j]; link->io.BasePort1 = base[j];
link->io.IOAddrLines = base[j] ? 16 : 3; link->io.IOAddrLines = base[j] ? 16 : 3;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
goto found_port; goto found_port;
} }
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
found_port: found_port:
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
BT_ERR("No usable port range found"); BT_ERR("No usable port range found");
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
goto failed; goto failed;
} }
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i); cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
} }
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i); cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
} }
...@@ -815,21 +812,21 @@ static void bt3c_config(dev_link_t *link) ...@@ -815,21 +812,21 @@ static void bt3c_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
bt3c_release(link); bt3c_release(link);
} }
static void bt3c_release(dev_link_t *link) static void bt3c_release(struct pcmcia_device *link)
{ {
bt3c_info_t *info = link->priv; bt3c_info_t *info = link->priv;
if (link->state & DEV_PRESENT) if (link->state & DEV_PRESENT)
bt3c_close(info); bt3c_close(info);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
......
...@@ -84,8 +84,8 @@ typedef struct btuart_info_t { ...@@ -84,8 +84,8 @@ typedef struct btuart_info_t {
} btuart_info_t; } btuart_info_t;
static void btuart_config(dev_link_t *link); static void btuart_config(struct pcmcia_device *link);
static void btuart_release(dev_link_t *link); static void btuart_release(struct pcmcia_device *link);
static void btuart_detach(struct pcmcia_device *p_dev); static void btuart_detach(struct pcmcia_device *p_dev);
...@@ -576,17 +576,16 @@ static int btuart_close(btuart_info_t *info) ...@@ -576,17 +576,16 @@ static int btuart_close(btuart_info_t *info)
return 0; return 0;
} }
static int btuart_attach(struct pcmcia_device *p_dev) static int btuart_attach(struct pcmcia_device *link)
{ {
btuart_info_t *info; btuart_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */ /* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
...@@ -607,9 +606,8 @@ static int btuart_attach(struct pcmcia_device *p_dev) ...@@ -607,9 +606,8 @@ static int btuart_attach(struct pcmcia_device *p_dev)
} }
static void btuart_detach(struct pcmcia_device *p_dev) static void btuart_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
btuart_info_t *info = link->priv; btuart_info_t *info = link->priv;
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -618,7 +616,7 @@ static void btuart_detach(struct pcmcia_device *p_dev) ...@@ -618,7 +616,7 @@ static void btuart_detach(struct pcmcia_device *p_dev)
kfree(info); kfree(info);
} }
static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
int i; int i;
...@@ -629,24 +627,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) ...@@ -629,24 +627,23 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS)
return CS_NO_MORE_ITEMS; return CS_NO_MORE_ITEMS;
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS)
return CS_NO_MORE_ITEMS; return CS_NO_MORE_ITEMS;
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void btuart_config(dev_link_t *link) static void btuart_config(struct pcmcia_device *link)
{ {
static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
client_handle_t handle = link->handle;
btuart_info_t *info = link->priv; btuart_info_t *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_short buf[256]; u_short buf[256];
...@@ -661,7 +658,7 @@ static void btuart_config(dev_link_t *link) ...@@ -661,7 +658,7 @@ static void btuart_config(dev_link_t *link)
/* Get configuration register information */ /* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse); last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) { if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple; last_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -680,7 +677,7 @@ static void btuart_config(dev_link_t *link) ...@@ -680,7 +677,7 @@ static void btuart_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
/* Two tries: without IO aliases, then with aliases */ /* Two tries: without IO aliases, then with aliases */
for (try = 0; try < 2; try++) { for (try = 0; try < 2; try++) {
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) { while (i != CS_NO_MORE_ITEMS) {
if (i != CS_SUCCESS) if (i != CS_SUCCESS)
goto next_entry; goto next_entry;
...@@ -690,19 +687,19 @@ static void btuart_config(dev_link_t *link) ...@@ -690,19 +687,19 @@ static void btuart_config(dev_link_t *link)
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base; link->io.BasePort1 = cf->io.win[0].base;
link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
goto found_port; goto found_port;
} }
next_entry: next_entry:
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
} }
/* Second pass: try to find an entry that isn't picky about /* Second pass: try to find an entry that isn't picky about
its base address, then try to grab any standard serial port its base address, then try to grab any standard serial port
address, and finally try to get any free port. */ address, and finally try to get any free port. */
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) { while (i != CS_NO_MORE_ITEMS) {
if ((i == CS_SUCCESS) && (cf->io.nwin > 0) if ((i == CS_SUCCESS) && (cf->io.nwin > 0)
&& ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
...@@ -710,30 +707,30 @@ static void btuart_config(dev_link_t *link) ...@@ -710,30 +707,30 @@ static void btuart_config(dev_link_t *link)
for (j = 0; j < 5; j++) { for (j = 0; j < 5; j++) {
link->io.BasePort1 = base[j]; link->io.BasePort1 = base[j];
link->io.IOAddrLines = base[j] ? 16 : 3; link->io.IOAddrLines = base[j] ? 16 : 3;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
goto found_port; goto found_port;
} }
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
found_port: found_port:
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
BT_ERR("No usable port range found"); BT_ERR("No usable port range found");
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
goto failed; goto failed;
} }
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i); cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
} }
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i); cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
} }
...@@ -747,21 +744,21 @@ static void btuart_config(dev_link_t *link) ...@@ -747,21 +744,21 @@ static void btuart_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
btuart_release(link); btuart_release(link);
} }
static void btuart_release(dev_link_t *link) static void btuart_release(struct pcmcia_device *link)
{ {
btuart_info_t *info = link->priv; btuart_info_t *info = link->priv;
if (link->state & DEV_PRESENT) if (link->state & DEV_PRESENT)
btuart_close(info); btuart_close(info);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static struct pcmcia_device_id btuart_ids[] = { static struct pcmcia_device_id btuart_ids[] = {
......
...@@ -87,8 +87,8 @@ typedef struct dtl1_info_t { ...@@ -87,8 +87,8 @@ typedef struct dtl1_info_t {
} dtl1_info_t; } dtl1_info_t;
static void dtl1_config(dev_link_t *link); static void dtl1_config(struct pcmcia_device *link);
static void dtl1_release(dev_link_t *link); static void dtl1_release(struct pcmcia_device *link);
static void dtl1_detach(struct pcmcia_device *p_dev); static void dtl1_detach(struct pcmcia_device *p_dev);
...@@ -555,17 +555,16 @@ static int dtl1_close(dtl1_info_t *info) ...@@ -555,17 +555,16 @@ static int dtl1_close(dtl1_info_t *info)
return 0; return 0;
} }
static int dtl1_attach(struct pcmcia_device *p_dev) static int dtl1_attach(struct pcmcia_device *link)
{ {
dtl1_info_t *info; dtl1_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */ /* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
...@@ -586,9 +585,8 @@ static int dtl1_attach(struct pcmcia_device *p_dev) ...@@ -586,9 +585,8 @@ static int dtl1_attach(struct pcmcia_device *p_dev)
} }
static void dtl1_detach(struct pcmcia_device *p_dev) static void dtl1_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
dtl1_info_t *info = link->priv; dtl1_info_t *info = link->priv;
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -597,7 +595,7 @@ static void dtl1_detach(struct pcmcia_device *p_dev) ...@@ -597,7 +595,7 @@ static void dtl1_detach(struct pcmcia_device *p_dev)
kfree(info); kfree(info);
} }
static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
int i; int i;
...@@ -608,23 +606,22 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) ...@@ -608,23 +606,22 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS) if (pcmcia_get_first_tuple(handle, tuple) != CS_SUCCESS)
return CS_NO_MORE_ITEMS; return CS_NO_MORE_ITEMS;
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
{ {
if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS) if (pcmcia_get_next_tuple(handle, tuple) != CS_SUCCESS)
return CS_NO_MORE_ITEMS; return CS_NO_MORE_ITEMS;
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void dtl1_config(dev_link_t *link) static void dtl1_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
dtl1_info_t *info = link->priv; dtl1_info_t *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_short buf[256]; u_short buf[256];
...@@ -639,7 +636,7 @@ static void dtl1_config(dev_link_t *link) ...@@ -639,7 +636,7 @@ static void dtl1_config(dev_link_t *link)
/* Get configuration register information */ /* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse); last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) { if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple; last_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -658,34 +655,34 @@ static void dtl1_config(dev_link_t *link) ...@@ -658,34 +655,34 @@ static void dtl1_config(dev_link_t *link)
/* Look for a generic full-sized window */ /* Look for a generic full-sized window */
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) { while (i != CS_NO_MORE_ITEMS) {
if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base; link->io.BasePort1 = cf->io.win[0].base;
link->io.NumPorts1 = cf->io.win[0].len; /*yo */ link->io.NumPorts1 = cf->io.win[0].len; /*yo */
link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
break; break;
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
goto failed; goto failed;
} }
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i); cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
} }
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i); cs_error(link, RequestConfiguration, i);
goto failed; goto failed;
} }
...@@ -699,21 +696,21 @@ static void dtl1_config(dev_link_t *link) ...@@ -699,21 +696,21 @@ static void dtl1_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
dtl1_release(link); dtl1_release(link);
} }
static void dtl1_release(dev_link_t *link) static void dtl1_release(struct pcmcia_device *link)
{ {
dtl1_info_t *info = link->priv; dtl1_info_t *info = link->priv;
if (link->state & DEV_PRESENT) if (link->state & DEV_PRESENT)
dtl1_close(info); dtl1_close(info);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
......
...@@ -67,7 +67,7 @@ static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; ...@@ -67,7 +67,7 @@ static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
#define T_100MSEC msecs_to_jiffies(100) #define T_100MSEC msecs_to_jiffies(100)
#define T_500MSEC msecs_to_jiffies(500) #define T_500MSEC msecs_to_jiffies(500)
static void cm4000_release(dev_link_t *link); static void cm4000_release(struct pcmcia_device *link);
static int major; /* major number we get from the kernel */ static int major; /* major number we get from the kernel */
...@@ -149,14 +149,14 @@ struct cm4000_dev { ...@@ -149,14 +149,14 @@ struct cm4000_dev {
#define ZERO_DEV(dev) \ #define ZERO_DEV(dev) \
memset(&dev->atr_csum,0, \ memset(&dev->atr_csum,0, \
sizeof(struct cm4000_dev) - \ sizeof(struct cm4000_dev) - \
/*link*/ sizeof(dev_link_t) - \ /*link*/ sizeof(struct pcmcia_device) - \
/*node*/ sizeof(dev_node_t) - \ /*node*/ sizeof(dev_node_t) - \
/*atr*/ MAX_ATR*sizeof(char) - \ /*atr*/ MAX_ATR*sizeof(char) - \
/*rbuf*/ 512*sizeof(char) - \ /*rbuf*/ 512*sizeof(char) - \
/*sbuf*/ 512*sizeof(char) - \ /*sbuf*/ 512*sizeof(char) - \
/*queue*/ 4*sizeof(wait_queue_head_t)) /*queue*/ 4*sizeof(wait_queue_head_t))
static dev_link_t *dev_table[CM4000_MAX_DEV]; static struct pcmcia_device *dev_table[CM4000_MAX_DEV];
static struct class *cmm_class; static struct class *cmm_class;
/* This table doesn't use spaces after the comma between fields and thus /* This table doesn't use spaces after the comma between fields and thus
...@@ -1441,7 +1441,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1441,7 +1441,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
{ {
struct cm4000_dev *dev = filp->private_data; struct cm4000_dev *dev = filp->private_data;
ioaddr_t iobase = dev->p_dev->io.BasePort1; ioaddr_t iobase = dev->p_dev->io.BasePort1;
dev_link_t *link; struct pcmcia_device *link;
int size; int size;
int rc; int rc;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
...@@ -1660,7 +1660,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1660,7 +1660,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
static int cmm_open(struct inode *inode, struct file *filp) static int cmm_open(struct inode *inode, struct file *filp)
{ {
struct cm4000_dev *dev; struct cm4000_dev *dev;
dev_link_t *link; struct pcmcia_device *link;
int rc, minor = iminor(inode); int rc, minor = iminor(inode);
if (minor >= CM4000_MAX_DEV) if (minor >= CM4000_MAX_DEV)
...@@ -1709,7 +1709,7 @@ static int cmm_open(struct inode *inode, struct file *filp) ...@@ -1709,7 +1709,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
static int cmm_close(struct inode *inode, struct file *filp) static int cmm_close(struct inode *inode, struct file *filp)
{ {
struct cm4000_dev *dev; struct cm4000_dev *dev;
dev_link_t *link; struct pcmcia_device *link;
int minor = iminor(inode); int minor = iminor(inode);
if (minor >= CM4000_MAX_DEV) if (minor >= CM4000_MAX_DEV)
...@@ -1735,7 +1735,7 @@ static int cmm_close(struct inode *inode, struct file *filp) ...@@ -1735,7 +1735,7 @@ static int cmm_close(struct inode *inode, struct file *filp)
return 0; return 0;
} }
static void cmm_cm4000_release(dev_link_t * link) static void cmm_cm4000_release(struct pcmcia_device * link)
{ {
struct cm4000_dev *dev = link->priv; struct cm4000_dev *dev = link->priv;
...@@ -1759,9 +1759,8 @@ static void cmm_cm4000_release(dev_link_t * link) ...@@ -1759,9 +1759,8 @@ static void cmm_cm4000_release(dev_link_t * link)
/*==== Interface to PCMCIA Layer =======================================*/ /*==== Interface to PCMCIA Layer =======================================*/
static void cm4000_config(dev_link_t * link, int devno) static void cm4000_config(struct pcmcia_device * link, int devno)
{ {
client_handle_t handle = link->handle;
struct cm4000_dev *dev; struct cm4000_dev *dev;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
...@@ -1776,16 +1775,16 @@ static void cm4000_config(dev_link_t * link, int devno) ...@@ -1776,16 +1775,16 @@ static void cm4000_config(dev_link_t * link, int devno)
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
if ((fail_rc = pcmcia_get_first_tuple(handle, &tuple)) != CS_SUCCESS) { if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) {
fail_fn = GetFirstTuple; fail_fn = GetFirstTuple;
goto cs_failed; goto cs_failed;
} }
if ((fail_rc = pcmcia_get_tuple_data(handle, &tuple)) != CS_SUCCESS) { if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) {
fail_fn = GetTupleData; fail_fn = GetTupleData;
goto cs_failed; goto cs_failed;
} }
if ((fail_rc = if ((fail_rc =
pcmcia_parse_tuple(handle, &tuple, &parse)) != CS_SUCCESS) { pcmcia_parse_tuple(link, &tuple, &parse)) != CS_SUCCESS) {
fail_fn = ParseTuple; fail_fn = ParseTuple;
goto cs_failed; goto cs_failed;
} }
...@@ -1798,13 +1797,13 @@ static void cm4000_config(dev_link_t * link, int devno) ...@@ -1798,13 +1797,13 @@ static void cm4000_config(dev_link_t * link, int devno)
link->io.NumPorts2 = 0; link->io.NumPorts2 = 0;
link->io.Attributes2 = 0; link->io.Attributes2 = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
for (rc = pcmcia_get_first_tuple(handle, &tuple); for (rc = pcmcia_get_first_tuple(link, &tuple);
rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(handle, &tuple)) { rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(link, &tuple)) {
rc = pcmcia_get_tuple_data(handle, &tuple); rc = pcmcia_get_tuple_data(link, &tuple);
if (rc != CS_SUCCESS) if (rc != CS_SUCCESS)
continue; continue;
rc = pcmcia_parse_tuple(handle, &tuple, &parse); rc = pcmcia_parse_tuple(link, &tuple, &parse);
if (rc != CS_SUCCESS) if (rc != CS_SUCCESS)
continue; continue;
...@@ -1824,7 +1823,7 @@ static void cm4000_config(dev_link_t * link, int devno) ...@@ -1824,7 +1823,7 @@ static void cm4000_config(dev_link_t * link, int devno)
link->io.IOAddrLines = parse.cftable_entry.io.flags link->io.IOAddrLines = parse.cftable_entry.io.flags
& CISTPL_IO_LINES_MASK; & CISTPL_IO_LINES_MASK;
rc = pcmcia_request_io(handle, &link->io); rc = pcmcia_request_io(link, &link->io);
if (rc == CS_SUCCESS) if (rc == CS_SUCCESS)
break; /* we are done */ break; /* we are done */
} }
...@@ -1834,7 +1833,7 @@ static void cm4000_config(dev_link_t * link, int devno) ...@@ -1834,7 +1833,7 @@ static void cm4000_config(dev_link_t * link, int devno)
link->conf.IntType = 00000002; link->conf.IntType = 00000002;
if ((fail_rc = if ((fail_rc =
pcmcia_request_configuration(handle, &link->conf)) != CS_SUCCESS) { pcmcia_request_configuration(link, &link->conf)) != CS_SUCCESS) {
fail_fn = RequestConfiguration; fail_fn = RequestConfiguration;
goto cs_release; goto cs_release;
} }
...@@ -1850,16 +1849,15 @@ static void cm4000_config(dev_link_t * link, int devno) ...@@ -1850,16 +1849,15 @@ static void cm4000_config(dev_link_t * link, int devno)
return; return;
cs_failed: cs_failed:
cs_error(handle, fail_fn, fail_rc); cs_error(link, fail_fn, fail_rc);
cs_release: cs_release:
cm4000_release(link); cm4000_release(link);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
} }
static int cm4000_suspend(struct pcmcia_device *p_dev) static int cm4000_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct cm4000_dev *dev; struct cm4000_dev *dev;
dev = link->priv; dev = link->priv;
...@@ -1868,9 +1866,8 @@ static int cm4000_suspend(struct pcmcia_device *p_dev) ...@@ -1868,9 +1866,8 @@ static int cm4000_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int cm4000_resume(struct pcmcia_device *p_dev) static int cm4000_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct cm4000_dev *dev; struct cm4000_dev *dev;
dev = link->priv; dev = link->priv;
...@@ -1880,17 +1877,16 @@ static int cm4000_resume(struct pcmcia_device *p_dev) ...@@ -1880,17 +1877,16 @@ static int cm4000_resume(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static void cm4000_release(dev_link_t *link) static void cm4000_release(struct pcmcia_device *link)
{ {
cmm_cm4000_release(link->priv); /* delay release until device closed */ cmm_cm4000_release(link->priv); /* delay release until device closed */
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int cm4000_attach(struct pcmcia_device *p_dev) static int cm4000_attach(struct pcmcia_device *link)
{ {
struct cm4000_dev *dev; struct cm4000_dev *dev;
int i; int i;
dev_link_t *link = dev_to_instance(p_dev);
for (i = 0; i < CM4000_MAX_DEV; i++) for (i = 0; i < CM4000_MAX_DEV; i++)
if (dev_table[i] == NULL) if (dev_table[i] == NULL)
...@@ -1906,7 +1902,7 @@ static int cm4000_attach(struct pcmcia_device *p_dev) ...@@ -1906,7 +1902,7 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
if (dev == NULL) if (dev == NULL)
return -ENOMEM; return -ENOMEM;
dev->p_dev = p_dev; dev->p_dev = link;
link->priv = dev; link->priv = dev;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link; dev_table[i] = link;
...@@ -1925,9 +1921,8 @@ static int cm4000_attach(struct pcmcia_device *p_dev) ...@@ -1925,9 +1921,8 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static void cm4000_detach(struct pcmcia_device *p_dev) static void cm4000_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct cm4000_dev *dev = link->priv; struct cm4000_dev *dev = link->priv;
int devno; int devno;
......
...@@ -65,7 +65,7 @@ static char *version = ...@@ -65,7 +65,7 @@ static char *version =
/* how often to poll for fifo status change */ /* how often to poll for fifo status change */
#define POLL_PERIOD msecs_to_jiffies(10) #define POLL_PERIOD msecs_to_jiffies(10)
static void reader_release(dev_link_t *link); static void reader_release(struct pcmcia_device *link);
static int major; static int major;
static struct class *cmx_class; static struct class *cmx_class;
...@@ -87,7 +87,7 @@ struct reader_dev { ...@@ -87,7 +87,7 @@ struct reader_dev {
struct timer_list poll_timer; struct timer_list poll_timer;
}; };
static dev_link_t *dev_table[CM_MAX_DEV]; static struct pcmcia_device *dev_table[CM_MAX_DEV];
#ifndef PCMCIA_DEBUG #ifndef PCMCIA_DEBUG
#define xoutb outb #define xoutb outb
...@@ -445,7 +445,7 @@ static unsigned int cm4040_poll(struct file *filp, poll_table *wait) ...@@ -445,7 +445,7 @@ static unsigned int cm4040_poll(struct file *filp, poll_table *wait)
static int cm4040_open(struct inode *inode, struct file *filp) static int cm4040_open(struct inode *inode, struct file *filp)
{ {
struct reader_dev *dev; struct reader_dev *dev;
dev_link_t *link; struct pcmcia_device *link;
int minor = iminor(inode); int minor = iminor(inode);
if (minor >= CM_MAX_DEV) if (minor >= CM_MAX_DEV)
...@@ -478,7 +478,7 @@ static int cm4040_open(struct inode *inode, struct file *filp) ...@@ -478,7 +478,7 @@ static int cm4040_open(struct inode *inode, struct file *filp)
static int cm4040_close(struct inode *inode, struct file *filp) static int cm4040_close(struct inode *inode, struct file *filp)
{ {
struct reader_dev *dev = filp->private_data; struct reader_dev *dev = filp->private_data;
dev_link_t *link; struct pcmcia_device *link;
int minor = iminor(inode); int minor = iminor(inode);
DEBUGP(2, dev, "-> cm4040_close(maj/min=%d.%d)\n", imajor(inode), DEBUGP(2, dev, "-> cm4040_close(maj/min=%d.%d)\n", imajor(inode),
...@@ -500,7 +500,7 @@ static int cm4040_close(struct inode *inode, struct file *filp) ...@@ -500,7 +500,7 @@ static int cm4040_close(struct inode *inode, struct file *filp)
return 0; return 0;
} }
static void cm4040_reader_release(dev_link_t *link) static void cm4040_reader_release(struct pcmcia_device *link)
{ {
struct reader_dev *dev = link->priv; struct reader_dev *dev = link->priv;
...@@ -514,9 +514,8 @@ static void cm4040_reader_release(dev_link_t *link) ...@@ -514,9 +514,8 @@ static void cm4040_reader_release(dev_link_t *link)
return; return;
} }
static void reader_config(dev_link_t *link, int devno) static void reader_config(struct pcmcia_device *link, int devno)
{ {
client_handle_t handle;
struct reader_dev *dev; struct reader_dev *dev;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
...@@ -524,23 +523,21 @@ static void reader_config(dev_link_t *link, int devno) ...@@ -524,23 +523,21 @@ static void reader_config(dev_link_t *link, int devno)
int fail_fn, fail_rc; int fail_fn, fail_rc;
int rc; int rc;
handle = link->handle;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
if ((fail_rc = pcmcia_get_first_tuple(handle, &tuple)) != CS_SUCCESS) { if ((fail_rc = pcmcia_get_first_tuple(link, &tuple)) != CS_SUCCESS) {
fail_fn = GetFirstTuple; fail_fn = GetFirstTuple;
goto cs_failed; goto cs_failed;
} }
if ((fail_rc = pcmcia_get_tuple_data(handle, &tuple)) != CS_SUCCESS) { if ((fail_rc = pcmcia_get_tuple_data(link, &tuple)) != CS_SUCCESS) {
fail_fn = GetTupleData; fail_fn = GetTupleData;
goto cs_failed; goto cs_failed;
} }
if ((fail_rc = pcmcia_parse_tuple(handle, &tuple, &parse)) if ((fail_rc = pcmcia_parse_tuple(link, &tuple, &parse))
!= CS_SUCCESS) { != CS_SUCCESS) {
fail_fn = ParseTuple; fail_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -554,13 +551,13 @@ static void reader_config(dev_link_t *link, int devno) ...@@ -554,13 +551,13 @@ static void reader_config(dev_link_t *link, int devno)
link->io.NumPorts2 = 0; link->io.NumPorts2 = 0;
link->io.Attributes2 = 0; link->io.Attributes2 = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
for (rc = pcmcia_get_first_tuple(handle, &tuple); for (rc = pcmcia_get_first_tuple(link, &tuple);
rc == CS_SUCCESS; rc == CS_SUCCESS;
rc = pcmcia_get_next_tuple(handle, &tuple)) { rc = pcmcia_get_next_tuple(link, &tuple)) {
rc = pcmcia_get_tuple_data(handle, &tuple); rc = pcmcia_get_tuple_data(link, &tuple);
if (rc != CS_SUCCESS) if (rc != CS_SUCCESS)
continue; continue;
rc = pcmcia_parse_tuple(handle, &tuple, &parse); rc = pcmcia_parse_tuple(link, &tuple, &parse);
if (rc != CS_SUCCESS) if (rc != CS_SUCCESS)
continue; continue;
...@@ -578,13 +575,13 @@ static void reader_config(dev_link_t *link, int devno) ...@@ -578,13 +575,13 @@ static void reader_config(dev_link_t *link, int devno)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.IOAddrLines = parse.cftable_entry.io.flags link->io.IOAddrLines = parse.cftable_entry.io.flags
& CISTPL_IO_LINES_MASK; & CISTPL_IO_LINES_MASK;
rc = pcmcia_request_io(handle, &link->io); rc = pcmcia_request_io(link, &link->io);
dev_printk(KERN_INFO, &handle_to_dev(handle), "foo"); dev_printk(KERN_INFO, &handle_to_dev(link), "foo");
if (rc == CS_SUCCESS) if (rc == CS_SUCCESS)
break; break;
else else
dev_printk(KERN_INFO, &handle_to_dev(handle), dev_printk(KERN_INFO, &handle_to_dev(link),
"pcmcia_request_io failed 0x%x\n", rc); "pcmcia_request_io failed 0x%x\n", rc);
} }
if (rc != CS_SUCCESS) if (rc != CS_SUCCESS)
...@@ -592,10 +589,10 @@ static void reader_config(dev_link_t *link, int devno) ...@@ -592,10 +589,10 @@ static void reader_config(dev_link_t *link, int devno)
link->conf.IntType = 00000002; link->conf.IntType = 00000002;
if ((fail_rc = pcmcia_request_configuration(handle,&link->conf)) if ((fail_rc = pcmcia_request_configuration(link,&link->conf))
!=CS_SUCCESS) { !=CS_SUCCESS) {
fail_fn = RequestConfiguration; fail_fn = RequestConfiguration;
dev_printk(KERN_INFO, &handle_to_dev(handle), dev_printk(KERN_INFO, &handle_to_dev(link),
"pcmcia_request_configuration failed 0x%x\n", "pcmcia_request_configuration failed 0x%x\n",
fail_rc); fail_rc);
goto cs_release; goto cs_release;
...@@ -616,23 +613,22 @@ static void reader_config(dev_link_t *link, int devno) ...@@ -616,23 +613,22 @@ static void reader_config(dev_link_t *link, int devno)
return; return;
cs_failed: cs_failed:
cs_error(handle, fail_fn, fail_rc); cs_error(link, fail_fn, fail_rc);
cs_release: cs_release:
reader_release(link); reader_release(link);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
} }
static void reader_release(dev_link_t *link) static void reader_release(struct pcmcia_device *link)
{ {
cm4040_reader_release(link->priv); cm4040_reader_release(link->priv);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int reader_attach(struct pcmcia_device *p_dev) static int reader_attach(struct pcmcia_device *link)
{ {
struct reader_dev *dev; struct reader_dev *dev;
int i; int i;
dev_link_t *link = dev_to_instance(p_dev);
for (i = 0; i < CM_MAX_DEV; i++) { for (i = 0; i < CM_MAX_DEV; i++) {
if (dev_table[i] == NULL) if (dev_table[i] == NULL)
...@@ -650,7 +646,7 @@ static int reader_attach(struct pcmcia_device *p_dev) ...@@ -650,7 +646,7 @@ static int reader_attach(struct pcmcia_device *p_dev)
dev->buffer_status = 0; dev->buffer_status = 0;
link->priv = dev; link->priv = dev;
dev->p_dev = p_dev; dev->p_dev = link;
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link; dev_table[i] = link;
...@@ -671,9 +667,8 @@ static int reader_attach(struct pcmcia_device *p_dev) ...@@ -671,9 +667,8 @@ static int reader_attach(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static void reader_detach(struct pcmcia_device *p_dev) static void reader_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct reader_dev *dev = link->priv; struct reader_dev *dev = link->priv;
int devno; int devno;
......
...@@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout); ...@@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
/* PCMCIA prototypes */ /* PCMCIA prototypes */
static void mgslpc_config(dev_link_t *link); static void mgslpc_config(struct pcmcia_device *link);
static void mgslpc_release(u_long arg); static void mgslpc_release(u_long arg);
static void mgslpc_detach(struct pcmcia_device *p_dev); static void mgslpc_detach(struct pcmcia_device *p_dev);
...@@ -533,10 +533,9 @@ static void ldisc_receive_buf(struct tty_struct *tty, ...@@ -533,10 +533,9 @@ static void ldisc_receive_buf(struct tty_struct *tty,
} }
} }
static int mgslpc_attach(struct pcmcia_device *p_dev) static int mgslpc_attach(struct pcmcia_device *link)
{ {
MGSLPC_INFO *info; MGSLPC_INFO *info;
dev_link_t *link = dev_to_instance(p_dev);
if (debug_level >= DEBUG_LEVEL_INFO) if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_attach\n"); printk("mgslpc_attach\n");
...@@ -565,10 +564,10 @@ static int mgslpc_attach(struct pcmcia_device *p_dev) ...@@ -565,10 +564,10 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
info->imrb_value = 0xffff; info->imrb_value = 0xffff;
info->pim_value = 0xff; info->pim_value = 0xff;
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
/* Initialize the dev_link_t structure */ /* Initialize the struct pcmcia_device structure */
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
...@@ -592,9 +591,8 @@ static int mgslpc_attach(struct pcmcia_device *p_dev) ...@@ -592,9 +591,8 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void mgslpc_config(dev_link_t *link) static void mgslpc_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
MGSLPC_INFO *info = link->priv; MGSLPC_INFO *info = link->priv;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
...@@ -612,9 +610,9 @@ static void mgslpc_config(dev_link_t *link) ...@@ -612,9 +610,9 @@ static void mgslpc_config(dev_link_t *link)
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
...@@ -624,11 +622,11 @@ static void mgslpc_config(dev_link_t *link) ...@@ -624,11 +622,11 @@ static void mgslpc_config(dev_link_t *link)
/* get CIS configuration entry */ /* get CIS configuration entry */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
cfg = &(parse.cftable_entry); cfg = &(parse.cftable_entry);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
if (cfg->index == 0) if (cfg->index == 0)
...@@ -649,7 +647,7 @@ static void mgslpc_config(dev_link_t *link) ...@@ -649,7 +647,7 @@ static void mgslpc_config(dev_link_t *link)
link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
link->io.BasePort1 = io->win[0].base; link->io.BasePort1 = io->win[0].base;
link->io.NumPorts1 = io->win[0].len; link->io.NumPorts1 = io->win[0].len;
CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
} }
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
...@@ -660,9 +658,9 @@ static void mgslpc_config(dev_link_t *link) ...@@ -660,9 +658,9 @@ static void mgslpc_config(dev_link_t *link)
link->irq.Attributes |= IRQ_HANDLE_PRESENT; link->irq.Attributes |= IRQ_HANDLE_PRESENT;
link->irq.Handler = mgslpc_isr; link->irq.Handler = mgslpc_isr;
link->irq.Instance = info; link->irq.Instance = info;
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
info->io_base = link->io.BasePort1; info->io_base = link->io.BasePort1;
info->irq_level = link->irq.AssignedIRQ; info->irq_level = link->irq.AssignedIRQ;
...@@ -685,7 +683,7 @@ static void mgslpc_config(dev_link_t *link) ...@@ -685,7 +683,7 @@ static void mgslpc_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
mgslpc_release((u_long)link); mgslpc_release((u_long)link);
} }
...@@ -695,18 +693,16 @@ static void mgslpc_config(dev_link_t *link) ...@@ -695,18 +693,16 @@ static void mgslpc_config(dev_link_t *link)
*/ */
static void mgslpc_release(u_long arg) static void mgslpc_release(u_long arg)
{ {
dev_link_t *link = (dev_link_t *)arg; struct pcmcia_device *link = (struct pcmcia_device *)arg;
if (debug_level >= DEBUG_LEVEL_INFO) if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_release(0x%p)\n", link); printk("mgslpc_release(0x%p)\n", link);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static void mgslpc_detach(struct pcmcia_device *p_dev) static void mgslpc_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
if (debug_level >= DEBUG_LEVEL_INFO) if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_detach(0x%p)\n", link); printk("mgslpc_detach(0x%p)\n", link);
...@@ -718,9 +714,8 @@ static void mgslpc_detach(struct pcmcia_device *p_dev) ...@@ -718,9 +714,8 @@ static void mgslpc_detach(struct pcmcia_device *p_dev)
mgslpc_remove_device((MGSLPC_INFO *)link->priv); mgslpc_remove_device((MGSLPC_INFO *)link->priv);
} }
static int mgslpc_suspend(struct pcmcia_device *dev) static int mgslpc_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(dev);
MGSLPC_INFO *info = link->priv; MGSLPC_INFO *info = link->priv;
info->stop = 1; info->stop = 1;
...@@ -728,9 +723,8 @@ static int mgslpc_suspend(struct pcmcia_device *dev) ...@@ -728,9 +723,8 @@ static int mgslpc_suspend(struct pcmcia_device *dev)
return 0; return 0;
} }
static int mgslpc_resume(struct pcmcia_device *dev) static int mgslpc_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(dev);
MGSLPC_INFO *info = link->priv; MGSLPC_INFO *info = link->priv;
info->stop = 0; info->stop = 0;
......
...@@ -87,8 +87,8 @@ typedef struct ide_info_t { ...@@ -87,8 +87,8 @@ typedef struct ide_info_t {
int hd; int hd;
} ide_info_t; } ide_info_t;
static void ide_release(dev_link_t *); static void ide_release(struct pcmcia_device *);
static void ide_config(dev_link_t *); static void ide_config(struct pcmcia_device *);
static void ide_detach(struct pcmcia_device *p_dev); static void ide_detach(struct pcmcia_device *p_dev);
...@@ -103,10 +103,9 @@ static void ide_detach(struct pcmcia_device *p_dev); ...@@ -103,10 +103,9 @@ static void ide_detach(struct pcmcia_device *p_dev);
======================================================================*/ ======================================================================*/
static int ide_attach(struct pcmcia_device *p_dev) static int ide_attach(struct pcmcia_device *link)
{ {
ide_info_t *info; ide_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "ide_attach()\n"); DEBUG(0, "ide_attach()\n");
...@@ -115,7 +114,7 @@ static int ide_attach(struct pcmcia_device *p_dev) ...@@ -115,7 +114,7 @@ static int ide_attach(struct pcmcia_device *p_dev)
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
...@@ -141,10 +140,8 @@ static int ide_attach(struct pcmcia_device *p_dev) ...@@ -141,10 +140,8 @@ static int ide_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void ide_detach(struct pcmcia_device *p_dev) static void ide_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "ide_detach(0x%p)\n", link); DEBUG(0, "ide_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -175,9 +172,8 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq ...@@ -175,9 +172,8 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void ide_config(dev_link_t *link) static void ide_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
tuple_t tuple; tuple_t tuple;
struct { struct {
...@@ -201,16 +197,16 @@ static void ide_config(dev_link_t *link) ...@@ -201,16 +197,16 @@ static void ide_config(dev_link_t *link)
tuple.TupleDataMax = 255; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &stk->parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &stk->parse));
link->conf.ConfigBase = stk->parse.config.base; link->conf.ConfigBase = stk->parse.config.base;
link->conf.Present = stk->parse.config.rmask[0]; link->conf.Present = stk->parse.config.rmask[0];
tuple.DesiredTuple = CISTPL_MANFID; tuple.DesiredTuple = CISTPL_MANFID;
if (!pcmcia_get_first_tuple(handle, &tuple) && if (!pcmcia_get_first_tuple(link, &tuple) &&
!pcmcia_get_tuple_data(handle, &tuple) && !pcmcia_get_tuple_data(link, &tuple) &&
!pcmcia_parse_tuple(handle, &tuple, &stk->parse)) !pcmcia_parse_tuple(link, &tuple, &stk->parse))
is_kme = ((stk->parse.manfid.manf == MANFID_KME) && is_kme = ((stk->parse.manfid.manf == MANFID_KME) &&
((stk->parse.manfid.card == PRODID_KME_KXLC005_A) || ((stk->parse.manfid.card == PRODID_KME_KXLC005_A) ||
(stk->parse.manfid.card == PRODID_KME_KXLC005_B))); (stk->parse.manfid.card == PRODID_KME_KXLC005_B)));
...@@ -219,15 +215,15 @@ static void ide_config(dev_link_t *link) ...@@ -219,15 +215,15 @@ static void ide_config(dev_link_t *link)
link->state |= DEV_CONFIG; link->state |= DEV_CONFIG;
/* Not sure if this is right... look up the current Vcc */ /* Not sure if this is right... look up the current Vcc */
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &stk->conf)); CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
pass = io_base = ctl_base = 0; pass = io_base = ctl_base = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0; tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) { while (1) {
if (pcmcia_get_tuple_data(handle, &tuple) != 0) goto next_entry; if (pcmcia_get_tuple_data(link, &tuple) != 0) goto next_entry;
if (pcmcia_parse_tuple(handle, &tuple, &stk->parse) != 0) goto next_entry; if (pcmcia_parse_tuple(link, &tuple, &stk->parse) != 0) goto next_entry;
/* Check for matching Vcc, unless we're desperate */ /* Check for matching Vcc, unless we're desperate */
if (!pass) { if (!pass) {
...@@ -258,14 +254,14 @@ static void ide_config(dev_link_t *link) ...@@ -258,14 +254,14 @@ static void ide_config(dev_link_t *link)
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->io.BasePort2 = io->win[1].base; link->io.BasePort2 = io->win[1].base;
link->io.NumPorts2 = (is_kme) ? 2 : 1; link->io.NumPorts2 = (is_kme) ? 2 : 1;
if (pcmcia_request_io(link->handle, &link->io) != 0) if (pcmcia_request_io(link, &link->io) != 0)
goto next_entry; goto next_entry;
io_base = link->io.BasePort1; io_base = link->io.BasePort1;
ctl_base = link->io.BasePort2; ctl_base = link->io.BasePort2;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) { } else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
link->io.NumPorts1 = io->win[0].len; link->io.NumPorts1 = io->win[0].len;
link->io.NumPorts2 = 0; link->io.NumPorts2 = 0;
if (pcmcia_request_io(link->handle, &link->io) != 0) if (pcmcia_request_io(link, &link->io) != 0)
goto next_entry; goto next_entry;
io_base = link->io.BasePort1; io_base = link->io.BasePort1;
ctl_base = link->io.BasePort1 + 0x0e; ctl_base = link->io.BasePort1 + 0x0e;
...@@ -278,16 +274,16 @@ static void ide_config(dev_link_t *link) ...@@ -278,16 +274,16 @@ static void ide_config(dev_link_t *link)
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
if (pass) { if (pass) {
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
} else if (pcmcia_get_next_tuple(handle, &tuple) != 0) { } else if (pcmcia_get_next_tuple(link, &tuple) != 0) {
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
memset(&stk->dflt, 0, sizeof(stk->dflt)); memset(&stk->dflt, 0, sizeof(stk->dflt));
pass++; pass++;
} }
} }
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
/* disable drive interrupts during IDE probe */ /* disable drive interrupts during IDE probe */
outb(0x02, ctl_base); outb(0x02, ctl_base);
...@@ -298,12 +294,12 @@ static void ide_config(dev_link_t *link) ...@@ -298,12 +294,12 @@ static void ide_config(dev_link_t *link)
/* retry registration in case device is still spinning up */ /* retry registration in case device is still spinning up */
for (hd = -1, i = 0; i < 10; i++) { for (hd = -1, i = 0; i < 10; i++) {
hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, handle); hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
if (hd >= 0) break; if (hd >= 0) break;
if (link->io.NumPorts1 == 0x20) { if (link->io.NumPorts1 == 0x20) {
outb(0x02, ctl_base + 0x10); outb(0x02, ctl_base + 0x10);
hd = idecs_register(io_base + 0x10, ctl_base + 0x10, hd = idecs_register(io_base + 0x10, ctl_base + 0x10,
link->irq.AssignedIRQ, handle); link->irq.AssignedIRQ, link);
if (hd >= 0) { if (hd >= 0) {
io_base += 0x10; io_base += 0x10;
ctl_base += 0x10; ctl_base += 0x10;
...@@ -338,7 +334,7 @@ static void ide_config(dev_link_t *link) ...@@ -338,7 +334,7 @@ static void ide_config(dev_link_t *link)
goto failed; goto failed;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
kfree(stk); kfree(stk);
ide_release(link); ide_release(link);
...@@ -353,7 +349,7 @@ static void ide_config(dev_link_t *link) ...@@ -353,7 +349,7 @@ static void ide_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
void ide_release(dev_link_t *link) void ide_release(struct pcmcia_device *link)
{ {
ide_info_t *info = link->priv; ide_info_t *info = link->priv;
...@@ -366,7 +362,7 @@ void ide_release(dev_link_t *link) ...@@ -366,7 +362,7 @@ void ide_release(dev_link_t *link)
} }
info->ndev = 0; info->ndev = 0;
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* ide_release */ } /* ide_release */
......
...@@ -51,8 +51,8 @@ MODULE_LICENSE("GPL"); ...@@ -51,8 +51,8 @@ MODULE_LICENSE("GPL");
handler. handler.
*/ */
static void avmcs_config(dev_link_t *link); static void avmcs_config(struct pcmcia_device *link);
static void avmcs_release(dev_link_t *link); static void avmcs_release(struct pcmcia_device *link);
/* /*
The attach() and detach() entry points are used to create and destroy The attach() and detach() entry points are used to create and destroy
...@@ -65,10 +65,10 @@ static void avmcs_detach(struct pcmcia_device *p_dev); ...@@ -65,10 +65,10 @@ static void avmcs_detach(struct pcmcia_device *p_dev);
/* /*
A linked list of "instances" of the skeleton device. Each actual A linked list of "instances" of the skeleton device. Each actual
PCMCIA card corresponds to one device instance, and is described PCMCIA card corresponds to one device instance, and is described
by one dev_link_t structure (defined in ds.h). by one struct pcmcia_device structure (defined in ds.h).
You may not want to use a linked list for this -- for example, the You may not want to use a linked list for this -- for example, the
memory card driver uses an array of dev_link_t pointers, where minor memory card driver uses an array of struct pcmcia_device pointers, where minor
device numbers are used to derive the corresponding array index. device numbers are used to derive the corresponding array index.
*/ */
...@@ -78,7 +78,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev); ...@@ -78,7 +78,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev);
example, ethernet cards, modems). In other cases, there may be example, ethernet cards, modems). In other cases, there may be
many actual or logical devices (SCSI adapters, memory cards with many actual or logical devices (SCSI adapters, memory cards with
multiple partitions). The dev_node_t structures need to be kept multiple partitions). The dev_node_t structures need to be kept
in a linked list starting at the 'dev' field of a dev_link_t in a linked list starting at the 'dev' field of a struct pcmcia_device
structure. We allocate them in the card's private data structure, structure. We allocate them in the card's private data structure,
because they generally can't be allocated dynamically. because they generally can't be allocated dynamically.
*/ */
...@@ -145,10 +145,8 @@ static int avmcs_attach(struct pcmcia_device *p_dev) ...@@ -145,10 +145,8 @@ static int avmcs_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void avmcs_detach(struct pcmcia_device *p_dev) static void avmcs_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
avmcs_release(link); avmcs_release(link);
...@@ -163,7 +161,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev) ...@@ -163,7 +161,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static int get_tuple(client_handle_t handle, tuple_t *tuple, static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_tuple_data(handle, tuple); int i = pcmcia_get_tuple_data(handle, tuple);
...@@ -171,7 +169,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -171,7 +169,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_first_tuple(handle, tuple); int i = pcmcia_get_first_tuple(handle, tuple);
...@@ -179,7 +177,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -179,7 +177,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_next_tuple(handle, tuple); int i = pcmcia_get_next_tuple(handle, tuple);
...@@ -187,9 +185,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -187,9 +185,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void avmcs_config(dev_link_t *link) static void avmcs_config(struct pcmcia_device *link)
{ {
client_handle_t handle;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
cistpl_cftable_entry_t *cf = &parse.cftable_entry; cistpl_cftable_entry_t *cf = &parse.cftable_entry;
...@@ -200,7 +197,6 @@ static void avmcs_config(dev_link_t *link) ...@@ -200,7 +197,6 @@ static void avmcs_config(dev_link_t *link)
int cardtype; int cardtype;
int (*addcard)(unsigned int port, unsigned irq); int (*addcard)(unsigned int port, unsigned irq);
handle = link->handle;
dev = link->priv; dev = link->priv;
/* /*
...@@ -209,19 +205,19 @@ static void avmcs_config(dev_link_t *link) ...@@ -209,19 +205,19 @@ static void avmcs_config(dev_link_t *link)
*/ */
do { do {
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
i = pcmcia_get_first_tuple(handle, &tuple); i = pcmcia_get_first_tuple(link, &tuple);
if (i != CS_SUCCESS) break; if (i != CS_SUCCESS) break;
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
i = pcmcia_get_tuple_data(handle, &tuple); i = pcmcia_get_tuple_data(link, &tuple);
if (i != CS_SUCCESS) break; if (i != CS_SUCCESS) break;
i = pcmcia_parse_tuple(handle, &tuple, &parse); i = pcmcia_parse_tuple(link, &tuple, &parse);
if (i != CS_SUCCESS) break; if (i != CS_SUCCESS) break;
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
} while (0); } while (0);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, ParseTuple, i); cs_error(link, ParseTuple, i);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
return; return;
} }
...@@ -238,7 +234,7 @@ static void avmcs_config(dev_link_t *link) ...@@ -238,7 +234,7 @@ static void avmcs_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_VERS_1; tuple.DesiredTuple = CISTPL_VERS_1;
devname[0] = 0; devname[0] = 0;
if( !first_tuple(handle, &tuple, &parse) && parse.version_1.ns > 1 ) { if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) {
strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1],
sizeof(devname)); sizeof(devname));
} }
...@@ -249,7 +245,7 @@ static void avmcs_config(dev_link_t *link) ...@@ -249,7 +245,7 @@ static void avmcs_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i == CS_SUCCESS) { while (i == CS_SUCCESS) {
if (cf->io.nwin > 0) { if (cf->io.nwin > 0) {
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
...@@ -259,36 +255,36 @@ static void avmcs_config(dev_link_t *link) ...@@ -259,36 +255,36 @@ static void avmcs_config(dev_link_t *link)
printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n",
link->io.BasePort1, link->io.BasePort1,
link->io.BasePort1+link->io.NumPorts1-1); link->io.BasePort1+link->io.NumPorts1-1);
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) goto found_port; if (i == CS_SUCCESS) goto found_port;
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
found_port: found_port:
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
break; break;
} }
/* /*
* allocate an interrupt line * allocate an interrupt line
*/ */
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i); cs_error(link, RequestIRQ, i);
/* undo */ /* undo */
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
break; break;
} }
/* /*
* configure the PCMCIA socket * configure the PCMCIA socket
*/ */
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i); cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
break; break;
} }
...@@ -351,10 +347,10 @@ static void avmcs_config(dev_link_t *link) ...@@ -351,10 +347,10 @@ static void avmcs_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void avmcs_release(dev_link_t *link) static void avmcs_release(struct pcmcia_device *link)
{ {
b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ); b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* avmcs_release */ } /* avmcs_release */
......
...@@ -67,8 +67,8 @@ module_param(isdnprot, int, 0); ...@@ -67,8 +67,8 @@ module_param(isdnprot, int, 0);
handler. handler.
*/ */
static void avma1cs_config(dev_link_t *link); static void avma1cs_config(struct pcmcia_device *link);
static void avma1cs_release(dev_link_t *link); static void avma1cs_release(struct pcmcia_device *link);
/* /*
The attach() and detach() entry points are used to create and destroy The attach() and detach() entry points are used to create and destroy
...@@ -82,10 +82,10 @@ static void avma1cs_detach(struct pcmcia_device *p_dev); ...@@ -82,10 +82,10 @@ static void avma1cs_detach(struct pcmcia_device *p_dev);
/* /*
A linked list of "instances" of the skeleton device. Each actual A linked list of "instances" of the skeleton device. Each actual
PCMCIA card corresponds to one device instance, and is described PCMCIA card corresponds to one device instance, and is described
by one dev_link_t structure (defined in ds.h). by one struct pcmcia_device structure (defined in ds.h).
You may not want to use a linked list for this -- for example, the You may not want to use a linked list for this -- for example, the
memory card driver uses an array of dev_link_t pointers, where minor memory card driver uses an array of struct pcmcia_device pointers, where minor
device numbers are used to derive the corresponding array index. device numbers are used to derive the corresponding array index.
*/ */
...@@ -95,7 +95,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev); ...@@ -95,7 +95,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev);
example, ethernet cards, modems). In other cases, there may be example, ethernet cards, modems). In other cases, there may be
many actual or logical devices (SCSI adapters, memory cards with many actual or logical devices (SCSI adapters, memory cards with
multiple partitions). The dev_node_t structures need to be kept multiple partitions). The dev_node_t structures need to be kept
in a linked list starting at the 'dev' field of a dev_link_t in a linked list starting at the 'dev' field of a struct pcmcia_device
structure. We allocate them in the card's private data structure, structure. We allocate them in the card's private data structure,
because they generally can't be allocated dynamically. because they generally can't be allocated dynamically.
*/ */
...@@ -164,10 +164,8 @@ static int avma1cs_attach(struct pcmcia_device *p_dev) ...@@ -164,10 +164,8 @@ static int avma1cs_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void avma1cs_detach(struct pcmcia_device *p_dev) static void avma1cs_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "avma1cs_detach(0x%p)\n", link); DEBUG(0, "avma1cs_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -184,7 +182,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev) ...@@ -184,7 +182,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static int get_tuple(client_handle_t handle, tuple_t *tuple, static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_tuple_data(handle, tuple); int i = pcmcia_get_tuple_data(handle, tuple);
...@@ -192,7 +190,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -192,7 +190,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_first_tuple(handle, tuple); int i = pcmcia_get_first_tuple(handle, tuple);
...@@ -200,7 +198,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -200,7 +198,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_next_tuple(handle, tuple); int i = pcmcia_get_next_tuple(handle, tuple);
...@@ -208,9 +206,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -208,9 +206,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void avma1cs_config(dev_link_t *link) static void avma1cs_config(struct pcmcia_device *link)
{ {
client_handle_t handle;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
cistpl_cftable_entry_t *cf = &parse.cftable_entry; cistpl_cftable_entry_t *cf = &parse.cftable_entry;
...@@ -221,7 +218,6 @@ static void avma1cs_config(dev_link_t *link) ...@@ -221,7 +218,6 @@ static void avma1cs_config(dev_link_t *link)
IsdnCard_t icard; IsdnCard_t icard;
int busy = 0; int busy = 0;
handle = link->handle;
dev = link->priv; dev = link->priv;
DEBUG(0, "avma1cs_config(0x%p)\n", link); DEBUG(0, "avma1cs_config(0x%p)\n", link);
...@@ -232,19 +228,19 @@ static void avma1cs_config(dev_link_t *link) ...@@ -232,19 +228,19 @@ static void avma1cs_config(dev_link_t *link)
*/ */
do { do {
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
i = pcmcia_get_first_tuple(handle, &tuple); i = pcmcia_get_first_tuple(link, &tuple);
if (i != CS_SUCCESS) break; if (i != CS_SUCCESS) break;
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
i = pcmcia_get_tuple_data(handle, &tuple); i = pcmcia_get_tuple_data(link, &tuple);
if (i != CS_SUCCESS) break; if (i != CS_SUCCESS) break;
i = pcmcia_parse_tuple(handle, &tuple, &parse); i = pcmcia_parse_tuple(link, &tuple, &parse);
if (i != CS_SUCCESS) break; if (i != CS_SUCCESS) break;
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
} while (0); } while (0);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, ParseTuple, i); cs_error(link, ParseTuple, i);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
return; return;
} }
...@@ -261,7 +257,7 @@ static void avma1cs_config(dev_link_t *link) ...@@ -261,7 +257,7 @@ static void avma1cs_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_VERS_1; tuple.DesiredTuple = CISTPL_VERS_1;
devname[0] = 0; devname[0] = 0;
if( !first_tuple(handle, &tuple, &parse) && parse.version_1.ns > 1 ) { if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) {
strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1],
sizeof(devname)); sizeof(devname));
} }
...@@ -272,7 +268,7 @@ static void avma1cs_config(dev_link_t *link) ...@@ -272,7 +268,7 @@ static void avma1cs_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i == CS_SUCCESS) { while (i == CS_SUCCESS) {
if (cf->io.nwin > 0) { if (cf->io.nwin > 0) {
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
...@@ -282,36 +278,36 @@ static void avma1cs_config(dev_link_t *link) ...@@ -282,36 +278,36 @@ static void avma1cs_config(dev_link_t *link)
printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n", printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n",
link->io.BasePort1, link->io.BasePort1,
link->io.BasePort1+link->io.NumPorts1 - 1); link->io.BasePort1+link->io.NumPorts1 - 1);
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) goto found_port; if (i == CS_SUCCESS) goto found_port;
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
found_port: found_port:
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
break; break;
} }
/* /*
* allocate an interrupt line * allocate an interrupt line
*/ */
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i); cs_error(link, RequestIRQ, i);
/* undo */ /* undo */
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
break; break;
} }
/* /*
* configure the PCMCIA socket * configure the PCMCIA socket
*/ */
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i); cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
break; break;
} }
...@@ -358,7 +354,7 @@ static void avma1cs_config(dev_link_t *link) ...@@ -358,7 +354,7 @@ static void avma1cs_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void avma1cs_release(dev_link_t *link) static void avma1cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
...@@ -367,7 +363,7 @@ static void avma1cs_release(dev_link_t *link) ...@@ -367,7 +363,7 @@ static void avma1cs_release(dev_link_t *link)
/* now unregister function with hisax */ /* now unregister function with hisax */
HiSax_closecard(local->node.minor); HiSax_closecard(local->node.minor);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* avma1cs_release */ } /* avma1cs_release */
......
...@@ -94,8 +94,8 @@ module_param(protocol, int, 0); ...@@ -94,8 +94,8 @@ module_param(protocol, int, 0);
handler. handler.
*/ */
static void elsa_cs_config(dev_link_t *link); static void elsa_cs_config(struct pcmcia_device *link);
static void elsa_cs_release(dev_link_t *link); static void elsa_cs_release(struct pcmcia_device *link);
/* /*
The attach() and detach() entry points are used to create and destroy The attach() and detach() entry points are used to create and destroy
...@@ -111,7 +111,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev); ...@@ -111,7 +111,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev);
example, ethernet cards, modems). In other cases, there may be example, ethernet cards, modems). In other cases, there may be
many actual or logical devices (SCSI adapters, memory cards with many actual or logical devices (SCSI adapters, memory cards with
multiple partitions). The dev_node_t structures need to be kept multiple partitions). The dev_node_t structures need to be kept
in a linked list starting at the 'dev' field of a dev_link_t in a linked list starting at the 'dev' field of a struct pcmcia_device
structure. We allocate them in the card's private data structure, structure. We allocate them in the card's private data structure,
because they generally shouldn't be allocated dynamically. because they generally shouldn't be allocated dynamically.
In this case, we also provide a flag to indicate if a device is In this case, we also provide a flag to indicate if a device is
...@@ -139,10 +139,9 @@ typedef struct local_info_t { ...@@ -139,10 +139,9 @@ typedef struct local_info_t {
======================================================================*/ ======================================================================*/
static int elsa_cs_attach(struct pcmcia_device *p_dev) static int elsa_cs_attach(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "elsa_cs_attach()\n"); DEBUG(0, "elsa_cs_attach()\n");
...@@ -151,7 +150,7 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev) ...@@ -151,7 +150,7 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev)
if (!local) return -ENOMEM; if (!local) return -ENOMEM;
memset(local, 0, sizeof(local_info_t)); memset(local, 0, sizeof(local_info_t));
local->p_dev = p_dev; local->p_dev = link;
link->priv = local; link->priv = local;
local->cardnr = -1; local->cardnr = -1;
...@@ -190,9 +189,8 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev) ...@@ -190,9 +189,8 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void elsa_cs_detach(struct pcmcia_device *p_dev) static void elsa_cs_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *info = link->priv; local_info_t *info = link->priv;
DEBUG(0, "elsa_cs_detach(0x%p)\n", link); DEBUG(0, "elsa_cs_detach(0x%p)\n", link);
...@@ -213,7 +211,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev) ...@@ -213,7 +211,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev)
device available to the system. device available to the system.
======================================================================*/ ======================================================================*/
static int get_tuple(client_handle_t handle, tuple_t *tuple, static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_tuple_data(handle, tuple); int i = pcmcia_get_tuple_data(handle, tuple);
...@@ -221,7 +219,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -221,7 +219,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_first_tuple(handle, tuple); int i = pcmcia_get_first_tuple(handle, tuple);
...@@ -229,7 +227,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -229,7 +227,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_next_tuple(handle, tuple); int i = pcmcia_get_next_tuple(handle, tuple);
...@@ -237,9 +235,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -237,9 +235,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void elsa_cs_config(dev_link_t *link) static void elsa_cs_config(struct pcmcia_device *link)
{ {
client_handle_t handle;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
local_info_t *dev; local_info_t *dev;
...@@ -249,7 +246,6 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -249,7 +246,6 @@ static void elsa_cs_config(dev_link_t *link)
IsdnCard_t icard; IsdnCard_t icard;
DEBUG(0, "elsa_config(0x%p)\n", link); DEBUG(0, "elsa_config(0x%p)\n", link);
handle = link->handle;
dev = link->priv; dev = link->priv;
/* /*
...@@ -261,7 +257,7 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -261,7 +257,7 @@ static void elsa_cs_config(dev_link_t *link)
tuple.TupleDataMax = 255; tuple.TupleDataMax = 255;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.Attributes = 0; tuple.Attributes = 0;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
last_fn = ParseTuple; last_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -276,25 +272,25 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -276,25 +272,25 @@ static void elsa_cs_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i == CS_SUCCESS) { while (i == CS_SUCCESS) {
if ( (cf->io.nwin > 0) && cf->io.win[0].base) { if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base; link->io.BasePort1 = cf->io.win[0].base;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} else { } else {
printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n");
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
link->io.BasePort1 = j; link->io.BasePort1 = j;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} }
break; break;
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
...@@ -302,14 +298,14 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -302,14 +298,14 @@ static void elsa_cs_config(dev_link_t *link)
goto cs_failed; goto cs_failed;
} }
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ; last_fn = RequestIRQ;
goto cs_failed; goto cs_failed;
} }
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
last_fn = RequestConfiguration; last_fn = RequestConfiguration;
goto cs_failed; goto cs_failed;
...@@ -352,7 +348,7 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -352,7 +348,7 @@ static void elsa_cs_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, i); cs_error(link, last_fn, i);
elsa_cs_release(link); elsa_cs_release(link);
} /* elsa_cs_config */ } /* elsa_cs_config */
...@@ -364,7 +360,7 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -364,7 +360,7 @@ static void elsa_cs_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void elsa_cs_release(dev_link_t *link) static void elsa_cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
...@@ -377,12 +373,11 @@ static void elsa_cs_release(dev_link_t *link) ...@@ -377,12 +373,11 @@ static void elsa_cs_release(dev_link_t *link)
} }
} }
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* elsa_cs_release */ } /* elsa_cs_release */
static int elsa_suspend(struct pcmcia_device *p_dev) static int elsa_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
dev->busy = 1; dev->busy = 1;
...@@ -390,9 +385,8 @@ static int elsa_suspend(struct pcmcia_device *p_dev) ...@@ -390,9 +385,8 @@ static int elsa_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int elsa_resume(struct pcmcia_device *p_dev) static int elsa_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
dev->busy = 0; dev->busy = 0;
......
...@@ -95,8 +95,8 @@ module_param(protocol, int, 0); ...@@ -95,8 +95,8 @@ module_param(protocol, int, 0);
event handler. event handler.
*/ */
static void sedlbauer_config(dev_link_t *link); static void sedlbauer_config(struct pcmcia_device *link);
static void sedlbauer_release(dev_link_t *link); static void sedlbauer_release(struct pcmcia_device *link);
/* /*
The attach() and detach() entry points are used to create and destroy The attach() and detach() entry points are used to create and destroy
...@@ -119,7 +119,7 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev); ...@@ -119,7 +119,7 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev);
example, ethernet cards, modems). In other cases, there may be example, ethernet cards, modems). In other cases, there may be
many actual or logical devices (SCSI adapters, memory cards with many actual or logical devices (SCSI adapters, memory cards with
multiple partitions). The dev_node_t structures need to be kept multiple partitions). The dev_node_t structures need to be kept
in a linked list starting at the 'dev' field of a dev_link_t in a linked list starting at the 'dev' field of a struct pcmcia_device
structure. We allocate them in the card's private data structure, structure. We allocate them in the card's private data structure,
because they generally shouldn't be allocated dynamically. because they generally shouldn't be allocated dynamically.
...@@ -148,10 +148,9 @@ typedef struct local_info_t { ...@@ -148,10 +148,9 @@ typedef struct local_info_t {
======================================================================*/ ======================================================================*/
static int sedlbauer_attach(struct pcmcia_device *p_dev) static int sedlbauer_attach(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "sedlbauer_attach()\n"); DEBUG(0, "sedlbauer_attach()\n");
...@@ -161,7 +160,7 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev) ...@@ -161,7 +160,7 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
memset(local, 0, sizeof(local_info_t)); memset(local, 0, sizeof(local_info_t));
local->cardnr = -1; local->cardnr = -1;
local->p_dev = p_dev; local->p_dev = link;
link->priv = local; link->priv = local;
/* Interrupt setup */ /* Interrupt setup */
...@@ -202,10 +201,8 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev) ...@@ -202,10 +201,8 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void sedlbauer_detach(struct pcmcia_device *p_dev) static void sedlbauer_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "sedlbauer_detach(0x%p)\n", link); DEBUG(0, "sedlbauer_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
...@@ -227,9 +224,8 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev) ...@@ -227,9 +224,8 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void sedlbauer_config(dev_link_t *link) static void sedlbauer_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
...@@ -251,16 +247,16 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -251,16 +247,16 @@ static void sedlbauer_config(dev_link_t *link)
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
/* Configure card */ /* Configure card */
link->state |= DEV_CONFIG; link->state |= DEV_CONFIG;
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
/* /*
In this loop, we scan the CIS for configuration table entries, In this loop, we scan the CIS for configuration table entries,
...@@ -275,12 +271,12 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -275,12 +271,12 @@ static void sedlbauer_config(dev_link_t *link)
will only use the CIS to fill in implementation-defined details. will only use the CIS to fill in implementation-defined details.
*/ */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) { while (1) {
cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t dflt = { 0 };
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
if (pcmcia_get_tuple_data(handle, &tuple) != 0 || if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0) pcmcia_parse_tuple(link, &tuple, &parse) != 0)
goto next_entry; goto next_entry;
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
...@@ -334,13 +330,13 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -334,13 +330,13 @@ static void sedlbauer_config(dev_link_t *link)
link->io.NumPorts2 = io->win[1].len; link->io.NumPorts2 = io->win[1].len;
} }
/* This reserves IO space but doesn't actually enable it */ /* This reserves IO space but doesn't actually enable it */
if (pcmcia_request_io(link->handle, &link->io) != 0) if (pcmcia_request_io(link, &link->io) != 0)
goto next_entry; goto next_entry;
} }
/* /*
Now set up a common memory window, if needed. There is room Now set up a common memory window, if needed. There is room
in the dev_link_t structure for one memory window handle, in the struct pcmcia_device structure for one memory window handle,
but if the base addresses need to be saved, or if multiple but if the base addresses need to be saved, or if multiple
windows are needed, the info should go in the private data windows are needed, the info should go in the private data
structure for this device. structure for this device.
...@@ -361,7 +357,7 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -361,7 +357,7 @@ static void sedlbauer_config(dev_link_t *link)
req.Size = 0x1000; req.Size = 0x1000;
*/ */
req.AccessSpeed = 0; req.AccessSpeed = 0;
if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) if (pcmcia_request_window(&link, &req, &link->win) != 0)
goto next_entry; goto next_entry;
map.Page = 0; map.CardOffset = mem->win[0].card_addr; map.Page = 0; map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(link->win, &map) != 0) if (pcmcia_map_mem_page(link->win, &map) != 0)
...@@ -371,7 +367,7 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -371,7 +367,7 @@ static void sedlbauer_config(dev_link_t *link)
break; break;
next_entry: next_entry:
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
} }
/* /*
...@@ -380,14 +376,14 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -380,14 +376,14 @@ static void sedlbauer_config(dev_link_t *link)
irq structure is initialized. irq structure is initialized.
*/ */
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ)
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
/* /*
This actually configures the PCMCIA socket -- setting up This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode. card and host interface into "Memory and IO" mode.
*/ */
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
/* /*
At this point, the dev_node_t structure(s) need to be At this point, the dev_node_t structure(s) need to be
...@@ -433,7 +429,7 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -433,7 +429,7 @@ static void sedlbauer_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
sedlbauer_release(link); sedlbauer_release(link);
} /* sedlbauer_config */ } /* sedlbauer_config */
...@@ -446,7 +442,7 @@ static void sedlbauer_config(dev_link_t *link) ...@@ -446,7 +442,7 @@ static void sedlbauer_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void sedlbauer_release(dev_link_t *link) static void sedlbauer_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
DEBUG(0, "sedlbauer_release(0x%p)\n", link); DEBUG(0, "sedlbauer_release(0x%p)\n", link);
...@@ -458,12 +454,11 @@ static void sedlbauer_release(dev_link_t *link) ...@@ -458,12 +454,11 @@ static void sedlbauer_release(dev_link_t *link)
} }
} }
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* sedlbauer_release */ } /* sedlbauer_release */
static int sedlbauer_suspend(struct pcmcia_device *p_dev) static int sedlbauer_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
dev->stop = 1; dev->stop = 1;
...@@ -471,9 +466,8 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev) ...@@ -471,9 +466,8 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int sedlbauer_resume(struct pcmcia_device *p_dev) static int sedlbauer_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
dev->stop = 0; dev->stop = 0;
......
...@@ -75,8 +75,8 @@ module_param(protocol, int, 0); ...@@ -75,8 +75,8 @@ module_param(protocol, int, 0);
handler. handler.
*/ */
static void teles_cs_config(dev_link_t *link); static void teles_cs_config(struct pcmcia_device *link);
static void teles_cs_release(dev_link_t *link); static void teles_cs_release(struct pcmcia_device *link);
/* /*
The attach() and detach() entry points are used to create and destroy The attach() and detach() entry points are used to create and destroy
...@@ -89,10 +89,10 @@ static void teles_detach(struct pcmcia_device *p_dev); ...@@ -89,10 +89,10 @@ static void teles_detach(struct pcmcia_device *p_dev);
/* /*
A linked list of "instances" of the teles_cs device. Each actual A linked list of "instances" of the teles_cs device. Each actual
PCMCIA card corresponds to one device instance, and is described PCMCIA card corresponds to one device instance, and is described
by one dev_link_t structure (defined in ds.h). by one struct pcmcia_device structure (defined in ds.h).
You may not want to use a linked list for this -- for example, the You may not want to use a linked list for this -- for example, the
memory card driver uses an array of dev_link_t pointers, where minor memory card driver uses an array of struct pcmcia_device pointers, where minor
device numbers are used to derive the corresponding array index. device numbers are used to derive the corresponding array index.
*/ */
...@@ -102,7 +102,7 @@ static void teles_detach(struct pcmcia_device *p_dev); ...@@ -102,7 +102,7 @@ static void teles_detach(struct pcmcia_device *p_dev);
example, ethernet cards, modems). In other cases, there may be example, ethernet cards, modems). In other cases, there may be
many actual or logical devices (SCSI adapters, memory cards with many actual or logical devices (SCSI adapters, memory cards with
multiple partitions). The dev_node_t structures need to be kept multiple partitions). The dev_node_t structures need to be kept
in a linked list starting at the 'dev' field of a dev_link_t in a linked list starting at the 'dev' field of a struct pcmcia_device
structure. We allocate them in the card's private data structure, structure. We allocate them in the card's private data structure,
because they generally shouldn't be allocated dynamically. because they generally shouldn't be allocated dynamically.
In this case, we also provide a flag to indicate if a device is In this case, we also provide a flag to indicate if a device is
...@@ -130,10 +130,9 @@ typedef struct local_info_t { ...@@ -130,10 +130,9 @@ typedef struct local_info_t {
======================================================================*/ ======================================================================*/
static int teles_attach(struct pcmcia_device *p_dev) static int teles_attach(struct pcmcia_device *link)
{ {
local_info_t *local; local_info_t *local;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "teles_attach()\n"); DEBUG(0, "teles_attach()\n");
...@@ -143,7 +142,7 @@ static int teles_attach(struct pcmcia_device *p_dev) ...@@ -143,7 +142,7 @@ static int teles_attach(struct pcmcia_device *p_dev)
memset(local, 0, sizeof(local_info_t)); memset(local, 0, sizeof(local_info_t));
local->cardnr = -1; local->cardnr = -1;
local->p_dev = p_dev; local->p_dev = link;
link->priv = local; link->priv = local;
/* Interrupt setup */ /* Interrupt setup */
...@@ -180,9 +179,8 @@ static int teles_attach(struct pcmcia_device *p_dev) ...@@ -180,9 +179,8 @@ static int teles_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void teles_detach(struct pcmcia_device *p_dev) static void teles_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *info = link->priv; local_info_t *info = link->priv;
DEBUG(0, "teles_detach(0x%p)\n", link); DEBUG(0, "teles_detach(0x%p)\n", link);
...@@ -203,7 +201,7 @@ static void teles_detach(struct pcmcia_device *p_dev) ...@@ -203,7 +201,7 @@ static void teles_detach(struct pcmcia_device *p_dev)
device available to the system. device available to the system.
======================================================================*/ ======================================================================*/
static int get_tuple(client_handle_t handle, tuple_t *tuple, static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_tuple_data(handle, tuple); int i = pcmcia_get_tuple_data(handle, tuple);
...@@ -211,7 +209,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -211,7 +209,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
return pcmcia_parse_tuple(handle, tuple, parse); return pcmcia_parse_tuple(handle, tuple, parse);
} }
static int first_tuple(client_handle_t handle, tuple_t *tuple, static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_first_tuple(handle, tuple); int i = pcmcia_get_first_tuple(handle, tuple);
...@@ -219,7 +217,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -219,7 +217,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static int next_tuple(client_handle_t handle, tuple_t *tuple, static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
cisparse_t *parse) cisparse_t *parse)
{ {
int i = pcmcia_get_next_tuple(handle, tuple); int i = pcmcia_get_next_tuple(handle, tuple);
...@@ -227,9 +225,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, ...@@ -227,9 +225,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
return get_tuple(handle, tuple, parse); return get_tuple(handle, tuple, parse);
} }
static void teles_cs_config(dev_link_t *link) static void teles_cs_config(struct pcmcia_device *link)
{ {
client_handle_t handle;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
local_info_t *dev; local_info_t *dev;
...@@ -239,7 +236,6 @@ static void teles_cs_config(dev_link_t *link) ...@@ -239,7 +236,6 @@ static void teles_cs_config(dev_link_t *link)
IsdnCard_t icard; IsdnCard_t icard;
DEBUG(0, "teles_config(0x%p)\n", link); DEBUG(0, "teles_config(0x%p)\n", link);
handle = link->handle;
dev = link->priv; dev = link->priv;
/* /*
...@@ -251,7 +247,7 @@ static void teles_cs_config(dev_link_t *link) ...@@ -251,7 +247,7 @@ static void teles_cs_config(dev_link_t *link)
tuple.TupleDataMax = 255; tuple.TupleDataMax = 255;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.Attributes = 0; tuple.Attributes = 0;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
last_fn = ParseTuple; last_fn = ParseTuple;
goto cs_failed; goto cs_failed;
...@@ -266,25 +262,25 @@ static void teles_cs_config(dev_link_t *link) ...@@ -266,25 +262,25 @@ static void teles_cs_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
i = first_tuple(handle, &tuple, &parse); i = first_tuple(link, &tuple, &parse);
while (i == CS_SUCCESS) { while (i == CS_SUCCESS) {
if ( (cf->io.nwin > 0) && cf->io.win[0].base) { if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base; link->io.BasePort1 = cf->io.win[0].base;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} else { } else {
printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
link->conf.ConfigIndex = cf->index; link->conf.ConfigIndex = cf->index;
for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) { for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
link->io.BasePort1 = j; link->io.BasePort1 = j;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} }
break; break;
} }
i = next_tuple(handle, &tuple, &parse); i = next_tuple(link, &tuple, &parse);
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
...@@ -292,14 +288,14 @@ static void teles_cs_config(dev_link_t *link) ...@@ -292,14 +288,14 @@ static void teles_cs_config(dev_link_t *link)
goto cs_failed; goto cs_failed;
} }
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
link->irq.AssignedIRQ = 0; link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ; last_fn = RequestIRQ;
goto cs_failed; goto cs_failed;
} }
i = pcmcia_request_configuration(link->handle, &link->conf); i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
last_fn = RequestConfiguration; last_fn = RequestConfiguration;
goto cs_failed; goto cs_failed;
...@@ -342,7 +338,7 @@ static void teles_cs_config(dev_link_t *link) ...@@ -342,7 +338,7 @@ static void teles_cs_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, i); cs_error(link, last_fn, i);
teles_cs_release(link); teles_cs_release(link);
} /* teles_cs_config */ } /* teles_cs_config */
...@@ -354,7 +350,7 @@ static void teles_cs_config(dev_link_t *link) ...@@ -354,7 +350,7 @@ static void teles_cs_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void teles_cs_release(dev_link_t *link) static void teles_cs_release(struct pcmcia_device *link)
{ {
local_info_t *local = link->priv; local_info_t *local = link->priv;
...@@ -367,12 +363,11 @@ static void teles_cs_release(dev_link_t *link) ...@@ -367,12 +363,11 @@ static void teles_cs_release(dev_link_t *link)
} }
} }
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* teles_cs_release */ } /* teles_cs_release */
static int teles_suspend(struct pcmcia_device *p_dev) static int teles_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
dev->busy = 1; dev->busy = 1;
...@@ -380,9 +375,8 @@ static int teles_suspend(struct pcmcia_device *p_dev) ...@@ -380,9 +375,8 @@ static int teles_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int teles_resume(struct pcmcia_device *p_dev) static int teles_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *dev = link->priv; local_info_t *dev = link->priv;
dev->busy = 0; dev->busy = 0;
......
...@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) ...@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
dev->offset, mrq.CardOffset); dev->offset, mrq.CardOffset);
mrq.Page = 0; mrq.Page = 0;
if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) {
cs_error(dev->p_dev->handle, MapMemPage, ret); cs_error(dev->p_dev, MapMemPage, ret);
return NULL; return NULL;
} }
dev->offset = mrq.CardOffset; dev->offset = mrq.CardOffset;
...@@ -319,7 +319,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f ...@@ -319,7 +319,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f
static void pcmciamtd_set_vpp(struct map_info *map, int on) static void pcmciamtd_set_vpp(struct map_info *map, int on)
{ {
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
dev_link_t *link = dev->p_dev; struct pcmcia_device *link = dev->p_dev;
modconf_t mod; modconf_t mod;
int ret; int ret;
...@@ -328,9 +328,9 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) ...@@ -328,9 +328,9 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0; mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0;
DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
ret = pcmcia_modify_configuration(link->handle, &mod); ret = pcmcia_modify_configuration(link, &mod);
if(ret != CS_SUCCESS) { if(ret != CS_SUCCESS) {
cs_error(link->handle, ModifyConfiguration, ret); cs_error(link, ModifyConfiguration, ret);
} }
} }
...@@ -340,7 +340,7 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) ...@@ -340,7 +340,7 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
* still open, this will be postponed until it is closed. * still open, this will be postponed until it is closed.
*/ */
static void pcmciamtd_release(dev_link_t *link) static void pcmciamtd_release(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev = link->priv; struct pcmciamtd_dev *dev = link->priv;
...@@ -353,11 +353,11 @@ static void pcmciamtd_release(dev_link_t *link) ...@@ -353,11 +353,11 @@ static void pcmciamtd_release(dev_link_t *link)
} }
pcmcia_release_window(link->win); pcmcia_release_window(link->win);
} }
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_name) static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name)
{ {
int rc; int rc;
tuple_t tuple; tuple_t tuple;
...@@ -370,16 +370,16 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ ...@@ -370,16 +370,16 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.DesiredTuple = RETURN_FIRST_TUPLE; tuple.DesiredTuple = RETURN_FIRST_TUPLE;
rc = pcmcia_get_first_tuple(link->handle, &tuple); rc = pcmcia_get_first_tuple(link, &tuple);
while(rc == CS_SUCCESS) { while(rc == CS_SUCCESS) {
rc = pcmcia_get_tuple_data(link->handle, &tuple); rc = pcmcia_get_tuple_data(link, &tuple);
if(rc != CS_SUCCESS) { if(rc != CS_SUCCESS) {
cs_error(link->handle, GetTupleData, rc); cs_error(link, GetTupleData, rc);
break; break;
} }
rc = pcmcia_parse_tuple(link->handle, &tuple, &parse); rc = pcmcia_parse_tuple(link, &tuple, &parse);
if(rc != CS_SUCCESS) { if(rc != CS_SUCCESS) {
cs_error(link->handle, ParseTuple, rc); cs_error(link, ParseTuple, rc);
break; break;
} }
...@@ -450,7 +450,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ ...@@ -450,7 +450,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); DEBUG(2, "Unknown tuple code %d", tuple.TupleCode);
} }
rc = pcmcia_get_next_tuple(link->handle, &tuple); rc = pcmcia_get_next_tuple(link, &tuple);
} }
if(!dev->pcmcia_map.size) if(!dev->pcmcia_map.size)
dev->pcmcia_map.size = MAX_PCMCIA_ADDR; dev->pcmcia_map.size = MAX_PCMCIA_ADDR;
...@@ -487,7 +487,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_ ...@@ -487,7 +487,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void pcmciamtd_config(dev_link_t *link) static void pcmciamtd_config(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev = link->priv; struct pcmciamtd_dev *dev = link->priv;
struct mtd_info *mtd = NULL; struct mtd_info *mtd = NULL;
...@@ -507,9 +507,9 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -507,9 +507,9 @@ static void pcmciamtd_config(dev_link_t *link)
link->state |= DEV_CONFIG; link->state |= DEV_CONFIG;
DEBUG(2, "Validating CIS"); DEBUG(2, "Validating CIS");
ret = pcmcia_validate_cis(link->handle, &cisinfo); ret = pcmcia_validate_cis(link, &cisinfo);
if(ret != CS_SUCCESS) { if(ret != CS_SUCCESS) {
cs_error(link->handle, GetTupleData, ret); cs_error(link, GetTupleData, ret);
} else { } else {
DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains);
} }
...@@ -537,7 +537,7 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -537,7 +537,7 @@ static void pcmciamtd_config(dev_link_t *link)
req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16;
req.Base = 0; req.Base = 0;
req.AccessSpeed = mem_speed; req.AccessSpeed = mem_speed;
link->win = (window_handle_t)link->handle; link->win = (window_handle_t)link;
req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR;
dev->win_size = 0; dev->win_size = 0;
...@@ -545,7 +545,7 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -545,7 +545,7 @@ static void pcmciamtd_config(dev_link_t *link)
int ret; int ret;
DEBUG(2, "requesting window with size = %dKiB memspeed = %d", DEBUG(2, "requesting window with size = %dKiB memspeed = %d",
req.Size >> 10, req.AccessSpeed); req.Size >> 10, req.AccessSpeed);
ret = pcmcia_request_window(&link->handle, &req, &link->win); ret = pcmcia_request_window(&link, &req, &link->win);
DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size);
if(ret) { if(ret) {
req.Size >>= 1; req.Size >>= 1;
...@@ -566,7 +566,7 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -566,7 +566,7 @@ static void pcmciamtd_config(dev_link_t *link)
DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
/* Get write protect status */ /* Get write protect status */
CS_CHECK(GetStatus, pcmcia_get_status(link->handle, &status)); CS_CHECK(GetStatus, pcmcia_get_status(link, &status));
DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx",
status.CardState, (unsigned long)link->win); status.CardState, (unsigned long)link->win);
dev->win_base = ioremap(req.Base, req.Size); dev->win_base = ioremap(req.Base, req.Size);
...@@ -583,7 +583,7 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -583,7 +583,7 @@ static void pcmciamtd_config(dev_link_t *link)
dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; dev->pcmcia_map.map_priv_2 = (unsigned long)link->win;
DEBUG(2, "Getting configuration"); DEBUG(2, "Getting configuration");
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link->handle, &t)); CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &t));
DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2); DEBUG(2, "Vcc = %d Vpp1 = %d Vpp2 = %d", t.Vcc, t.Vpp1, t.Vpp2);
dev->vpp = (vpp) ? vpp : t.Vpp1; dev->vpp = (vpp) ? vpp : t.Vpp1;
link->conf.Attributes = 0; link->conf.Attributes = 0;
...@@ -602,9 +602,9 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -602,9 +602,9 @@ static void pcmciamtd_config(dev_link_t *link)
link->conf.ConfigIndex = 0; link->conf.ConfigIndex = 0;
link->conf.Present = t.Present; link->conf.Present = t.Present;
DEBUG(2, "Setting Configuration"); DEBUG(2, "Setting Configuration");
ret = pcmcia_request_configuration(link->handle, &link->conf); ret = pcmcia_request_configuration(link, &link->conf);
if(ret != CS_SUCCESS) { if(ret != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, ret); cs_error(link, RequestConfiguration, ret);
} }
if(mem_type == 1) { if(mem_type == 1) {
...@@ -677,7 +677,7 @@ static void pcmciamtd_config(dev_link_t *link) ...@@ -677,7 +677,7 @@ static void pcmciamtd_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
err("CS Error, exiting"); err("CS Error, exiting");
pcmciamtd_release(link); pcmciamtd_release(link);
return; return;
...@@ -709,10 +709,8 @@ static int pcmciamtd_resume(struct pcmcia_device *dev) ...@@ -709,10 +709,8 @@ static int pcmciamtd_resume(struct pcmcia_device *dev)
* when the device is released. * when the device is released.
*/ */
static void pcmciamtd_detach(struct pcmcia_device *p_dev) static void pcmciamtd_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(3, "link=0x%p", link); DEBUG(3, "link=0x%p", link);
if(link->state & DEV_CONFIG) { if(link->state & DEV_CONFIG) {
...@@ -732,10 +730,9 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev) ...@@ -732,10 +730,9 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev)
* with Card Services. * with Card Services.
*/ */
static int pcmciamtd_attach(struct pcmcia_device *p_dev) static int pcmciamtd_attach(struct pcmcia_device *link)
{ {
struct pcmciamtd_dev *dev; struct pcmciamtd_dev *dev;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new memory card device */ /* Create new memory card device */
dev = kmalloc(sizeof(*dev), GFP_KERNEL); dev = kmalloc(sizeof(*dev), GFP_KERNEL);
...@@ -743,7 +740,7 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev) ...@@ -743,7 +740,7 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev)
DEBUG(1, "dev=0x%p", dev); DEBUG(1, "dev=0x%p", dev);
memset(dev, 0, sizeof(*dev)); memset(dev, 0, sizeof(*dev));
dev->p_dev = p_dev; dev->p_dev = link;
link->priv = dev; link->priv = dev;
link->conf.Attributes = 0; link->conf.Attributes = 0;
......
...@@ -225,8 +225,8 @@ static char mii_preamble_required = 0; ...@@ -225,8 +225,8 @@ static char mii_preamble_required = 0;
/* Index of functions. */ /* Index of functions. */
static void tc574_config(dev_link_t *link); static void tc574_config(struct pcmcia_device *link);
static void tc574_release(dev_link_t *link); static void tc574_release(struct pcmcia_device *link);
static void mdio_sync(kio_addr_t ioaddr, int bits); static void mdio_sync(kio_addr_t ioaddr, int bits);
static int mdio_read(kio_addr_t ioaddr, int phy_id, int location); static int mdio_read(kio_addr_t ioaddr, int phy_id, int location);
...@@ -256,11 +256,10 @@ static void tc574_detach(struct pcmcia_device *p_dev); ...@@ -256,11 +256,10 @@ static void tc574_detach(struct pcmcia_device *p_dev);
with Card Services. with Card Services.
*/ */
static int tc574_attach(struct pcmcia_device *p_dev) static int tc574_attach(struct pcmcia_device *link)
{ {
struct el3_private *lp; struct el3_private *lp;
struct net_device *dev; struct net_device *dev;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "3c574_attach()\n"); DEBUG(0, "3c574_attach()\n");
...@@ -270,7 +269,7 @@ static int tc574_attach(struct pcmcia_device *p_dev) ...@@ -270,7 +269,7 @@ static int tc574_attach(struct pcmcia_device *p_dev)
return -ENOMEM; return -ENOMEM;
lp = netdev_priv(dev); lp = netdev_priv(dev);
link->priv = dev; link->priv = dev;
lp->p_dev = p_dev; lp->p_dev = link;
spin_lock_init(&lp->window_lock); spin_lock_init(&lp->window_lock);
link->io.NumPorts1 = 32; link->io.NumPorts1 = 32;
...@@ -312,9 +311,8 @@ static int tc574_attach(struct pcmcia_device *p_dev) ...@@ -312,9 +311,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
*/ */
static void tc574_detach(struct pcmcia_device *p_dev) static void tc574_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "3c574_detach(0x%p)\n", link); DEBUG(0, "3c574_detach(0x%p)\n", link);
...@@ -339,9 +337,8 @@ static void tc574_detach(struct pcmcia_device *p_dev) ...@@ -339,9 +337,8 @@ static void tc574_detach(struct pcmcia_device *p_dev)
static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
static void tc574_config(dev_link_t *link) static void tc574_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
tuple_t tuple; tuple_t tuple;
...@@ -359,12 +356,12 @@ static void tc574_config(dev_link_t *link) ...@@ -359,12 +356,12 @@ static void tc574_config(dev_link_t *link)
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
tuple.TupleData = (cisdata_t *)buf; tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
...@@ -374,15 +371,15 @@ static void tc574_config(dev_link_t *link) ...@@ -374,15 +371,15 @@ static void tc574_config(dev_link_t *link)
link->io.IOAddrLines = 16; link->io.IOAddrLines = 16;
for (i = j = 0; j < 0x400; j += 0x20) { for (i = j = 0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300; link->io.BasePort1 = j ^ 0x300;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
goto failed; goto failed;
} }
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -393,8 +390,8 @@ static void tc574_config(dev_link_t *link) ...@@ -393,8 +390,8 @@ static void tc574_config(dev_link_t *link)
the hardware address. The future products may include a modem chip the hardware address. The future products may include a modem chip
and put the address in the CIS. */ and put the address in the CIS. */
tuple.DesiredTuple = 0x88; tuple.DesiredTuple = 0x88;
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
pcmcia_get_tuple_data(handle, &tuple); pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(buf[i]); phys_addr[i] = htons(buf[i]);
} else { } else {
...@@ -408,9 +405,9 @@ static void tc574_config(dev_link_t *link) ...@@ -408,9 +405,9 @@ static void tc574_config(dev_link_t *link)
} }
} }
tuple.DesiredTuple = CISTPL_VERS_1; tuple.DesiredTuple = CISTPL_VERS_1;
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS && if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS &&
pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS && pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS &&
pcmcia_parse_tuple(handle, &tuple, &parse) == CS_SUCCESS) { pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
cardname = parse.version_1.str + parse.version_1.ofs[1]; cardname = parse.version_1.str + parse.version_1.ofs[1];
} else } else
cardname = "3Com 3c574"; cardname = "3Com 3c574";
...@@ -471,7 +468,7 @@ static void tc574_config(dev_link_t *link) ...@@ -471,7 +468,7 @@ static void tc574_config(dev_link_t *link)
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
link->dev_node = &lp->node; link->dev_node = &lp->node;
SET_NETDEV_DEV(dev, &handle_to_dev(handle)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
...@@ -492,7 +489,7 @@ static void tc574_config(dev_link_t *link) ...@@ -492,7 +489,7 @@ static void tc574_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
tc574_release(link); tc574_release(link);
return; return;
...@@ -505,14 +502,13 @@ static void tc574_config(dev_link_t *link) ...@@ -505,14 +502,13 @@ static void tc574_config(dev_link_t *link)
still open, this will be postponed until it is closed. still open, this will be postponed until it is closed.
*/ */
static void tc574_release(dev_link_t *link) static void tc574_release(struct pcmcia_device *link)
{ {
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int tc574_suspend(struct pcmcia_device *p_dev) static int tc574_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) if ((link->state & DEV_CONFIG) && (link->open))
...@@ -521,9 +517,8 @@ static int tc574_suspend(struct pcmcia_device *p_dev) ...@@ -521,9 +517,8 @@ static int tc574_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int tc574_resume(struct pcmcia_device *p_dev) static int tc574_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) { if ((link->state & DEV_CONFIG) && (link->open)) {
...@@ -739,7 +734,7 @@ static void tc574_reset(struct net_device *dev) ...@@ -739,7 +734,7 @@ static void tc574_reset(struct net_device *dev)
static int el3_open(struct net_device *dev) static int el3_open(struct net_device *dev)
{ {
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
if (!DEV_OK(link)) if (!DEV_OK(link))
return -ENODEV; return -ENODEV;
...@@ -1185,7 +1180,7 @@ static int el3_close(struct net_device *dev) ...@@ -1185,7 +1180,7 @@ static int el3_close(struct net_device *dev)
{ {
kio_addr_t ioaddr = dev->base_addr; kio_addr_t ioaddr = dev->base_addr;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
DEBUG(2, "%s: shutting down ethercard.\n", dev->name); DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
......
...@@ -142,8 +142,8 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)"; ...@@ -142,8 +142,8 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
/*====================================================================*/ /*====================================================================*/
static void tc589_config(dev_link_t *link); static void tc589_config(struct pcmcia_device *link);
static void tc589_release(dev_link_t *link); static void tc589_release(struct pcmcia_device *link);
static u16 read_eeprom(kio_addr_t ioaddr, int index); static u16 read_eeprom(kio_addr_t ioaddr, int index);
static void tc589_reset(struct net_device *dev); static void tc589_reset(struct net_device *dev);
...@@ -170,11 +170,10 @@ static void tc589_detach(struct pcmcia_device *p_dev); ...@@ -170,11 +170,10 @@ static void tc589_detach(struct pcmcia_device *p_dev);
======================================================================*/ ======================================================================*/
static int tc589_attach(struct pcmcia_device *p_dev) static int tc589_attach(struct pcmcia_device *link)
{ {
struct el3_private *lp; struct el3_private *lp;
struct net_device *dev; struct net_device *dev;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "3c589_attach()\n"); DEBUG(0, "3c589_attach()\n");
...@@ -184,7 +183,7 @@ static int tc589_attach(struct pcmcia_device *p_dev) ...@@ -184,7 +183,7 @@ static int tc589_attach(struct pcmcia_device *p_dev)
return -ENOMEM; return -ENOMEM;
lp = netdev_priv(dev); lp = netdev_priv(dev);
link->priv = dev; link->priv = dev;
lp->p_dev = p_dev; lp->p_dev = link;
spin_lock_init(&lp->lock); spin_lock_init(&lp->lock);
link->io.NumPorts1 = 16; link->io.NumPorts1 = 16;
...@@ -227,9 +226,8 @@ static int tc589_attach(struct pcmcia_device *p_dev) ...@@ -227,9 +226,8 @@ static int tc589_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void tc589_detach(struct pcmcia_device *p_dev) static void tc589_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "3c589_detach(0x%p)\n", link); DEBUG(0, "3c589_detach(0x%p)\n", link);
...@@ -254,9 +252,8 @@ static void tc589_detach(struct pcmcia_device *p_dev) ...@@ -254,9 +252,8 @@ static void tc589_detach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void tc589_config(dev_link_t *link) static void tc589_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
tuple_t tuple; tuple_t tuple;
...@@ -271,20 +268,20 @@ static void tc589_config(dev_link_t *link) ...@@ -271,20 +268,20 @@ static void tc589_config(dev_link_t *link)
phys_addr = (u16 *)dev->dev_addr; phys_addr = (u16 *)dev->dev_addr;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
tuple.TupleData = (cisdata_t *)buf; tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
/* Is this a 3c562? */ /* Is this a 3c562? */
tuple.DesiredTuple = CISTPL_MANFID; tuple.DesiredTuple = CISTPL_MANFID;
tuple.Attributes = TUPLE_RETURN_COMMON; tuple.Attributes = TUPLE_RETURN_COMMON;
if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) && if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
(pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) { (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
if (le16_to_cpu(buf[0]) != MANFID_3COM) if (le16_to_cpu(buf[0]) != MANFID_3COM)
printk(KERN_INFO "3c589_cs: hmmm, is this really a " printk(KERN_INFO "3c589_cs: hmmm, is this really a "
"3Com card??\n"); "3Com card??\n");
...@@ -299,15 +296,15 @@ static void tc589_config(dev_link_t *link) ...@@ -299,15 +296,15 @@ static void tc589_config(dev_link_t *link)
for (i = j = 0; j < 0x400; j += 0x10) { for (i = j = 0; j < 0x400; j += 0x10) {
if (multi && (j & 0x80)) continue; if (multi && (j & 0x80)) continue;
link->io.BasePort1 = j ^ 0x300; link->io.BasePort1 = j ^ 0x300;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) break; if (i == CS_SUCCESS) break;
} }
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i); cs_error(link, RequestIO, i);
goto failed; goto failed;
} }
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -317,8 +314,8 @@ static void tc589_config(dev_link_t *link) ...@@ -317,8 +314,8 @@ static void tc589_config(dev_link_t *link)
/* The 3c589 has an extra EEPROM for configuration info, including /* The 3c589 has an extra EEPROM for configuration info, including
the hardware address. The 3c562 puts the address in the CIS. */ the hardware address. The 3c562 puts the address in the CIS. */
tuple.DesiredTuple = 0x88; tuple.DesiredTuple = 0x88;
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) { if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
pcmcia_get_tuple_data(handle, &tuple); pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
phys_addr[i] = htons(buf[i]); phys_addr[i] = htons(buf[i]);
} else { } else {
...@@ -344,7 +341,7 @@ static void tc589_config(dev_link_t *link) ...@@ -344,7 +341,7 @@ static void tc589_config(dev_link_t *link)
link->dev_node = &lp->node; link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
...@@ -365,7 +362,7 @@ static void tc589_config(dev_link_t *link) ...@@ -365,7 +362,7 @@ static void tc589_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
tc589_release(link); tc589_release(link);
return; return;
...@@ -380,14 +377,13 @@ static void tc589_config(dev_link_t *link) ...@@ -380,14 +377,13 @@ static void tc589_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void tc589_release(dev_link_t *link) static void tc589_release(struct pcmcia_device *link)
{ {
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int tc589_suspend(struct pcmcia_device *p_dev) static int tc589_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) if ((link->state & DEV_CONFIG) && (link->open))
...@@ -396,9 +392,8 @@ static int tc589_suspend(struct pcmcia_device *p_dev) ...@@ -396,9 +392,8 @@ static int tc589_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int tc589_resume(struct pcmcia_device *p_dev) static int tc589_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) { if ((link->state & DEV_CONFIG) && (link->open)) {
...@@ -569,7 +564,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map) ...@@ -569,7 +564,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
static int el3_open(struct net_device *dev) static int el3_open(struct net_device *dev)
{ {
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
if (!DEV_OK(link)) if (!DEV_OK(link))
return -ENODEV; return -ENODEV;
...@@ -830,7 +825,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev) ...@@ -830,7 +825,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
{ {
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
unsigned long flags; unsigned long flags;
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
if (DEV_OK(link)) { if (DEV_OK(link)) {
spin_lock_irqsave(&lp->lock, flags); spin_lock_irqsave(&lp->lock, flags);
...@@ -932,7 +927,7 @@ static int el3_rx(struct net_device *dev) ...@@ -932,7 +927,7 @@ static int el3_rx(struct net_device *dev)
static void set_multicast_list(struct net_device *dev) static void set_multicast_list(struct net_device *dev)
{ {
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
kio_addr_t ioaddr = dev->base_addr; kio_addr_t ioaddr = dev->base_addr;
u16 opts = SetRxFilter | RxStation | RxBroadcast; u16 opts = SetRxFilter | RxStation | RxBroadcast;
...@@ -947,7 +942,7 @@ static void set_multicast_list(struct net_device *dev) ...@@ -947,7 +942,7 @@ static void set_multicast_list(struct net_device *dev)
static int el3_close(struct net_device *dev) static int el3_close(struct net_device *dev)
{ {
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
kio_addr_t ioaddr = dev->base_addr; kio_addr_t ioaddr = dev->base_addr;
DEBUG(1, "%s: shutting down ethercard.\n", dev->name); DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
......
...@@ -86,8 +86,8 @@ static char *version = ...@@ -86,8 +86,8 @@ static char *version =
/*====================================================================*/ /*====================================================================*/
static void axnet_config(dev_link_t *link); static void axnet_config(struct pcmcia_device *link);
static void axnet_release(dev_link_t *link); static void axnet_release(struct pcmcia_device *link);
static int axnet_open(struct net_device *dev); static int axnet_open(struct net_device *dev);
static int axnet_close(struct net_device *dev); static int axnet_close(struct net_device *dev);
static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
...@@ -142,11 +142,10 @@ static inline axnet_dev_t *PRIV(struct net_device *dev) ...@@ -142,11 +142,10 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
======================================================================*/ ======================================================================*/
static int axnet_attach(struct pcmcia_device *p_dev) static int axnet_attach(struct pcmcia_device *link)
{ {
axnet_dev_t *info; axnet_dev_t *info;
struct net_device *dev; struct net_device *dev;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "axnet_attach()\n"); DEBUG(0, "axnet_attach()\n");
...@@ -157,7 +156,7 @@ static int axnet_attach(struct pcmcia_device *p_dev) ...@@ -157,7 +156,7 @@ static int axnet_attach(struct pcmcia_device *p_dev)
return -ENOMEM; return -ENOMEM;
info = PRIV(dev); info = PRIV(dev);
info->p_dev = p_dev; info->p_dev = link;
link->priv = dev; link->priv = dev;
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
link->irq.IRQInfo1 = IRQ_LEVEL_ID; link->irq.IRQInfo1 = IRQ_LEVEL_ID;
...@@ -184,9 +183,8 @@ static int axnet_attach(struct pcmcia_device *p_dev) ...@@ -184,9 +183,8 @@ static int axnet_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void axnet_detach(struct pcmcia_device *p_dev) static void axnet_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "axnet_detach(0x%p)\n", link); DEBUG(0, "axnet_detach(0x%p)\n", link);
...@@ -206,7 +204,7 @@ static void axnet_detach(struct pcmcia_device *p_dev) ...@@ -206,7 +204,7 @@ static void axnet_detach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static int get_prom(dev_link_t *link) static int get_prom(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
kio_addr_t ioaddr = dev->base_addr; kio_addr_t ioaddr = dev->base_addr;
...@@ -260,7 +258,7 @@ static int get_prom(dev_link_t *link) ...@@ -260,7 +258,7 @@ static int get_prom(dev_link_t *link)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static int try_io_port(dev_link_t *link) static int try_io_port(struct pcmcia_device *link)
{ {
int j, ret; int j, ret;
if (link->io.NumPorts1 == 32) { if (link->io.NumPorts1 == 32) {
...@@ -281,18 +279,17 @@ static int try_io_port(dev_link_t *link) ...@@ -281,18 +279,17 @@ static int try_io_port(dev_link_t *link)
for (j = 0; j < 0x400; j += 0x20) { for (j = 0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300; link->io.BasePort1 = j ^ 0x300;
link->io.BasePort2 = (j ^ 0x300) + 0x10; link->io.BasePort2 = (j ^ 0x300) + 0x10;
ret = pcmcia_request_io(link->handle, &link->io); ret = pcmcia_request_io(link, &link->io);
if (ret == CS_SUCCESS) return ret; if (ret == CS_SUCCESS) return ret;
} }
return ret; return ret;
} else { } else {
return pcmcia_request_io(link->handle, &link->io); return pcmcia_request_io(link, &link->io);
} }
} }
static void axnet_config(dev_link_t *link) static void axnet_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
axnet_dev_t *info = PRIV(dev); axnet_dev_t *info = PRIV(dev);
tuple_t tuple; tuple_t tuple;
...@@ -307,9 +304,9 @@ static void axnet_config(dev_link_t *link) ...@@ -307,9 +304,9 @@ static void axnet_config(dev_link_t *link)
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
/* don't trust the CIS on this; Linksys got it wrong */ /* don't trust the CIS on this; Linksys got it wrong */
link->conf.Present = 0x63; link->conf.Present = 0x63;
...@@ -319,13 +316,13 @@ static void axnet_config(dev_link_t *link) ...@@ -319,13 +316,13 @@ static void axnet_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0; tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (last_ret == CS_SUCCESS) { while (last_ret == CS_SUCCESS) {
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
cistpl_io_t *io = &(parse.cftable_entry.io); cistpl_io_t *io = &(parse.cftable_entry.io);
if (pcmcia_get_tuple_data(handle, &tuple) != 0 || if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0 || pcmcia_parse_tuple(link, &tuple, &parse) != 0 ||
cfg->index == 0 || cfg->io.nwin == 0) cfg->index == 0 || cfg->io.nwin == 0)
goto next_entry; goto next_entry;
...@@ -347,21 +344,21 @@ static void axnet_config(dev_link_t *link) ...@@ -347,21 +344,21 @@ static void axnet_config(dev_link_t *link)
if (last_ret == CS_SUCCESS) break; if (last_ret == CS_SUCCESS) break;
} }
next_entry: next_entry:
last_ret = pcmcia_get_next_tuple(handle, &tuple); last_ret = pcmcia_get_next_tuple(link, &tuple);
} }
if (last_ret != CS_SUCCESS) { if (last_ret != CS_SUCCESS) {
cs_error(handle, RequestIO, last_ret); cs_error(link, RequestIO, last_ret);
goto failed; goto failed;
} }
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
if (link->io.NumPorts2 == 8) { if (link->io.NumPorts2 == 8) {
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA; link->conf.Status = CCSR_AUDIO_ENA;
} }
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -398,7 +395,7 @@ static void axnet_config(dev_link_t *link) ...@@ -398,7 +395,7 @@ static void axnet_config(dev_link_t *link)
Bit 2 of CCSR is active low. */ Bit 2 of CCSR is active low. */
if (i == 32) { if (i == 32) {
conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 };
pcmcia_access_configuration_register(link->handle, &reg); pcmcia_access_configuration_register(link, &reg);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
if ((j != 0) && (j != 0xffff)) break; if ((j != 0) && (j != 0xffff)) break;
...@@ -408,7 +405,7 @@ static void axnet_config(dev_link_t *link) ...@@ -408,7 +405,7 @@ static void axnet_config(dev_link_t *link)
info->phy_id = (i < 32) ? i : -1; info->phy_id = (i < 32) ? i : -1;
link->dev_node = &info->node; link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
if (register_netdev(dev) != 0) { if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
...@@ -431,7 +428,7 @@ static void axnet_config(dev_link_t *link) ...@@ -431,7 +428,7 @@ static void axnet_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
axnet_release(link); axnet_release(link);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
...@@ -446,14 +443,13 @@ static void axnet_config(dev_link_t *link) ...@@ -446,14 +443,13 @@ static void axnet_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void axnet_release(dev_link_t *link) static void axnet_release(struct pcmcia_device *link)
{ {
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int axnet_suspend(struct pcmcia_device *p_dev) static int axnet_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) if ((link->state & DEV_CONFIG) && (link->open))
...@@ -462,9 +458,8 @@ static int axnet_suspend(struct pcmcia_device *p_dev) ...@@ -462,9 +458,8 @@ static int axnet_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int axnet_resume(struct pcmcia_device *p_dev) static int axnet_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) { if ((link->state & DEV_CONFIG) && (link->open)) {
...@@ -540,7 +535,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value) ...@@ -540,7 +535,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value)
static int axnet_open(struct net_device *dev) static int axnet_open(struct net_device *dev)
{ {
axnet_dev_t *info = PRIV(dev); axnet_dev_t *info = PRIV(dev);
dev_link_t *link = info->p_dev; struct pcmcia_device *link = info->p_dev;
DEBUG(2, "axnet_open('%s')\n", dev->name); DEBUG(2, "axnet_open('%s')\n", dev->name);
...@@ -566,7 +561,7 @@ static int axnet_open(struct net_device *dev) ...@@ -566,7 +561,7 @@ static int axnet_open(struct net_device *dev)
static int axnet_close(struct net_device *dev) static int axnet_close(struct net_device *dev)
{ {
axnet_dev_t *info = PRIV(dev); axnet_dev_t *info = PRIV(dev);
dev_link_t *link = info->p_dev; struct pcmcia_device *link = info->p_dev;
DEBUG(2, "axnet_close('%s')\n", dev->name); DEBUG(2, "axnet_close('%s')\n", dev->name);
......
...@@ -118,8 +118,8 @@ MODULE_LICENSE("GPL"); ...@@ -118,8 +118,8 @@ MODULE_LICENSE("GPL");
/*====================================================================*/ /*====================================================================*/
static void com20020_config(dev_link_t *link); static void com20020_config(struct pcmcia_device *link);
static void com20020_release(dev_link_t *link); static void com20020_release(struct pcmcia_device *link);
static void com20020_detach(struct pcmcia_device *p_dev); static void com20020_detach(struct pcmcia_device *p_dev);
...@@ -198,9 +198,8 @@ static int com20020_attach(struct pcmcia_device *p_dev) ...@@ -198,9 +198,8 @@ static int com20020_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void com20020_detach(struct pcmcia_device *p_dev) static void com20020_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct com20020_dev_t *info = link->priv; struct com20020_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
...@@ -251,10 +250,9 @@ static void com20020_detach(struct pcmcia_device *p_dev) ...@@ -251,10 +250,9 @@ static void com20020_detach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void com20020_config(dev_link_t *link) static void com20020_config(struct pcmcia_device *link)
{ {
struct arcnet_local *lp; struct arcnet_local *lp;
client_handle_t handle;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
com20020_dev_t *info; com20020_dev_t *info;
...@@ -263,7 +261,6 @@ static void com20020_config(dev_link_t *link) ...@@ -263,7 +261,6 @@ static void com20020_config(dev_link_t *link)
u_char buf[64]; u_char buf[64];
int ioaddr; int ioaddr;
handle = link->handle;
info = link->priv; info = link->priv;
dev = info->dev; dev = info->dev;
...@@ -276,9 +273,9 @@ static void com20020_config(dev_link_t *link) ...@@ -276,9 +273,9 @@ static void com20020_config(dev_link_t *link)
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
/* Configure card */ /* Configure card */
...@@ -291,13 +288,13 @@ static void com20020_config(dev_link_t *link) ...@@ -291,13 +288,13 @@ static void com20020_config(dev_link_t *link)
for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10)
{ {
link->io.BasePort1 = ioaddr; link->io.BasePort1 = ioaddr;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS) if (i == CS_SUCCESS)
break; break;
} }
} }
else else
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i != CS_SUCCESS) if (i != CS_SUCCESS)
{ {
...@@ -311,7 +308,7 @@ static void com20020_config(dev_link_t *link) ...@@ -311,7 +308,7 @@ static void com20020_config(dev_link_t *link)
DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n",
link->irq.AssignedIRQ, link->irq.AssignedIRQ,
link->irq.IRQInfo1, link->irq.IRQInfo2); link->irq.IRQInfo1, link->irq.IRQInfo2);
i = pcmcia_request_irq(link->handle, &link->irq); i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) if (i != CS_SUCCESS)
{ {
DEBUG(1,"arcnet: requestIRQ failed totally!\n"); DEBUG(1,"arcnet: requestIRQ failed totally!\n");
...@@ -320,7 +317,7 @@ static void com20020_config(dev_link_t *link) ...@@ -320,7 +317,7 @@ static void com20020_config(dev_link_t *link)
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
if (com20020_check(dev)) if (com20020_check(dev))
{ {
...@@ -334,7 +331,7 @@ static void com20020_config(dev_link_t *link) ...@@ -334,7 +331,7 @@ static void com20020_config(dev_link_t *link)
link->dev_node = &info->node; link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
i = com20020_found(dev, 0); /* calls register_netdev */ i = com20020_found(dev, 0); /* calls register_netdev */
...@@ -351,7 +348,7 @@ static void com20020_config(dev_link_t *link) ...@@ -351,7 +348,7 @@ static void com20020_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
DEBUG(1,"com20020_config failed...\n"); DEBUG(1,"com20020_config failed...\n");
com20020_release(link); com20020_release(link);
...@@ -365,15 +362,14 @@ static void com20020_config(dev_link_t *link) ...@@ -365,15 +362,14 @@ static void com20020_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void com20020_release(dev_link_t *link) static void com20020_release(struct pcmcia_device *link)
{ {
DEBUG(0, "com20020_release(0x%p)\n", link); DEBUG(0, "com20020_release(0x%p)\n", link);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int com20020_suspend(struct pcmcia_device *p_dev) static int com20020_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
com20020_dev_t *info = link->priv; com20020_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
...@@ -383,9 +379,8 @@ static int com20020_suspend(struct pcmcia_device *p_dev) ...@@ -383,9 +379,8 @@ static int com20020_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int com20020_resume(struct pcmcia_device *p_dev) static int com20020_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
com20020_dev_t *info = link->priv; com20020_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
......
This diff is collapsed.
...@@ -105,9 +105,9 @@ MODULE_LICENSE("GPL"); ...@@ -105,9 +105,9 @@ MODULE_LICENSE("GPL");
/*====================================================================*/ /*====================================================================*/
static void ibmtr_config(dev_link_t *link); static void ibmtr_config(struct pcmcia_device *link);
static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase); static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase);
static void ibmtr_release(dev_link_t *link); static void ibmtr_release(struct pcmcia_device *link);
static void ibmtr_detach(struct pcmcia_device *p_dev); static void ibmtr_detach(struct pcmcia_device *p_dev);
/*====================================================================*/ /*====================================================================*/
...@@ -138,11 +138,10 @@ static struct ethtool_ops netdev_ethtool_ops = { ...@@ -138,11 +138,10 @@ static struct ethtool_ops netdev_ethtool_ops = {
======================================================================*/ ======================================================================*/
static int ibmtr_attach(struct pcmcia_device *p_dev) static int ibmtr_attach(struct pcmcia_device *link)
{ {
ibmtr_dev_t *info; ibmtr_dev_t *info;
struct net_device *dev; struct net_device *dev;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "ibmtr_attach()\n"); DEBUG(0, "ibmtr_attach()\n");
...@@ -156,7 +155,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev) ...@@ -156,7 +155,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
return -ENOMEM; return -ENOMEM;
} }
info->p_dev = p_dev; info->p_dev = link;
link->priv = info; link->priv = info;
info->ti = netdev_priv(dev); info->ti = netdev_priv(dev);
...@@ -189,9 +188,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev) ...@@ -189,9 +188,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void ibmtr_detach(struct pcmcia_device *p_dev) static void ibmtr_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct ibmtr_dev_t *info = link->priv; struct ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
...@@ -222,9 +220,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev) ...@@ -222,9 +220,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void ibmtr_config(dev_link_t *link) static void ibmtr_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
struct tok_info *ti = netdev_priv(dev); struct tok_info *ti = netdev_priv(dev);
...@@ -242,9 +239,9 @@ static void ibmtr_config(dev_link_t *link) ...@@ -242,9 +239,9 @@ static void ibmtr_config(dev_link_t *link)
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
/* Configure card */ /* Configure card */
...@@ -256,15 +253,15 @@ static void ibmtr_config(dev_link_t *link) ...@@ -256,15 +253,15 @@ static void ibmtr_config(dev_link_t *link)
/* Try PRIMARY card at 0xA20-0xA23 */ /* Try PRIMARY card at 0xA20-0xA23 */
link->io.BasePort1 = 0xA20; link->io.BasePort1 = 0xA20;
i = pcmcia_request_io(link->handle, &link->io); i = pcmcia_request_io(link, &link->io);
if (i != CS_SUCCESS) { if (i != CS_SUCCESS) {
/* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
link->io.BasePort1 = 0xA24; link->io.BasePort1 = 0xA24;
CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
} }
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
ti->irq = link->irq.AssignedIRQ; ti->irq = link->irq.AssignedIRQ;
ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
...@@ -275,7 +272,7 @@ static void ibmtr_config(dev_link_t *link) ...@@ -275,7 +272,7 @@ static void ibmtr_config(dev_link_t *link)
req.Base = 0; req.Base = 0;
req.Size = 0x2000; req.Size = 0x2000;
req.AccessSpeed = 250; req.AccessSpeed = 250;
CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
mem.CardOffset = mmiobase; mem.CardOffset = mmiobase;
mem.Page = 0; mem.Page = 0;
...@@ -288,7 +285,7 @@ static void ibmtr_config(dev_link_t *link) ...@@ -288,7 +285,7 @@ static void ibmtr_config(dev_link_t *link)
req.Base = 0; req.Base = 0;
req.Size = sramsize * 1024; req.Size = sramsize * 1024;
req.AccessSpeed = 250; req.AccessSpeed = 250;
CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &info->sram_win_handle)); CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle));
mem.CardOffset = srambase; mem.CardOffset = srambase;
mem.Page = 0; mem.Page = 0;
...@@ -298,7 +295,7 @@ static void ibmtr_config(dev_link_t *link) ...@@ -298,7 +295,7 @@ static void ibmtr_config(dev_link_t *link)
ti->sram_virt = ioremap(req.Base, req.Size); ti->sram_virt = ioremap(req.Base, req.Size);
ti->sram_phys = req.Base; ti->sram_phys = req.Base;
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
/* Set up the Token-Ring Controller Configuration Register and /* Set up the Token-Ring Controller Configuration Register and
turn on the card. Check the "Local Area Network Credit Card turn on the card. Check the "Local Area Network Credit Card
...@@ -307,7 +304,7 @@ static void ibmtr_config(dev_link_t *link) ...@@ -307,7 +304,7 @@ static void ibmtr_config(dev_link_t *link)
link->dev_node = &info->node; link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
i = ibmtr_probe_card(dev); i = ibmtr_probe_card(dev);
if (i != 0) { if (i != 0) {
...@@ -329,7 +326,7 @@ static void ibmtr_config(dev_link_t *link) ...@@ -329,7 +326,7 @@ static void ibmtr_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
ibmtr_release(link); ibmtr_release(link);
} /* ibmtr_config */ } /* ibmtr_config */
...@@ -342,7 +339,7 @@ static void ibmtr_config(dev_link_t *link) ...@@ -342,7 +339,7 @@ static void ibmtr_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void ibmtr_release(dev_link_t *link) static void ibmtr_release(struct pcmcia_device *link)
{ {
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
...@@ -354,12 +351,11 @@ static void ibmtr_release(dev_link_t *link) ...@@ -354,12 +351,11 @@ static void ibmtr_release(dev_link_t *link)
iounmap(ti->mmio); iounmap(ti->mmio);
pcmcia_release_window(info->sram_win_handle); pcmcia_release_window(info->sram_win_handle);
} }
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int ibmtr_suspend(struct pcmcia_device *p_dev) static int ibmtr_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
...@@ -369,9 +365,8 @@ static int ibmtr_suspend(struct pcmcia_device *p_dev) ...@@ -369,9 +365,8 @@ static int ibmtr_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int ibmtr_resume(struct pcmcia_device *p_dev) static int ibmtr_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
ibmtr_dev_t *info = link->priv; ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev; struct net_device *dev = info->dev;
......
...@@ -417,8 +417,8 @@ INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); ...@@ -417,8 +417,8 @@ INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
Function Prototypes Function Prototypes
---------------------------------------------------------------------------- */ ---------------------------------------------------------------------------- */
static void nmclan_config(dev_link_t *link); static void nmclan_config(struct pcmcia_device *link);
static void nmclan_release(dev_link_t *link); static void nmclan_release(struct pcmcia_device *link);
static void nmclan_reset(struct net_device *dev); static void nmclan_reset(struct net_device *dev);
static int mace_config(struct net_device *dev, struct ifmap *map); static int mace_config(struct net_device *dev, struct ifmap *map);
...@@ -443,11 +443,10 @@ nmclan_attach ...@@ -443,11 +443,10 @@ nmclan_attach
Services. Services.
---------------------------------------------------------------------------- */ ---------------------------------------------------------------------------- */
static int nmclan_attach(struct pcmcia_device *p_dev) static int nmclan_attach(struct pcmcia_device *link)
{ {
mace_private *lp; mace_private *lp;
struct net_device *dev; struct net_device *dev;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "nmclan_attach()\n"); DEBUG(0, "nmclan_attach()\n");
DEBUG(1, "%s\n", rcsid); DEBUG(1, "%s\n", rcsid);
...@@ -457,7 +456,7 @@ static int nmclan_attach(struct pcmcia_device *p_dev) ...@@ -457,7 +456,7 @@ static int nmclan_attach(struct pcmcia_device *p_dev)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
lp = netdev_priv(dev); lp = netdev_priv(dev);
lp->p_dev = p_dev; lp->p_dev = link;
link->priv = dev; link->priv = dev;
spin_lock_init(&lp->bank_lock); spin_lock_init(&lp->bank_lock);
...@@ -502,9 +501,8 @@ nmclan_detach ...@@ -502,9 +501,8 @@ nmclan_detach
when the device is released. when the device is released.
---------------------------------------------------------------------------- */ ---------------------------------------------------------------------------- */
static void nmclan_detach(struct pcmcia_device *p_dev) static void nmclan_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
DEBUG(0, "nmclan_detach(0x%p)\n", link); DEBUG(0, "nmclan_detach(0x%p)\n", link);
...@@ -657,9 +655,8 @@ nmclan_config ...@@ -657,9 +655,8 @@ nmclan_config
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void nmclan_config(dev_link_t *link) static void nmclan_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
mace_private *lp = netdev_priv(dev); mace_private *lp = netdev_priv(dev);
tuple_t tuple; tuple_t tuple;
...@@ -675,17 +672,17 @@ static void nmclan_config(dev_link_t *link) ...@@ -675,17 +672,17 @@ static void nmclan_config(dev_link_t *link)
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
/* Configure card */ /* Configure card */
link->state |= DEV_CONFIG; link->state |= DEV_CONFIG;
CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io)); CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
dev->irq = link->irq.AssignedIRQ; dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1; dev->base_addr = link->io.BasePort1;
...@@ -696,8 +693,8 @@ static void nmclan_config(dev_link_t *link) ...@@ -696,8 +693,8 @@ static void nmclan_config(dev_link_t *link)
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = 64; tuple.TupleDataMax = 64;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN);
/* Verify configuration by reading the MACE ID. */ /* Verify configuration by reading the MACE ID. */
...@@ -728,7 +725,7 @@ static void nmclan_config(dev_link_t *link) ...@@ -728,7 +725,7 @@ static void nmclan_config(dev_link_t *link)
link->dev_node = &lp->node; link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
i = register_netdev(dev); i = register_netdev(dev);
if (i != 0) { if (i != 0) {
...@@ -746,7 +743,7 @@ static void nmclan_config(dev_link_t *link) ...@@ -746,7 +743,7 @@ static void nmclan_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
nmclan_release(link); nmclan_release(link);
return; return;
...@@ -759,15 +756,14 @@ nmclan_release ...@@ -759,15 +756,14 @@ nmclan_release
net device, and release the PCMCIA configuration. If the device net device, and release the PCMCIA configuration. If the device
is still open, this will be postponed until it is closed. is still open, this will be postponed until it is closed.
---------------------------------------------------------------------------- */ ---------------------------------------------------------------------------- */
static void nmclan_release(dev_link_t *link) static void nmclan_release(struct pcmcia_device *link)
{ {
DEBUG(0, "nmclan_release(0x%p)\n", link); DEBUG(0, "nmclan_release(0x%p)\n", link);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int nmclan_suspend(struct pcmcia_device *p_dev) static int nmclan_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) if ((link->state & DEV_CONFIG) && (link->open))
...@@ -776,9 +772,8 @@ static int nmclan_suspend(struct pcmcia_device *p_dev) ...@@ -776,9 +772,8 @@ static int nmclan_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int nmclan_resume(struct pcmcia_device *p_dev) static int nmclan_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) { if ((link->state & DEV_CONFIG) && (link->open)) {
...@@ -799,7 +794,7 @@ static void nmclan_reset(struct net_device *dev) ...@@ -799,7 +794,7 @@ static void nmclan_reset(struct net_device *dev)
mace_private *lp = netdev_priv(dev); mace_private *lp = netdev_priv(dev);
#if RESET_XILINX #if RESET_XILINX
dev_link_t *link = &lp->link; struct pcmcia_device *link = &lp->link;
conf_reg_t reg; conf_reg_t reg;
u_long OrigCorValue; u_long OrigCorValue;
...@@ -808,7 +803,7 @@ static void nmclan_reset(struct net_device *dev) ...@@ -808,7 +803,7 @@ static void nmclan_reset(struct net_device *dev)
reg.Action = CS_READ; reg.Action = CS_READ;
reg.Offset = CISREG_COR; reg.Offset = CISREG_COR;
reg.Value = 0; reg.Value = 0;
pcmcia_access_configuration_register(link->handle, &reg); pcmcia_access_configuration_register(link, &reg);
OrigCorValue = reg.Value; OrigCorValue = reg.Value;
/* Reset Xilinx */ /* Reset Xilinx */
...@@ -817,12 +812,12 @@ static void nmclan_reset(struct net_device *dev) ...@@ -817,12 +812,12 @@ static void nmclan_reset(struct net_device *dev)
DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n",
OrigCorValue); OrigCorValue);
reg.Value = COR_SOFT_RESET; reg.Value = COR_SOFT_RESET;
pcmcia_access_configuration_register(link->handle, &reg); pcmcia_access_configuration_register(link, &reg);
/* Need to wait for 20 ms for PCMCIA to finish reset. */ /* Need to wait for 20 ms for PCMCIA to finish reset. */
/* Restore original COR configuration index */ /* Restore original COR configuration index */
reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK); reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK);
pcmcia_access_configuration_register(link->handle, &reg); pcmcia_access_configuration_register(link, &reg);
/* Xilinx is now completely reset along with the MACE chip. */ /* Xilinx is now completely reset along with the MACE chip. */
lp->tx_free_frames=AM2150_MAX_TX_FRAMES; lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
...@@ -866,7 +861,7 @@ static int mace_open(struct net_device *dev) ...@@ -866,7 +861,7 @@ static int mace_open(struct net_device *dev)
{ {
kio_addr_t ioaddr = dev->base_addr; kio_addr_t ioaddr = dev->base_addr;
mace_private *lp = netdev_priv(dev); mace_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
if (!DEV_OK(link)) if (!DEV_OK(link))
return -ENODEV; return -ENODEV;
...@@ -889,7 +884,7 @@ static int mace_close(struct net_device *dev) ...@@ -889,7 +884,7 @@ static int mace_close(struct net_device *dev)
{ {
kio_addr_t ioaddr = dev->base_addr; kio_addr_t ioaddr = dev->base_addr;
mace_private *lp = netdev_priv(dev); mace_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
DEBUG(2, "%s: shutting down ethercard.\n", dev->name); DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
...@@ -944,12 +939,12 @@ mace_start_xmit ...@@ -944,12 +939,12 @@ mace_start_xmit
static void mace_tx_timeout(struct net_device *dev) static void mace_tx_timeout(struct net_device *dev)
{ {
mace_private *lp = netdev_priv(dev); mace_private *lp = netdev_priv(dev);
dev_link_t *link = lp->p_dev; struct pcmcia_device *link = lp->p_dev;
printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name);
#if RESET_ON_TIMEOUT #if RESET_ON_TIMEOUT
printk("resetting card\n"); printk("resetting card\n");
pcmcia_reset_card(link->handle, NULL); pcmcia_reset_card(link, NULL);
#else /* #if RESET_ON_TIMEOUT */ #else /* #if RESET_ON_TIMEOUT */
printk("NOT resetting card\n"); printk("NOT resetting card\n");
#endif /* #if RESET_ON_TIMEOUT */ #endif /* #if RESET_ON_TIMEOUT */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -80,8 +80,8 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); ...@@ -80,8 +80,8 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
event handler. event handler.
*/ */
static void airo_config(dev_link_t *link); static void airo_config(struct pcmcia_device *link);
static void airo_release(dev_link_t *link); static void airo_release(struct pcmcia_device *link);
/* /*
The attach() and detach() entry points are used to create and destroy The attach() and detach() entry points are used to create and destroy
...@@ -101,10 +101,10 @@ static void airo_detach(struct pcmcia_device *p_dev); ...@@ -101,10 +101,10 @@ static void airo_detach(struct pcmcia_device *p_dev);
/* /*
A linked list of "instances" of the aironet device. Each actual A linked list of "instances" of the aironet device. Each actual
PCMCIA card corresponds to one device instance, and is described PCMCIA card corresponds to one device instance, and is described
by one dev_link_t structure (defined in ds.h). by one struct pcmcia_device structure (defined in ds.h).
You may not want to use a linked list for this -- for example, the You may not want to use a linked list for this -- for example, the
memory card driver uses an array of dev_link_t pointers, where minor memory card driver uses an array of struct pcmcia_device pointers, where minor
device numbers are used to derive the corresponding array index. device numbers are used to derive the corresponding array index.
*/ */
...@@ -114,7 +114,7 @@ static void airo_detach(struct pcmcia_device *p_dev); ...@@ -114,7 +114,7 @@ static void airo_detach(struct pcmcia_device *p_dev);
example, ethernet cards, modems). In other cases, there may be example, ethernet cards, modems). In other cases, there may be
many actual or logical devices (SCSI adapters, memory cards with many actual or logical devices (SCSI adapters, memory cards with
multiple partitions). The dev_node_t structures need to be kept multiple partitions). The dev_node_t structures need to be kept
in a linked list starting at the 'dev' field of a dev_link_t in a linked list starting at the 'dev' field of a struct pcmcia_device
structure. We allocate them in the card's private data structure, structure. We allocate them in the card's private data structure,
because they generally shouldn't be allocated dynamically. because they generally shouldn't be allocated dynamically.
...@@ -185,10 +185,8 @@ static int airo_attach(struct pcmcia_device *p_dev) ...@@ -185,10 +185,8 @@ static int airo_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void airo_detach(struct pcmcia_device *p_dev) static void airo_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "airo_detach(0x%p)\n", link); DEBUG(0, "airo_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -213,9 +211,8 @@ static void airo_detach(struct pcmcia_device *p_dev) ...@@ -213,9 +211,8 @@ static void airo_detach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void airo_config(dev_link_t *link) static void airo_config(struct pcmcia_device *link)
{ {
client_handle_t handle;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
local_info_t *dev; local_info_t *dev;
...@@ -224,7 +221,6 @@ static void airo_config(dev_link_t *link) ...@@ -224,7 +221,6 @@ static void airo_config(dev_link_t *link)
win_req_t req; win_req_t req;
memreq_t map; memreq_t map;
handle = link->handle;
dev = link->priv; dev = link->priv;
DEBUG(0, "airo_config(0x%p)\n", link); DEBUG(0, "airo_config(0x%p)\n", link);
...@@ -238,9 +234,9 @@ static void airo_config(dev_link_t *link) ...@@ -238,9 +234,9 @@ static void airo_config(dev_link_t *link)
tuple.TupleData = buf; tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf); tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
...@@ -260,12 +256,12 @@ static void airo_config(dev_link_t *link) ...@@ -260,12 +256,12 @@ static void airo_config(dev_link_t *link)
will only use the CIS to fill in implementation-defined details. will only use the CIS to fill in implementation-defined details.
*/ */
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) { while (1) {
cistpl_cftable_entry_t dflt = { 0 }; cistpl_cftable_entry_t dflt = { 0 };
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
if (pcmcia_get_tuple_data(handle, &tuple) != 0 || if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0) pcmcia_parse_tuple(link, &tuple, &parse) != 0)
goto next_entry; goto next_entry;
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
...@@ -310,12 +306,12 @@ static void airo_config(dev_link_t *link) ...@@ -310,12 +306,12 @@ static void airo_config(dev_link_t *link)
} }
/* This reserves IO space but doesn't actually enable it */ /* This reserves IO space but doesn't actually enable it */
if (pcmcia_request_io(link->handle, &link->io) != 0) if (pcmcia_request_io(link, &link->io) != 0)
goto next_entry; goto next_entry;
/* /*
Now set up a common memory window, if needed. There is room Now set up a common memory window, if needed. There is room
in the dev_link_t structure for one memory window handle, in the struct pcmcia_device structure for one memory window handle,
but if the base addresses need to be saved, or if multiple but if the base addresses need to be saved, or if multiple
windows are needed, the info should go in the private data windows are needed, the info should go in the private data
structure for this device. structure for this device.
...@@ -331,7 +327,7 @@ static void airo_config(dev_link_t *link) ...@@ -331,7 +327,7 @@ static void airo_config(dev_link_t *link)
req.Base = mem->win[0].host_addr; req.Base = mem->win[0].host_addr;
req.Size = mem->win[0].len; req.Size = mem->win[0].len;
req.AccessSpeed = 0; req.AccessSpeed = 0;
if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) if (pcmcia_request_window(&link, &req, &link->win) != 0)
goto next_entry; goto next_entry;
map.Page = 0; map.CardOffset = mem->win[0].card_addr; map.Page = 0; map.CardOffset = mem->win[0].card_addr;
if (pcmcia_map_mem_page(link->win, &map) != 0) if (pcmcia_map_mem_page(link->win, &map) != 0)
...@@ -341,7 +337,7 @@ static void airo_config(dev_link_t *link) ...@@ -341,7 +337,7 @@ static void airo_config(dev_link_t *link)
break; break;
next_entry: next_entry:
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
} }
/* /*
...@@ -350,17 +346,17 @@ static void airo_config(dev_link_t *link) ...@@ -350,17 +346,17 @@ static void airo_config(dev_link_t *link)
irq structure is initialized. irq structure is initialized.
*/ */
if (link->conf.Attributes & CONF_ENABLE_IRQ) if (link->conf.Attributes & CONF_ENABLE_IRQ)
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
/* /*
This actually configures the PCMCIA socket -- setting up This actually configures the PCMCIA socket -- setting up
the I/O windows and the interrupt mapping, and putting the the I/O windows and the interrupt mapping, and putting the
card and host interface into "Memory and IO" mode. card and host interface into "Memory and IO" mode.
*/ */
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
((local_info_t*)link->priv)->eth_dev = ((local_info_t*)link->priv)->eth_dev =
init_airo_card( link->irq.AssignedIRQ, init_airo_card( link->irq.AssignedIRQ,
link->io.BasePort1, 1, &handle_to_dev(handle) ); link->io.BasePort1, 1, &handle_to_dev(link) );
if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed; if (!((local_info_t*)link->priv)->eth_dev) goto cs_failed;
/* /*
...@@ -393,7 +389,7 @@ static void airo_config(dev_link_t *link) ...@@ -393,7 +389,7 @@ static void airo_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
airo_release(link); airo_release(link);
} /* airo_config */ } /* airo_config */
...@@ -406,15 +402,14 @@ static void airo_config(dev_link_t *link) ...@@ -406,15 +402,14 @@ static void airo_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
static void airo_release(dev_link_t *link) static void airo_release(struct pcmcia_device *link)
{ {
DEBUG(0, "airo_release(0x%p)\n", link); DEBUG(0, "airo_release(0x%p)\n", link);
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} }
static int airo_suspend(struct pcmcia_device *p_dev) static int airo_suspend(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *local = link->priv; local_info_t *local = link->priv;
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -423,9 +418,8 @@ static int airo_suspend(struct pcmcia_device *p_dev) ...@@ -423,9 +418,8 @@ static int airo_suspend(struct pcmcia_device *p_dev)
return 0; return 0;
} }
static int airo_resume(struct pcmcia_device *p_dev) static int airo_resume(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
local_info_t *local = link->priv; local_info_t *local = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) { if ((link->state & DEV_CONFIG) && (link->open)) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -31,7 +31,7 @@ typedef struct ray_dev_t { ...@@ -31,7 +31,7 @@ typedef struct ray_dev_t {
void __iomem *sram; /* pointer to beginning of shared RAM */ void __iomem *sram; /* pointer to beginning of shared RAM */
void __iomem *amem; /* pointer to attribute mem window */ void __iomem *amem; /* pointer to attribute mem window */
void __iomem *rmem; /* pointer to receive buffer window */ void __iomem *rmem; /* pointer to receive buffer window */
dev_link_t *finder; /* pointer back to dev_link_t for card */ struct pcmcia_device *finder; /* pointer back to struct pcmcia_device for card */
struct timer_list timer; struct timer_list timer;
long tx_ccs_lock; long tx_ccs_lock;
long ccs_lock; long ccs_lock;
......
This diff is collapsed.
This diff is collapsed.
...@@ -602,7 +602,7 @@ struct net_local ...@@ -602,7 +602,7 @@ struct net_local
dev_node_t node; /* ???? What is this stuff ???? */ dev_node_t node; /* ???? What is this stuff ???? */
struct net_device * dev; /* Reverse link... */ struct net_device * dev; /* Reverse link... */
spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
dev_link_t * link; /* pcmcia structure */ struct pcmcia_device * link; /* pcmcia structure */
en_stats stats; /* Ethernet interface statistics */ en_stats stats; /* Ethernet interface statistics */
int nresets; /* Number of hw resets */ int nresets; /* Number of hw resets */
u_char configured; /* If it is configured */ u_char configured; /* If it is configured */
...@@ -733,9 +733,9 @@ static int ...@@ -733,9 +733,9 @@ static int
static inline void static inline void
wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ wv_hw_reset(struct net_device *); /* Same, + start receiver unit */
static inline int static inline int
wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */ wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */
static void static void
wv_pcmcia_release(dev_link_t *);/* Remove a device */ wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */
/* ---------------------- INTERRUPT HANDLING ---------------------- */ /* ---------------------- INTERRUPT HANDLING ---------------------- */
static irqreturn_t static irqreturn_t
wavelan_interrupt(int, /* Interrupt handler */ wavelan_interrupt(int, /* Interrupt handler */
......
This diff is collapsed.
...@@ -88,8 +88,8 @@ typedef struct parport_info_t { ...@@ -88,8 +88,8 @@ typedef struct parport_info_t {
} parport_info_t; } parport_info_t;
static void parport_detach(struct pcmcia_device *p_dev); static void parport_detach(struct pcmcia_device *p_dev);
static void parport_config(dev_link_t *link); static void parport_config(struct pcmcia_device *link);
static void parport_cs_release(dev_link_t *); static void parport_cs_release(struct pcmcia_device *);
/*====================================================================== /*======================================================================
...@@ -99,10 +99,9 @@ static void parport_cs_release(dev_link_t *); ...@@ -99,10 +99,9 @@ static void parport_cs_release(dev_link_t *);
======================================================================*/ ======================================================================*/
static int parport_attach(struct pcmcia_device *p_dev) static int parport_attach(struct pcmcia_device *link)
{ {
parport_info_t *info; parport_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "parport_attach()\n"); DEBUG(0, "parport_attach()\n");
...@@ -111,7 +110,7 @@ static int parport_attach(struct pcmcia_device *p_dev) ...@@ -111,7 +110,7 @@ static int parport_attach(struct pcmcia_device *p_dev)
if (!info) return -ENOMEM; if (!info) return -ENOMEM;
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
link->priv = info; link->priv = info;
info->p_dev = p_dev; info->p_dev = link;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
...@@ -135,10 +134,8 @@ static int parport_attach(struct pcmcia_device *p_dev) ...@@ -135,10 +134,8 @@ static int parport_attach(struct pcmcia_device *p_dev)
======================================================================*/ ======================================================================*/
static void parport_detach(struct pcmcia_device *p_dev) static void parport_detach(struct pcmcia_device *link)
{ {
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "parport_detach(0x%p)\n", link); DEBUG(0, "parport_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
...@@ -158,9 +155,8 @@ static void parport_detach(struct pcmcia_device *p_dev) ...@@ -158,9 +155,8 @@ static void parport_detach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \ #define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
void parport_config(dev_link_t *link) void parport_config(struct pcmcia_device *link)
{ {
client_handle_t handle = link->handle;
parport_info_t *info = link->priv; parport_info_t *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_short buf[128]; u_short buf[128];
...@@ -176,9 +172,9 @@ void parport_config(dev_link_t *link) ...@@ -176,9 +172,9 @@ void parport_config(dev_link_t *link)
tuple.TupleOffset = 0; tuple.TupleDataMax = 255; tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG; tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base; link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0]; link->conf.Present = parse.config.rmask[0];
...@@ -187,10 +183,10 @@ void parport_config(dev_link_t *link) ...@@ -187,10 +183,10 @@ void parport_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0; tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) { while (1) {
if (pcmcia_get_tuple_data(handle, &tuple) != 0 || if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0) pcmcia_parse_tuple(link, &tuple, &parse) != 0)
goto next_entry; goto next_entry;
if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
...@@ -205,7 +201,7 @@ void parport_config(dev_link_t *link) ...@@ -205,7 +201,7 @@ void parport_config(dev_link_t *link)
link->io.BasePort2 = io->win[1].base; link->io.BasePort2 = io->win[1].base;
link->io.NumPorts2 = io->win[1].len; link->io.NumPorts2 = io->win[1].len;
} }
if (pcmcia_request_io(link->handle, &link->io) != 0) if (pcmcia_request_io(link, &link->io) != 0)
goto next_entry; goto next_entry;
/* If we've got this far, we're done */ /* If we've got this far, we're done */
break; break;
...@@ -213,11 +209,11 @@ void parport_config(dev_link_t *link) ...@@ -213,11 +209,11 @@ void parport_config(dev_link_t *link)
next_entry: next_entry:
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
} }
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2,
link->irq.AssignedIRQ, PARPORT_DMA_NONE, link->irq.AssignedIRQ, PARPORT_DMA_NONE,
...@@ -243,7 +239,7 @@ void parport_config(dev_link_t *link) ...@@ -243,7 +239,7 @@ void parport_config(dev_link_t *link)
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link, last_fn, last_ret);
failed: failed:
parport_cs_release(link); parport_cs_release(link);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
...@@ -258,7 +254,7 @@ void parport_config(dev_link_t *link) ...@@ -258,7 +254,7 @@ void parport_config(dev_link_t *link)
======================================================================*/ ======================================================================*/
void parport_cs_release(dev_link_t *link) void parport_cs_release(struct pcmcia_device *link)
{ {
parport_info_t *info = link->priv; parport_info_t *info = link->priv;
...@@ -270,7 +266,7 @@ void parport_cs_release(dev_link_t *link) ...@@ -270,7 +266,7 @@ void parport_cs_release(dev_link_t *link)
} }
info->ndev = 0; info->ndev = 0;
pcmcia_disable_device(link->handle); pcmcia_disable_device(link);
} /* parport_cs_release */ } /* parport_cs_release */
......
...@@ -31,7 +31,7 @@ typedef struct region_t { ...@@ -31,7 +31,7 @@ typedef struct region_t {
u_short region_magic; u_short region_magic;
u_short state; u_short state;
dev_info_t dev_info; dev_info_t dev_info;
client_handle_t mtd; struct pcmcia_device *mtd;
u_int MediaID; u_int MediaID;
region_info_t info; region_info_t info;
} region_t; } region_t;
......
...@@ -391,7 +391,6 @@ static int pcmcia_device_probe(struct device * dev) ...@@ -391,7 +391,6 @@ static int pcmcia_device_probe(struct device * dev)
} }
p_dev->p_state &= ~CLIENT_UNBOUND; p_dev->p_state &= ~CLIENT_UNBOUND;
p_dev->handle = p_dev;
ret = p_drv->probe(p_dev); ret = p_drv->probe(p_dev);
if (ret) if (ret)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -35,7 +35,7 @@ typedef struct region_info_t { ...@@ -35,7 +35,7 @@ typedef struct region_info_t {
#define REGION_BAR_MASK 0xe000 #define REGION_BAR_MASK 0xe000
#define REGION_BAR_SHIFT 13 #define REGION_BAR_SHIFT 13
int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn); int pcmcia_get_first_region(struct pcmcia_device *handle, region_info_t *rgn);
int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn); int pcmcia_get_next_region(struct pcmcia_device *handle, region_info_t *rgn);
#endif /* _LINUX_BULKMEM_H */ #endif /* _LINUX_BULKMEM_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment