From patchwork Sun Feb 27 22:13:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Yariv X-Patchwork-Id: 593761 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1RMEFgg025635 for ; Sun, 27 Feb 2011 22:14:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751589Ab1B0WOL (ORCPT ); Sun, 27 Feb 2011 17:14:11 -0500 Received: from mail-wy0-f174.google.com ([74.125.82.174]:50359 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751236Ab1B0WOK (ORCPT ); Sun, 27 Feb 2011 17:14:10 -0500 Received: by wyg36 with SMTP id 36so3119314wyg.19 for ; Sun, 27 Feb 2011 14:14:09 -0800 (PST) Received: by 10.227.177.15 with SMTP id bg15mr4334649wbb.150.1298844848049; Sun, 27 Feb 2011 14:14:08 -0800 (PST) Received: from localhost.localdomain (93-173-12-148.bb.netvision.net.il [93.173.12.148]) by mx.google.com with ESMTPS id i80sm1551939wej.28.2011.02.27.14.14.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Feb 2011 14:14:07 -0800 (PST) From: Ido Yariv To: Luciano Coelho Cc: linux-wireless@vger.kernel.org, Ido Yariv , Ohad Ben-Cohen Subject: [PATCH] wl12xx: Don't rely on runtime PM for toggling power Date: Mon, 28 Feb 2011 00:13:58 +0200 Message-Id: <1298844838-11845-1-git-send-email-ido@wizery.com> X-Mailer: git-send-email 1.7.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 27 Feb 2011 22:14:16 +0000 (UTC) diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c index d5e8748..f27e915 100644 --- a/drivers/net/wireless/wl12xx/sdio.c +++ b/drivers/net/wireless/wl12xx/sdio.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -163,11 +164,16 @@ static int wl1271_sdio_power_on(struct wl1271 *wl) struct sdio_func *func = wl_to_func(wl); int ret; - /* Power up the card */ + /* Make sure the card will not be powered off by runtime PM */ ret = pm_runtime_get_sync(&func->dev); if (ret < 0) goto out; + /* Runtime PM might be disabled, so power up the card manually */ + ret = mmc_power_restore_host(func->card->host); + if (ret < 0) + goto out; + sdio_claim_host(func); sdio_enable_func(func); sdio_release_host(func); @@ -179,12 +185,18 @@ out: static int wl1271_sdio_power_off(struct wl1271 *wl) { struct sdio_func *func = wl_to_func(wl); + int ret; sdio_claim_host(func); sdio_disable_func(func); sdio_release_host(func); - /* Power down the card */ + /* Runtime PM might be disabled, so power off the card manually */ + ret = mmc_power_save_host(func->card->host); + if (ret < 0) + return ret; + + /* Let runtime PM know the card is powered off */ return pm_runtime_put_sync(&func->dev); }