Skip to content

Commit

Permalink
mtd: rawnand: meson: only initialize the RB completion once
Browse files Browse the repository at this point in the history
Documentation/scheduler/completion.txt states:
  Calling init_completion() on the same completion object twice is
  most likely a bug as it re-initializes the queue to an empty queue and
  enqueued tasks could get "lost" - use reinit_completion() in that case,
  but be aware of other races.

Initialize nfc->completion in meson_nfc_probe using init_completion and
change the call in meson_nfc_queue_rb to reinit_completion so the logic
matches what the documentation suggests.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by:Liang Yang <liang.yang@amlogic.com>
Acked-by: Liang Yang <liang.yang@amlogic.com>
Tested-by:Liang Yang <liang.yang@amlogic.com>
Acked-by: Liang Yang <liang.yang@amlogic.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
  • Loading branch information
Martin Blumenstingl authored and Miquel Raynal committed Apr 18, 2019
1 parent c96ffed commit 39e0195
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mtd/nand/raw/meson_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static int meson_nfc_queue_rb(struct meson_nfc *nfc, int timeout_ms)
cfg |= NFC_RB_IRQ_EN;
writel(cfg, nfc->reg_base + NFC_REG_CFG);

init_completion(&nfc->completion);
reinit_completion(&nfc->completion);

/* use the max erase time as the maximum clock for waiting R/B */
cmd = NFC_CMD_RB | NFC_CMD_RB_INT
Expand Down Expand Up @@ -1380,6 +1380,7 @@ static int meson_nfc_probe(struct platform_device *pdev)

nand_controller_init(&nfc->controller);
INIT_LIST_HEAD(&nfc->chips);
init_completion(&nfc->completion);

nfc->dev = dev;

Expand Down

0 comments on commit 39e0195

Please sign in to comment.