From patchwork Sun Sep 8 10:12:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 173336 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3002967ilq; Sun, 8 Sep 2019 03:12:43 -0700 (PDT) X-Received: by 2002:ac2:52b8:: with SMTP id r24mr13247033lfm.131.1567937563617; Sun, 08 Sep 2019 03:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567937563; cv=none; d=google.com; s=arc-20160816; b=BVwUC4Z8i/WA0nVi3AxUZ1ctRagKUa/5BoiXvelJk9BcFqSUU2MhIDk45ZhlV7gtRD Lt2M1GH79DwsX6GWDSQWm+3Nuim/yfMlZ+o91HGNN8KppJPWsqWN3chPh9szQm3Z/yXR Yfw0v7wfbPvhBtZOpRacEgOaK6+OF4NN1drphQXjh2Q+hWQQ+Iv2E4Lz01dLRxUWdJ+E a5FwajerWpWvNbGCo6Bc4B4vUmmkEE6MH3ou1kWD4TfqtZXtzqgyty+YOY+QDt/06w4Z KrZb9Yhkj56sgmlYbUNl+K6TYHNNEJi6DRhNhELs59MoxaFgnfoMvzUdzWPAACgX4cHd VBWg== 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=njwNwAwc6r0dkq3naz0El9lnBpKIVIeF99HX8Xzv4dE=; b=EaSJ9QyL6cXke8E7hGH5nHoIA8WV9KyTA6+SuBtv2/Bb0NYvHrIsv2IHTi2Fkw84EX ih/+j6bgQ4ZL/jkBs2qL4jiE7/ZS/oAD0v7Wpn9V/xeP+4k9WOMzYlG9NW8ZpApMaUDO m9pnPgxRHnNGvqrns9AIfUm2fsPLcTIgg1kPJLwWOYka0KsH00TVI+a6lRKjj8najFOA C3+gM+wUzbxi1tinh6jBMsHWqujnUldOPRH9AwgNtoejTmkPjZ4GwO4al9yDL1WW1ocP MiPjYQlXw0NctGMvx3yYwP++Bc+vjkva1kXrVaSk0u/5xSqiNsfMzH8Lv7N0GMt7doJa UqiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WY/PSxE6"; 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 r26sor5675484ljm.1.2019.09.08.03.12.43 for (Google Transport Security); Sun, 08 Sep 2019 03:12:43 -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="WY/PSxE6"; 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=njwNwAwc6r0dkq3naz0El9lnBpKIVIeF99HX8Xzv4dE=; b=WY/PSxE68qVV9583kfNBuDbYuUpdPB+qveDxNuOd0xhevC45Z2dpWbWg3WoA4MjpAG Mc9TplI8Vz7PzhC8BF/Masppqn+si9//Kow3TlGfcY3MXI/nmOJMNP8gA3KmIZoqOyEv WRWSc7+aH7p5jqfiO7PUYleEHDNP5OlQo2NV4lTY5JOJ1SAb9YdoAKs7JHsuNWC+G6yl 3wu8eSlKNQCSxPPgGe9++aKJ0jjfBSO64Tua3fD7kXXfo/dGaAaKpCefSg2Sugel94e4 An5JKrcuaZG80RHNmKuTLeH/Dbhc/c845T38mjOOJc9x5QuWwooeWNoF19P63Iw7IzGV 8dLQ== 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=njwNwAwc6r0dkq3naz0El9lnBpKIVIeF99HX8Xzv4dE=; b=T/SCN1aBGosdEeKafbDUekciVZdSOFMMmH+E2FL9Wsm7sVHEoPnmedXTmyuz8bLqOw POKoiz8EOj4+hu+lYCn64e2hJLKZdQ89kTp8ljZH7HKSGwMThQRdKCsCHKQXq7ewHpPc u9WjgUUPxhWcqGxu9GebszkGgV/N0M2NqQUptNA5E2JotuViHvu9yvxS2kjd3WJOlF0Y yJfdrZMNm1ny/ZjB1IJhpoFe0T9H9tBG4ro6sWB6S4IyvyYr3KswioEdRiWps/0yAOGU hktIPVWbYGOHPmQoa+9zcW0m6ei6LmpXiwWo4/YlQ4OPRnsivfBpf9+bX2Ib0uA0nvkw maSA== X-Gm-Message-State: APjAAAVW6eBoNR7fgrcoRzYYti5XHGlt8hXrTr5PZAO2Gwl/tPcsbiv4 9jqx+FEZGrKF3TGm7Sn1jdUqM/Vb X-Google-Smtp-Source: APXvYqw5LzDY8B2YTdCvLHuC2pxw+qjmoU1Z7hBcb+FHPXc+nj5c8+wJj+AdAqhGC00CKThlLHZ02Q== X-Received: by 2002:a2e:1415:: with SMTP id u21mr12369659ljd.22.1567937563298; Sun, 08 Sep 2019 03:12:43 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([185.122.190.73]) by smtp.gmail.com with ESMTPSA id h25sm2444849lfj.81.2019.09.08.03.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 03:12:42 -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 v2 01/11] mmc: core: Add helper function to indicate if SDIO IRQs is enabled Date: Sun, 8 Sep 2019 12:12:26 +0200 Message-Id: <20190908101236.2802-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908101236.2802-1-ulf.hansson@linaro.org> References: <20190908101236.2802-1-ulf.hansson@linaro.org> To avoid each host driver supporting SDIO IRQs, from keeping track internally about if SDIO IRQs has been claimed, let's introduce a common helper function, sdio_irq_claimed(). The function returns true if SDIO IRQs are claimed, 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. Tested-by: Matthias Kaehlcke Signed-off-by: Ulf Hansson --- Changes in v2: - Renamed function to sdio_irq_claimed(). --- include/linux/mmc/host.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 Reviewed-by: Douglas Anderson diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4a351cb7f20f..a9d52a4d5041 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 claimed. +*/ +static inline bool sdio_irq_claimed(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);