diff mbox series

[v2,04/16] mmc: meson-gx: use _irqsave variant of spinlock

Message ID 20170821160301.21899-5-jbrunet@baylibre.com
State New
Headers show
Series [v2,01/16] mmc: meson-gx: fix mux mask definition | expand

Commit Message

Jerome Brunet Aug. 21, 2017, 4:02 p.m. UTC
spinlock used in interrupt handler should use the _irqsave variant

Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Reviewed-by: Kevin Hilman <khilman@baylibre.com>

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

---
 drivers/mmc/host/meson-gx-mmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Ulf Hansson Aug. 22, 2017, 11:08 a.m. UTC | #1
On 21 August 2017 at 18:02, Jerome Brunet <jbrunet@baylibre.com> wrote:
> spinlock used in interrupt handler should use the _irqsave variant


Exactly why is that needed?

>

> Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")

> Reviewed-by: Kevin Hilman <khilman@baylibre.com>

> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

> ---

>  drivers/mmc/host/meson-gx-mmc.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c

> index 8a74a048db88..a399fbd415f4 100644

> --- a/drivers/mmc/host/meson-gx-mmc.c

> +++ b/drivers/mmc/host/meson-gx-mmc.c

> @@ -727,6 +727,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)

>         struct mmc_command *cmd;

>         struct mmc_data *data;

>         u32 irq_en, status, raw_status;

> +       unsigned long flag;

>         irqreturn_t ret = IRQ_HANDLED;

>

>         if (WARN_ON(!host))

> @@ -739,7 +740,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)

>

>         data = cmd->data;

>

> -       spin_lock(&host->lock);

> +       spin_lock_irqsave(&host->lock, flag);

>         irq_en = readl(host->regs + SD_EMMC_IRQ_EN);

>         raw_status = readl(host->regs + SD_EMMC_STATUS);

>         status = raw_status & irq_en;

> @@ -806,7 +807,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)

>         if (ret == IRQ_HANDLED)

>                 meson_mmc_request_done(host->mmc, cmd->mrq);

>

> -       spin_unlock(&host->lock);

> +       spin_unlock_irqrestore(&host->lock, flag);

>         return ret;

>  }

>

> --

> 2.9.5

>


Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jerome Brunet Aug. 22, 2017, 11:41 a.m. UTC | #2
On Tue, 2017-08-22 at 13:08 +0200, Ulf Hansson wrote:
> On 21 August 2017 at 18:02, Jerome Brunet <jbrunet@baylibre.com> wrote:

> > spinlock used in interrupt handler should use the _irqsave variant

> 

> Exactly why is that needed?


That's a mistake left over from a debugging session. Thx for pointing it out.
I'll respin w/o it 

> 

> > 

> > Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")

> > Reviewed-by: Kevin Hilman <khilman@baylibre.com>

> > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

> > ---

> >  drivers/mmc/host/meson-gx-mmc.c | 5 +++--

> >  1 file changed, 3 insertions(+), 2 deletions(-)

> > 

> > diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-

> > mmc.c

> > index 8a74a048db88..a399fbd415f4 100644

> > --- a/drivers/mmc/host/meson-gx-mmc.c

> > +++ b/drivers/mmc/host/meson-gx-mmc.c

> > @@ -727,6 +727,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)

> >         struct mmc_command *cmd;

> >         struct mmc_data *data;

> >         u32 irq_en, status, raw_status;

> > +       unsigned long flag;

> >         irqreturn_t ret = IRQ_HANDLED;

> > 

> >         if (WARN_ON(!host))

> > @@ -739,7 +740,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)

> > 

> >         data = cmd->data;

> > 

> > -       spin_lock(&host->lock);

> > +       spin_lock_irqsave(&host->lock, flag);

> >         irq_en = readl(host->regs + SD_EMMC_IRQ_EN);

> >         raw_status = readl(host->regs + SD_EMMC_STATUS);

> >         status = raw_status & irq_en;

> > @@ -806,7 +807,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)

> >         if (ret == IRQ_HANDLED)

> >                 meson_mmc_request_done(host->mmc, cmd->mrq);

> > 

> > -       spin_unlock(&host->lock);

> > +       spin_unlock_irqrestore(&host->lock, flag);

> >         return ret;

> >  }

> > 

> > --

> > 2.9.5

> > 

> 

> Kind regards

> Uffe


--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 8a74a048db88..a399fbd415f4 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -727,6 +727,7 @@  static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 	struct mmc_command *cmd;
 	struct mmc_data *data;
 	u32 irq_en, status, raw_status;
+	unsigned long flag;
 	irqreturn_t ret = IRQ_HANDLED;
 
 	if (WARN_ON(!host))
@@ -739,7 +740,7 @@  static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 
 	data = cmd->data;
 
-	spin_lock(&host->lock);
+	spin_lock_irqsave(&host->lock, flag);
 	irq_en = readl(host->regs + SD_EMMC_IRQ_EN);
 	raw_status = readl(host->regs + SD_EMMC_STATUS);
 	status = raw_status & irq_en;
@@ -806,7 +807,7 @@  static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 	if (ret == IRQ_HANDLED)
 		meson_mmc_request_done(host->mmc, cmd->mrq);
 
-	spin_unlock(&host->lock);
+	spin_unlock_irqrestore(&host->lock, flag);
 	return ret;
 }