lkml.org 
[lkml]   [2019]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 135/211] mmc: core: Add helper function to indicate if SDIO IRQs is enabled
    Date
    From: Ulf Hansson <ulf.hansson@linaro.org>

    [ 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 <mka@chromium.org>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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


    \
     
     \ /
      Last update: 2019-10-03 18:21    [W:5.274 / U:0.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site