libertas: fix card cleanup order in SDIO driver
authorAndrey Yurovsky <andrey@cozybit.com>
Thu, 18 Jun 2009 02:15:19 +0000 (19:15 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 19:01:55 +0000 (15:01 -0400)
The SDIO driver sets the surpriseremoved flag before calling
lbs_remove_card.  With IEEE PS enabled, lbs_remove_card must issue a
command to exit IEEE PS mode, however with that flag set the command
path is blocked and the card is never taken out of IEEE PS mode.  This
step is required to ensure that the driver can be reloaded.  This patch
moves the setting of surpriseremoved after lbs_remove_card is called.

Tested with V9 firmware by ensuring that IEEE PS is disabled when the
driver is removed.  Reloading the driver is not fully tested due to a
separate issue with module reload in the SDIO driver, however this
patch at least leaves the card in a better state when we bring the
driver down.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/if_sdio.c

index 89396a7..485a8d4 100644 (file)
@@ -1093,11 +1093,11 @@ static void if_sdio_remove(struct sdio_func *func)
                        lbs_pr_alert("CMD_FUNC_SHUTDOWN cmd failed\n");
        }
 
-       card->priv->surpriseremoved = 1;
 
        lbs_deb_sdio("call remove card\n");
        lbs_stop_card(card->priv);
        lbs_remove_card(card->priv);
+       card->priv->surpriseremoved = 1;
 
        flush_workqueue(card->workqueue);
        destroy_workqueue(card->workqueue);