2019-04-11 22:03:55

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 0/4] meson-nand: small code improvements

This series comes with four small improvements for the meson-nand
driver:
* the first patches are replacing open-coded logic with existing
utilities / helpers
* the third patch drops some unnecessary casting after changing
the type of the info buffer parameter from "u8 *" to "void *"
* the fourth patch adjusts the usage of init_completion with what the
documentation suggests

I have tested these patches as best as I could on my Meson8m2 board
using experimental patches on top of this series which add support for
this older SoC to the meson-nand driver.

Liang, can you please test this series on GXL and/or AXG so I don't
break the NFC driver on these newer SoCs? All of my GXL/GXM boards
have eMMC instead of raw NAND, so I cannot test it on these newer SoCs
myself.

This series is meant to be applied to the nand/next tree.


Martin Blumenstingl (4):
mtd: rawnand: meson: use struct_size macro
mtd: rawnand: meson: use of_property_count_elems_of_size helper
mtd: rawnand: meson: use a void pointer for meson_nfc_dma_buffer_setup
mtd: rawnand: meson: only initialize the RB completion once

drivers/mtd/nand/raw/meson_nand.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

--
2.21.0


2019-04-11 22:02:36

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 1/4] mtd: rawnand: meson: use struct_size macro

Use the recently introduced struct_size macro instead of open-coding
it's logic.
No functional changes.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/mtd/nand/raw/meson_nand.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index cb0b03e36a35..c1a6af57dab5 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1242,8 +1242,7 @@ meson_nfc_nand_chip_init(struct device *dev,
return -EINVAL;
}

- meson_chip = devm_kzalloc(dev,
- sizeof(*meson_chip) + (nsels * sizeof(u8)),
+ meson_chip = devm_kzalloc(dev, struct_size(meson_chip, sels, nsels),
GFP_KERNEL);
if (!meson_chip)
return -ENOMEM;
--
2.21.0

2019-04-11 22:02:41

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 3/4] mtd: rawnand: meson: use a void pointer for meson_nfc_dma_buffer_setup

This simplifies the code because it gets rid of the casts to an
u8-pointer when passing "info_buf" from struct meson_nfc_nand_chip.
Also it gets rid of the cast of the u8 databuf pointer to a void
pointer.
The logic inside meson_nfc_dma_buffer_setup() doesn't care about the
pointer types themselves because it only passes them to dma_map_single
which accepts a void pointer.

No functional changes.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/mtd/nand/raw/meson_nand.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 9a6023638101..57cc4bd3f665 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -470,15 +470,15 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips,
return ret;
}

-static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, u8 *databuf,
- int datalen, u8 *infobuf, int infolen,
+static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, void *databuf,
+ int datalen, void *infobuf, int infolen,
enum dma_data_direction dir)
{
struct meson_nfc *nfc = nand_get_controller_data(nand);
u32 cmd;
int ret = 0;

- nfc->daddr = dma_map_single(nfc->dev, (void *)databuf, datalen, dir);
+ nfc->daddr = dma_map_single(nfc->dev, databuf, datalen, dir);
ret = dma_mapping_error(nfc->dev, nfc->daddr);
if (ret) {
dev_err(nfc->dev, "DMA mapping error\n");
@@ -645,7 +645,7 @@ static int meson_nfc_write_page_sub(struct nand_chip *nand,
return ret;

ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf,
- data_len, (u8 *)meson_chip->info_buf,
+ data_len, meson_chip->info_buf,
info_len, DMA_TO_DEVICE);
if (ret)
return ret;
@@ -729,7 +729,7 @@ static int meson_nfc_read_page_sub(struct nand_chip *nand,
return ret;

ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf,
- data_len, (u8 *)meson_chip->info_buf,
+ data_len, meson_chip->info_buf,
info_len, DMA_FROM_DEVICE);
if (ret)
return ret;
--
2.21.0

2019-04-11 22:03:12

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 2/4] mtd: rawnand: meson: use of_property_count_elems_of_size helper

Use the of_property_count_elems_of_size() helper instead of open-coding
it's logic. As a bonus this will now error out if the "reg" property
values use an incorrect size (anything other than sizeof(u32)).

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/mtd/nand/raw/meson_nand.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index c1a6af57dab5..9a6023638101 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1233,10 +1233,7 @@ meson_nfc_nand_chip_init(struct device *dev,
int ret, i;
u32 tmp, nsels;

- if (!of_get_property(np, "reg", &nsels))
- return -EINVAL;
-
- nsels /= sizeof(u32);
+ nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32));
if (!nsels || nsels > MAX_CE_NUM) {
dev_err(dev, "invalid register property size\n");
return -EINVAL;
--
2.21.0

2019-04-11 23:04:46

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH 4/4] mtd: rawnand: meson: only initialize the RB completion once

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 <[email protected]>
---
drivers/mtd/nand/raw/meson_nand.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 57cc4bd3f665..ea57ddcec41e 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -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
@@ -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;

--
2.21.0

2019-04-15 06:03:28

by Liang Yang

[permalink] [raw]
Subject: Re: [PATCH 1/4] mtd: rawnand: meson: use struct_size macro

Hello Martin and Miquel,

On 2019/4/12 6:00, Martin Blumenstingl wrote:
> Use the recently introduced struct_size macro instead of open-coding
> it's logic.
> No functional changes.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>
> ---
> drivers/mtd/nand/raw/meson_nand.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index cb0b03e36a35..c1a6af57dab5 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -1242,8 +1242,7 @@ meson_nfc_nand_chip_init(struct device *dev,
> return -EINVAL;
> }
>
> - meson_chip = devm_kzalloc(dev,
> - sizeof(*meson_chip) + (nsels * sizeof(u8)),
> + meson_chip = devm_kzalloc(dev, struct_size(meson_chip, sels, nsels),
> GFP_KERNEL);
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
> if (!meson_chip)
> return -ENOMEM;
>

2019-04-15 06:03:39

by Liang Yang

[permalink] [raw]
Subject: Re: [PATCH 2/4] mtd: rawnand: meson: use of_property_count_elems_of_size helper


On 2019/4/12 6:00, Martin Blumenstingl wrote:
> Use the of_property_count_elems_of_size() helper instead of open-coding
> it's logic. As a bonus this will now error out if the "reg" property
> values use an incorrect size (anything other than sizeof(u32)).
>
> Signed-off-by: Martin Blumenstingl <[email protected]>
> ---
> drivers/mtd/nand/raw/meson_nand.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index c1a6af57dab5..9a6023638101 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -1233,10 +1233,7 @@ meson_nfc_nand_chip_init(struct device *dev,
> int ret, i;
> u32 tmp, nsels;
>
> - if (!of_get_property(np, "reg", &nsels))
> - return -EINVAL;
> -
> - nsels /= sizeof(u32);
> + nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32));
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
> if (!nsels || nsels > MAX_CE_NUM) {
> dev_err(dev, "invalid register property size\n");
> return -EINVAL;
>

2019-04-15 06:05:20

by Liang Yang

[permalink] [raw]
Subject: Re: [PATCH 3/4] mtd: rawnand: meson: use a void pointer for meson_nfc_dma_buffer_setup


On 2019/4/12 6:00, Martin Blumenstingl wrote:
> This simplifies the code because it gets rid of the casts to an
> u8-pointer when passing "info_buf" from struct meson_nfc_nand_chip.
> Also it gets rid of the cast of the u8 databuf pointer to a void
> pointer.
> The logic inside meson_nfc_dma_buffer_setup() doesn't care about the
> pointer types themselves because it only passes them to dma_map_single
> which accepts a void pointer.
>
> No functional changes.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>
> ---
> drivers/mtd/nand/raw/meson_nand.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index 9a6023638101..57cc4bd3f665 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -470,15 +470,15 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips,
> return ret;
> }
>
> -static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, u8 *databuf,
> - int datalen, u8 *infobuf, int infolen,
> +static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, void *databuf,
> + int datalen, void *infobuf, int infolen,
> enum dma_data_direction dir)
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
> {
> struct meson_nfc *nfc = nand_get_controller_data(nand);
> u32 cmd;
> int ret = 0;
>
> - nfc->daddr = dma_map_single(nfc->dev, (void *)databuf, datalen, dir);
> + nfc->daddr = dma_map_single(nfc->dev, databuf, datalen, dir);
> ret = dma_mapping_error(nfc->dev, nfc->daddr);
> if (ret) {
> dev_err(nfc->dev, "DMA mapping error\n");
> @@ -645,7 +645,7 @@ static int meson_nfc_write_page_sub(struct nand_chip *nand,
> return ret;
>
> ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf,
> - data_len, (u8 *)meson_chip->info_buf,
> + data_len, meson_chip->info_buf,
> info_len, DMA_TO_DEVICE);
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
> if (ret)
> return ret;
> @@ -729,7 +729,7 @@ static int meson_nfc_read_page_sub(struct nand_chip *nand,
> return ret;
>
> ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf,
> - data_len, (u8 *)meson_chip->info_buf,
> + data_len, meson_chip->info_buf,
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
> info_len, DMA_FROM_DEVICE);
> if (ret)
> return ret;
>

2019-04-15 06:06:05

by Liang Yang

[permalink] [raw]
Subject: Re: [PATCH 4/4] mtd: rawnand: meson: only initialize the RB completion once


On 2019/4/12 6:00, Martin Blumenstingl wrote:
> 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 <[email protected]>
> ---
> drivers/mtd/nand/raw/meson_nand.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index 57cc4bd3f665..ea57ddcec41e 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -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);
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
>
> /* use the max erase time as the maximum clock for waiting R/B */
> cmd = NFC_CMD_RB | NFC_CMD_RB_INT
> @@ -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);
Tested-by:Liang Yang <[email protected]>
Acked-by: Liang Yang <[email protected]>
>
> nfc->dev = dev;
>
>

2019-04-18 16:24:31

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH 0/4] meson-nand: small code improvements

Hi Martin,

Martin Blumenstingl <[email protected]> wrote on Fri,
12 Apr 2019 00:00:52 +0200:

> This series comes with four small improvements for the meson-nand
> driver:
> * the first patches are replacing open-coded logic with existing
> utilities / helpers
> * the third patch drops some unnecessary casting after changing
> the type of the info buffer parameter from "u8 *" to "void *"
> * the fourth patch adjusts the usage of init_completion with what the
> documentation suggests
>
> I have tested these patches as best as I could on my Meson8m2 board
> using experimental patches on top of this series which add support for
> this older SoC to the meson-nand driver.
>
> Liang, can you please test this series on GXL and/or AXG so I don't
> break the NFC driver on these newer SoCs? All of my GXL/GXM boards
> have eMMC instead of raw NAND, so I cannot test it on these newer SoCs
> myself.
>
> This series is meant to be applied to the nand/next tree.
>
>
> Martin Blumenstingl (4):
> mtd: rawnand: meson: use struct_size macro
> mtd: rawnand: meson: use of_property_count_elems_of_size helper
> mtd: rawnand: meson: use a void pointer for meson_nfc_dma_buffer_setup
> mtd: rawnand: meson: only initialize the RB completion once
>
> drivers/mtd/nand/raw/meson_nand.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>

Series applied to
https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git
branch nand/next.

Thanks,
Miquèl

2019-04-18 19:45:49

by Martin Blumenstingl

[permalink] [raw]
Subject: Re: [PATCH 4/4] mtd: rawnand: meson: only initialize the RB completion once

Hi Liang,

On Mon, Apr 15, 2019 at 8:04 AM Liang Yang <[email protected]> wrote:
>
>
> On 2019/4/12 6:00, Martin Blumenstingl wrote:
> > 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 <[email protected]>
> > ---
> > drivers/mtd/nand/raw/meson_nand.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> > index 57cc4bd3f665..ea57ddcec41e 100644
> > --- a/drivers/mtd/nand/raw/meson_nand.c
> > +++ b/drivers/mtd/nand/raw/meson_nand.c
> > @@ -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);
> Tested-by:Liang Yang <[email protected]>
> Acked-by: Liang Yang <[email protected]>
thank you for reviewing and testing my patches!

[...]
> Tested-by:Liang Yang <[email protected]>
> Acked-by: Liang Yang <[email protected]>
please consider the following note for future code-reviews:
most maintainers take the patch from patchwork and apply it to their git tree.
however, patchwork is not smart enough to detect when the same
Tested-by/Acked-by is sent multiple times.
this results in the same Tested-by/Acked-by being listed multiple
times in the final commit: [0]

what I do instead is to reply with one set of Tested-by/Acked-by
(below the author's Signed-off-by) which is then valid for the whole
patch.
There's no problem to have Tested-by and Acked-by at the same time,
the issue only shows up if you send Acked-by (or any other tag) for
the same patch multiple times.


Have a great day!
Regards,
Martin


[0] https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?h=nand/next&id=39e01956e2f70ff9f0e97db1a69c9847aa1d5d8b

2019-04-19 03:55:52

by Liang Yang

[permalink] [raw]
Subject: Re: [PATCH 4/4] mtd: rawnand: meson: only initialize the RB completion once

Hi Martin,

On 2019/4/19 3:44, Martin Blumenstingl wrote:
> Hi Liang,
>
> On Mon, Apr 15, 2019 at 8:04 AM Liang Yang <[email protected]> wrote:
>>
>>
>> On 2019/4/12 6:00, Martin Blumenstingl wrote:
>>> 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 <[email protected]>
>>> ---
>>> drivers/mtd/nand/raw/meson_nand.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
>>> index 57cc4bd3f665..ea57ddcec41e 100644
>>> --- a/drivers/mtd/nand/raw/meson_nand.c
>>> +++ b/drivers/mtd/nand/raw/meson_nand.c
>>> @@ -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);
>> Tested-by:Liang Yang <[email protected]>
>> Acked-by: Liang Yang <[email protected]>
> thank you for reviewing and testing my patches!
>
> [...]
>> Tested-by:Liang Yang <[email protected]>
>> Acked-by: Liang Yang <[email protected]>
> please consider the following note for future code-reviews:
> most maintainers take the patch from patchwork and apply it to their git tree.
> however, patchwork is not smart enough to detect when the same
> Tested-by/Acked-by is sent multiple times.
> this results in the same Tested-by/Acked-by being listed multiple
> times in the final commit: [0]
>
> what I do instead is to reply with one set of Tested-by/Acked-by
> (below the author's Signed-off-by) which is then valid for the whole
> patch.
> There's no problem to have Tested-by and Acked-by at the same time,
> the issue only shows up if you send Acked-by (or any other tag) for
> the same patch multiple times.
>
Thanks. Well, I known about it now.

>
> Have a great day!
> Regards,
> Martin
>
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?h=nand/next&id=39e01956e2f70ff9f0e97db1a69c9847aa1d5d8b
>
> .
>

2019-04-19 20:04:07

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH 4/4] mtd: rawnand: meson: only initialize the RB completion once

Hi Martin,

Martin Blumenstingl <[email protected]> wrote on Thu,
18 Apr 2019 21:44:05 +0200:

> Hi Liang,
>
> On Mon, Apr 15, 2019 at 8:04 AM Liang Yang <[email protected]> wrote:
> >
> >
> > On 2019/4/12 6:00, Martin Blumenstingl wrote:
> > > 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 <[email protected]>
> > > ---
> > > drivers/mtd/nand/raw/meson_nand.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> > > index 57cc4bd3f665..ea57ddcec41e 100644
> > > --- a/drivers/mtd/nand/raw/meson_nand.c
> > > +++ b/drivers/mtd/nand/raw/meson_nand.c
> > > @@ -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);
> > Tested-by:Liang Yang <[email protected]>
> > Acked-by: Liang Yang <[email protected]>
> thank you for reviewing and testing my patches!
>
> [...]
> > Tested-by:Liang Yang <[email protected]>
> > Acked-by: Liang Yang <[email protected]>
> please consider the following note for future code-reviews:
> most maintainers take the patch from patchwork and apply it to their git tree.
> however, patchwork is not smart enough to detect when the same
> Tested-by/Acked-by is sent multiple times.
> this results in the same Tested-by/Acked-by being listed multiple
> times in the final commit: [0]
>
> what I do instead is to reply with one set of Tested-by/Acked-by
> (below the author's Signed-off-by) which is then valid for the whole
> patch.
> There's no problem to have Tested-by and Acked-by at the same time,
> the issue only shows up if you send Acked-by (or any other tag) for
> the same patch multiple times.

Crap, I did not noticed that.

Thanks for pointing it. I don't have time right now to fix it and send
a new PR, I'll see in one week.


Thanks,
Miquèl