Browse Source

[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: Dominik Brodowski <linux@dominikbrodowski.net>
imx_3.10.17_1.0.0_ga
Dominik Brodowski 15 years ago
parent
commit
fba395eee7
52 changed files with 1235 additions and 1467 deletions
  1. +17
    -20
      drivers/bluetooth/bluecard_cs.c
  2. +24
    -27
      drivers/bluetooth/bt3c_cs.c
  3. +24
    -27
      drivers/bluetooth/btuart_cs.c
  4. +21
    -24
      drivers/bluetooth/dtl1_cs.c
  5. +25
    -30
      drivers/char/pcmcia/cm4000_cs.c
  6. +24
    -29
      drivers/char/pcmcia/cm4040_cs.c
  7. +20
    -26
      drivers/char/pcmcia/synclink_cs.c
  8. +28
    -32
      drivers/ide/legacy/ide-cs.c
  9. +28
    -32
      drivers/isdn/hardware/avm/avm_cs.c
  10. +28
    -32
      drivers/isdn/hisax/avma1_cs.c
  11. +22
    -28
      drivers/isdn/hisax/elsa_cs.c
  12. +26
    -32
      drivers/isdn/hisax/sedlbauer_cs.c
  13. +24
    -30
      drivers/isdn/hisax/teles_cs.c
  14. +26
    -29
      drivers/mtd/maps/pcmciamtd.c
  15. +26
    -31
      drivers/net/pcmcia/3c574_cs.c
  16. +27
    -32
      drivers/net/pcmcia/3c589_cs.c
  17. +29
    -34
      drivers/net/pcmcia/axnet_cs.c
  18. +17
    -22
      drivers/net/pcmcia/com20020_cs.c
  19. +46
    -51
      drivers/net/pcmcia/fmvj18x_cs.c
  20. +22
    -27
      drivers/net/pcmcia/ibmtr_cs.c
  21. +28
    -33
      drivers/net/pcmcia/nmclan_cs.c
  22. +43
    -48
      drivers/net/pcmcia/pcnet_cs.c
  23. +53
    -61
      drivers/net/pcmcia/smc91c92_cs.c
  24. +51
    -57
      drivers/net/pcmcia/xirc2ps_cs.c
  25. +26
    -32
      drivers/net/wireless/airo_cs.c
  26. +25
    -31
      drivers/net/wireless/atmel_cs.c
  27. +39
    -43
      drivers/net/wireless/hostap/hostap_cs.c
  28. +28
    -33
      drivers/net/wireless/netwave_cs.c
  29. +27
    -32
      drivers/net/wireless/orinoco_cs.c
  30. +44
    -48
      drivers/net/wireless/ray_cs.c
  31. +1
    -1
      drivers/net/wireless/ray_cs.h
  32. +37
    -43
      drivers/net/wireless/spectrum_cs.c
  33. +31
    -36
      drivers/net/wireless/wavelan_cs.c
  34. +3
    -3
      drivers/net/wireless/wavelan_cs.p.h
  35. +31
    -36
      drivers/net/wireless/wl3501_cs.c
  36. +19
    -23
      drivers/parport/parport_cs.c
  37. +1
    -1
      drivers/pcmcia/cs_internal.h
  38. +0
    -1
      drivers/pcmcia/ds.c
  39. +22
    -27
      drivers/scsi/pcmcia/aha152x_stub.c
  40. +20
    -26
      drivers/scsi/pcmcia/fdomain_stub.c
  41. +22
    -28
      drivers/scsi/pcmcia/nsp_cs.c
  42. +3
    -3
      drivers/scsi/pcmcia/nsp_cs.h
  43. +24
    -30
      drivers/scsi/pcmcia/qlogic_stub.c
  44. +20
    -25
      drivers/scsi/pcmcia/sym53c500_cs.c
  45. +51
    -60
      drivers/serial/serial_cs.c
  46. +19
    -25
      drivers/telephony/ixj_pcmcia.c
  47. +21
    -25
      drivers/usb/host/sl811_cs.c
  48. +2
    -2
      include/pcmcia/bulkmem.h
  49. +1
    -6
      include/pcmcia/ds.h
  50. +1
    -1
      include/pcmcia/ss.h
  51. +18
    -25
      sound/pcmcia/pdaudiocf/pdaudiocf.c
  52. +20
    -27
      sound/pcmcia/vx/vxpocket.c

+ 17
- 20
drivers/bluetooth/bluecard_cs.c View File

@ -85,8 +85,8 @@ typedef struct bluecard_info_t {
} bluecard_info_t;
static void bluecard_config(dev_link_t *link);
static void bluecard_release(dev_link_t *link);
static void bluecard_config(struct pcmcia_device *link);
static void bluecard_release(struct pcmcia_device *link);
static void bluecard_detach(struct pcmcia_device *p_dev);
@ -856,17 +856,16 @@ static int bluecard_close(bluecard_info_t *info)
return 0;
}
static int bluecard_attach(struct pcmcia_device *p_dev)
static int bluecard_attach(struct pcmcia_device *link)
{
bluecard_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
info->p_dev = p_dev;
info->p_dev = link;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@ -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;
if (link->state & DEV_CONFIG)
@ -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;
@ -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);
}
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;
tuple_t tuple;
u_short buf[256];
@ -930,7 +927,7 @@ static void bluecard_config(dev_link_t *link)
/* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse);
last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple;
goto cs_failed;
@ -947,25 +944,25 @@ static void bluecard_config(dev_link_t *link)
for (n = 0; n < 0x400; n += 0x40) {
link->io.BasePort1 = n ^ 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) {
cs_error(link->handle, RequestIO, i);
cs_error(link, RequestIO, i);
goto failed;
}
i = pcmcia_request_irq(link->handle, &link->irq);
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i);
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link->handle, &link->conf);
i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i);
cs_error(link, RequestConfiguration, i);
goto failed;
}
@ -979,14 +976,14 @@ static void bluecard_config(dev_link_t *link)
return;
cs_failed:
cs_error(link->handle, last_fn, last_ret);
cs_error(link, last_fn, last_ret);
failed:
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;
@ -995,7 +992,7 @@ static void bluecard_release(dev_link_t *link)
del_timer(&(info->timer));
pcmcia_disable_device(link->handle);
pcmcia_disable_device(link);
}
static struct pcmcia_device_id bluecard_ids[] = {


+ 24
- 27
drivers/bluetooth/bt3c_cs.c View File

@ -88,8 +88,8 @@ typedef struct bt3c_info_t {
} bt3c_info_t;
static void bt3c_config(dev_link_t *link);
static void bt3c_release(dev_link_t *link);
static void bt3c_config(struct pcmcia_device *link);
static void bt3c_release(struct pcmcia_device *link);
static void bt3c_detach(struct pcmcia_device *p_dev);
@ -645,17 +645,16 @@ static int bt3c_close(bt3c_info_t *info)
return 0;
}
static int bt3c_attach(struct pcmcia_device *p_dev)
static int bt3c_attach(struct pcmcia_device *link)
{
bt3c_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
info->p_dev = p_dev;
info->p_dev = link;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@ -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;
if (link->state & DEV_CONFIG)
@ -687,7 +685,7 @@ static void bt3c_detach(struct pcmcia_device *p_dev)
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;
@ -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);
}
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)
return CS_NO_MORE_ITEMS;
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)
return CS_NO_MORE_ITEMS;
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 };
client_handle_t handle = link->handle;
bt3c_info_t *info = link->priv;
tuple_t tuple;
u_short buf[256];
@ -730,7 +727,7 @@ static void bt3c_config(dev_link_t *link)
/* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse);
last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple;
goto cs_failed;
@ -749,7 +746,7 @@ static void bt3c_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
/* Two tries: without IO aliases, then with aliases */
for (try = 0; try < 2; try++) {
i = first_tuple(handle, &tuple, &parse);
i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) {
if (i != CS_SUCCESS)
goto next_entry;
@ -759,49 +756,49 @@ static void bt3c_config(dev_link_t *link)
link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base;
link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
i = pcmcia_request_io(link->handle, &link->io);
i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS)
goto found_port;
}
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
its base address, then try to grab any standard serial 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) {
if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
link->conf.ConfigIndex = cf->index;
for (j = 0; j < 5; j++) {
link->io.BasePort1 = base[j];
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)
goto found_port;
}
}
i = next_tuple(handle, &tuple, &parse);
i = next_tuple(link, &tuple, &parse);
}
found_port:
if (i != CS_SUCCESS) {
BT_ERR("No usable port range found");
cs_error(link->handle, RequestIO, i);
cs_error(link, RequestIO, i);
goto failed;
}
i = pcmcia_request_irq(link->handle, &link->irq);
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i);
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link->handle, &link->conf);
i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i);
cs_error(link, RequestConfiguration, i);
goto failed;
}
@ -815,21 +812,21 @@ found_port:
return;
cs_failed:
cs_error(link->handle, last_fn, last_ret);
cs_error(link, last_fn, last_ret);
failed:
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;
if (link->state & DEV_PRESENT)
bt3c_close(info);
pcmcia_disable_device(link->handle);
pcmcia_disable_device(link);
}


+ 24
- 27
drivers/bluetooth/btuart_cs.c View File

@ -84,8 +84,8 @@ typedef struct btuart_info_t {
} btuart_info_t;
static void btuart_config(dev_link_t *link);
static void btuart_release(dev_link_t *link);
static void btuart_config(struct pcmcia_device *link);
static void btuart_release(struct pcmcia_device *link);
static void btuart_detach(struct pcmcia_device *p_dev);
@ -576,17 +576,16 @@ static int btuart_close(btuart_info_t *info)
return 0;
}
static int btuart_attach(struct pcmcia_device *p_dev)
static int btuart_attach(struct pcmcia_device *link)
{
btuart_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
info->p_dev = p_dev;
info->p_dev = link;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@ -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;
if (link->state & DEV_CONFIG)
@ -618,7 +616,7 @@ static void btuart_detach(struct pcmcia_device *p_dev)
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;
@ -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);
}
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)
return CS_NO_MORE_ITEMS;
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)
return CS_NO_MORE_ITEMS;
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 };
client_handle_t handle = link->handle;
btuart_info_t *info = link->priv;
tuple_t tuple;
u_short buf[256];
@ -661,7 +658,7 @@ static void btuart_config(dev_link_t *link)
/* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse);
last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple;
goto cs_failed;
@ -680,7 +677,7 @@ static void btuart_config(dev_link_t *link)
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
/* Two tries: without IO aliases, then with aliases */
for (try = 0; try < 2; try++) {
i = first_tuple(handle, &tuple, &parse);
i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) {
if (i != CS_SUCCESS)
goto next_entry;
@ -690,19 +687,19 @@ static void btuart_config(dev_link_t *link)
link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base;
link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
i = pcmcia_request_io(link->handle, &link->io);
i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS)
goto found_port;
}
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
its base address, then try to grab any standard serial 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) {
if ((i == CS_SUCCESS) && (cf->io.nwin > 0)
&& ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
@ -710,30 +707,30 @@ next_entry:
for (j = 0; j < 5; j++) {
link->io.BasePort1 = base[j];
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)
goto found_port;
}
}
i = next_tuple(handle, &tuple, &parse);
i = next_tuple(link, &tuple, &parse);
}
found_port:
if (i != CS_SUCCESS) {
BT_ERR("No usable port range found");
cs_error(link->handle, RequestIO, i);
cs_error(link, RequestIO, i);
goto failed;
}
i = pcmcia_request_irq(link->handle, &link->irq);
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i);
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link->handle, &link->conf);
i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i);
cs_error(link, RequestConfiguration, i);
goto failed;
}
@ -747,21 +744,21 @@ found_port:
return;
cs_failed:
cs_error(link->handle, last_fn, last_ret);
cs_error(link, last_fn, last_ret);
failed:
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;
if (link->state & DEV_PRESENT)
btuart_close(info);
pcmcia_disable_device(link->handle);
pcmcia_disable_device(link);
}
static struct pcmcia_device_id btuart_ids[] = {


+ 21
- 24
drivers/bluetooth/dtl1_cs.c View File

@ -87,8 +87,8 @@ typedef struct dtl1_info_t {
} dtl1_info_t;
static void dtl1_config(dev_link_t *link);
static void dtl1_release(dev_link_t *link);
static void dtl1_config(struct pcmcia_device *link);
static void dtl1_release(struct pcmcia_device *link);
static void dtl1_detach(struct pcmcia_device *p_dev);
@ -555,17 +555,16 @@ static int dtl1_close(dtl1_info_t *info)
return 0;
}
static int dtl1_attach(struct pcmcia_device *p_dev)
static int dtl1_attach(struct pcmcia_device *link)
{
dtl1_info_t *info;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
info->p_dev = p_dev;
info->p_dev = link;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@ -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;
if (link->state & DEV_CONFIG)
@ -597,7 +595,7 @@ static void dtl1_detach(struct pcmcia_device *p_dev)
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;
@ -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);
}
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)
return CS_NO_MORE_ITEMS;
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)
return CS_NO_MORE_ITEMS;
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;
tuple_t tuple;
u_short buf[256];
@ -639,7 +636,7 @@ static void dtl1_config(dev_link_t *link)
/* Get configuration register information */
tuple.DesiredTuple = CISTPL_CONFIG;
last_ret = first_tuple(handle, &tuple, &parse);
last_ret = first_tuple(link, &tuple, &parse);
if (last_ret != CS_SUCCESS) {
last_fn = ParseTuple;
goto cs_failed;
@ -658,34 +655,34 @@ static void dtl1_config(dev_link_t *link)
/* Look for a generic full-sized window */
link->io.NumPorts1 = 8;
i = first_tuple(handle, &tuple, &parse);
i = first_tuple(link, &tuple, &parse);
while (i != CS_NO_MORE_ITEMS) {
if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
link->conf.ConfigIndex = cf->index;
link->io.BasePort1 = cf->io.win[0].base;
link->io.NumPorts1 = cf->io.win[0].len; /*yo */
link->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
i = pcmcia_request_io(link->handle, &link->io);
i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS)
break;
}
i = next_tuple(handle, &tuple, &parse);
i = next_tuple(link, &tuple, &parse);
}
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIO, i);
cs_error(link, RequestIO, i);
goto failed;
}
i = pcmcia_request_irq(link->handle, &link->irq);
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestIRQ, i);
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}
i = pcmcia_request_configuration(link->handle, &link->conf);
i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
cs_error(link->handle, RequestConfiguration, i);
cs_error(link, RequestConfiguration, i);
goto failed;
}
@ -699,21 +696,21 @@ static void dtl1_config(dev_link_t *link)
return;
cs_failed:
cs_error(link->handle, last_fn, last_ret);
cs_error(link, last_fn, last_ret);
failed:
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;
if (link->state & DEV_PRESENT)
dtl1_close(info);
pcmcia_disable_device(link->handle);
pcmcia_disable_device(link);
}


+ 25
- 30
drivers/char/pcmcia/cm4000_cs.c View File

@ -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_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 */
@ -149,14 +149,14 @@ struct cm4000_dev {
#define ZERO_DEV(dev) \
memset(&dev->atr_csum,0, \
sizeof(struct cm4000_dev) - \
/*link*/ sizeof(dev_link_t) - \
/*link*/ sizeof(struct pcmcia_device) - \
/*node*/ sizeof(dev_node_t) - \
/*atr*/ MAX_ATR*sizeof(char) - \
/*rbuf*/ 512*sizeof(char) - \
/*sbuf*/ 512*sizeof(char) - \
/*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;
/* 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,
{
struct cm4000_dev *dev = filp->private_data;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
dev_link_t *link;
struct pcmcia_device *link;
int size;
int rc;
void __user *argp = (void __user *)arg;
@ -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)
{
struct cm4000_dev *dev;
dev_link_t *link;
struct pcmcia_device *link;
int rc, minor = iminor(inode);
if (minor >= CM4000_MAX_DEV)
@ -1709,7 +1709,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
static int cmm_close(struct inode *inode, struct file *filp)
{
struct cm4000_dev *dev;
dev_link_t *link;
struct pcmcia_device *link;
int minor = iminor(inode);
if (minor >= CM4000_MAX_DEV)
@ -1735,7 +1735,7 @@ static int cmm_close(struct inode *inode, struct file *filp)
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;
@ -1759,9 +1759,8 @@ static void cmm_cm4000_release(dev_link_t * link)
/*==== 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;
tuple_t tuple;
cisparse_t parse;
@ -1776,16 +1775,16 @@ static void cm4000_config(dev_link_t * link, int devno)
tuple.TupleDataMax = sizeof(buf);
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;
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;
goto cs_failed;
}
if ((fail_rc =
pcmcia_parse_tuple(handle, &tuple, &parse)) != CS_SUCCESS) {
pcmcia_parse_tuple(link, &tuple, &parse)) != CS_SUCCESS) {
fail_fn = ParseTuple;
goto cs_failed;
}
@ -1798,13 +1797,13 @@ static void cm4000_config(dev_link_t * link, int devno)
link->io.NumPorts2 = 0;
link->io.Attributes2 = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
for (rc = pcmcia_get_first_tuple(handle, &tuple);
rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(handle, &tuple)) {
for (rc = pcmcia_get_first_tuple(link, &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)
continue;
rc = pcmcia_parse_tuple(handle, &tuple, &parse);
rc = pcmcia_parse_tuple(link, &tuple, &parse);
if (rc != CS_SUCCESS)
continue;
@ -1824,7 +1823,7 @@ static void cm4000_config(dev_link_t * link, int devno)
link->io.IOAddrLines = parse.cftable_entry.io.flags
& CISTPL_IO_LINES_MASK;
rc = pcmcia_request_io(handle, &link->io);
rc = pcmcia_request_io(link, &link->io);
if (rc == CS_SUCCESS)
break; /* we are done */
}
@ -1834,7 +1833,7 @@ static void cm4000_config(dev_link_t * link, int devno)
link->conf.IntType = 00000002;
if ((fail_rc =
pcmcia_request_configuration(handle, &link->conf)) != CS_SUCCESS) {
pcmcia_request_configuration(link, &link->conf)) != CS_SUCCESS) {
fail_fn = RequestConfiguration;
goto cs_release;
}
@ -1850,16 +1849,15 @@ static void cm4000_config(dev_link_t * link, int devno)
return;
cs_failed:
cs_error(handle, fail_fn, fail_rc);
cs_error(link, fail_fn, fail_rc);
cs_release:
cm4000_release(link);
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;
dev = link->priv;
@ -1868,9 +1866,8 @@ static int cm4000_suspend(struct pcmcia_device *p_dev)
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;
dev = link->priv;
@ -1880,17 +1877,16 @@ static int cm4000_resume(struct pcmcia_device *p_dev)
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 */
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;
int i;
dev_link_t *link = dev_to_instance(p_dev);
for (i = 0; i < CM4000_MAX_DEV; i++)
if (dev_table[i] == NULL)
@ -1906,7 +1902,7 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
if (dev == NULL)
return -ENOMEM;
dev->p_dev = p_dev;
dev->p_dev = link;
link->priv = dev;
link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link;
@ -1925,9 +1921,8 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
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;
int devno;


+ 24
- 29
drivers/char/pcmcia/cm4040_cs.c View File

@ -65,7 +65,7 @@ static char *version =
/* how often to poll for fifo status change */
#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 struct class *cmx_class;
@ -87,7 +87,7 @@ struct reader_dev {
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
#define xoutb outb
@ -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)
{
struct reader_dev *dev;
dev_link_t *link;
struct pcmcia_device *link;
int minor = iminor(inode);
if (minor >= CM_MAX_DEV)
@ -478,7 +478,7 @@ static int cm4040_open(struct inode *inode, struct file *filp)
static int cm4040_close(struct inode *inode, struct file *filp)
{
struct reader_dev *dev = filp->private_data;
dev_link_t *link;
struct pcmcia_device *link;
int minor = iminor(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)
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;
@ -514,9 +514,8 @@ static void cm4040_reader_release(dev_link_t *link)
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;
tuple_t tuple;
cisparse_t parse;
@ -524,23 +523,21 @@ static void reader_config(dev_link_t *link, int devno)
int fail_fn, fail_rc;
int rc;
handle = link->handle;
tuple.DesiredTuple = CISTPL_CONFIG;
tuple.Attributes = 0;
tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf);
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;
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;
goto cs_failed;
}
if ((fail_rc = pcmcia_parse_tuple(handle, &tuple, &parse))
if ((fail_rc = pcmcia_parse_tuple(link, &tuple, &parse))
!= CS_SUCCESS) {
fail_fn = ParseTuple;
goto cs_failed;
@ -554,13 +551,13 @@ static void reader_config(dev_link_t *link, int devno)
link->io.NumPorts2 = 0;
link->io.Attributes2 = 0;
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 = pcmcia_get_tuple_data(handle, &tuple);
rc = pcmcia_get_next_tuple(link, &tuple)) {
rc = pcmcia_get_tuple_data(link, &tuple);
if (rc != CS_SUCCESS)
continue;
rc = pcmcia_parse_tuple(handle, &tuple, &parse);
rc = pcmcia_parse_tuple(link, &tuple, &parse);
if (rc != CS_SUCCESS)
continue;
@ -578,13 +575,13 @@ static void reader_config(dev_link_t *link, int devno)
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.IOAddrLines = parse.cftable_entry.io.flags
& 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)
break;
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);
}
if (rc != CS_SUCCESS)
@ -592,10 +589,10 @@ static void reader_config(dev_link_t *link, int devno)
link->conf.IntType = 00000002;
if ((fail_rc = pcmcia_request_configuration(handle,&link->conf))
if ((fail_rc = pcmcia_request_configuration(link,&link->conf))
!=CS_SUCCESS) {
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",
fail_rc);
goto cs_release;
@ -616,23 +613,22 @@ static void reader_config(dev_link_t *link, int devno)
return;
cs_failed:
cs_error(handle, fail_fn, fail_rc);
cs_error(link, fail_fn, fail_rc);
cs_release:
reader_release(link);
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);
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;
int i;
dev_link_t *link = dev_to_instance(p_dev);
for (i = 0; i < CM_MAX_DEV; i++) {
if (dev_table[i] == NULL)
@ -650,7 +646,7 @@ static int reader_attach(struct pcmcia_device *p_dev)
dev->buffer_status = 0;
link->priv = dev;
dev->p_dev = p_dev;
dev->p_dev = link;
link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link;
@ -671,9 +667,8 @@ static int reader_attach(struct pcmcia_device *p_dev)
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;
int devno;


+ 20
- 26
drivers/char/pcmcia/synclink_cs.c View File

@ -484,7 +484,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
/* 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_detach(struct pcmcia_device *p_dev);
@ -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;
dev_link_t *link = dev_to_instance(p_dev);
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_attach\n");
@ -565,10 +564,10 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
info->imrb_value = 0xffff;
info->pim_value = 0xff;
info->p_dev = p_dev;
info->p_dev = link;
link->priv = info;
/* Initialize the dev_link_t structure */
/* Initialize the struct pcmcia_device structure */
/* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@ -592,9 +591,8 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
#define CS_CHECK(fn, ret) \
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void mgslpc_config(dev_link_t *link)
static void mgslpc_config(struct pcmcia_device *link)
{
client_handle_t handle = link->handle;
MGSLPC_INFO *info = link->priv;
tuple_t tuple;
cisparse_t parse;
@ -612,9 +610,9 @@ static void mgslpc_config(dev_link_t *link)
tuple.TupleData = buf;
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
@ -624,11 +622,11 @@ static void mgslpc_config(dev_link_t *link)
/* get CIS configuration 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);
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
if (cfg->index == 0)
@ -649,7 +647,7 @@ static void mgslpc_config(dev_link_t *link)
link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
link->io.BasePort1 = io->win[0].base;
link->io.NumPorts1 = io->win[0].len;
CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io));
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
}
link->conf.Attributes = CONF_ENABLE_IRQ;
@ -660,9 +658,9 @@ static void mgslpc_config(dev_link_t *link)
link->irq.Attributes |= IRQ_HANDLE_PRESENT;
link->irq.Handler = mgslpc_isr;
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->irq_level = link->irq.AssignedIRQ;
@ -685,7 +683,7 @@ static void mgslpc_config(dev_link_t *link)
return;
cs_failed:
cs_error(link->handle, last_fn, last_ret);
cs_error(link, last_fn, last_ret);
mgslpc_release((u_long)link);
}
@ -695,18 +693,16 @@ cs_failed:
*/
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)
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)
printk("mgslpc_detach(0x%p)\n", link);
@ -718,9 +714,8 @@ static void mgslpc_detach(struct pcmcia_device *p_dev)
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;
info->stop = 1;
@ -728,9 +723,8 @@ static int mgslpc_suspend(struct pcmcia_device *dev)
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;
info->stop = 0;


+ 28
- 32
drivers/ide/legacy/ide-cs.c View File

@ -87,8 +87,8 @@ typedef struct ide_info_t {
int hd;
} ide_info_t;
static void ide_release(dev_link_t *);
static void ide_config(dev_link_t *);
static void ide_release(struct pcmcia_device *);
static void ide_config(struct pcmcia_device *);
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;
dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "ide_attach()\n");
@ -115,7 +114,7 @@ static int ide_attach(struct pcmcia_device *p_dev)
if (!info)
return -ENOMEM;
info->p_dev = p_dev;
info->p_dev = link;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@ -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);
if (link->state & DEV_CONFIG)
@ -175,9 +172,8 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
#define CS_CHECK(fn, ret) \
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;
tuple_t tuple;
struct {
@ -201,16 +197,16 @@ static void ide_config(dev_link_t *link)
tuple.TupleDataMax = 255;
tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CONFIG;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &stk->parse));
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &stk->parse));
link->conf.ConfigBase = stk->parse.config.base;
link->conf.Present = stk->parse.config.rmask[0];
tuple.DesiredTuple = CISTPL_MANFID;
if (!pcmcia_get_first_tuple(handle, &tuple) &&
!pcmcia_get_tuple_data(handle, &tuple) &&
!pcmcia_parse_tuple(handle, &tuple, &stk->parse))
if (!pcmcia_get_first_tuple(link, &tuple) &&
!pcmcia_get_tuple_data(link, &tuple) &&
!pcmcia_parse_tuple(link, &tuple, &stk->parse))
is_kme = ((stk->parse.manfid.manf == MANFID_KME) &&
((stk->parse.manfid.card == PRODID_KME_KXLC005_A) ||
(stk->parse.manfid.card == PRODID_KME_KXLC005_B)));
@ -219,15 +215,15 @@ static void ide_config(dev_link_t *link)
link->state |= DEV_CONFIG;
/* 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;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) {
if (pcmcia_get_tuple_data(handle, &tuple) != 0) goto next_entry;
if (pcmcia_parse_tuple(handle, &tuple, &stk->parse) != 0) goto next_entry;
if (pcmcia_get_tuple_data(link, &tuple) != 0) goto next_entry;
if (pcmcia_parse_tuple(link, &tuple, &stk->parse) != 0) goto next_entry;
/* Check for matching Vcc, unless we're desperate */
if (!pass) {
@ -258,14 +254,14 @@ static void ide_config(dev_link_t *link)
link->io.NumPorts1 = 8;
link->io.BasePort2 = io->win[1].base;
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;
io_base = link->io.BasePort1;
ctl_base = link->io.BasePort2;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
link->io.NumPorts1 = io->win[0].len;
link->io.NumPorts2 = 0;
if (pcmcia_request_io(link->handle, &link->io) != 0)
if (pcmcia_request_io(link, &link->io) != 0)
goto next_entry;
io_base = link->io.BasePort1;
ctl_base = link->io.BasePort1 + 0x0e;
@ -278,16 +274,16 @@ static void ide_config(dev_link_t *link)
if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
memcpy(&stk->dflt, cfg, sizeof(stk->dflt));
if (pass) {
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
} else if (pcmcia_get_next_tuple(handle, &tuple) != 0) {
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
} else if (pcmcia_get_next_tuple(link, &tuple) != 0) {
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
memset(&stk->dflt, 0, sizeof(stk->dflt));
pass++;
}
}
CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
/* disable drive interrupts during IDE probe */
outb(0x02, ctl_base);
@ -298,12 +294,12 @@ static void ide_config(dev_link_t *link)
/* retry registration in case device is still spinning up */
for (hd = -1, i = 0; i < 10; i++) {
hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, handle);