From patchwork Tue Sep 3 14:22:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 172798 Delivered-To: patches@linaro.org Received: by 2002:ac9:5c4b:0:0:0:0:0 with SMTP id r11csp5641436ocp; Tue, 3 Sep 2019 07:22:40 -0700 (PDT) X-Received: by 2002:a2e:958c:: with SMTP id w12mr3510393ljh.98.1567520560479; Tue, 03 Sep 2019 07:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567520560; cv=none; d=google.com; s=arc-20160816; b=latIXuAC/NqivCF2Qijhuy9N4oVh3lp+x/Nk/BTJYg7anO+SeDfa2mcehTTdXd1TpL jMgC83SH8FTEzXDCbDkORQdiE1nGwHA4ha98UJRhvgYolejlsF5On+UF1OusOHgZSNrD sm+5olmH3+rdB4amb/6WWSVshNiOaWYc91a3mh7T2qJaiU+Xv7nsJDcTzJ/czf2LBSuE 0v/m+3MFsdBKAIEnK0dyeL2AEqCrYHtIi07yPeT8GOkqIszG+LiTjTbGrXkQAbqoYSq1 3dIg8wz/y8LUMRCdHnAsD6xEYBBarNubZi7JfugR7Dl+yJTYeiLJYa7xD5afNHFp49rq en6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qvTZyKCFJI1bAINVcXhrb9dRTTR+BybSa6+sJhzvtc8=; b=Xg5jGvNaun1IEumf81X83ukJvYfR8h6+EvzKlCCpoA0I+682ZFs/9wakOSRN1v7Vkm abC8pWQ+upjJQjpcXa3u1tHH3Z8Kd/da8jujLrLAf8vF2wVShE7nJfAFWRUKkGS+a5p0 bqLqDpGoG/LcL+/fvkxGwr9kSqQTUAmTzIqQAAYIvmxXkDuGkVBhBBrWHW3rAnVu39RQ oHRn+HuO7uzcq+sxkT2WXEEmdvyAvgHjtllR6u5CyFta+KO19oL/JFFYM5PTeW8TFn2c NQp5ngreKX+ao7PLEdkU4x/JrDoLLRbl8/5oNCz50nLbux4Nc0RbY70QWf4Ug7v0/Bwf W+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gglFd6MH; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e8sor6618687ljl.36.2019.09.03.07.22.40 for (Google Transport Security); Tue, 03 Sep 2019 07:22:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gglFd6MH; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=qvTZyKCFJI1bAINVcXhrb9dRTTR+BybSa6+sJhzvtc8=; b=gglFd6MHuNK4Z6tmxlxiATJyByVg6zIKFequidBHSYMo1U/EyW4mJcQ/Qbc121DWUy JpJI3+si6yMcp3K513RPrh5JbCRsdrWZ8UlklF1Hi7UMHF5ESSuAp1KWjTmWC5M3kZfL WD3op0jEdXCooG55ZxloSu23l8WhaHqYUB0tN/VBCrnzeJ7WvDK7YPq6qF6zTxf3Mfni Thd1J08Oj6+NO/dzVY+iXrF/1SV1BNI31yKV7JbJ4KPT19vqSBZk52efD5Fg4YKIEejZ 7s5IRhfCKixC8qvEOXYiiawbrGJiokx1J1BkYheBOPlkZedbdnC1b1MVPc2kK2hrmmUD HHpA== 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=qvTZyKCFJI1bAINVcXhrb9dRTTR+BybSa6+sJhzvtc8=; b=kblNeYXtL6NK+W//eXm8BIbQ/6vpeW9AFhIyb2HmnSpsk+BzQb4eiYh0q2qtVN4ebq ECDKbOV+hYYTXvqbEfbxBGqv6tJz9f4MWpv0jmKkoOCgUbaG7XI6dL0JNlfQJ6YFNSNU pbkNIueuCvoaqsNRyMJcv3ZYNZuHjIYVs9QbQxXczEJ4NIqrahhaACOrefSALtNR+E7I OOR2ISYXhU4tm6NetMAxmYI6EbrOE21OGM+gxuqjWXPxARQdLEjLDt6NUQccmjRTOAFx xhD2Kauk28V0wyNs1xBIzmkf9wjhdSFHAd9FtEufCtXieq63sTFFg12Yi46x/QZ605Ne 5o9g== X-Gm-Message-State: APjAAAUECeaEwXbdC4MK9C9WknGwb904RZDFPTE56zx9CYKA2z4VrxVZ 7rJ+ASG7atVQj/4x3VwaPaHl0dj5 X-Google-Smtp-Source: APXvYqyc877+x8lrzt/YfDR3SsN0Br740tfMZzmjB6HUviT0AGI0ES80ASlAy2rNE449uMd0H8oSjA== X-Received: by 2002:a2e:6586:: with SMTP id e6mr13751574ljf.115.1567520560114; Tue, 03 Sep 2019 07:22:40 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v10sm2430862ljc.64.2019.09.03.07.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 07:22:39 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson , Matthias Kaehlcke Cc: Shawn Lin , Jaehoon Chung , Yong Mao , Chaotian Jing , linux-kernel@vger.kernel.org Subject: [PATCH 05/11] mmc: core: Clarify sdio_irq_pending flag for MMC_CAP2_SDIO_IRQ_NOTHREAD Date: Tue, 3 Sep 2019 16:22:01 +0200 Message-Id: <20190903142207.5825-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190903142207.5825-1-ulf.hansson@linaro.org> References: <20190903142207.5825-1-ulf.hansson@linaro.org> In the single SDIO IRQ handler case, the sdio_irq_pending flag is used to avoid reading the SDIO_CCCR_INTx register and instead immediately call the SDIO func's >irq_handler() callback. To clarify the use behind the flag for the MMC_CAP2_SDIO_IRQ_NOTHREAD case, let's set the flag from inside sdio_signal_irq(), rather from sdio_run_irqs(). Moreover, let's also reset the flag when the SDIO IRQ have been properly processed. Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio_irq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.17.1 Reviewed-by: Matthias Kaehlcke diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index f75043266984..0962a4357d54 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -59,6 +59,7 @@ static int process_sdio_pending_irqs(struct mmc_host *host) { struct mmc_card *card = host->card; int i, ret, count; + bool sdio_irq_pending = host->sdio_irq_pending; unsigned char pending; struct sdio_func *func; @@ -66,13 +67,16 @@ static int process_sdio_pending_irqs(struct mmc_host *host) if (mmc_card_suspended(card)) return 0; + /* Clear the flag to indicate that we have processed the IRQ. */ + host->sdio_irq_pending = false; + /* * Optimization, if there is only 1 function interrupt registered * and we know an IRQ was signaled then call irq handler directly. * Otherwise do the full probe. */ func = card->sdio_single_irq; - if (func && host->sdio_irq_pending) { + if (func && sdio_irq_pending) { func->irq_handler(func); return 1; } @@ -110,7 +114,6 @@ static void sdio_run_irqs(struct mmc_host *host) { mmc_claim_host(host); if (host->sdio_irqs) { - host->sdio_irq_pending = true; process_sdio_pending_irqs(host); if (host->ops->ack_sdio_irq) host->ops->ack_sdio_irq(host); @@ -128,6 +131,7 @@ void sdio_irq_work(struct work_struct *work) void sdio_signal_irq(struct mmc_host *host) { + host->sdio_irq_pending = true; queue_delayed_work(system_wq, &host->sdio_irq_work, 0); } EXPORT_SYMBOL_GPL(sdio_signal_irq); @@ -173,7 +177,6 @@ static int sdio_irq_thread(void *_host) if (ret) break; ret = process_sdio_pending_irqs(host); - host->sdio_irq_pending = false; mmc_release_host(host); /*