mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <mwalle@kernel.org>,
	Takahiro Kuwano <takahiro.kuwano@infineon.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] mtd: spi-nor: Unprepare legacy controllers upon RWW wait interruption
Date: Wed, 12 Aug 2026 12:52:48 +0300	[thread overview]
Message-ID: <e0d2710a-2a67-40e0-aacb-5d18742cea76@linaro.org> (raw)
In-Reply-To: <20260811-perso-rww-fixes-v1-1-5866a70e5d1c@bootlin.com>



On 8/11/26 6:56 PM, Miquel Raynal wrote:
> All the parallel locking helpers (spi_nor_prep_and_lock(),
> spi_nor_prep_and_lock_pe() and spi_nor_prep_and_lock_rd()) call
> spi_nor_prep() then wait with a killable sleep. If the sleep gets
> killed, we leave the controller in its prepared state.
> 
> Call ->unprepare() in these cases.


We don't even care about SPI NOR controllers. I stopped adding/accepting
new support for them few years ago, so that we encourage people to update
the drivers to use SPI MEM.

The alternative is to drop prep unprep entirely.

Anyway, all good, regardless the path chosen:

Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> 
> Fixes: 74df43b3f626 ("mtd: spi-nor: Enhance locking to support reads while writes")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/mtd/spi-nor/core.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 8bc117b46e02..250e996284f9 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1346,6 +1346,9 @@ int spi_nor_prep_and_lock(struct spi_nor *nor)
>  		ret = wait_event_killable(nor->rww.wait,
>  					  spi_nor_rww_start_exclusive(nor));
>  
> +	if (ret)
> +		spi_nor_unprep(nor);
> +
>  	return ret;
>  }
>  
> @@ -1417,6 +1420,9 @@ static int spi_nor_prep_and_lock_pe(struct spi_nor *nor, loff_t start, size_t le
>  		ret = wait_event_killable(nor->rww.wait,
>  					  spi_nor_rww_start_pe(nor, start, len));
>  
> +	if (ret)
> +		spi_nor_unprep(nor);
> +
>  	return ret;
>  }
>  
> @@ -1490,6 +1496,9 @@ static int spi_nor_prep_and_lock_rd(struct spi_nor *nor, loff_t start, size_t le
>  		ret = wait_event_killable(nor->rww.wait,
>  					  spi_nor_rww_start_rd(nor, start, len));
>  
> +	if (ret)
> +		spi_nor_unprep(nor);
> +
>  	return ret;
>  }
>  
> 
> ---
> base-commit: db5f6418501f9795a96026b764d747179a231b2b
> change-id: 20260811-perso-rww-fixes-016cdd229647
> 
> Best regards,


  parent reply	other threads:[~2026-08-12  9:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 15:56 Miquel Raynal
2026-08-12  9:44 ` Michael Walle
2026-08-12 10:05   ` Miquel Raynal
2026-08-12 10:33     ` Michael Walle
2026-08-12  9:52 ` Tudor Ambarus [this message]
2026-08-12 10:02   ` Miquel Raynal
2026-09-04 13:40 ` Michael Walle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0d2710a-2a67-40e0-aacb-5d18742cea76@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=takahiro.kuwano@infineon.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®