Skip to content

Commit fc2efaf

Browse files
jaimeliaoambarus
authored andcommitted
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 <jaimeliao@mxic.com.tw> Reviewed-by: Michael Walle <michael@walle.cc> [ta: update commit subject and description and the sysfs description] Link: https://lore.kernel.org/r/20231215082138.16063-4-tudor.ambarus@linaro.org Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
1 parent 15eb830 commit fc2efaf

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ KernelVersion: 5.14
2525
Contact: linux-mtd@lists.infradead.org
2626
Description: (RO) Part name of the SPI NOR flash.
2727

28+
The attribute is optional. User space should not rely on
29+
it to be present or even correct. Instead, user space
30+
should read the jedec_id attribute.
2831

2932
What: /sys/bus/spi/devices/.../spi-nor/sfdp
3033
Date: April 2021

drivers/mtd/spi-nor/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
7878

7979
if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer)
8080
return 0;
81+
if (attr == &dev_attr_partname.attr && !nor->info->name)
82+
return 0;
8183
if (attr == &dev_attr_jedec_id.attr && !nor->info->id && !nor->id)
8284
return 0;
8385

0 commit comments

Comments
 (0)