From patchwork Thu Oct 3 15:52:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175173 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp607637ill; Thu, 3 Oct 2019 10:10:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVpEGzqivBki++brCpCln+prIqlRnOWvEOM6bHnzQVqPNRZ+Wwl8Q9S9wrMyt1ogBaCuu6 X-Received: by 2002:a50:cd1a:: with SMTP id z26mr10447043edi.75.1570122647495; Thu, 03 Oct 2019 10:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570122647; cv=none; d=google.com; s=arc-20160816; b=zijVWIzpbw7SxevpcxxQgvy/OaaAm1Kzl/6EPDiVLj0t467UvX+yNDHj6Oqc93ZRlw oyBDm8Obv6XUZl29ZuopxYFW20X4VoBnfuzIYU7NPTddEONiabYYb3A8KIUKWOyD72iu rdP5MkXyh5U+CjEAHSAT43jamllQW9GfW4DyyvElvu1GYp6HXNrTxmSMUtdeg/4VOvZr wEz1VBR+i0GQ/2L6NLjIvSDqVosmxKj5FNh11H77g2SDlavm8lR0RlIks2NpAHMt+h3W TWCIXdliqBNCAVdM2EAxQzqAPhooQBtIEXcyHKvHnbE/gdAPwJDWFR+O7PRBQOsk8scG Ld6Q== 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=j9l5qnGwpBRszCflNXeG5KF20Sa8/C1O76Qf1LyNtek=; b=Y9PLdUfC39Je5tOWuUjFEjGNoq10SENgxsPJXzYwTDrwtOFkwjAzf/WGvnPr9N47ke WB2oES7qV3klTNVOURBjlWrC+Z5DUwgm71nTu/uTJYL2T6WcatTMVeWkliSD/XJgfxU4 xB4f27SWgQ4eVB3r149mVGsUHONdmgKUNjXr3g23h6X65hPjXxAT926sg2lNM6bR+OQn fnAlLpP5ppAtIMPkeAGwUpwNAsbwKDe2nuvXn4S602lZ9ACUoX5zuxbvIc4e4yfkpH+W xYaAXV5CPTRRjVt8RAxqH7V1G95ek2jKU4enNywo8t0s5DHJ7NwpgEX2O7dAPgwrW8H1 y3sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bM53Q1+p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 b4si2210109edk.331.2019.10.03.10.10.47; Thu, 03 Oct 2019 10:10:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=bM53Q1+p; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393441AbfJCRKp (ORCPT + 27 others); Thu, 3 Oct 2019 13:10:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:40382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403963AbfJCQck (ORCPT ); Thu, 3 Oct 2019 12:32:40 -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 7789821783; Thu, 3 Oct 2019 16:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120360; bh=g187vndwyMzQFiDGPL8Bhd9t6/8cXzXzq/6xcOQIgj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bM53Q1+plmpAjz1vYRMkPOqSL52DxqptPRvp9XmP4hSazY1l7q+Ee4G5Gt61NsX8G 3HkccfH6KwWIEuRgygcguX7pDDHXwvp0rLWdGRUS8qKZz5IvVXrJsMwmuwxmWTqtfE m8uYrZG+u0lGA9yBn6sOvsV6HGHnGmJHIpWf4e3k= 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.2 192/313] mmc: core: Add helper function to indicate if SDIO IRQs is enabled Date: Thu, 3 Oct 2019 17:52:50 +0200 Message-Id: <20191003154551.890683592@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 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(+) -- 2.20.1 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7ac3755444d3d..56a8ad506072c 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);