pcmcia: call CIS cleanup from ds.c
authorDominik Brodowski <linux@dominikbrodowski.net>
Sat, 2 Jan 2010 16:34:09 +0000 (17:34 +0100)
committerDominik Brodowski <linux@dominikbrodowski.net>
Sun, 17 Jan 2010 17:30:49 +0000 (18:30 +0100)
As ds.c is the only real user of CIS access functions, call the
cleanup functions from ds.c, too.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
drivers/pcmcia/cs.c
drivers/pcmcia/ds.c

index 8c51493d1f957d99a3d05432275dc266b2819ff1..9d8b9c1f5a694ac355df1bd148f304b40caeb124 100644 (file)
@@ -283,8 +283,6 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
        if (socket->thread)
                kthread_stop(socket->thread);
 
-       release_cis_mem(socket);
-
        /* remove from our own list */
        down_write(&pcmcia_socket_list_rwsem);
        list_del(&socket->socket_list);
@@ -399,7 +397,6 @@ static void socket_shutdown(struct pcmcia_socket *s)
        s->ops->set_socket(s, &s->socket);
        s->irq.AssignedIRQ = s->irq.Config = 0;
        s->lock_count = 0;
-       destroy_cis_cache(s);
        kfree(s->fake_cis);
        s->fake_cis = NULL;
 #ifdef CONFIG_CARDBUS
index 87e06395c12945982135abc1ea45fd302c7534bd..7bb52b003f0ee42809ca944faeace9881cb9d28f 100644 (file)
@@ -1241,10 +1241,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
                s->pcmcia_state.present = 0;
                pcmcia_card_remove(skt, NULL);
                handle_event(skt, event);
+               destroy_cis_cache(s);
                break;
 
        case CS_EVENT_CARD_INSERTION:
                s->pcmcia_state.present = 1;
+               destroy_cis_cache(s); /* to be on the safe side... */
                pcmcia_card_add(skt);
                handle_event(skt, event);
                break;
@@ -1366,6 +1368,7 @@ static void pcmcia_bus_remove_socket(struct device *dev,
        /* unregister any unbound devices */
        mutex_lock(&socket->skt_mutex);
        pcmcia_card_remove(socket, NULL);
+       release_cis_mem(socket);
        mutex_unlock(&socket->skt_mutex);
 
        pcmcia_put_socket(socket);