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

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

index 4258cbc8bad0fde66fe2a0c2f9e514c424aa8fec..b90113130c729a93fc416a4a334ddd989be342b6 100644 (file)
@@ -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);
index f173ce1c61d1ca0174f9faf5b9fb1d2a9930fcdd..a2db758dc8ffc9c34ea4d54c19ba3f4b4c0d108f 100644 (file)
@@ -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)
 
index 0eb4561611ff145f23a1430696652323b975e0c4..9b2b22573d44c40556427349aa4514fbc8f1e534 100644 (file)
@@ -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);
index aa7dd46f234653b817c8c0501a08366e41a1b7b6..2de22cfda2bf0c05824a5185f1aa0413fa9620e0 100644 (file)
@@ -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)