2024-04-19 14:15:27

by Michael Walle

[permalink] [raw]
Subject: [PATCH v2 6/6] mtd: spi-nor: introduce support for displaying deprecation message

SPI-NOR will automatically detect the attached flash device most of the
time. We cannot easily find out if boards are using a given flash.
Therefore, add a .deprecation_version to the flash_info struct which
indicates the kernel version after which the driver support will be
removed.

Signed-off-by: Michael Walle <[email protected]>
---
drivers/mtd/spi-nor/core.c | 11 ++++++++++-
drivers/mtd/spi-nor/core.h | 3 +++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 8e4ae1317870..bed5209b94de 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3323,7 +3323,16 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
* some partitions may be marked read-only, and we don't want to loose
* that information, even if it's not 100% accurate.
*/
- return jinfo ?: info;
+ if (jinfo)
+ info = jinfo;
+
+ if (info && info->deprecation_version)
+ pr_warn("Your board is using a SPI NOR flash (%s) with deprecated driver\n"
+ "support. It will be removed after kernel version %s.\n"
+ "If you feel this shouldn't be the case, please contact us at\n"
+ "[email protected]\n",
+ info->name, info->deprecation_version);
+ return info;
}

static u32
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 1516b6d0dc37..984155d10fd8 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -447,6 +447,8 @@ struct spi_nor_id {
* @id: pointer to struct spi_nor_id or NULL, which means "no ID" (mostly
* older chips).
* @name: (obsolete) the name of the flash. Do not set it for new additions.
+ * @deprecation_version: the kernel version after which the support for
+ * this flash will be removed.
* @size: the size of the flash in bytes.
* @sector_size: (optional) the size listed here is what works with
* SPINOR_OP_SE, which isn't necessarily called a "sector" by
@@ -504,6 +506,7 @@ struct spi_nor_id {
struct flash_info {
char *name;
const struct spi_nor_id *id;
+ const char *deprecation_version;
size_t size;
unsigned sector_size;
u16 page_size;
--
2.39.2



2024-04-19 18:38:48

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH v2 6/6] mtd: spi-nor: introduce support for displaying deprecation message

On Fri, Apr 19 2024, Michael Walle wrote:

> SPI-NOR will automatically detect the attached flash device most of the
> time. We cannot easily find out if boards are using a given flash.
> Therefore, add a .deprecation_version to the flash_info struct which
> indicates the kernel version after which the driver support will be
> removed.
>
> Signed-off-by: Michael Walle <[email protected]>

Reviewed-by: Pratyush Yadav <[email protected]>

Would also like to get an ACK from Tudor for this patch.

--
Regards,
Pratyush Yadav

2024-04-22 06:08:22

by Tudor Ambarus

[permalink] [raw]
Subject: Re: [PATCH v2 6/6] mtd: spi-nor: introduce support for displaying deprecation message



On 4/19/24 15:12, Michael Walle wrote:
> SPI-NOR will automatically detect the attached flash device most of the

SPI NOR. Looks good. Please follow up with a patch in the same patch set
to use deprecation_version, otherwise we introduce code that's not used
and we risk to get patches removing it.

Reviewed-by: Tudor Ambarus <[email protected]>

2024-04-22 06:43:07

by Tudor Ambarus

[permalink] [raw]
Subject: Re: [PATCH v2 6/6] mtd: spi-nor: introduce support for displaying deprecation message



On 4/19/24 15:12, Michael Walle wrote:
> + if (info && info->deprecation_version)

and here you won't need to check for info again

2024-04-22 10:00:12

by Michael Walle

[permalink] [raw]
Subject: Re: [PATCH v2 6/6] mtd: spi-nor: introduce support for displaying deprecation message

On Mon Apr 22, 2024 at 8:06 AM CEST, Tudor Ambarus wrote:
> On 4/19/24 15:12, Michael Walle wrote:
> > SPI-NOR will automatically detect the attached flash device most of the
>
> SPI NOR. Looks good. Please follow up with a patch in the same patch set
> to use deprecation_version, otherwise we introduce code that's not used
> and we risk to get patches removing it.

I missed the RFC tag this time. My plan was actually to have this
patch already reviewed and then repost it with a deprecation of
some flashes.

But apart from that, it's the nature of this flag that it might be
unused from time to time.

> Reviewed-by: Tudor Ambarus <[email protected]>

Thanks!

-michael


Attachments:
signature.asc (305.00 B)