Re: [PATCH] spi: nxp-xspi: Use reinit_completion() for repeated operations
From: Felix Gu
Date: Wed Mar 04 2026 - 07:40:59 EST
On Wed, Mar 4, 2026 at 3:23 PM Bough Chen <haibo.chen@xxxxxxx> wrote:
>
> > -----Original Message-----
> > From: Felix Gu <ustc.gu@xxxxxxxxx>
> > Sent: 2026年3月3日 21:21
> > To: Han Xu <han.xu@xxxxxxx>; Bough Chen <haibo.chen@xxxxxxx>; Mark
> > Brown <broonie@xxxxxxxxxx>; Frank Li <frank.li@xxxxxxx>
> > Cc: linux-spi@xxxxxxxxxxxxxxx; imx@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> > Felix Gu <ustc.gu@xxxxxxxxx>
> > Subject: [PATCH] spi: nxp-xspi: Use reinit_completion() for repeated operations
> >
> > The driver currently calls init_completion() during every spi_mem_op.
> > Tchnically it may work, but it's not the recommended pattern.
> >
> > According to the kernel documentation: 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.
> >
> > So moves the initial initialization to probe function and uses
> > reinit_completion() for subsequent perations.
>
> Hi Felix,
>
> Good catch, I think spi-nxp-fspi.c and spi-fsl-qspi.c also have the same issue, can you help fix?
>
> As Frank's comment, there is one typo: perations -> operations, please fix it and feel free to add my tag in next version.
> Reviewed-by: Haibo Chen <haibo.chen@xxxxxxx>
>
> Regards
> Haibo Chen
Hi Bough and Frank,
Thanks for review, I will send V2 for this.
Best regards,
Felix