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 <mwalle@kernel.org>
---
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"
+ "linux-mtd@lists.infradead.org\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
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
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 <tudor.ambarus@linaro.org>
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 <tudor.ambarus@linaro.org> Thanks! -michael
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 <mwalle@kernel.org> Reviewed-by: Pratyush Yadav <pratyush@kernel.org> Would also like to get an ACK from Tudor for this patch. -- Regards, Pratyush Yadav
© 2016 - 2026 Red Hat, Inc.