Commit 69b21a60 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] 13-get_status.diff

Add a wrapper around pcmcia_get_status, and use pccard_get_status
in ds.c
parent 7bd760e6
......@@ -1121,15 +1121,11 @@ EXPORT_SYMBOL(pcmcia_lookup_bus);
======================================================================*/
int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status)
{
struct pcmcia_socket *s;
config_t *c;
int val;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
s->ops->get_status(s, &val);
status->CardState = status->SocketState = 0;
status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0;
......@@ -1141,13 +1137,7 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD;
/* Get info from the PRR, if necessary */
if (handle->Function == BIND_FN_ALL) {
if (status->Function && (status->Function >= s->functions))
return CS_BAD_ARGS;
c = (s->config != NULL) ? &s->config[status->Function] : NULL;
} else
c = CONFIG(handle);
c = (s->config != NULL) ? &s->config[function] : NULL;
if ((c != NULL) && (c->state & CONFIG_LOCKED) &&
(c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) {
u_char reg;
......@@ -1182,6 +1172,7 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
(val & SS_READY) ? CS_EVENT_READY_CHANGE : 0;
return CS_SUCCESS;
} /* get_status */
EXPORT_SYMBOL(pccard_get_status);
/*======================================================================
......@@ -2070,7 +2061,6 @@ EXPORT_SYMBOL(pcmcia_deregister_client);
EXPORT_SYMBOL(pcmcia_eject_card);
EXPORT_SYMBOL(pcmcia_get_card_services_info);
EXPORT_SYMBOL(pcmcia_get_mem_page);
EXPORT_SYMBOL(pcmcia_get_status);
EXPORT_SYMBOL(pcmcia_insert_card);
EXPORT_SYMBOL(pcmcia_map_mem_page);
EXPORT_SYMBOL(pcmcia_modify_configuration);
......
......@@ -174,6 +174,7 @@ extern struct list_head pcmcia_socket_list;
int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req);
int pccard_get_configuration_info(struct pcmcia_socket *s, unsigned int function, config_info_t *config);
int pccard_reset_card(struct pcmcia_socket *skt);
int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status);
#define cs_socket_name(skt) ((skt)->dev.class_id)
......
......@@ -966,7 +966,11 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret = pccard_reset_card(s->parent);
break;
case DS_GET_STATUS:
ret = pcmcia_get_status(s->handle, &buf.status);
if (buf.status.Function &&
(buf.status.Function >= s->parent->functions))
ret = CS_BAD_ARGS;
else
ret = pccard_get_status(s->parent, buf.status.Function, &buf.status);
break;
case DS_VALIDATE_CIS:
pcmcia_validate_mem(s->parent);
......
......@@ -102,6 +102,16 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req)
}
EXPORT_SYMBOL(pcmcia_reset_card);
int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
{
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
return pccard_get_status(s, handle->Function, status);
}
EXPORT_SYMBOL(pcmcia_get_status);
#ifdef CONFIG_PCMCIA_OBSOLETE
int pcmcia_get_first_window(window_handle_t *win, win_req_t *req)
......
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