From patchwork Wed Apr 25 13:41:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eyal Reizer X-Patchwork-Id: 10363261 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8346660225 for ; Wed, 25 Apr 2018 13:42:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 751AD28BF9 for ; Wed, 25 Apr 2018 13:42:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67DD928E65; Wed, 25 Apr 2018 13:42:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E446928D43 for ; Wed, 25 Apr 2018 13:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754165AbeDYNmP (ORCPT ); Wed, 25 Apr 2018 09:42:15 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:46496 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851AbeDYNmL (ORCPT ); Wed, 25 Apr 2018 09:42:11 -0400 Received: by mail-wr0-f193.google.com with SMTP id d1-v6so53355712wrj.13; Wed, 25 Apr 2018 06:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QWkZxfQk3Z+rFMX35j1d3RBeUuwEZ76zuKfgeMk9RPE=; b=RsmIvddHwDjP0vqkRQoTHMortQr3OxMW30y5OV8zvge6KOcAJbjkGSKz0ENuJdf5ym WHBZqZY5Q9XfgHzEwjxLmDXr+XCNyWC4Lal3ybhlz+TAAt3j/0qYlCm/nAJ4np2RHWCL cMfBICvJIsRJxbqlxiI+YmdQ0CCY5cxdHGSyVKRu2JzaEui35VixX0QY8Ny8sJ2n8YAv Wh+1r9Re38vmnU0VzzU7PK0J9Akc/xsKu5i8wA3OhAF6yD5jxNaeR/70haGb3ssjfpt0 OjMkU+yQjVWEeDPu9LDhyFIRnNHxI0r1MRK7HHD3ZJHo+yUCkr+D0IFCpH9/JZMudY50 ncfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QWkZxfQk3Z+rFMX35j1d3RBeUuwEZ76zuKfgeMk9RPE=; b=svz+jL9IAWmPZPyMgCrcDi/Iny1vSFyWsTuUU82f8dWRZea5gU7qJbJQ2f0iIvoKTN Q05SqxHwzCeDwOyk6VrX0/6FTMRZ3nXDnrUzYsT9OH7fLrK+jLvGesNBuxzjKQSJqyXK 9s51+C1VlPvb4lc7ZXFSC5kCxp23strTMYKVoG/4YG8tvTLmLoHp9Vlv2bTFpxFtO7Jp ALj42zJ62mNhu+g0wJzFCDLW2d1XTmViwLm2cCiNyyn8oOFEACxrq76TYpo2jnin5NLo YLCdzN5PTJdkvC6drPxphDFbC2QUAz8llU6oUtbRdA6d9c1urTlYFX7cJCot53Yz2/jy enZQ== X-Gm-Message-State: ALQs6tBtxTgIqHmyP5juUdKVksCN3JtQXJ863COTcqUUU4kepGCoSYNp YzQf3SiB+lOyRaZJiQdIfLg= X-Google-Smtp-Source: AIpwx4/vMeupYJaP3aq6HAX6KDtnbwxkkS4us7jg+qYvo6SMxKv93SQ9RLqaG+RxgVCdrzk3nZd62A== X-Received: by 2002:adf:d207:: with SMTP id g7-v6mr23196451wri.59.1524663729738; Wed, 25 Apr 2018 06:42:09 -0700 (PDT) Received: from localhost.localdomain ([5.102.253.200]) by smtp.gmail.com with ESMTPSA id r3sm4192623wmg.5.2018.04.25.06.42.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Apr 2018 06:42:08 -0700 (PDT) From: Eyal Reizer X-Google-Original-From: Eyal Reizer To: kvalo@codeaurora.org, linux-wireless@vger.kernel.org, robh@kernel.org, sre@kernel.org, tony@atomide.com, linux-kernel@vger.kernel.org Cc: Eyal Reizer , stable@vger.kernel.org Subject: [PATCH] net: wireless: ti: wlcore: sdio: allow pm to handle sdio power Date: Wed, 25 Apr 2018 16:41:50 +0300 Message-Id: <1524663710-31927-1-git-send-email-eyalr@ti.com> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pm_runtime handles sdio power on and power off transitions. An old workaround for trying to control the power explicitly from the driver was in fact causing failures on suspend/resume as the mmc layer already power the module on resume. In case of resume pm_runtime_get sync returns a positive device's usage count causing the driver to try an re-initialize an already initialized device. This was causing sdio bus failure on resume. Remove this manual power on/off sequence as it is in-fact not needed. Signed-off-by: Eyal Reizer Cc: stable@vger.kernel.org Acked-by: Tony Lindgren --- drivers/net/wireless/ti/wlcore/sdio.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 1f727ba..6dbe61d 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -155,17 +155,11 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) struct mmc_card *card = func->card; ret = pm_runtime_get_sync(&card->dev); - if (ret) { - /* - * Runtime PM might be temporarily disabled, or the device - * might have a positive reference counter. Make sure it is - * really powered on. - */ - ret = mmc_power_restore_host(card->host); - if (ret < 0) { - pm_runtime_put_sync(&card->dev); - goto out; - } + if (ret < 0) { + pm_runtime_put_noidle(&card->dev); + dev_err(glue->dev, "%s: failed to get_sync(%d)\n", + __func__, ret); + goto out; } sdio_claim_host(func); @@ -178,7 +172,6 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) { - int ret; struct sdio_func *func = dev_to_sdio_func(glue->dev); struct mmc_card *card = func->card; @@ -186,16 +179,8 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) sdio_disable_func(func); sdio_release_host(func); - /* Power off the card manually in case it wasn't powered off above */ - ret = mmc_power_save_host(card->host); - if (ret < 0) - goto out; - /* Let runtime PM know the card is powered off */ - pm_runtime_put_sync(&card->dev); - -out: - return ret; + return pm_runtime_put_sync(&card->dev); } static int wl12xx_sdio_set_power(struct device *child, bool enable)