]> git.hungrycats.org Git - linux/commitdiff
[PCMCIA] 14-access_configuration.diff
authorDominik Brodowski <linux@de.rmk.(none)>
Mon, 18 Oct 2004 23:12:54 +0000 (00:12 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Mon, 18 Oct 2004 23:12:54 +0000 (00:12 +0100)
Add a wrapper around pcmcia_access_configuration_register, and use
pccard_access_configuration_register in ds.c

drivers/pcmcia/cs.c
drivers/pcmcia/cs_internal.h
drivers/pcmcia/ds.c
drivers/pcmcia/pcmcia_compat.c

index b90113130c729a93fc416a4a334ddd989be342b6..842a0cfbe5562969d41b1d2df612f11746ebbe85 100644 (file)
@@ -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)
 {
-    struct pcmcia_socket *s;
     config_t *c;
     int addr;
     u_char val;
-    
-    if (CHECK_HANDLE(handle))
-       return CS_BAD_HANDLE;
-    s = SOCKET(handle);
-    if (handle->Function == BIND_FN_ALL) {
-       if (reg->Function >= s->functions)
-           return CS_BAD_ARGS;
-       c = &s->config[reg->Function];
-    } else
-       c = CONFIG(handle);
+
+    if (!s || !s->config)
+       return CS_NO_CARD;    
+
+    c = &s->config[function];
 
     if (c == NULL)
        return CS_NO_CARD;
@@ -887,7 +882,7 @@ int pcmcia_access_configuration_register(client_handle_t handle,
     }
     return CS_SUCCESS;
 } /* access_configuration_register */
-
+EXPORT_SYMBOL(pccard_access_configuration_register);
 
 /*====================================================================*/
 
@@ -2056,7 +2051,6 @@ EXPORT_SYMBOL(pcmcia_set_event_mask);
     
 ======================================================================*/
 /* in alpha order */
-EXPORT_SYMBOL(pcmcia_access_configuration_register);
 EXPORT_SYMBOL(pcmcia_deregister_client);
 EXPORT_SYMBOL(pcmcia_eject_card);
 EXPORT_SYMBOL(pcmcia_get_card_services_info);
index a2db758dc8ffc9c34ea4d54c19ba3f4b4c0d108f..a485cdaa53de834031b0c51716b3edf20c7cb3cf 100644 (file)
@@ -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_reset_card(struct pcmcia_socket *skt);
 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)
 
index 9b2b22573d44c40556427349aa4514fbc8f1e534..d75e29057e49eb2e6e2e49c8eb51222eaf45c2eb 100644 (file)
@@ -991,7 +991,11 @@ static int ds_ioctl(struct inode * inode, struct file * file,
     case DS_ACCESS_CONFIGURATION_REGISTER:
        if ((buf.conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN))
            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;
     case DS_GET_FIRST_REGION:
         ret = pcmcia_get_first_region(s->handle, &buf.region);
index 2de22cfda2bf0c05824a5185f1aa0413fa9620e0..673d34576d3befb13374d204f8c922996c0cee72 100644 (file)
@@ -112,6 +112,17 @@ int pcmcia_get_status(client_handle_t handle, cs_status_t *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
 
 int pcmcia_get_first_window(window_handle_t *win, win_req_t *req)