You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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>
This commit is contained in:
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
@@ -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);
|
||||
hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
|
||||
if (hd >= 0) break;
|
||||
if (link->io.NumPorts1 == 0x20) {
|
||||
outb(0x02, ctl_base + 0x10);
|
||||
hd = idecs_register(io_base + 0x10, ctl_base + 0x10,
|
||||
link->irq.AssignedIRQ, handle);
|
||||
link->irq.AssignedIRQ, link);
|
||||
if (hd >= 0) {
|
||||
io_base += 0x10;
|
||||
ctl_base += 0x10;
|
||||
@@ -338,7 +334,7 @@ err_mem:
|
||||
goto failed;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
kfree(stk);
|
||||
ide_release(link);
|
||||
@@ -353,7 +349,7 @@ failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
void ide_release(dev_link_t *link)
|
||||
void ide_release(struct pcmcia_device *link)
|
||||
{
|
||||
ide_info_t *info = link->priv;
|
||||
|
||||
@@ -366,7 +362,7 @@ void ide_release(dev_link_t *link)
|
||||
}
|
||||
info->ndev = 0;
|
||||
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
} /* ide_release */
|
||||
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ MODULE_LICENSE("GPL");
|
||||
handler.
|
||||
*/
|
||||
|
||||
static void avmcs_config(dev_link_t *link);
|
||||
static void avmcs_release(dev_link_t *link);
|
||||
static void avmcs_config(struct pcmcia_device *link);
|
||||
static void avmcs_release(struct pcmcia_device *link);
|
||||
|
||||
/*
|
||||
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);
|
||||
/*
|
||||
A linked list of "instances" of the skeleton device. Each actual
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -78,7 +78,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev);
|
||||
example, ethernet cards, modems). In other cases, there may be
|
||||
many actual or logical devices (SCSI adapters, memory cards with
|
||||
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,
|
||||
because they generally can't be allocated dynamically.
|
||||
*/
|
||||
@@ -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)
|
||||
avmcs_release(link);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
int i = pcmcia_get_tuple_data(handle, tuple);
|
||||
@@ -171,7 +169,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_first_tuple(handle, tuple);
|
||||
@@ -179,7 +177,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_next_tuple(handle, tuple);
|
||||
@@ -187,9 +185,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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;
|
||||
cisparse_t parse;
|
||||
cistpl_cftable_entry_t *cf = &parse.cftable_entry;
|
||||
@@ -199,8 +196,7 @@ static void avmcs_config(dev_link_t *link)
|
||||
char devname[128];
|
||||
int cardtype;
|
||||
int (*addcard)(unsigned int port, unsigned irq);
|
||||
|
||||
handle = link->handle;
|
||||
|
||||
dev = link->priv;
|
||||
|
||||
/*
|
||||
@@ -209,19 +205,19 @@ static void avmcs_config(dev_link_t *link)
|
||||
*/
|
||||
do {
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
i = pcmcia_get_first_tuple(handle, &tuple);
|
||||
i = pcmcia_get_first_tuple(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
i = pcmcia_get_tuple_data(handle, &tuple);
|
||||
i = pcmcia_get_tuple_data(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
i = pcmcia_parse_tuple(handle, &tuple, &parse);
|
||||
i = pcmcia_parse_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) break;
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
} while (0);
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link->handle, ParseTuple, i);
|
||||
cs_error(link, ParseTuple, i);
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
return;
|
||||
}
|
||||
@@ -238,7 +234,7 @@ static void avmcs_config(dev_link_t *link)
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
|
||||
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],
|
||||
sizeof(devname));
|
||||
}
|
||||
@@ -249,7 +245,7 @@ static void avmcs_config(dev_link_t *link)
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
i = first_tuple(handle, &tuple, &parse);
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
while (i == CS_SUCCESS) {
|
||||
if (cf->io.nwin > 0) {
|
||||
link->conf.ConfigIndex = cf->index;
|
||||
@@ -259,36 +255,36 @@ static void avmcs_config(dev_link_t *link)
|
||||
printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n",
|
||||
link->io.BasePort1,
|
||||
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;
|
||||
}
|
||||
i = next_tuple(handle, &tuple, &parse);
|
||||
i = next_tuple(link, &tuple, &parse);
|
||||
}
|
||||
|
||||
found_port:
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link->handle, RequestIO, i);
|
||||
cs_error(link, RequestIO, i);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* allocate an interrupt line
|
||||
*/
|
||||
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);
|
||||
/* undo */
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* configure the PCMCIA socket
|
||||
*/
|
||||
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);
|
||||
pcmcia_disable_device(link->handle);
|
||||
cs_error(link, RequestConfiguration, i);
|
||||
pcmcia_disable_device(link);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -351,10 +347,10 @@ found_port:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void avmcs_release(dev_link_t *link)
|
||||
static void avmcs_release(struct pcmcia_device *link)
|
||||
{
|
||||
b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
} /* avmcs_release */
|
||||
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ module_param(isdnprot, int, 0);
|
||||
handler.
|
||||
*/
|
||||
|
||||
static void avma1cs_config(dev_link_t *link);
|
||||
static void avma1cs_release(dev_link_t *link);
|
||||
static void avma1cs_config(struct pcmcia_device *link);
|
||||
static void avma1cs_release(struct pcmcia_device *link);
|
||||
|
||||
/*
|
||||
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);
|
||||
/*
|
||||
A linked list of "instances" of the skeleton device. Each actual
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -95,7 +95,7 @@ static void avma1cs_detach(struct pcmcia_device *p_dev);
|
||||
example, ethernet cards, modems). In other cases, there may be
|
||||
many actual or logical devices (SCSI adapters, memory cards with
|
||||
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,
|
||||
because they generally can't be allocated dynamically.
|
||||
*/
|
||||
@@ -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);
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
@@ -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)
|
||||
{
|
||||
int i = pcmcia_get_tuple_data(handle, tuple);
|
||||
@@ -192,7 +190,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_first_tuple(handle, tuple);
|
||||
@@ -200,7 +198,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_next_tuple(handle, tuple);
|
||||
@@ -208,9 +206,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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;
|
||||
cisparse_t parse;
|
||||
cistpl_cftable_entry_t *cf = &parse.cftable_entry;
|
||||
@@ -220,8 +217,7 @@ static void avma1cs_config(dev_link_t *link)
|
||||
char devname[128];
|
||||
IsdnCard_t icard;
|
||||
int busy = 0;
|
||||
|
||||
handle = link->handle;
|
||||
|
||||
dev = link->priv;
|
||||
|
||||
DEBUG(0, "avma1cs_config(0x%p)\n", link);
|
||||
@@ -232,19 +228,19 @@ static void avma1cs_config(dev_link_t *link)
|
||||
*/
|
||||
do {
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
i = pcmcia_get_first_tuple(handle, &tuple);
|
||||
i = pcmcia_get_first_tuple(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
tuple.TupleData = buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
i = pcmcia_get_tuple_data(handle, &tuple);
|
||||
i = pcmcia_get_tuple_data(link, &tuple);
|
||||
if (i != CS_SUCCESS) break;
|
||||
i = pcmcia_parse_tuple(handle, &tuple, &parse);
|
||||
i = pcmcia_parse_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) break;
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
} while (0);
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link->handle, ParseTuple, i);
|
||||
cs_error(link, ParseTuple, i);
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
return;
|
||||
}
|
||||
@@ -261,7 +257,7 @@ static void avma1cs_config(dev_link_t *link)
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
|
||||
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],
|
||||
sizeof(devname));
|
||||
}
|
||||
@@ -272,7 +268,7 @@ static void avma1cs_config(dev_link_t *link)
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
i = first_tuple(handle, &tuple, &parse);
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
while (i == CS_SUCCESS) {
|
||||
if (cf->io.nwin > 0) {
|
||||
link->conf.ConfigIndex = cf->index;
|
||||
@@ -282,36 +278,36 @@ static void avma1cs_config(dev_link_t *link)
|
||||
printk(KERN_INFO "avma1_cs: testing i/o %#x-%#x\n",
|
||||
link->io.BasePort1,
|
||||
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;
|
||||
}
|
||||
i = next_tuple(handle, &tuple, &parse);
|
||||
i = next_tuple(link, &tuple, &parse);
|
||||
}
|
||||
|
||||
found_port:
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link->handle, RequestIO, i);
|
||||
cs_error(link, RequestIO, i);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* allocate an interrupt line
|
||||
*/
|
||||
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);
|
||||
/* undo */
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* configure the PCMCIA socket
|
||||
*/
|
||||
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);
|
||||
pcmcia_disable_device(link->handle);
|
||||
cs_error(link, RequestConfiguration, i);
|
||||
pcmcia_disable_device(link);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -358,7 +354,7 @@ found_port:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void avma1cs_release(dev_link_t *link)
|
||||
static void avma1cs_release(struct pcmcia_device *link)
|
||||
{
|
||||
local_info_t *local = link->priv;
|
||||
|
||||
@@ -367,7 +363,7 @@ static void avma1cs_release(dev_link_t *link)
|
||||
/* now unregister function with hisax */
|
||||
HiSax_closecard(local->node.minor);
|
||||
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
} /* avma1cs_release */
|
||||
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ module_param(protocol, int, 0);
|
||||
handler.
|
||||
*/
|
||||
|
||||
static void elsa_cs_config(dev_link_t *link);
|
||||
static void elsa_cs_release(dev_link_t *link);
|
||||
static void elsa_cs_config(struct pcmcia_device *link);
|
||||
static void elsa_cs_release(struct pcmcia_device *link);
|
||||
|
||||
/*
|
||||
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);
|
||||
example, ethernet cards, modems). In other cases, there may be
|
||||
many actual or logical devices (SCSI adapters, memory cards with
|
||||
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,
|
||||
because they generally shouldn't be allocated dynamically.
|
||||
In this case, we also provide a flag to indicate if a device is
|
||||
@@ -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;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "elsa_cs_attach()\n");
|
||||
|
||||
@@ -151,7 +150,7 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev)
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
|
||||
local->p_dev = p_dev;
|
||||
local->p_dev = link;
|
||||
link->priv = local;
|
||||
|
||||
local->cardnr = -1;
|
||||
@@ -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;
|
||||
|
||||
DEBUG(0, "elsa_cs_detach(0x%p)\n", link);
|
||||
@@ -213,7 +211,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev)
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_tuple_data(handle, tuple);
|
||||
@@ -221,7 +219,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_first_tuple(handle, tuple);
|
||||
@@ -229,7 +227,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_next_tuple(handle, tuple);
|
||||
@@ -237,9 +235,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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;
|
||||
cisparse_t parse;
|
||||
local_info_t *dev;
|
||||
@@ -249,7 +246,6 @@ static void elsa_cs_config(dev_link_t *link)
|
||||
IsdnCard_t icard;
|
||||
|
||||
DEBUG(0, "elsa_config(0x%p)\n", link);
|
||||
handle = link->handle;
|
||||
dev = link->priv;
|
||||
|
||||
/*
|
||||
@@ -261,7 +257,7 @@ static void elsa_cs_config(dev_link_t *link)
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.Attributes = 0;
|
||||
i = first_tuple(handle, &tuple, &parse);
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
@@ -276,25 +272,25 @@ static void elsa_cs_config(dev_link_t *link)
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
i = first_tuple(handle, &tuple, &parse);
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
while (i == CS_SUCCESS) {
|
||||
if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
|
||||
printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
|
||||
link->conf.ConfigIndex = cf->index;
|
||||
link->io.BasePort1 = cf->io.win[0].base;
|
||||
i = pcmcia_request_io(link->handle, &link->io);
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
if (i == CS_SUCCESS) break;
|
||||
} else {
|
||||
printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n");
|
||||
link->conf.ConfigIndex = cf->index;
|
||||
for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
|
||||
link->io.BasePort1 = j;
|
||||
i = pcmcia_request_io(link->handle, &link->io);
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
if (i == CS_SUCCESS) break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i = next_tuple(handle, &tuple, &parse);
|
||||
i = next_tuple(link, &tuple, &parse);
|
||||
}
|
||||
|
||||
if (i != CS_SUCCESS) {
|
||||
@@ -302,14 +298,14 @@ static void elsa_cs_config(dev_link_t *link)
|
||||
goto cs_failed;
|
||||
}
|
||||
|
||||
i = pcmcia_request_irq(link->handle, &link->irq);
|
||||
i = pcmcia_request_irq(link, &link->irq);
|
||||
if (i != CS_SUCCESS) {
|
||||
link->irq.AssignedIRQ = 0;
|
||||
last_fn = RequestIRQ;
|
||||
goto cs_failed;
|
||||
}
|
||||
|
||||
i = pcmcia_request_configuration(link->handle, &link->conf);
|
||||
i = pcmcia_request_configuration(link, &link->conf);
|
||||
if (i != CS_SUCCESS) {
|
||||
last_fn = RequestConfiguration;
|
||||
goto cs_failed;
|
||||
@@ -352,7 +348,7 @@ static void elsa_cs_config(dev_link_t *link)
|
||||
|
||||
return;
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, i);
|
||||
cs_error(link, last_fn, i);
|
||||
elsa_cs_release(link);
|
||||
} /* elsa_cs_config */
|
||||
|
||||
@@ -364,7 +360,7 @@ cs_failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void elsa_cs_release(dev_link_t *link)
|
||||
static void elsa_cs_release(struct pcmcia_device *link)
|
||||
{
|
||||
local_info_t *local = link->priv;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
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;
|
||||
|
||||
dev->busy = 1;
|
||||
@@ -390,9 +385,8 @@ static int elsa_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
|
||||
dev->busy = 0;
|
||||
|
||||
@@ -95,8 +95,8 @@ module_param(protocol, int, 0);
|
||||
event handler.
|
||||
*/
|
||||
|
||||
static void sedlbauer_config(dev_link_t *link);
|
||||
static void sedlbauer_release(dev_link_t *link);
|
||||
static void sedlbauer_config(struct pcmcia_device *link);
|
||||
static void sedlbauer_release(struct pcmcia_device *link);
|
||||
|
||||
/*
|
||||
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);
|
||||
example, ethernet cards, modems). In other cases, there may be
|
||||
many actual or logical devices (SCSI adapters, memory cards with
|
||||
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,
|
||||
because they generally shouldn't be allocated dynamically.
|
||||
|
||||
@@ -148,11 +148,10 @@ 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;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
|
||||
DEBUG(0, "sedlbauer_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
@@ -161,7 +160,7 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
|
||||
local->p_dev = p_dev;
|
||||
local->p_dev = link;
|
||||
link->priv = local;
|
||||
|
||||
/* Interrupt setup */
|
||||
@@ -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);
|
||||
|
||||
if (link->state & DEV_CONFIG) {
|
||||
@@ -227,9 +224,8 @@ static void sedlbauer_detach(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 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;
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
@@ -251,16 +247,16 @@ static void sedlbauer_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];
|
||||
|
||||
/* Configure card */
|
||||
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,
|
||||
@@ -275,12 +271,12 @@ static void sedlbauer_config(dev_link_t *link)
|
||||
will only use the CIS to fill in implementation-defined details.
|
||||
*/
|
||||
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) {
|
||||
cistpl_cftable_entry_t dflt = { 0 };
|
||||
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
|
||||
if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
|
||||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
|
||||
if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
|
||||
pcmcia_parse_tuple(link, &tuple, &parse) != 0)
|
||||
goto next_entry;
|
||||
|
||||
if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
|
||||
@@ -334,13 +330,13 @@ static void sedlbauer_config(dev_link_t *link)
|
||||
link->io.NumPorts2 = io->win[1].len;
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
windows are needed, the info should go in the private data
|
||||
structure for this device.
|
||||
@@ -361,7 +357,7 @@ static void sedlbauer_config(dev_link_t *link)
|
||||
req.Size = 0x1000;
|
||||
*/
|
||||
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;
|
||||
map.Page = 0; map.CardOffset = mem->win[0].card_addr;
|
||||
if (pcmcia_map_mem_page(link->win, &map) != 0)
|
||||
@@ -371,7 +367,7 @@ static void sedlbauer_config(dev_link_t *link)
|
||||
break;
|
||||
|
||||
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)
|
||||
irq structure is initialized.
|
||||
*/
|
||||
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
|
||||
the I/O windows and the interrupt mapping, and putting the
|
||||
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
|
||||
@@ -433,7 +429,7 @@ static void sedlbauer_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
sedlbauer_release(link);
|
||||
|
||||
} /* sedlbauer_config */
|
||||
@@ -446,7 +442,7 @@ cs_failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void sedlbauer_release(dev_link_t *link)
|
||||
static void sedlbauer_release(struct pcmcia_device *link)
|
||||
{
|
||||
local_info_t *local = link->priv;
|
||||
DEBUG(0, "sedlbauer_release(0x%p)\n", link);
|
||||
@@ -458,12 +454,11 @@ static void sedlbauer_release(dev_link_t *link)
|
||||
}
|
||||
}
|
||||
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
} /* 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;
|
||||
|
||||
dev->stop = 1;
|
||||
@@ -471,9 +466,8 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
|
||||
dev->stop = 0;
|
||||
|
||||
@@ -75,8 +75,8 @@ module_param(protocol, int, 0);
|
||||
handler.
|
||||
*/
|
||||
|
||||
static void teles_cs_config(dev_link_t *link);
|
||||
static void teles_cs_release(dev_link_t *link);
|
||||
static void teles_cs_config(struct pcmcia_device *link);
|
||||
static void teles_cs_release(struct pcmcia_device *link);
|
||||
|
||||
/*
|
||||
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);
|
||||
/*
|
||||
A linked list of "instances" of the teles_cs device. Each actual
|
||||
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
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -102,7 +102,7 @@ static void teles_detach(struct pcmcia_device *p_dev);
|
||||
example, ethernet cards, modems). In other cases, there may be
|
||||
many actual or logical devices (SCSI adapters, memory cards with
|
||||
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,
|
||||
because they generally shouldn't be allocated dynamically.
|
||||
In this case, we also provide a flag to indicate if a device is
|
||||
@@ -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;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "teles_attach()\n");
|
||||
|
||||
@@ -143,7 +142,7 @@ static int teles_attach(struct pcmcia_device *p_dev)
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
|
||||
local->p_dev = p_dev;
|
||||
local->p_dev = link;
|
||||
link->priv = local;
|
||||
|
||||
/* Interrupt setup */
|
||||
@@ -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;
|
||||
|
||||
DEBUG(0, "teles_detach(0x%p)\n", link);
|
||||
@@ -203,7 +201,7 @@ static void teles_detach(struct pcmcia_device *p_dev)
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_tuple_data(handle, tuple);
|
||||
@@ -211,7 +209,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_first_tuple(handle, tuple);
|
||||
@@ -219,7 +217,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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)
|
||||
{
|
||||
int i = pcmcia_get_next_tuple(handle, tuple);
|
||||
@@ -227,9 +225,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple,
|
||||
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;
|
||||
cisparse_t parse;
|
||||
local_info_t *dev;
|
||||
@@ -239,7 +236,6 @@ static void teles_cs_config(dev_link_t *link)
|
||||
IsdnCard_t icard;
|
||||
|
||||
DEBUG(0, "teles_config(0x%p)\n", link);
|
||||
handle = link->handle;
|
||||
dev = link->priv;
|
||||
|
||||
/*
|
||||
@@ -251,7 +247,7 @@ static void teles_cs_config(dev_link_t *link)
|
||||
tuple.TupleDataMax = 255;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.Attributes = 0;
|
||||
i = first_tuple(handle, &tuple, &parse);
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
if (i != CS_SUCCESS) {
|
||||
last_fn = ParseTuple;
|
||||
goto cs_failed;
|
||||
@@ -266,25 +262,25 @@ static void teles_cs_config(dev_link_t *link)
|
||||
tuple.TupleOffset = 0; tuple.TupleDataMax = 255;
|
||||
tuple.Attributes = 0;
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
i = first_tuple(handle, &tuple, &parse);
|
||||
i = first_tuple(link, &tuple, &parse);
|
||||
while (i == CS_SUCCESS) {
|
||||
if ( (cf->io.nwin > 0) && cf->io.win[0].base) {
|
||||
printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
|
||||
link->conf.ConfigIndex = cf->index;
|
||||
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;
|
||||
} else {
|
||||
printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
|
||||
link->conf.ConfigIndex = cf->index;
|
||||
for (i = 0, j = 0x2f0; j > 0x100; j -= 0x10) {
|
||||
link->io.BasePort1 = j;
|
||||
i = pcmcia_request_io(link->handle, &link->io);
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
if (i == CS_SUCCESS) break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i = next_tuple(handle, &tuple, &parse);
|
||||
i = next_tuple(link, &tuple, &parse);
|
||||
}
|
||||
|
||||
if (i != CS_SUCCESS) {
|
||||
@@ -292,14 +288,14 @@ static void teles_cs_config(dev_link_t *link)
|
||||
goto cs_failed;
|
||||
}
|
||||
|
||||
i = pcmcia_request_irq(link->handle, &link->irq);
|
||||
i = pcmcia_request_irq(link, &link->irq);
|
||||
if (i != CS_SUCCESS) {
|
||||
link->irq.AssignedIRQ = 0;
|
||||
last_fn = RequestIRQ;
|
||||
goto cs_failed;
|
||||
}
|
||||
|
||||
i = pcmcia_request_configuration(link->handle, &link->conf);
|
||||
i = pcmcia_request_configuration(link, &link->conf);
|
||||
if (i != CS_SUCCESS) {
|
||||
last_fn = RequestConfiguration;
|
||||
goto cs_failed;
|
||||
@@ -342,7 +338,7 @@ static void teles_cs_config(dev_link_t *link)
|
||||
|
||||
return;
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, i);
|
||||
cs_error(link, last_fn, i);
|
||||
teles_cs_release(link);
|
||||
} /* teles_cs_config */
|
||||
|
||||
@@ -354,7 +350,7 @@ cs_failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void teles_cs_release(dev_link_t *link)
|
||||
static void teles_cs_release(struct pcmcia_device *link)
|
||||
{
|
||||
local_info_t *local = link->priv;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
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;
|
||||
|
||||
dev->busy = 1;
|
||||
@@ -380,9 +375,8 @@ static int teles_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
|
||||
dev->busy = 0;
|
||||
|
||||
@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
|
||||
dev->offset, mrq.CardOffset);
|
||||
mrq.Page = 0;
|
||||
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;
|
||||
}
|
||||
dev->offset = mrq.CardOffset;
|
||||
@@ -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)
|
||||
{
|
||||
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;
|
||||
int ret;
|
||||
|
||||
@@ -328,9 +328,9 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
|
||||
mod.Vpp1 = mod.Vpp2 = on ? dev->vpp : 0;
|
||||
|
||||
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) {
|
||||
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)
|
||||
* 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;
|
||||
|
||||
@@ -353,11 +353,11 @@ static void pcmciamtd_release(dev_link_t *link)
|
||||
}
|
||||
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;
|
||||
tuple_t tuple;
|
||||
@@ -370,16 +370,16 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.DesiredTuple = RETURN_FIRST_TUPLE;
|
||||
|
||||
rc = pcmcia_get_first_tuple(link->handle, &tuple);
|
||||
rc = pcmcia_get_first_tuple(link, &tuple);
|
||||
while(rc == CS_SUCCESS) {
|
||||
rc = pcmcia_get_tuple_data(link->handle, &tuple);
|
||||
rc = pcmcia_get_tuple_data(link, &tuple);
|
||||
if(rc != CS_SUCCESS) {
|
||||
cs_error(link->handle, GetTupleData, rc);
|
||||
cs_error(link, GetTupleData, rc);
|
||||
break;
|
||||
}
|
||||
rc = pcmcia_parse_tuple(link->handle, &tuple, &parse);
|
||||
rc = pcmcia_parse_tuple(link, &tuple, &parse);
|
||||
if(rc != CS_SUCCESS) {
|
||||
cs_error(link->handle, ParseTuple, rc);
|
||||
cs_error(link, ParseTuple, rc);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
rc = pcmcia_get_next_tuple(link->handle, &tuple);
|
||||
rc = pcmcia_get_next_tuple(link, &tuple);
|
||||
}
|
||||
if(!dev->pcmcia_map.size)
|
||||
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_
|
||||
#define CS_CHECK(fn, ret) \
|
||||
do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
|
||||
|
||||
static void pcmciamtd_config(dev_link_t *link)
|
||||
static void pcmciamtd_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct pcmciamtd_dev *dev = link->priv;
|
||||
struct mtd_info *mtd = NULL;
|
||||
@@ -507,9 +507,9 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
link->state |= DEV_CONFIG;
|
||||
|
||||
DEBUG(2, "Validating CIS");
|
||||
ret = pcmcia_validate_cis(link->handle, &cisinfo);
|
||||
ret = pcmcia_validate_cis(link, &cisinfo);
|
||||
if(ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, GetTupleData, ret);
|
||||
cs_error(link, GetTupleData, ret);
|
||||
} else {
|
||||
DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains);
|
||||
}
|
||||
@@ -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.Base = 0;
|
||||
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;
|
||||
dev->win_size = 0;
|
||||
|
||||
@@ -545,7 +545,7 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
int ret;
|
||||
DEBUG(2, "requesting window with size = %dKiB memspeed = %d",
|
||||
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);
|
||||
if(ret) {
|
||||
req.Size >>= 1;
|
||||
@@ -566,7 +566,7 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
|
||||
|
||||
/* 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",
|
||||
status.CardState, (unsigned long)link->win);
|
||||
dev->win_base = ioremap(req.Base, req.Size);
|
||||
@@ -583,7 +583,7 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
dev->pcmcia_map.map_priv_2 = (unsigned long)link->win;
|
||||
|
||||
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);
|
||||
dev->vpp = (vpp) ? vpp : t.Vpp1;
|
||||
link->conf.Attributes = 0;
|
||||
@@ -602,9 +602,9 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
link->conf.ConfigIndex = 0;
|
||||
link->conf.Present = t.Present;
|
||||
DEBUG(2, "Setting Configuration");
|
||||
ret = pcmcia_request_configuration(link->handle, &link->conf);
|
||||
ret = pcmcia_request_configuration(link, &link->conf);
|
||||
if(ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RequestConfiguration, ret);
|
||||
cs_error(link, RequestConfiguration, ret);
|
||||
}
|
||||
|
||||
if(mem_type == 1) {
|
||||
@@ -677,7 +677,7 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
err("CS Error, exiting");
|
||||
pcmciamtd_release(link);
|
||||
return;
|
||||
@@ -709,10 +709,8 @@ static int pcmciamtd_resume(struct pcmcia_device *dev)
|
||||
* 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);
|
||||
|
||||
if(link->state & DEV_CONFIG) {
|
||||
@@ -732,10 +730,9 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev)
|
||||
* with Card Services.
|
||||
*/
|
||||
|
||||
static int pcmciamtd_attach(struct pcmcia_device *p_dev)
|
||||
static int pcmciamtd_attach(struct pcmcia_device *link)
|
||||
{
|
||||
struct pcmciamtd_dev *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
/* Create new memory card device */
|
||||
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
|
||||
@@ -743,7 +740,7 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev)
|
||||
DEBUG(1, "dev=0x%p", dev);
|
||||
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
dev->p_dev = p_dev;
|
||||
dev->p_dev = link;
|
||||
link->priv = dev;
|
||||
|
||||
link->conf.Attributes = 0;
|
||||
|
||||
@@ -225,8 +225,8 @@ static char mii_preamble_required = 0;
|
||||
|
||||
/* Index of functions. */
|
||||
|
||||
static void tc574_config(dev_link_t *link);
|
||||
static void tc574_release(dev_link_t *link);
|
||||
static void tc574_config(struct pcmcia_device *link);
|
||||
static void tc574_release(struct pcmcia_device *link);
|
||||
|
||||
static void mdio_sync(kio_addr_t ioaddr, int bits);
|
||||
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);
|
||||
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 net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "3c574_attach()\n");
|
||||
|
||||
@@ -270,7 +269,7 @@ static int tc574_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link->priv = dev;
|
||||
lp->p_dev = p_dev;
|
||||
lp->p_dev = link;
|
||||
|
||||
spin_lock_init(&lp->window_lock);
|
||||
link->io.NumPorts1 = 32;
|
||||
@@ -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;
|
||||
|
||||
DEBUG(0, "3c574_detach(0x%p)\n", link);
|
||||
@@ -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 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 el3_private *lp = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
@@ -359,12 +356,12 @@ static void tc574_config(dev_link_t *link)
|
||||
|
||||
tuple.Attributes = 0;
|
||||
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.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
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));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
@@ -374,15 +371,15 @@ static void tc574_config(dev_link_t *link)
|
||||
link->io.IOAddrLines = 16;
|
||||
for (i = j = 0; j < 0x400; j += 0x20) {
|
||||
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) {
|
||||
cs_error(link->handle, RequestIO, i);
|
||||
cs_error(link, RequestIO, i);
|
||||
goto failed;
|
||||
}
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
|
||||
dev->irq = link->irq.AssignedIRQ;
|
||||
dev->base_addr = link->io.BasePort1;
|
||||
@@ -393,8 +390,8 @@ static void tc574_config(dev_link_t *link)
|
||||
the hardware address. The future products may include a modem chip
|
||||
and put the address in the CIS. */
|
||||
tuple.DesiredTuple = 0x88;
|
||||
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) {
|
||||
pcmcia_get_tuple_data(handle, &tuple);
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
|
||||
pcmcia_get_tuple_data(link, &tuple);
|
||||
for (i = 0; i < 3; i++)
|
||||
phys_addr[i] = htons(buf[i]);
|
||||
} else {
|
||||
@@ -408,9 +405,9 @@ static void tc574_config(dev_link_t *link)
|
||||
}
|
||||
}
|
||||
tuple.DesiredTuple = CISTPL_VERS_1;
|
||||
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS &&
|
||||
pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS &&
|
||||
pcmcia_parse_tuple(handle, &tuple, &parse) == CS_SUCCESS) {
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS &&
|
||||
pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS &&
|
||||
pcmcia_parse_tuple(link, &tuple, &parse) == CS_SUCCESS) {
|
||||
cardname = parse.version_1.str + parse.version_1.ofs[1];
|
||||
} else
|
||||
cardname = "3Com 3c574";
|
||||
@@ -471,7 +468,7 @@ static void tc574_config(dev_link_t *link)
|
||||
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
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) {
|
||||
printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
|
||||
@@ -492,7 +489,7 @@ static void tc574_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
tc574_release(link);
|
||||
return;
|
||||
@@ -505,14 +502,13 @@ failed:
|
||||
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;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open))
|
||||
@@ -521,9 +517,8 @@ static int tc574_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open)) {
|
||||
@@ -739,7 +734,7 @@ static void tc574_reset(struct net_device *dev)
|
||||
static int el3_open(struct net_device *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))
|
||||
return -ENODEV;
|
||||
@@ -1185,7 +1180,7 @@ static int el3_close(struct net_device *dev)
|
||||
{
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
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);
|
||||
|
||||
|
||||
@@ -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_release(dev_link_t *link);
|
||||
static void tc589_config(struct pcmcia_device *link);
|
||||
static void tc589_release(struct pcmcia_device *link);
|
||||
|
||||
static u16 read_eeprom(kio_addr_t ioaddr, int index);
|
||||
static void tc589_reset(struct net_device *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 net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "3c589_attach()\n");
|
||||
|
||||
@@ -184,7 +183,7 @@ static int tc589_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link->priv = dev;
|
||||
lp->p_dev = p_dev;
|
||||
lp->p_dev = link;
|
||||
|
||||
spin_lock_init(&lp->lock);
|
||||
link->io.NumPorts1 = 16;
|
||||
@@ -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;
|
||||
|
||||
DEBUG(0, "3c589_detach(0x%p)\n", link);
|
||||
@@ -254,9 +252,8 @@ static void tc589_detach(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 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 el3_private *lp = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
@@ -271,20 +268,20 @@ static void tc589_config(dev_link_t *link)
|
||||
phys_addr = (u16 *)dev->dev_addr;
|
||||
tuple.Attributes = 0;
|
||||
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.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 0;
|
||||
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));
|
||||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Is this a 3c562? */
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
tuple.Attributes = TUPLE_RETURN_COMMON;
|
||||
if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) &&
|
||||
(pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS)) {
|
||||
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) &&
|
||||
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS)) {
|
||||
if (le16_to_cpu(buf[0]) != MANFID_3COM)
|
||||
printk(KERN_INFO "3c589_cs: hmmm, is this really a "
|
||||
"3Com card??\n");
|
||||
@@ -299,15 +296,15 @@ static void tc589_config(dev_link_t *link)
|
||||
for (i = j = 0; j < 0x400; j += 0x10) {
|
||||
if (multi && (j & 0x80)) continue;
|
||||
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) {
|
||||
cs_error(link->handle, RequestIO, i);
|
||||
cs_error(link, RequestIO, i);
|
||||
goto failed;
|
||||
}
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
|
||||
dev->irq = link->irq.AssignedIRQ;
|
||||
dev->base_addr = link->io.BasePort1;
|
||||
@@ -317,8 +314,8 @@ static void tc589_config(dev_link_t *link)
|
||||
/* The 3c589 has an extra EEPROM for configuration info, including
|
||||
the hardware address. The 3c562 puts the address in the CIS. */
|
||||
tuple.DesiredTuple = 0x88;
|
||||
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) {
|
||||
pcmcia_get_tuple_data(handle, &tuple);
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
|
||||
pcmcia_get_tuple_data(link, &tuple);
|
||||
for (i = 0; i < 3; i++)
|
||||
phys_addr[i] = htons(buf[i]);
|
||||
} else {
|
||||
@@ -344,7 +341,7 @@ static void tc589_config(dev_link_t *link)
|
||||
|
||||
link->dev_node = &lp->node;
|
||||
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) {
|
||||
printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
|
||||
@@ -365,7 +362,7 @@ static void tc589_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
tc589_release(link);
|
||||
return;
|
||||
@@ -380,14 +377,13 @@ failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
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;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open))
|
||||
@@ -396,9 +392,8 @@ static int tc589_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open)) {
|
||||
@@ -569,7 +564,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
|
||||
static int el3_open(struct net_device *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))
|
||||
return -ENODEV;
|
||||
@@ -830,7 +825,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
struct pcmcia_device *link = lp->p_dev;
|
||||
|
||||
if (DEV_OK(link)) {
|
||||
spin_lock_irqsave(&lp->lock, flags);
|
||||
@@ -932,7 +927,7 @@ static int el3_rx(struct net_device *dev)
|
||||
static void set_multicast_list(struct net_device *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;
|
||||
u16 opts = SetRxFilter | RxStation | RxBroadcast;
|
||||
|
||||
@@ -947,7 +942,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
static int el3_close(struct net_device *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;
|
||||
|
||||
DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
|
||||
|
||||
@@ -86,8 +86,8 @@ static char *version =
|
||||
|
||||
/*====================================================================*/
|
||||
|
||||
static void axnet_config(dev_link_t *link);
|
||||
static void axnet_release(dev_link_t *link);
|
||||
static void axnet_config(struct pcmcia_device *link);
|
||||
static void axnet_release(struct pcmcia_device *link);
|
||||
static int axnet_open(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);
|
||||
@@ -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;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "axnet_attach()\n");
|
||||
|
||||
@@ -157,7 +156,7 @@ static int axnet_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
info = PRIV(dev);
|
||||
info->p_dev = p_dev;
|
||||
info->p_dev = link;
|
||||
link->priv = dev;
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
@@ -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;
|
||||
|
||||
DEBUG(0, "axnet_detach(0x%p)\n", link);
|
||||
@@ -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;
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
@@ -260,7 +258,7 @@ static int get_prom(dev_link_t *link)
|
||||
#define CS_CHECK(fn, ret) \
|
||||
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;
|
||||
if (link->io.NumPorts1 == 32) {
|
||||
@@ -281,18 +279,17 @@ static int try_io_port(dev_link_t *link)
|
||||
for (j = 0; j < 0x400; j += 0x20) {
|
||||
link->io.BasePort1 = j ^ 0x300;
|
||||
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;
|
||||
}
|
||||
return ret;
|
||||
} 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;
|
||||
axnet_dev_t *info = PRIV(dev);
|
||||
tuple_t tuple;
|
||||
@@ -307,9 +304,9 @@ static void axnet_config(dev_link_t *link)
|
||||
tuple.TupleDataMax = sizeof(buf);
|
||||
tuple.TupleOffset = 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, &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;
|
||||
/* don't trust the CIS on this; Linksys got it wrong */
|
||||
link->conf.Present = 0x63;
|
||||
@@ -319,13 +316,13 @@ static void axnet_config(dev_link_t *link)
|
||||
|
||||
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 (last_ret == CS_SUCCESS) {
|
||||
cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
|
||||
cistpl_io_t *io = &(parse.cftable_entry.io);
|
||||
|
||||
if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
|
||||
pcmcia_parse_tuple(handle, &tuple, &parse) != 0 ||
|
||||
if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
|
||||
pcmcia_parse_tuple(link, &tuple, &parse) != 0 ||
|
||||
cfg->index == 0 || cfg->io.nwin == 0)
|
||||
goto next_entry;
|
||||
|
||||
@@ -347,21 +344,21 @@ static void axnet_config(dev_link_t *link)
|
||||
if (last_ret == CS_SUCCESS) break;
|
||||
}
|
||||
next_entry:
|
||||
last_ret = pcmcia_get_next_tuple(handle, &tuple);
|
||||
last_ret = pcmcia_get_next_tuple(link, &tuple);
|
||||
}
|
||||
if (last_ret != CS_SUCCESS) {
|
||||
cs_error(handle, RequestIO, last_ret);
|
||||
cs_error(link, RequestIO, last_ret);
|
||||
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) {
|
||||
link->conf.Attributes |= CONF_ENABLE_SPKR;
|
||||
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->base_addr = link->io.BasePort1;
|
||||
|
||||
@@ -398,7 +395,7 @@ static void axnet_config(dev_link_t *link)
|
||||
Bit 2 of CCSR is active low. */
|
||||
if (i == 32) {
|
||||
conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 };
|
||||
pcmcia_access_configuration_register(link->handle, ®);
|
||||
pcmcia_access_configuration_register(link, ®);
|
||||
for (i = 0; i < 32; i++) {
|
||||
j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
|
||||
if ((j != 0) && (j != 0xffff)) break;
|
||||
@@ -408,7 +405,7 @@ static void axnet_config(dev_link_t *link)
|
||||
info->phy_id = (i < 32) ? i : -1;
|
||||
link->dev_node = &info->node;
|
||||
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) {
|
||||
printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
|
||||
@@ -431,7 +428,7 @@ static void axnet_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
axnet_release(link);
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
@@ -446,14 +443,13 @@ failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
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;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open))
|
||||
@@ -462,9 +458,8 @@ static int axnet_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
|
||||
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)
|
||||
static int axnet_open(struct net_device *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);
|
||||
|
||||
@@ -566,7 +561,7 @@ static int axnet_open(struct net_device *dev)
|
||||
static int axnet_close(struct net_device *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);
|
||||
|
||||
|
||||
@@ -118,8 +118,8 @@ MODULE_LICENSE("GPL");
|
||||
|
||||
/*====================================================================*/
|
||||
|
||||
static void com20020_config(dev_link_t *link);
|
||||
static void com20020_release(dev_link_t *link);
|
||||
static void com20020_config(struct pcmcia_device *link);
|
||||
static void com20020_release(struct pcmcia_device *link);
|
||||
|
||||
static void com20020_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
@@ -198,9 +198,8 @@ fail_alloc_info:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
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 net_device *dev = info->dev;
|
||||
|
||||
@@ -251,10 +250,9 @@ static void com20020_detach(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 com20020_config(dev_link_t *link)
|
||||
static void com20020_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct arcnet_local *lp;
|
||||
client_handle_t handle;
|
||||
tuple_t tuple;
|
||||
cisparse_t parse;
|
||||
com20020_dev_t *info;
|
||||
@@ -263,7 +261,6 @@ static void com20020_config(dev_link_t *link)
|
||||
u_char buf[64];
|
||||
int ioaddr;
|
||||
|
||||
handle = link->handle;
|
||||
info = link->priv;
|
||||
dev = info->dev;
|
||||
|
||||
@@ -276,9 +273,9 @@ static void com20020_config(dev_link_t *link)
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 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, &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;
|
||||
|
||||
/* Configure card */
|
||||
@@ -291,13 +288,13 @@ static void com20020_config(dev_link_t *link)
|
||||
for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10)
|
||||
{
|
||||
link->io.BasePort1 = ioaddr;
|
||||
i = pcmcia_request_io(link->handle, &link->io);
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
if (i == CS_SUCCESS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
i = pcmcia_request_io(link->handle, &link->io);
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
|
||||
if (i != CS_SUCCESS)
|
||||
{
|
||||
@@ -311,7 +308,7 @@ static void com20020_config(dev_link_t *link)
|
||||
DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n",
|
||||
link->irq.AssignedIRQ,
|
||||
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)
|
||||
{
|
||||
DEBUG(1,"arcnet: requestIRQ failed totally!\n");
|
||||
@@ -320,7 +317,7 @@ static void com20020_config(dev_link_t *link)
|
||||
|
||||
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))
|
||||
{
|
||||
@@ -334,7 +331,7 @@ static void com20020_config(dev_link_t *link)
|
||||
|
||||
link->dev_node = &info->node;
|
||||
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 */
|
||||
|
||||
@@ -351,7 +348,7 @@ static void com20020_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
DEBUG(1,"com20020_config failed...\n");
|
||||
com20020_release(link);
|
||||
@@ -365,15 +362,14 @@ failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void com20020_release(dev_link_t *link)
|
||||
static void com20020_release(struct pcmcia_device *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;
|
||||
struct net_device *dev = info->dev;
|
||||
|
||||
@@ -383,9 +379,8 @@ static int com20020_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
struct net_device *dev = info->dev;
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ static char *version = DRV_NAME ".c " DRV_VERSION " 2002/03/23";
|
||||
/*
|
||||
PCMCIA event handlers
|
||||
*/
|
||||
static void fmvj18x_config(dev_link_t *link);
|
||||
static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id);
|
||||
static int fmvj18x_setup_mfc(dev_link_t *link);
|
||||
static void fmvj18x_release(dev_link_t *link);
|
||||
static void fmvj18x_config(struct pcmcia_device *link);
|
||||
static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id);
|
||||
static int fmvj18x_setup_mfc(struct pcmcia_device *link);
|
||||
static void fmvj18x_release(struct pcmcia_device *link);
|
||||
static void fmvj18x_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
@@ -228,11 +228,10 @@ typedef struct local_info_t {
|
||||
#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
|
||||
#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
|
||||
|
||||
static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
static int fmvj18x_attach(struct pcmcia_device *link)
|
||||
{
|
||||
local_info_t *lp;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "fmvj18x_attach()\n");
|
||||
|
||||
@@ -242,7 +241,7 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link->priv = dev;
|
||||
lp->p_dev = p_dev;
|
||||
lp->p_dev = link;
|
||||
|
||||
/* The io structure describes IO port mapping */
|
||||
link->io.NumPorts1 = 32;
|
||||
@@ -281,9 +280,8 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
|
||||
/*====================================================================*/
|
||||
|
||||
static void fmvj18x_detach(struct pcmcia_device *p_dev)
|
||||
static void fmvj18x_detach(struct pcmcia_device *link)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
struct net_device *dev = link->priv;
|
||||
|
||||
DEBUG(0, "fmvj18x_detach(0x%p)\n", link);
|
||||
@@ -302,7 +300,7 @@ static void fmvj18x_detach(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 int mfc_try_io_port(dev_link_t *link)
|
||||
static int mfc_try_io_port(struct pcmcia_device *link)
|
||||
{
|
||||
int i, ret;
|
||||
static const kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
|
||||
@@ -314,13 +312,13 @@ static int mfc_try_io_port(dev_link_t *link)
|
||||
link->io.NumPorts2 = 0;
|
||||
printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n");
|
||||
}
|
||||
ret = pcmcia_request_io(link->handle, &link->io);
|
||||
ret = pcmcia_request_io(link, &link->io);
|
||||
if (ret == CS_SUCCESS) return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ungermann_try_io_port(dev_link_t *link)
|
||||
static int ungermann_try_io_port(struct pcmcia_device *link)
|
||||
{
|
||||
int ret;
|
||||
kio_addr_t ioaddr;
|
||||
@@ -330,7 +328,7 @@ static int ungermann_try_io_port(dev_link_t *link)
|
||||
*/
|
||||
for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) {
|
||||
link->io.BasePort1 = ioaddr;
|
||||
ret = pcmcia_request_io(link->handle, &link->io);
|
||||
ret = pcmcia_request_io(link, &link->io);
|
||||
if (ret == CS_SUCCESS) {
|
||||
/* calculate ConfigIndex value */
|
||||
link->conf.ConfigIndex =
|
||||
@@ -341,9 +339,8 @@ static int ungermann_try_io_port(dev_link_t *link)
|
||||
return ret; /* RequestIO failed */
|
||||
}
|
||||
|
||||
static void fmvj18x_config(dev_link_t *link)
|
||||
static void fmvj18x_config(struct pcmcia_device *link)
|
||||
{
|
||||
client_handle_t handle = link->handle;
|
||||
struct net_device *dev = link->priv;
|
||||
local_info_t *lp = netdev_priv(dev);
|
||||
tuple_t tuple;
|
||||
@@ -362,12 +359,12 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
registers.
|
||||
*/
|
||||
tuple.DesiredTuple = CISTPL_CONFIG;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleData = (u_char *)buf;
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 0;
|
||||
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));
|
||||
|
||||
/* Configure card */
|
||||
link->state |= DEV_CONFIG;
|
||||
@@ -377,16 +374,16 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
|
||||
tuple.DesiredTuple = CISTPL_FUNCE;
|
||||
tuple.TupleOffset = 0;
|
||||
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) {
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
|
||||
/* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */
|
||||
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
|
||||
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.ConfigIndex = parse.cftable_entry.index;
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
else
|
||||
buf[0] = 0xffff;
|
||||
switch (le16_to_cpu(buf[0])) {
|
||||
@@ -420,8 +417,8 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
} else {
|
||||
/* old type card */
|
||||
tuple.DesiredTuple = CISTPL_MANFID;
|
||||
if (pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
|
||||
if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS)
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
else
|
||||
buf[0] = 0xffff;
|
||||
switch (le16_to_cpu(buf[0])) {
|
||||
@@ -452,10 +449,10 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
ret = ungermann_try_io_port(link);
|
||||
if (ret != CS_SUCCESS) goto cs_failed;
|
||||
} else {
|
||||
CS_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io));
|
||||
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
|
||||
}
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
dev->irq = link->irq.AssignedIRQ;
|
||||
dev->base_addr = link->io.BasePort1;
|
||||
|
||||
@@ -484,17 +481,17 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
case CONTEC:
|
||||
tuple.DesiredTuple = CISTPL_FUNCE;
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
|
||||
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
|
||||
tuple.TupleOffset = 0;
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
if (cardtype == MBH10304) {
|
||||
/* MBH10304's CIS_FUNCE is corrupted */
|
||||
node_id = &(tuple.TupleData[5]);
|
||||
card_name = "FMV-J182";
|
||||
} else {
|
||||
while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) {
|
||||
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
|
||||
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
|
||||
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
|
||||
}
|
||||
node_id = &(tuple.TupleData[2]);
|
||||
if( cardtype == TDK ) {
|
||||
@@ -538,7 +535,7 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
lp->cardtype = cardtype;
|
||||
link->dev_node = &lp->node;
|
||||
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) {
|
||||
printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n");
|
||||
@@ -559,7 +556,7 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
|
||||
cs_failed:
|
||||
/* All Card Services errors end up here */
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
fmvj18x_release(link);
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
@@ -567,7 +564,7 @@ failed:
|
||||
} /* fmvj18x_config */
|
||||
/*====================================================================*/
|
||||
|
||||
static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
|
||||
static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
|
||||
{
|
||||
win_req_t req;
|
||||
memreq_t mem;
|
||||
@@ -578,9 +575,9 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
|
||||
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
|
||||
req.Base = 0; req.Size = 0;
|
||||
req.AccessSpeed = 0;
|
||||
i = pcmcia_request_window(&link->handle, &req, &link->win);
|
||||
i = pcmcia_request_window(&link, &req, &link->win);
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link->handle, RequestWindow, i);
|
||||
cs_error(link, RequestWindow, i);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -614,13 +611,13 @@ static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id)
|
||||
iounmap(base);
|
||||
j = pcmcia_release_window(link->win);
|
||||
if (j != CS_SUCCESS)
|
||||
cs_error(link->handle, ReleaseWindow, j);
|
||||
cs_error(link, ReleaseWindow, j);
|
||||
return (i != 0x200) ? 0 : -1;
|
||||
|
||||
} /* fmvj18x_get_hwinfo */
|
||||
/*====================================================================*/
|
||||
|
||||
static int fmvj18x_setup_mfc(dev_link_t *link)
|
||||
static int fmvj18x_setup_mfc(struct pcmcia_device *link)
|
||||
{
|
||||
win_req_t req;
|
||||
memreq_t mem;
|
||||
@@ -633,9 +630,9 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
|
||||
req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
|
||||
req.Base = 0; req.Size = 0;
|
||||
req.AccessSpeed = 0;
|
||||
i = pcmcia_request_window(&link->handle, &req, &link->win);
|
||||
i = pcmcia_request_window(&link, &req, &link->win);
|
||||
if (i != CS_SUCCESS) {
|
||||
cs_error(link->handle, RequestWindow, i);
|
||||
cs_error(link, RequestWindow, i);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -657,21 +654,20 @@ static int fmvj18x_setup_mfc(dev_link_t *link)
|
||||
iounmap(base);
|
||||
j = pcmcia_release_window(link->win);
|
||||
if (j != CS_SUCCESS)
|
||||
cs_error(link->handle, ReleaseWindow, j);
|
||||
cs_error(link, ReleaseWindow, j);
|
||||
return 0;
|
||||
|
||||
}
|
||||
/*====================================================================*/
|
||||
|
||||
static void fmvj18x_release(dev_link_t *link)
|
||||
static void fmvj18x_release(struct pcmcia_device *link)
|
||||
{
|
||||
DEBUG(0, "fmvj18x_release(0x%p)\n", link);
|
||||
pcmcia_disable_device(link->handle);
|
||||
pcmcia_disable_device(link);
|
||||
}
|
||||
|
||||
static int fmvj18x_suspend(struct pcmcia_device *p_dev)
|
||||
static int fmvj18x_suspend(struct pcmcia_device *link)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
struct net_device *dev = link->priv;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open))
|
||||
@@ -680,9 +676,8 @@ static int fmvj18x_suspend(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fmvj18x_resume(struct pcmcia_device *p_dev)
|
||||
static int fmvj18x_resume(struct pcmcia_device *link)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
struct net_device *dev = link->priv;
|
||||
|
||||
if ((link->state & DEV_CONFIG) && (link->open)) {
|
||||
@@ -1122,7 +1117,7 @@ static int fjn_config(struct net_device *dev, struct ifmap *map){
|
||||
static int fjn_open(struct net_device *dev)
|
||||
{
|
||||
struct local_info_t *lp = netdev_priv(dev);
|
||||
dev_link_t *link = lp->p_dev;
|
||||
struct pcmcia_device *link = lp->p_dev;
|
||||
|
||||
DEBUG(4, "fjn_open('%s').\n", dev->name);
|
||||
|
||||
@@ -1147,7 +1142,7 @@ static int fjn_open(struct net_device *dev)
|
||||
static int fjn_close(struct net_device *dev)
|
||||
{
|
||||
struct local_info_t *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;
|
||||
|
||||
DEBUG(4, "fjn_close('%s').\n", dev->name);
|
||||
|
||||
@@ -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_release(dev_link_t *link);
|
||||
static void ibmtr_release(struct pcmcia_device *link);
|
||||
static void ibmtr_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*====================================================================*/
|
||||
@@ -138,12 +138,11 @@ 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;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
|
||||
DEBUG(0, "ibmtr_attach()\n");
|
||||
|
||||
/* Create new token-ring device */
|
||||
@@ -156,7 +155,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
info->p_dev = p_dev;
|
||||
info->p_dev = link;
|
||||
link->priv = info;
|
||||
info->ti = netdev_priv(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 net_device *dev = info->dev;
|
||||
|
||||
@@ -222,9 +220,8 @@ static void ibmtr_detach(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 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;
|
||||
struct net_device *dev = info->dev;
|
||||
struct tok_info *ti = netdev_priv(dev);
|
||||
@@ -242,9 +239,9 @@ static void ibmtr_config(dev_link_t *link)
|
||||
tuple.TupleDataMax = 64;
|
||||
tuple.TupleOffset = 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, &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;
|
||||
|
||||
/* Configure card */
|
||||
@@ -256,15 +253,15 @@ static void ibmtr_config(dev_link_t *link)
|
||||
|
||||
/* Try PRIMARY card at 0xA20-0xA23 */
|
||||
link->io.BasePort1 = 0xA20;
|
||||
i = pcmcia_request_io(link->handle, &link->io);
|
||||
i = pcmcia_request_io(link, &link->io);
|
||||
if (i != CS_SUCCESS) {
|
||||
/* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
|
||||
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;
|
||||
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
|
||||
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
|
||||
dev->irq = link->irq.AssignedIRQ;
|
||||
ti->irq = link->irq.AssignedIRQ;
|
||||
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)
|
||||
req.Base = 0;
|
||||
req.Size = 0x2000;
|
||||
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.Page = 0;
|
||||
@@ -288,7 +285,7 @@ static void ibmtr_config(dev_link_t *link)
|
||||
req.Base = 0;
|
||||
req.Size = sramsize * 1024;
|
||||
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.Page = 0;
|
||||
@@ -298,7 +295,7 @@ static void ibmtr_config(dev_link_t *link)
|
||||
ti->sram_virt = ioremap(req.Base, req.Size);
|
||||
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
|
||||
turn on the card. Check the "Local Area Network Credit Card
|
||||
@@ -307,7 +304,7 @@ static void ibmtr_config(dev_link_t *link)
|
||||
|
||||
link->dev_node = &info->node;
|
||||
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);
|
||||
if (i != 0) {
|
||||
@@ -329,7 +326,7 @@ static void ibmtr_config(dev_link_t *link)
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link->handle, last_fn, last_ret);
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
ibmtr_release(link);
|
||||
} /* ibmtr_config */
|
||||
@@ -342,7 +339,7 @@ failed:
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static void ibmtr_release(dev_link_t *link)
|
||||
static void ibmtr_release(struct pcmcia_device *link)
|
||||
{
|
||||
ibmtr_dev_t *info = link->priv;
|
||||
struct net_device *dev = info->dev;
|
||||
@@ -354,12 +351,11 @@ static void ibmtr_release(dev_link_t *link)
|
||||
iounmap(ti->mmio);
|
||||
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;
|
||||
struct net_device *dev = info->dev;
|
||||
|
||||
@@ -369,9 +365,8 @@ static int ibmtr_suspend(struct pcmcia_device *p_dev)
|
||||
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;
|
||||
struct net_device *dev = info->dev;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user