aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaimeLiao <[email protected]>2023-12-15 10:21:37 +0200
committerTudor Ambarus <[email protected]>2023-12-19 05:08:23 +0200
commitfc2efaf90a4538781aac26cf44d705c1d93fb9f5 (patch)
tree52b3ff42cf5ffd0d7b5a785a93255067b81ab9da
parent15eb8303bb424e36a7f5f411c6bb489bc0c1c06e (diff)
mtd: spi-nor: sysfs: hide the flash name if not set
The flash name is not reliable as we saw flash ID collisions. Hide the flash name if not set. Signed-off-by: JaimeLiao <[email protected]> Reviewed-by: Michael Walle <[email protected]> [ta: update commit subject and description and the sysfs description] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tudor Ambarus <[email protected]>
-rw-r--r--Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor3
-rw-r--r--drivers/mtd/spi-nor/sysfs.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
index c800621eff95..9ed5582ddea2 100644
--- a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
+++ b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
@@ -25,6 +25,9 @@ KernelVersion: 5.14
Description: (RO) Part name of the SPI NOR flash.
+ The attribute is optional. User space should not rely on
+ it to be present or even correct. Instead, user space
+ should read the jedec_id attribute.
What: /sys/bus/spi/devices/.../spi-nor/sfdp
Date: April 2021
diff --git a/drivers/mtd/spi-nor/sysfs.c b/drivers/mtd/spi-nor/sysfs.c
index 2dfdc555a69f..96064e4babf0 100644
--- a/drivers/mtd/spi-nor/sysfs.c
+++ b/drivers/mtd/spi-nor/sysfs.c
@@ -78,6 +78,8 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer)
return 0;
+ if (attr == &dev_attr_partname.attr && !nor->info->name)
+ return 0;
if (attr == &dev_attr_jedec_id.attr && !nor->info->id && !nor->id)
return 0;