From patchwork Thu Oct 3 15:52:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175169 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp591291ill; Thu, 3 Oct 2019 09:59:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjjNRPn1YBlYIDUNR33k0u1QSzK2xM7JjFhvuBWpZEaL/Gr9Dp4xfDnFPCIA/Oq88s3rMi X-Received: by 2002:a17:906:d8c8:: with SMTP id re8mr8674778ejb.130.1570121943828; Thu, 03 Oct 2019 09:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570121943; cv=none; d=google.com; s=arc-20160816; b=Mv1/GKw4rlwEg57ex5Z7nrUdmwzdhuFNe85DjWZBbBZ6rhn+rvU8XcPjrh24RrkAC6 a+V6JsTfXn/wwWGtj724pdoFng6vA4qROteWAcl/1YWypk1lG1qfrR0B7z+cFP4BLH5T NUKmiiOXGcEXJlKVm/4+E1uKqIRGikqYgHsndPC4q88zRL6dd99r7dM9B/PYxSUcqsli 7Dhwrcs47kZNnFnI12IX/RiCfkOeC6gKYE6T+WDcM8XR4NNmd9QM1voXPweWLMMyYFY9 iD+POdWhLh7Z13K+wzktQS98fujV/8Vlei+8PRNE0XZqn53PB+NdSx3zZC1LljeZWzo1 xJiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ohbaYWyHH7+ggwuundGiVHjcN4uF+QjslNgbf54Kp48=; b=uSKUb7D/cWs1G2vOrpmVJnXS+4QfZB6QgMsSbgK0C8dZ1CEiOylF7OqTBM1+MF8e8Z GIecNyTTTFGxBuU9llly4V81S4nhKFx/1QAuzISG1uJQTI0fozjWKi3mBjV+z0x1ajZF OOMWRnRkdnyxVltQC5TH7UepuaChXPdapqiiZ/QNy8LMDI+xUHjhtJPV+kxrW2/rSkFO r8tCfBOPcUkfFaDxFqpFJ3+AuWm9IoMHT6cOpOv/1x48hjl0Dm8Wx5sbyhoWsiEFCGWQ VhnQ0ruVhYF3bn99r3XFIMEXJjYSUklwRHdVkTvtUJPYRaXxiSfbHPwteT5R6Yos/w/K JBpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xcdGSCHP; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si1539848ejr.358.2019.10.03.09.59.03; Thu, 03 Oct 2019 09:59:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xcdGSCHP; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393000AbfJCQ7A (ORCPT + 14 others); Thu, 3 Oct 2019 12:59:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:33204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405539AbfJCQrp (ORCPT ); Thu, 3 Oct 2019 12:47:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4FB9D20865; Thu, 3 Oct 2019 16:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570121264; bh=HiwsV5TpdnN+VgtHgx7ikNQaIghLwyuaB9/PgqbRLeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcdGSCHPPiPbVjNlKOczMHiCX9ZhQCuP3EnSq0khEV7AY1nZbjwJOSqvnsDkJHUBX dG09DkhRncupc9jIqrg5cTVEKoVP9mJJp2UUmOhjZBdZOtzWgm4RPln9RnYk89wQ+6 MNl73XkcfBvirVYP6f5X7ojqON74FiNB20ESq/q4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Ulf Hansson , Douglas Anderson , Sasha Levin Subject: [PATCH 5.3 214/344] mmc: core: Add helper function to indicate if SDIO IRQs is enabled Date: Thu, 3 Oct 2019 17:52:59 +0200 Message-Id: <20191003154601.403868995@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154540.062170222@linuxfoundation.org> References: <20191003154540.062170222@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ Upstream commit bd880b00697befb73eff7220ee20bdae4fdd487b ] 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 Reviewed-by: Douglas Anderson Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- include/linux/mmc/host.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.20.1 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4a351cb7f20fc..cf87c673cbb81 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);