Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

JaimeLiao and committed by
Tudor Ambarus
fc2efaf9 15eb8303

+5
+3
Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
··· 25 25 Contact: linux-mtd@lists.infradead.org 26 26 Description: (RO) Part name of the SPI NOR flash. 27 27 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. 28 31 29 32 What: /sys/bus/spi/devices/.../spi-nor/sfdp 30 33 Date: April 2021
+2
drivers/mtd/spi-nor/sysfs.c
··· 78 78 79 79 if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer) 80 80 return 0; 81 + if (attr == &dev_attr_partname.attr && !nor->info->name) 82 + return 0; 81 83 if (attr == &dev_attr_jedec_id.attr && !nor->info->id && !nor->id) 82 84 return 0; 83 85