Commit 92ceceb4 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] 14-access_configuration.diff

Add a wrapper around pcmcia_access_configuration_register, and use
pccard_access_configuration_register in ds.c
parent 69b21a60
...@@ -846,23 +846,18 @@ static void release_io_space(struct pcmcia_socket *s, ioaddr_t base, ...@@ -846,23 +846,18 @@ static void release_io_space(struct pcmcia_socket *s, ioaddr_t base,
======================================================================*/ ======================================================================*/
int pcmcia_access_configuration_register(client_handle_t handle, int pccard_access_configuration_register(struct pcmcia_socket *s,
unsigned int function,
conf_reg_t *reg) conf_reg_t *reg)
{ {
struct pcmcia_socket *s;
config_t *c; config_t *c;
int addr; int addr;
u_char val; u_char val;
if (CHECK_HANDLE(handle)) if (!s || !s->config)
return CS_BAD_HANDLE; return CS_NO_CARD;
s = SOCKET(handle);
if (handle->Function == BIND_FN_ALL) { c = &s->config[function];
if (reg->Function >= s->functions)
return CS_BAD_ARGS;
c = &s->config[reg->Function];
} else
c = CONFIG(handle);
if (c == NULL) if (c == NULL)
return CS_NO_CARD; return CS_NO_CARD;
...@@ -887,7 +882,7 @@ int pcmcia_access_configuration_register(client_handle_t handle, ...@@ -887,7 +882,7 @@ int pcmcia_access_configuration_register(client_handle_t handle,
} }
return CS_SUCCESS; return CS_SUCCESS;
} /* access_configuration_register */ } /* access_configuration_register */
EXPORT_SYMBOL(pccard_access_configuration_register);
/*====================================================================*/ /*====================================================================*/
...@@ -2056,7 +2051,6 @@ EXPORT_SYMBOL(pcmcia_set_event_mask); ...@@ -2056,7 +2051,6 @@ EXPORT_SYMBOL(pcmcia_set_event_mask);
======================================================================*/ ======================================================================*/
/* in alpha order */ /* in alpha order */
EXPORT_SYMBOL(pcmcia_access_configuration_register);
EXPORT_SYMBOL(pcmcia_deregister_client); EXPORT_SYMBOL(pcmcia_deregister_client);
EXPORT_SYMBOL(pcmcia_eject_card); EXPORT_SYMBOL(pcmcia_eject_card);
EXPORT_SYMBOL(pcmcia_get_card_services_info); EXPORT_SYMBOL(pcmcia_get_card_services_info);
......
...@@ -175,6 +175,7 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, ...@@ -175,6 +175,7 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx,
int pccard_get_configuration_info(struct pcmcia_socket *s, unsigned int function, config_info_t *config); 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_reset_card(struct pcmcia_socket *skt);
int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status); int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status);
int pccard_access_configuration_register(struct pcmcia_socket *s, unsigned int function, conf_reg_t *reg);
#define cs_socket_name(skt) ((skt)->dev.class_id) #define cs_socket_name(skt) ((skt)->dev.class_id)
......
...@@ -991,7 +991,11 @@ static int ds_ioctl(struct inode * inode, struct file * file, ...@@ -991,7 +991,11 @@ static int ds_ioctl(struct inode * inode, struct file * file,
case DS_ACCESS_CONFIGURATION_REGISTER: case DS_ACCESS_CONFIGURATION_REGISTER:
if ((buf.conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) if ((buf.conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
ret = pcmcia_access_configuration_register(s->handle, &buf.conf_reg); if (buf.conf_reg.Function &&
(buf.conf_reg.Function >= s->parent->functions))
ret = CS_BAD_ARGS;
else
ret = pccard_access_configuration_register(s->parent, buf.conf_reg.Function, &buf.conf_reg);
break; break;
case DS_GET_FIRST_REGION: case DS_GET_FIRST_REGION:
ret = pcmcia_get_first_region(s->handle, &buf.region); ret = pcmcia_get_first_region(s->handle, &buf.region);
......
...@@ -112,6 +112,17 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *status) ...@@ -112,6 +112,17 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *status)
} }
EXPORT_SYMBOL(pcmcia_get_status); EXPORT_SYMBOL(pcmcia_get_status);
int pcmcia_access_configuration_register(client_handle_t handle,
conf_reg_t *reg)
{
struct pcmcia_socket *s;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
s = SOCKET(handle);
return pccard_access_configuration_register(s, handle->Function, reg);
}
EXPORT_SYMBOL(pcmcia_access_configuration_register);
#ifdef CONFIG_PCMCIA_OBSOLETE #ifdef CONFIG_PCMCIA_OBSOLETE
int pcmcia_get_first_window(window_handle_t *win, win_req_t *req) 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