From patchwork Wed Sep 23 23:58:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7253061 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 3E9A7BF036 for ; Wed, 23 Sep 2015 23:58:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A9A5208FE for ; Wed, 23 Sep 2015 23:58:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48126208FA for ; Wed, 23 Sep 2015 23:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756086AbbIWX62 (ORCPT ); Wed, 23 Sep 2015 19:58:28 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:34002 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753455AbbIWX61 (ORCPT ); Wed, 23 Sep 2015 19:58:27 -0400 Received: by lahg1 with SMTP id g1so69316459lah.1 for ; Wed, 23 Sep 2015 16:58:26 -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:organization :user-agent:mime-version:content-transfer-encoding:content-type; bh=dcf88wHEmTHZAe9SYVnzHwh7kcvmmng0J9IkiY5xB4k=; b=KAs693WkGr/BNGXYqqn/eOYGwE2upnNvu+MBGd+MKSlZEhy1qW3l9w8R0gTs9cPAx8 t92QCWRfz9pU8BndIxukDhG2cfXBF8+T3CyehjjF3ULnpzh5unJKLJiMaLI3vBYO3stR Dk0rPpk2KdoO+QJXEnuiZgaUcmAHiESGk0qWNu86Eyd1BsqqouFhw3HtDjx8sjeCK2MK Da4nVuh0ho9xO67LToFs9lqA4fpE9e+UeuENmk3bzCMAQqM5PQc+kcvp5HdlVwVtqvF6 MWoNM4+K3Iza/PsMjRcS74ePFcpqU7VpSmhaFwR6RLPjIlc/tpcuEYvEyYODl9QHQ6bC 2f7Q== X-Gm-Message-State: ALoCoQkBrHr0vEDdsdC+d+efmGoLjfQ8iTQvex0LapfiwHwGRV6P7qr+J5F9GMPFKeoOVUxNURYe X-Received: by 10.112.72.193 with SMTP id f1mr5362224lbv.12.1443052705962; Wed, 23 Sep 2015 16:58:25 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp83-237-248-131.pppoe.mtu-net.ru. [83.237.248.131]) by smtp.gmail.com with ESMTPSA id dt5sm1048404lac.26.2015.09.23.16.58.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 16:58:24 -0700 (PDT) From: Sergei Shtylyov To: linux-mmc@vger.kernel.org, ulf.hansson@linaro.org, ian@mnementh.co.uk Cc: linux-sh@vger.kernel.org Subject: [PATCH] tmio_mmc_pio: test TMIO_MMC_WRPROTECT_DISABLE earlier Date: Thu, 24 Sep 2015 02:58:23 +0300 Message-ID: <1513691.2yatcrs42i@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.1.6-100.fc21.x86_64; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 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, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 There seems to be no sense in the runtime PM calls when the actual register read is suppressed by the TMIO_MMC_WRPROTECT_DISABLE flag. Check that flag before trying to read the register and thus doing the runtime PM dance... While at it, kill useless local variable and add empty line after declarations. Signed-off-by: Sergei Shtylyov Acked-by: Geert Uytterhoeven --- The patch is against Ulf Hansson's 'mmc.git' repo's 'next' branch. drivers/mmc/host/tmio_mmc_pio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: mmc/drivers/mmc/host/tmio_mmc_pio.c =================================================================== --- mmc.orig/drivers/mmc/host/tmio_mmc_pio.c +++ mmc/drivers/mmc/host/tmio_mmc_pio.c @@ -988,14 +988,16 @@ static void tmio_mmc_set_ios(struct mmc_ static int tmio_mmc_get_ro(struct mmc_host *mmc) { struct tmio_mmc_host *host = mmc_priv(mmc); - struct tmio_mmc_data *pdata = host->pdata; int ret = mmc_gpio_get_ro(mmc); + if (ret >= 0) return ret; + if (host->pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) + return 0; + pm_runtime_get_sync(mmc_dev(mmc)); - ret = !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) || - (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); + ret = !(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT); pm_runtime_mark_last_busy(mmc_dev(mmc)); pm_runtime_put_autosuspend(mmc_dev(mmc));