Commit 7ea33fc9 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] 08-validate_cis.diff

Add a wrapper around pcmcia_validate_cis, and use
pccard_validate_cis in ds.c
parent 0eb4a605
...@@ -1437,20 +1437,15 @@ EXPORT_SYMBOL(pccard_read_tuple); ...@@ -1437,20 +1437,15 @@ EXPORT_SYMBOL(pccard_read_tuple);
======================================================================*/ ======================================================================*/
int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info)
{ {
tuple_t *tuple; tuple_t *tuple;
cisparse_t *p; cisparse_t *p;
int ret, reserved, dev_ok = 0, ident_ok = 0; 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) if (!s)
return CS_BAD_HANDLE; return CS_BAD_HANDLE;
function = handle->Function;
tuple = kmalloc(sizeof(*tuple), GFP_KERNEL); tuple = kmalloc(sizeof(*tuple), GFP_KERNEL);
if (tuple == NULL) if (tuple == NULL)
return CS_OUT_OF_RESOURCE; return CS_OUT_OF_RESOURCE;
...@@ -1486,7 +1481,7 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) ...@@ -1486,7 +1481,7 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info)
goto done; goto done;
for (info->Chains = 1; info->Chains < MAX_TUPLES; info->Chains++) { for (info->Chains = 1; info->Chains < MAX_TUPLES; info->Chains++) {
ret = pccard_get_next_tuple(handle->Socket, handle->Function, tuple); ret = pccard_get_next_tuple(s, function, tuple);
if (ret != CS_SUCCESS) break; if (ret != CS_SUCCESS) break;
if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) || ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) ||
...@@ -1502,6 +1497,7 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) ...@@ -1502,6 +1497,7 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info)
kfree(p); kfree(p);
return CS_SUCCESS; return CS_SUCCESS;
} }
EXPORT_SYMBOL(pccard_validate_cis);
/* /*
* Compatibility layer. * Compatibility layer.
...@@ -1542,3 +1538,13 @@ int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse ...@@ -1542,3 +1538,13 @@ int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse
return pccard_parse_tuple(tuple, parse); return pccard_parse_tuple(tuple, parse);
} }
EXPORT_SYMBOL(pcmcia_parse_tuple); EXPORT_SYMBOL(pcmcia_parse_tuple);
int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info)
{
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
return pccard_validate_cis(s, handle->Function, info);
}
EXPORT_SYMBOL(pcmcia_validate_cis);
...@@ -2122,7 +2122,6 @@ EXPORT_SYMBOL(pcmcia_request_window); ...@@ -2122,7 +2122,6 @@ EXPORT_SYMBOL(pcmcia_request_window);
EXPORT_SYMBOL(pcmcia_reset_card); EXPORT_SYMBOL(pcmcia_reset_card);
EXPORT_SYMBOL(pcmcia_resume_card); EXPORT_SYMBOL(pcmcia_resume_card);
EXPORT_SYMBOL(pcmcia_suspend_card); EXPORT_SYMBOL(pcmcia_suspend_card);
EXPORT_SYMBOL(pcmcia_validate_cis);
EXPORT_SYMBOL(dead_socket); EXPORT_SYMBOL(dead_socket);
EXPORT_SYMBOL(pcmcia_parse_events); EXPORT_SYMBOL(pcmcia_parse_events);
......
...@@ -966,7 +966,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, ...@@ -966,7 +966,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
break; break;
case DS_VALIDATE_CIS: case DS_VALIDATE_CIS:
pcmcia_validate_mem(s->parent); pcmcia_validate_mem(s->parent);
ret = pcmcia_validate_cis(s->handle, &buf.cisinfo); ret = pccard_validate_cis(s->parent, BIND_FN_ALL, &buf.cisinfo);
break; break;
case DS_SUSPEND_CARD: case DS_SUSPEND_CARD:
ret = pcmcia_suspend_card(s->parent); ret = pcmcia_suspend_card(s->parent);
......
...@@ -307,7 +307,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *in ...@@ -307,7 +307,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *in
s->cis_mem.res = res; s->cis_mem.res = res;
s->cis_virt = ioremap(res->start, s->map_size); s->cis_virt = ioremap(res->start, s->map_size);
if (s->cis_virt) { if (s->cis_virt) {
ret = pcmcia_validate_cis(s->clients, info); ret = pccard_validate_cis(s, BIND_FN_ALL, info);
/* invalidate mapping and CIS cache */ /* invalidate mapping and CIS cache */
iounmap(s->cis_virt); iounmap(s->cis_virt);
s->cis_virt = NULL; s->cis_virt = NULL;
......
...@@ -615,4 +615,6 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple ...@@ -615,4 +615,6 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple
int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse); int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse);
int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info);
#endif /* LINUX_CISTPL_H */ #endif /* LINUX_CISTPL_H */
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