From patchwork Wed Apr 19 21:17:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 97680 Delivered-To: patches@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp447932obc; Wed, 19 Apr 2017 14:17:20 -0700 (PDT) X-Received: by 10.129.173.23 with SMTP id l23mr4473504ywh.28.1492636640839; Wed, 19 Apr 2017 14:17:20 -0700 (PDT) Return-Path: Received: from mail-wr0-x229.google.com (mail-wr0-x229.google.com. [2a00:1450:400c:c0c::229]) by mx.google.com with ESMTPS id 140si2343509wmf.2.2017.04.19.14.17.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 14:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::229 as permitted sender) client-ip=2a00:1450:400c:c0c::229; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::229 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wr0-x229.google.com with SMTP id w50so368505wrc.0 for ; Wed, 19 Apr 2017 14:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IXSnM+4er9wPlSZ/9ETuGeD2BvJcmvaPhzrMcdIumSE=; b=QN2wRk4pXGyii8Nrjl24z2Y5hMlcnJXPBKEGIrlcTLOTEhsMrjHr3QKwO/rWKUKqGO hYyu/CcI3VaSVpX3Dt7rPeyM/4TLrhx3b3LAKnt+sa3crKAnu3Ip644IcLqewjtas+gr b5HE2PvjWcAbqCJkdWKGnR4vlZsKGUCGjguPw= 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:in-reply-to :references; bh=IXSnM+4er9wPlSZ/9ETuGeD2BvJcmvaPhzrMcdIumSE=; b=AokaBmgz+YM3MI7jnW6HpOdW8CuNZcmtZnkBagpNQeFCoQh/1Of9o4n9kVs033dmzf eEXkeEdyYBnLD+/DI78sxcS/oyvqXVENUmTMA5MGzlolXhHC5FlNIjpww2/757b4CE/i ETo2L226S7hcVDh29lLslan8bBpWpHIAMsPBzGAEzQNy5TDx1obIcF0HMQIkd/Z8FOZ8 XzMQVTqyEg1ZQtXKkO4xnb4oc0cN3p4iXRSgW/rs4m0I1rqHBn5vmnEqI1nmxcfyovPp eVM8SmdXq80SXicbujOR20wYOvNYwiRAAzg30ElXnXPAFVRjG8+hZeKsiODq4Z4MNDP8 RtVA== X-Gm-Message-State: AN3rC/777PXdZqPOuB0LDgblNJAlPGSRwEE+aSJod6n/nKZtdl3I04wo zI6vrjpa/YuwWDqQKxDZH4os X-Received: by 10.223.149.33 with SMTP id 30mr2015193wrs.20.1492636640475; Wed, 19 Apr 2017 14:17:20 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id g53sm4837747wrg.22.2017.04.19.14.17.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 14:17:19 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Brian Norris , Shawn Lin , Doug Anderson Subject: [PATCH v2 1/5] mmc: core: Prevent processing SDIO IRQs when none is claimed Date: Wed, 19 Apr 2017 23:17:07 +0200 Message-Id: <1492636631-28254-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492636631-28254-1-git-send-email-ulf.hansson@linaro.org> References: <1492636631-28254-1-git-send-email-ulf.hansson@linaro.org> In cases when MMC_CAP2_SDIO_IRQ_NOTHREAD is set, there is a minor window for when the mmc host could call sdio_run_irqs(), while in fact an SDIO func driver could have decided to released the SDIO IRQ via a call to sdio_release_irq(). In this scenario, processing of the SDIO IRQs are done even if there is none IRQ claimed, which is not what we want. To prevent this from happen, close the window by validating that at least one SDIO IRQs is claimed, before deciding to process them. Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio_irq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index 6d4b720..44d9c86 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -95,8 +95,10 @@ static int process_sdio_pending_irqs(struct mmc_host *host) void sdio_run_irqs(struct mmc_host *host) { mmc_claim_host(host); - host->sdio_irq_pending = true; - process_sdio_pending_irqs(host); + if (host->sdio_irqs) { + host->sdio_irq_pending = true; + process_sdio_pending_irqs(host); + } mmc_release_host(host); } EXPORT_SYMBOL_GPL(sdio_run_irqs);