Commit 0d9270f2 authored by Michael Walle's avatar Michael Walle Committed by Tudor Ambarus
Browse files

mtd: spi-nor: sysfs: hide manufacturer if it is not set



The manufacturer may be optional when pure SFDP flashes are supported.
Hide the sysfs property if no manufacturer is set.

Signed-off-by: default avatarMichael Walle <michael@walle.cc>
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: default avatarTakahiro Kuwano <Takahiro.Kuwano@infineon.com>
Link: https://lore.kernel.org/r/20220810220654.1297699-3-michael@walle.cc
parent 7d388551
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@ KernelVersion: 5.14
Contact:	linux-mtd@lists.infradead.org
Description:	(RO) Manufacturer of the SPI NOR flash.

		The attribute is not present if the flash device isn't
		known to the kernel and is only probed by its SFDP
		tables.

What:		/sys/bus/spi/devices/.../spi-nor/partname
Date:		April 2021
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
	struct spi_mem *spimem = spi_get_drvdata(spi);
	struct spi_nor *nor = spi_mem_get_drvdata(spimem);

	if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer)
		return 0;
	if (attr == &dev_attr_jedec_id.attr && !nor->info->id_len)
		return 0;