From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD375C3A5A6 for ; Sun, 22 Sep 2019 19:14:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B18A920882 for ; Sun, 22 Sep 2019 19:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569179665; bh=DWNzfLJ61MFerPbmG0E1WG/O8uncf6ZwntcksS8TIQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JQn/LwjmwI3KsUQ+j5Jzpezu1MCluN8bm2srk+BkJF6AIGkm79KLBJja3itKHWfZE 40SFifrVJ4SOCpBFq8VbLBGFrxNnWsLs5MkcD1cFQx3eRgtB56ewuOHh56a9iMu207 SbmEzi2WlRSkMA5SpISswgYldoAHp5x+xLVirR9U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436878AbfIVTOY (ORCPT ); Sun, 22 Sep 2019 15:14:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:59352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394715AbfIVS47 (ORCPT ); Sun, 22 Sep 2019 14:56:59 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AAE29214D9; Sun, 22 Sep 2019 18:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178618; bh=DWNzfLJ61MFerPbmG0E1WG/O8uncf6ZwntcksS8TIQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAsncWrgT/ljNBFfG4pEXwXNL74g73wOVvJKQxcY7BhBXZ+mcqlFFcdjoP/V84+Dj lhPBdNSWA6yP2EalSOkJAzV+oADG/mVxXp6YpSSQqXAbC/qb5z4QDVeGrN0rIExTjE fM6ElUd9wE7aSURTdVBvg5tHyJH3kWfD/HEGdU9s= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Matthias Kaehlcke , Douglas Anderson , Sasha Levin , linux-mmc@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 117/128] mmc: core: Add helper function to indicate if SDIO IRQs is enabled Date: Sun, 22 Sep 2019 14:54:07 -0400 Message-Id: <20190922185418.2158-117-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922185418.2158-1-sashal@kernel.org> References: <20190922185418.2158-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 2ff52de1c2b89..840462ed1ec7e 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -488,6 +488,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); -- 2.20.1