Commit b2fac47f authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] 11-configuration_info.diff

Add a wrapper around pcmcia_get_configuration_info, and
use pccard_get_configuration_info in ds.c
parent 28cbfb34
......@@ -935,29 +935,20 @@ int pcmcia_deregister_client(client_handle_t handle)
/*====================================================================*/
int pcmcia_get_configuration_info(client_handle_t handle,
int pccard_get_configuration_info(struct pcmcia_socket *s,
unsigned int function,
config_info_t *config)
{
struct pcmcia_socket *s;
config_t *c;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD;
if (handle->Function == BIND_FN_ALL) {
if (config->Function && (config->Function >= s->functions))
return CS_BAD_ARGS;
} else
config->Function = handle->Function;
config->Function = function;
#ifdef CONFIG_CARDBUS
if (s->state & SOCKET_CARDBUS) {
u_char fn = config->Function;
memset(config, 0, sizeof(config_info_t));
config->Function = fn;
config->Vcc = s->socket.Vcc;
config->Vpp1 = config->Vpp2 = s->socket.Vpp;
config->Option = s->cb_dev->subordinate->number;
......@@ -974,7 +965,7 @@ int pcmcia_get_configuration_info(client_handle_t handle,
}
#endif
c = (s->config != NULL) ? &s->config[config->Function] : NULL;
c = (s->config != NULL) ? &s->config[function] : NULL;
if ((c == NULL) || !(c->state & CONFIG_LOCKED)) {
config->Attributes = 0;
......@@ -999,6 +990,7 @@ int pcmcia_get_configuration_info(client_handle_t handle,
return CS_SUCCESS;
} /* get_configuration_info */
EXPORT_SYMBOL(pccard_get_configuration_info);
/*======================================================================
......@@ -2083,7 +2075,6 @@ EXPORT_SYMBOL(pcmcia_access_configuration_register);
EXPORT_SYMBOL(pcmcia_deregister_client);
EXPORT_SYMBOL(pcmcia_eject_card);
EXPORT_SYMBOL(pcmcia_get_card_services_info);
EXPORT_SYMBOL(pcmcia_get_configuration_info);
EXPORT_SYMBOL(pcmcia_get_mem_page);
EXPORT_SYMBOL(pcmcia_get_status);
EXPORT_SYMBOL(pcmcia_insert_card);
......
......@@ -172,6 +172,7 @@ extern struct class_interface pccard_sysfs_interface;
extern struct rw_semaphore pcmcia_socket_list_rwsem;
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);
#define cs_socket_name(skt) ((skt)->dev.class_id)
......
......@@ -940,7 +940,11 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret = pcmcia_get_card_services_info(&buf.servinfo);
break;
case DS_GET_CONFIGURATION_INFO:
ret = pcmcia_get_configuration_info(s->handle, &buf.config);
if (buf.config.Function &&
(buf.config.Function >= s->parent->functions))
ret = CS_BAD_ARGS;
else
ret = pccard_get_configuration_info(s->parent, buf.config.Function, &buf.config);
break;
case DS_GET_FIRST_TUPLE:
pcmcia_validate_mem(s->parent);
......
......@@ -74,6 +74,20 @@ int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info)
}
EXPORT_SYMBOL(pcmcia_validate_cis);
int pcmcia_get_configuration_info(client_handle_t handle,
config_info_t *config)
{
struct pcmcia_socket *s;
if ((CHECK_HANDLE(handle)) || !config)
return CS_BAD_HANDLE;
s = SOCKET(handle);
if (!s)
return CS_BAD_HANDLE;
return pccard_get_configuration_info(s, handle->Function, config);
}
EXPORT_SYMBOL(pcmcia_get_configuration_info);
#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