From patchwork Tue May 5 16:03:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eliad Peller X-Patchwork-Id: 6340331 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ECE8ABEEE1 for ; Tue, 5 May 2015 17:16:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12EE62010F for ; Tue, 5 May 2015 17:16:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39A0F20263 for ; Tue, 5 May 2015 17:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761748AbbEERQa (ORCPT ); Tue, 5 May 2015 13:16:30 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37554 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753604AbbEEQJF (ORCPT ); Tue, 5 May 2015 12:09:05 -0400 Received: by widdi4 with SMTP id di4so152903926wid.0 for ; Tue, 05 May 2015 09:09:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z5BoxbAGAFdwurSwKTZfss9O7mZJlknjlJPE0twohJM=; b=WNUO8q3oioH7qVr95/nRsDOK+N4n/JecLzM6zUGs2wgn9N6lDbTs9v7TmZTQvNGWLO IdJo3JY631tQhP5+h+Nu2Po2LokARqvTfjc2pkW4X0Gp8bhWffSPXwsO8Ao7wqe7KNuq deDzNVXsmbgznudnZRI5tPZBlo5fQ2+Ge5QuhQ9LuOvQly+5yZ6lDKibU+oi9yNfF3md 1YTALb9XwbK6k8+eQVcWRwKH4VSoLokYLL3OSfa1X28yT7FnLirD4ca7cX6n/D21n19X XwM5Hj/pqNphEZaDX+uV0eTucn4jTy/1r9N7FwBGS+XYhaInBmCxaZtUndXHz2csRU5z FKSQ== X-Gm-Message-State: ALoCoQnX/GGK+Ml/qgMQi80FWqUYtUJDh4n5lfn8KzB3DPzban1y0GdQhu60OkjkLlQOAHUqT1Lw X-Received: by 10.194.23.66 with SMTP id k2mr51851832wjf.18.1430841834025; Tue, 05 May 2015 09:03:54 -0700 (PDT) Received: from localhost.localdomain ([93.172.48.98]) by mx.google.com with ESMTPSA id o6sm16812207wiz.24.2015.05.05.09.03.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 09:03:53 -0700 (PDT) From: Eliad Peller To: Cc: Ulf Hansson , Ido Yariv Subject: [PATCH] mmc: core: don't call bus_ops->power_restore if already on Date: Tue, 5 May 2015 19:03:47 +0300 Message-Id: <1430841827-7834-1-git-send-email-eliad@wizery.com> X-Mailer: git-send-email 1.8.5.2.229.g4448466.dirty Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mmc_power_restore_host() calls mmc_power_up(), which returns immediately if power is already on. However, it still calls host->bus_ops->power_restore, which might result in various errors if the bus_ops doesn't handle it well (e.g. failing to run init sequence twice) Simply bail out in this case, without further calling bus_ops->power_restore. Specifically, this solves issue with wl18xx sdio card, where the mmc core powers on the card on resume (while MMC_PM_KEEP_POWER is not set), and the wl18xx device driver calls mmc_power_restore_host() once more. Signed-off-by: Eliad Peller Signed-off-by: Ido Yariv --- drivers/mmc/core/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index c296bc0..797b574 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2604,6 +2604,11 @@ int mmc_power_restore_host(struct mmc_host *host) return -EINVAL; } + if (host->ios.power_mode == MMC_POWER_ON) { + mmc_bus_put(host); + return 0; + } + mmc_power_up(host, host->card->ocr); ret = host->bus_ops->power_restore(host);