* [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag
@ 2026-04-17 7:17 tkuw584924
2026-04-17 8:49 ` Miquel Raynal
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tkuw584924 @ 2026-04-17 7:17 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Takahiro Kuwano
From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
NO_OP_CHIP_ERASE flag is no longer used.
Remove definition and references of the flag in core and debugfs.
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
---
Changes in v2:
- Collect R-b from Tudor
- Just drop NO_OP_CHIP_ERASE and leave the rest of bit assignment as is
- Copy to <linux-kernel@vger.kernel.org>
---
drivers/mtd/spi-nor/core.c | 3 +--
drivers/mtd/spi-nor/core.h | 6 ++++--
drivers/mtd/spi-nor/debugfs.c | 7 ++-----
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index e6c1fda61f57..278b3fd0996e 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1787,8 +1787,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
return ret;
/* chip (die) erase? */
- if ((len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) ||
- multi_die_erase) {
+ if (len == mtd->size || multi_die_erase) {
ret = spi_nor_erase_dice(nor, addr, len, die_size);
if (ret)
goto erase_err;
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index e838c40a2589..fd9475ca4530 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -121,10 +121,12 @@
SPI_MEM_OP_NO_ADDR, \
SPI_MEM_OP_NO_DATA)
-/* Keep these in sync with the list in debugfs.c */
+/*
+ * This could contain holes, if adding a new flag use the first free spot.
+ * Keep the flags in sync with the list in debugfs.c
+ */
enum spi_nor_option_flags {
SNOR_F_HAS_SR_TB = BIT(0),
- SNOR_F_NO_OP_CHIP_ERASE = BIT(1),
SNOR_F_BROKEN_RESET = BIT(2),
SNOR_F_4B_OPCODES = BIT(3),
SNOR_F_HAS_4BAIT = BIT(4),
diff --git a/drivers/mtd/spi-nor/debugfs.c b/drivers/mtd/spi-nor/debugfs.c
index fa6956144d2e..7505cbab75d6 100644
--- a/drivers/mtd/spi-nor/debugfs.c
+++ b/drivers/mtd/spi-nor/debugfs.c
@@ -12,7 +12,6 @@
#define SNOR_F_NAME(name) [ilog2(SNOR_F_##name)] = #name
static const char *const snor_f_names[] = {
SNOR_F_NAME(HAS_SR_TB),
- SNOR_F_NAME(NO_OP_CHIP_ERASE),
SNOR_F_NAME(BROKEN_RESET),
SNOR_F_NAME(4B_OPCODES),
SNOR_F_NAME(HAS_4BAIT),
@@ -136,10 +135,8 @@ static int spi_nor_params_show(struct seq_file *s, void *data)
}
}
- if (!(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
- string_get_size(params->size, 1, STRING_UNITS_2, buf, sizeof(buf));
- seq_printf(s, " %02x (%s)\n", nor->params->die_erase_opcode, buf);
- }
+ string_get_size(params->size, 1, STRING_UNITS_2, buf, sizeof(buf));
+ seq_printf(s, " %02x (%s)\n", nor->params->die_erase_opcode, buf);
seq_puts(s, "\nsector map\n");
seq_puts(s, " region (in hex) | erase mask | overlaid\n");
---
base-commit: ed7f4ffeda2d93a97bdfd11f5c9b2d3fe9c3e837
change-id: 20260416-die-erase-fix-e35a5221fdb0
Best regards,
--
Takahiro Kuwano <takahiro.kuwano@infineon.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag
2026-04-17 7:17 [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag tkuw584924
@ 2026-04-17 8:49 ` Miquel Raynal
2026-04-17 8:54 ` Michael Walle
2026-04-17 15:27 ` Tudor Ambarus
2 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-04-17 8:49 UTC (permalink / raw)
To: tkuw584924
Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
Vignesh Raghavendra, linux-mtd, linux-kernel, Takahiro Kuwano
On 17/04/2026 at 16:17:15 +09, tkuw584924@gmail.com wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
>
> NO_OP_CHIP_ERASE flag is no longer used.
> Remove definition and references of the flag in core and debugfs.
>
> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
> ---
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks for the comment about the bits renumbering Michael, I prefer this
version indeed.
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag
2026-04-17 7:17 [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag tkuw584924
2026-04-17 8:49 ` Miquel Raynal
@ 2026-04-17 8:54 ` Michael Walle
2026-04-17 15:27 ` Tudor Ambarus
2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2026-04-17 8:54 UTC (permalink / raw)
To: tkuw584924, Tudor Ambarus, Pratyush Yadav, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Takahiro Kuwano
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
On Fri Apr 17, 2026 at 9:17 AM CEST, tkuw584924 wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
>
> NO_OP_CHIP_ERASE flag is no longer used.
> Remove definition and references of the flag in core and debugfs.
>
> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Michael Walle <mwalle@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag
2026-04-17 7:17 [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag tkuw584924
2026-04-17 8:49 ` Miquel Raynal
2026-04-17 8:54 ` Michael Walle
@ 2026-04-17 15:27 ` Tudor Ambarus
2 siblings, 0 replies; 4+ messages in thread
From: Tudor Ambarus @ 2026-04-17 15:27 UTC (permalink / raw)
To: tkuw584924, Pratyush Yadav, Michael Walle, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Takahiro Kuwano
On 4/17/26 10:17 AM, tkuw584924@gmail.com wrote:
> - Copy to <linux-kernel@vger.kernel.org>
cool, thanks.
see what sashiko discovered:
https://sashiko.dev/#/patchset/20260417-die-erase-fix-v2-1-73bb7004ebad%40infineon.com
and the patch
https://lore.kernel.org/linux-mtd/20260417-fix-oob-read-spi-nor-v1-1-2132e61a684a@linaro.org/T/#u
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-17 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 7:17 [PATCH v2] mtd: spi-nor: remove unused NO_OP_CHIP_ERASE flag tkuw584924
2026-04-17 8:49 ` Miquel Raynal
2026-04-17 8:54 ` Michael Walle
2026-04-17 15:27 ` Tudor Ambarus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox