From patchwork Tue Sep 3 14:21:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 172795 Delivered-To: patches@linaro.org Received: by 2002:ac9:5c4b:0:0:0:0:0 with SMTP id r11csp5641288ocp; Tue, 3 Sep 2019 07:22:35 -0700 (PDT) X-Received: by 2002:ac2:46d8:: with SMTP id p24mr20029612lfo.58.1567520555241; Tue, 03 Sep 2019 07:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567520555; cv=none; d=google.com; s=arc-20160816; b=GemAo24hJXRzrJ3f/vaFWtzfRIu/143M2GVtsXUWIndQ40WbfHflLVFiI7oUst7YFQ BTkbAM6hQU3RBJ/1/6aKC7eCBNhfxIH46k4vAjmsFh52nEuI8eCvTpGts4wavuRItkv4 LeLwhWgewifem8DPCVNGXrLDQb8gOqmsCe/fFvIK+1Y5z0l8DQIiPdYTivQSpib47aqL 6DQMPFLk2eg11ONuj7WV5SprFHUgW5194HOZkK/YmhdtN+jGY0vrZpZ2e7WtwOW5OvWs mayrWefuSW/pjHeylfldH6lhP/nvQkjpNbfVdPJFyhxB0+joJO+q2wRYbA038Xxyv4wL VclQ== 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=D5QBbUbIGIGd6IsxRdoAWwzoHYpPt8QRqVo3tuh083M=; b=z9fUsKHh+dWjAKjTzIDWNp0SoO8ulTyMb/fVZrTLU9BB12/Vs1vg/+IOn20N9G2mxF A/EMSvms0ABr8PC6chdm3AmCdWdSs1M65owAB8AyJk8/LH7lM0Zcqv+XZVUNZvcpbs0+ sO4OauEssSrkAkv1Qm5vD5MsckyMmUNupcJANejGxHj83bis9biInsJ4TF+hl2E+HoFl OmvPPgCU0tXKnwOu7g7h967vdHSfTATfWmpPmmiBqiv06koTcWaJx6p30bY2uX5vXOm8 8I3dkJdWUjYaowzowITpGOdKcGo8aqYJmowYBO/j19JnZ8oLSZNxl2kXDlgksPzoi841 0New== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RP7NBDNt; 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 e8sor6618489ljl.36.2019.09.03.07.22.35 for (Google Transport Security); Tue, 03 Sep 2019 07:22:35 -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=RP7NBDNt; 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=D5QBbUbIGIGd6IsxRdoAWwzoHYpPt8QRqVo3tuh083M=; b=RP7NBDNto85o8qwpd+eBtArA8GsDbwZzo/N21c5w/x6H5zZ5ZPvBKOgT5AKNZjn4UQ VtlHjUycq/Sjk7L+8sIg5gVnv9YNWJl5mP61BIRnivL/jWz1tFolfQUSHRItCk0FfYBB tTbntNmCtOIEAtIBHrJLVQcmfKNvs03l4FAeYhME9rQZYWB2FEJ58cmnmtC30es9NDRV VCHMolZ3jrdPU57/NxfzMw6I7vpgpIjQyMAfJrwOxX9/5dccWgMqFFjuDxfa0iGilerx 7mr+AforWPw4ExJA6GKojspQDjLzq8ixKdjDidfmy3xZkXBIoaTRRLSfwlfYKC72AKzE OAug== 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=D5QBbUbIGIGd6IsxRdoAWwzoHYpPt8QRqVo3tuh083M=; b=oEjpr4KvAF/7BqZ01fGekGlfRNgRUTBmP9I0wsqcJkQbSmKiSpp94gM7vDBu1YHJcT 12d+eoMWbcS0DMvxj/DbX5sTACKpENgEMlT1m9yrqXVD2GS32Ipjuwcz9xwtnqZaT6Ad TtmO/0y1KZhD0ce2x8JAxWMSzdiX7XPtAFtOfCVtnPrUpJ17ZSbXWWTf3YLs9i+hWBcf Knq6PUBzFC+xKuYrmRvOlksI+Cvmjwl+RgJqSxnhjOH+oNGD+F7xry4dXT0YjX0JgWCh Gx1ew5ywyCebacMZr4+k7r9gqnocEjeOWwKpR8CbbqEUfBcp86VSO24CGcx0ssiJ5l03 mRAQ== X-Gm-Message-State: APjAAAWLInmr/ZC0W1gC/rb18exhysUU3PDyfKOnREACzBG9/MOAdXhb 8pJjNo172HFNsCC2hSyEfu3KIhjI X-Google-Smtp-Source: APXvYqyYZS0LZ/x/v3d6oArjV2CxJmO4miYGU2bMEsj46wakq+VgwT1upJ9K3Ttnb344DmtcvFVNBQ== X-Received: by 2002:a2e:99d7:: with SMTP id l23mr1996664ljj.86.1567520554912; Tue, 03 Sep 2019 07:22:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 07:22:34 -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 01/11] mmc: core: Add helper function to indicate if SDIO IRQs is enabled Date: Tue, 3 Sep 2019 16:21:57 +0200 Message-Id: <20190903142207.5825-2-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> To avoid each host driver supporting SDIO IRQs, from keeping track internally about if SDIO IRQs has been enabled, let's introduce a common helper function, sdio_irq_enabled(). The function returns true if SDIO IRQs are enabled, via using the information about the number of claimed irqs. This is safe, even without any locks, as long as the helper function is called only from runtime/system suspend callbacks of the host driver. Signed-off-by: Ulf Hansson --- include/linux/mmc/host.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4a351cb7f20f..0c0a565c7ff1 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -493,6 +493,15 @@ void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq); void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq); +/* + * May be called from host driver's system/runtime suspend/resume callbacks, + * to know if SDIO IRQs has been enabled. +*/ +static inline bool sdio_irq_enabled(struct mmc_host *host) +{ + return host->sdio_irqs > 0; +} + static inline void mmc_signal_sdio_irq(struct mmc_host *host) { host->ops->enable_sdio_irq(host, 0);