From patchwork Sun May 29 13:36:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 827772 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 p4TDba6f017374 for ; Sun, 29 May 2011 13:37:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753942Ab1E2Nhf (ORCPT ); Sun, 29 May 2011 09:37:35 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:36317 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753933Ab1E2Nhe (ORCPT ); Sun, 29 May 2011 09:37:34 -0400 Received: by wya21 with SMTP id 21so2131759wya.19 for ; Sun, 29 May 2011 06:37:33 -0700 (PDT) Received: by 10.216.236.157 with SMTP id w29mr1667805weq.18.1306676253662; Sun, 29 May 2011 06:37:33 -0700 (PDT) Received: from localhost.localdomain (109-186-65-238.bb.netvision.net.il [109.186.65.238]) by mx.google.com with ESMTPS id c17sm2405463wbh.63.2011.05.29.06.37.32 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 May 2011 06:37:33 -0700 (PDT) From: Ohad Ben-Cohen To: Cc: , Luciano Coelho , Ohad Ben-Cohen Subject: [PATCH] wl12xx: don't bail if mmc isn't MMC_CAP_POWER_OFF_CARD Date: Sun, 29 May 2011 16:36:03 +0300 Message-Id: <1306676163-17325-1-git-send-email-ohad@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, 29 May 2011 13:37:37 +0000 (UTC) If our SDIO function has its runtime PM disabled, don't try to manipulate its runtime PM status at all. This way we can still power on cards plugged to mmc hosts that are not MMC_CAP_POWER_OFF_CARD. Reported-and-tested-by: Tim Yamin Signed-off-by: Ohad Ben-Cohen --- drivers/net/wireless/wl12xx/sdio.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c index 74fd7c6..e3b0436 100644 --- a/drivers/net/wireless/wl12xx/sdio.c +++ b/drivers/net/wireless/wl12xx/sdio.c @@ -161,10 +161,12 @@ static int wl1271_sdio_power_on(struct wl1271 *wl) struct sdio_func *func = wl_to_func(wl); int ret; - /* Make sure the card will not be powered off by runtime PM */ - ret = pm_runtime_get_sync(&func->dev); - if (ret < 0) - goto out; + /* If enabled, tell runtime PM not to power off the card */ + if (pm_runtime_enabled(&func->dev)) { + ret = pm_runtime_get_sync(&func->dev); + if (ret) + goto out; + } /* Runtime PM might be disabled, so power up the card manually */ ret = mmc_power_restore_host(func->card->host); @@ -191,8 +193,11 @@ static int wl1271_sdio_power_off(struct wl1271 *wl) if (ret < 0) return ret; - /* Let runtime PM know the card is powered off */ - return pm_runtime_put_sync(&func->dev); + /* If enabled, let runtime PM know the card is powered off */ + if (pm_runtime_enabled(&func->dev)) + ret = pm_runtime_put_sync(&func->dev); + + return ret; } static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)