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: 7253051 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 C40BDBEEC1 for ; Wed, 23 Sep 2015 23:58:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4854B208FC for ; Wed, 23 Sep 2015 23:58:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D2F7208EF for ; Wed, 23 Sep 2015 23:58:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756106AbbIWX62 (ORCPT ); Wed, 23 Sep 2015 19:58:28 -0400 Received: from mail-la0-f46.google.com ([209.85.215.46]:36131 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756001AbbIWX61 (ORCPT ); Wed, 23 Sep 2015 19:58:27 -0400 Received: by lacao8 with SMTP id ao8so45966231lac.3 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=Ouh4uKcPkvDn9oVd0m2TL64Elgjfbaa0KdStqGeHYEjOWvJGaPTNc4IFZt5F5SEmu3 7xjDi4np2ivK+Wz0FK11WcIV2F9GCEVrWkJSHbVnZHvNdWlcX2OeV4qFH+h49OnFAzHQ +s9WH1ugSYN4yO0WZMEo9GZA60zY/V1aaGenAjs7DQXESMOSKnDM49Pj6IXFqfDg0J5G dL14ywAmQ6pa42znlmlvrUyWAlMnKjC3gk4tPL3mmc/XMyagm9vjxrhzRecGeUTEbEFW gnH0F1SqOw0nDv3JiIJWhuUcn+zZ+9+2+eu/CVYJvsRRY91rqTgjGmrUAVH5Lwl/a3IZ iYLw== X-Gm-Message-State: ALoCoQlZBCj6PCOHOqzTjAOAb9/yTct94uUtApTvkvpX9bspwGg0lR9Icg38UHiSH78Qa4/sge93 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-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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=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 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-sh" 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));