From patchwork Thu Jun 9 23:40:27 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: 867612 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p59Ng7MJ017082 for ; Thu, 9 Jun 2011 23:42:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756806Ab1FIXmE (ORCPT ); Thu, 9 Jun 2011 19:42:04 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:38126 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755001Ab1FIXmD (ORCPT ); Thu, 9 Jun 2011 19:42:03 -0400 Received: by wya21 with SMTP id 21so1500116wya.19 for ; Thu, 09 Jun 2011 16:42:01 -0700 (PDT) Received: by 10.227.164.129 with SMTP id e1mr1411146wby.67.1307662921644; Thu, 09 Jun 2011 16:42:01 -0700 (PDT) Received: from localhost.localdomain (46-116-119-47.bb.netvision.net.il [46.116.119.47]) by mx.google.com with ESMTPS id b10sm1591036wbh.43.2011.06.09.16.41.59 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Jun 2011 16:42:00 -0700 (PDT) From: Ohad Ben-Cohen To: Cc: Chris Ball , , Ohad Ben-Cohen Subject: [PATCH] mmc: sdio: fix runtime PM path during driver removal Date: Fri, 10 Jun 2011 02:40:27 +0300 Message-Id: <1307662827-16618-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]); Thu, 09 Jun 2011 23:42:07 +0000 (UTC) After commit e1866b3 "PM / Runtime: Rework runtime PM handling during driver removal" was introduced, the driver core stopped incrementing the runtime PM usage counter of the device during the invocation of the ->remove() callback. This indirectly broke SDIO's runtime PM path during driver removal, because no one calls _put_sync() anymore after ->remove() completes. This means that the power of runtime-PM-managed SDIO cards is kept high after their driver is removed (even if it was powered down beforehand). Fix that by directly calling _put_sync() when the last usage counter is downref'ed by the SDIO bus. Reported-and-tested-by: Daniel Drake Signed-off-by: Ohad Ben-Cohen --- drivers/mmc/core/sdio_bus.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index d29b9c3..d2565df 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -189,7 +189,7 @@ static int sdio_bus_remove(struct device *dev) /* Then undo the runtime PM settings in sdio_bus_probe() */ if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) - pm_runtime_put_noidle(dev); + pm_runtime_put_sync(dev); out: return ret;