Commit 0eb4a605 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] 07-read_tuple.diff

Rename the "internal" read_tuple to pccard_read_tuple, and
update it to better calling conventions.
parent ed5dce04
......@@ -83,16 +83,16 @@ static void setup_regions(client_handle_t handle, int attr,
handle, attr, list);
code = (attr) ? CISTPL_DEVICE_A : CISTPL_DEVICE;
if (read_tuple(handle, code, &device) != CS_SUCCESS)
if (pccard_read_tuple(handle->Socket, handle->Function, code, &device) != CS_SUCCESS)
return;
code = (attr) ? CISTPL_JEDEC_A : CISTPL_JEDEC_C;
has_jedec = (read_tuple(handle, code, &jedec) == CS_SUCCESS);
has_jedec = (pccard_read_tuple(handle->Socket, handle->Function, code, &jedec) == CS_SUCCESS);
if (has_jedec && (device.ndev != jedec.nid)) {
ds_dbg(SOCKET(handle), 0, "Device info does not match JEDEC info.\n");
has_jedec = 0;
}
code = (attr) ? CISTPL_DEVICE_GEO_A : CISTPL_DEVICE_GEO;
has_geo = (read_tuple(handle, code, &geo) == CS_SUCCESS);
has_geo = (pccard_read_tuple(handle->Socket, handle->Function, code, &geo) == CS_SUCCESS);
if (has_geo && (device.ndev != geo.ngeo)) {
ds_dbg(SOCKET(handle), 0, "Device info does not match geometry tuple.\n");
has_geo = 0;
......
......@@ -1402,7 +1402,7 @@ EXPORT_SYMBOL(pccard_parse_tuple);
======================================================================*/
int read_tuple(client_handle_t handle, cisdata_t code, void *parse)
int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse)
{
tuple_t tuple;
cisdata_t *buf;
......@@ -1413,19 +1413,19 @@ int read_tuple(client_handle_t handle, cisdata_t code, void *parse)
return CS_OUT_OF_RESOURCE;
tuple.DesiredTuple = code;
tuple.Attributes = TUPLE_RETURN_COMMON;
ret = pccard_get_first_tuple(handle->Socket, handle->Function, &tuple);
ret = pccard_get_first_tuple(s, function, &tuple);
if (ret != CS_SUCCESS) goto done;
tuple.TupleData = buf;
tuple.TupleOffset = 0;
tuple.TupleDataMax = 255;
ret = pcmcia_get_tuple_data(handle, &tuple);
ret = pccard_get_tuple_data(s, &tuple);
if (ret != CS_SUCCESS) goto done;
ret = pcmcia_parse_tuple(handle, &tuple, parse);
ret = pccard_parse_tuple(&tuple, parse);
done:
kfree(buf);
return ret;
}
EXPORT_SYMBOL(read_tuple);
EXPORT_SYMBOL(pccard_read_tuple);
/*======================================================================
......@@ -1442,9 +1442,15 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info)
tuple_t *tuple;
cisparse_t *p;
int ret, reserved, dev_ok = 0, ident_ok = 0;
struct pcmcia_socket *s;
unsigned int function;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
if (!s)
return CS_BAD_HANDLE;
function = handle->Function;
tuple = kmalloc(sizeof(*tuple), GFP_KERNEL);
if (tuple == NULL)
return CS_OUT_OF_RESOURCE;
......@@ -1457,23 +1463,23 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info)
info->Chains = reserved = 0;
tuple->DesiredTuple = RETURN_FIRST_TUPLE;
tuple->Attributes = TUPLE_RETURN_COMMON;
ret = pccard_get_first_tuple(handle->Socket, handle->Function, tuple);
ret = pccard_get_first_tuple(s, function, tuple);
if (ret != CS_SUCCESS)
goto done;
/* First tuple should be DEVICE; we should really have either that
or a CFTABLE_ENTRY of some sort */
if ((tuple->TupleCode == CISTPL_DEVICE) ||
(read_tuple(handle, CISTPL_CFTABLE_ENTRY, p) == CS_SUCCESS) ||
(read_tuple(handle, CISTPL_CFTABLE_ENTRY_CB, p) == CS_SUCCESS))
(pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == CS_SUCCESS) ||
(pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == CS_SUCCESS))
dev_ok++;
/* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2
tuple, for card identification. Certain old D-Link and Linksys
cards have only a broken VERS_2 tuple; hence the bogus test. */
if ((read_tuple(handle, CISTPL_MANFID, p) == CS_SUCCESS) ||
(read_tuple(handle, CISTPL_VERS_1, p) == CS_SUCCESS) ||
(read_tuple(handle, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS))
if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == CS_SUCCESS) ||
(pccard_read_tuple(s, function, CISTPL_VERS_1, p) == CS_SUCCESS) ||
(pccard_read_tuple(s, function, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS))
ident_ok++;
if (!dev_ok && !ident_ok)
......
......@@ -1367,7 +1367,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
if ((!(s->state & SOCKET_CARDBUS)) && (s->functions == 0) &&
(client->Function != BIND_FN_ALL)) {
cistpl_longlink_mfc_t mfc;
if (read_tuple(client, CISTPL_LONGLINK_MFC, &mfc)
if (pccard_read_tuple(s, client->Function, CISTPL_LONGLINK_MFC, &mfc)
== CS_SUCCESS)
s->functions = mfc.nfn;
else
......
......@@ -146,7 +146,7 @@ void write_cis_mem(struct pcmcia_socket *s, int attr,
void release_cis_mem(struct pcmcia_socket *s);
void destroy_cis_cache(struct pcmcia_socket *s);
int verify_cis_cache(struct pcmcia_socket *s);
int read_tuple(client_handle_t handle, cisdata_t code, void *parse);
int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse);
/* In bulkmem.c */
int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment