Skip to content

Commit

Permalink
mmc: sh_mmcif: sg_miter must not be atomic
Browse files Browse the repository at this point in the history
All the sglist iterations happen in the *threaded* interrupt handler and
that context is not atomic, so don't request an atomic sglist miter. Using
an atomic miter results in "BUG: scheduling while atomic" splats.

Reported-by: Geert Uytterhoeven <[email protected]>
Fixes: 27b5727 ("mmc: sh_mmcif: Use sg_miter for PIO")
Tested-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
  • Loading branch information
linusw authored and storulf committed Feb 28, 2024
1 parent 44d41bf commit 727cba7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/mmc/host/sh_mmcif.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ static void sh_mmcif_single_read(struct sh_mmcif_host *host,
BLOCK_SIZE_MASK) + 3;

sg_miter_start(&host->sg_miter, data->sg, data->sg_len,
SG_MITER_ATOMIC | SG_MITER_TO_SG);
SG_MITER_TO_SG);

host->wait_for = MMCIF_WAIT_FOR_READ;

Expand Down Expand Up @@ -662,7 +662,7 @@ static void sh_mmcif_multi_read(struct sh_mmcif_host *host,
BLOCK_SIZE_MASK;

sg_miter_start(&host->sg_miter, data->sg, data->sg_len,
SG_MITER_ATOMIC | SG_MITER_TO_SG);
SG_MITER_TO_SG);

host->wait_for = MMCIF_WAIT_FOR_MREAD;

Expand Down Expand Up @@ -710,7 +710,7 @@ static void sh_mmcif_single_write(struct sh_mmcif_host *host,
BLOCK_SIZE_MASK) + 3;

sg_miter_start(&host->sg_miter, data->sg, data->sg_len,
SG_MITER_ATOMIC | SG_MITER_FROM_SG);
SG_MITER_FROM_SG);

host->wait_for = MMCIF_WAIT_FOR_WRITE;

Expand Down Expand Up @@ -765,7 +765,7 @@ static void sh_mmcif_multi_write(struct sh_mmcif_host *host,
BLOCK_SIZE_MASK;

sg_miter_start(&host->sg_miter, data->sg, data->sg_len,
SG_MITER_ATOMIC | SG_MITER_FROM_SG);
SG_MITER_FROM_SG);

host->wait_for = MMCIF_WAIT_FOR_MWRITE;

Expand Down

0 comments on commit 727cba7

Please sign in to comment.