All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Tudor Ambarus <tudor.ambarus@microchip.com>,
	Pratyush Yadav <p.yadav@ti.com>, Michael Walle <michael@walle.cc>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: [PATCH 2/6] mtd: spi-nor: sysfs: hide manufacturer if it is not set
Date: Fri, 13 May 2022 15:35:16 +0200	[thread overview]
Message-ID: <20220513133520.3945820-3-michael@walle.cc> (raw)
In-Reply-To: <20220513133520.3945820-1-michael@walle.cc>

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

Signed-off-by: Michael Walle <michael@walle.cc>
---
 Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor | 3 +++
 drivers/mtd/spi-nor/sysfs.c                             | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
index e9ef69aef20b..c800621eff95 100644
--- a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
+++ b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
@@ -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
diff --git a/drivers/mtd/spi-nor/sysfs.c b/drivers/mtd/spi-nor/sysfs.c
index 4c3b351aef24..20563c1926f4 100644
--- a/drivers/mtd/spi-nor/sysfs.c
+++ b/drivers/mtd/spi-nor/sysfs.c
@@ -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;
 
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Michael Walle <michael@walle.cc>
To: Tudor Ambarus <tudor.ambarus@microchip.com>,
	Pratyush Yadav <p.yadav@ti.com>, Michael Walle <michael@walle.cc>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: [PATCH 2/6] mtd: spi-nor: sysfs: hide manufacturer if it is not set
Date: Fri, 13 May 2022 15:35:16 +0200	[thread overview]
Message-ID: <20220513133520.3945820-3-michael@walle.cc> (raw)
In-Reply-To: <20220513133520.3945820-1-michael@walle.cc>

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

Signed-off-by: Michael Walle <michael@walle.cc>
---
 Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor | 3 +++
 drivers/mtd/spi-nor/sysfs.c                             | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
index e9ef69aef20b..c800621eff95 100644
--- a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
+++ b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
@@ -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
diff --git a/drivers/mtd/spi-nor/sysfs.c b/drivers/mtd/spi-nor/sysfs.c
index 4c3b351aef24..20563c1926f4 100644
--- a/drivers/mtd/spi-nor/sysfs.c
+++ b/drivers/mtd/spi-nor/sysfs.c
@@ -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;
 
-- 
2.30.2


  parent reply	other threads:[~2022-05-13 13:36 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 13:35 [PATCH 0/6] mtd: spi-nor: generic flash driver Michael Walle
2022-05-13 13:35 ` Michael Walle
2022-05-13 13:35 ` [PATCH 1/6] mtd: spi-nor: hide jedec_id sysfs attribute if not present Michael Walle
2022-05-13 13:35   ` Michael Walle
2022-07-26 10:00   ` Takahiro Kuwano
2022-07-26 10:00     ` Takahiro Kuwano
2022-05-13 13:35 ` Michael Walle [this message]
2022-05-13 13:35   ` [PATCH 2/6] mtd: spi-nor: sysfs: hide manufacturer if it is not set Michael Walle
2022-07-26 10:04   ` Takahiro Kuwano
2022-07-26 10:04     ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 3/6] mtd: spi-nor: remember full JEDEC flash ID Michael Walle
2022-05-13 13:35   ` Michael Walle
2022-07-29  1:00   ` Takahiro Kuwano
2022-07-29  1:00     ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 4/6] mtd: spi-nor: move function declaration out of sfdp.h Michael Walle
2022-05-13 13:35   ` Michael Walle
2022-07-26 23:41   ` Takahiro Kuwano
2022-07-26 23:41     ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 5/6] mtd: spi-nor: add generic flash driver Michael Walle
2022-05-13 13:35   ` Michael Walle
2022-05-13 14:47   ` kernel test robot
2022-07-21  9:32     ` Biju Das
2022-07-21  9:32     ` Biju Das
2022-05-13 14:47     ` kernel test robot
2022-07-21  9:48     ` Michael Walle
2022-07-21  9:48       ` Michael Walle
2022-07-21  9:52       ` Biju Das
2022-07-21  9:52         ` Biju Das
2022-10-28 18:00         ` Biju Das
2022-10-28 18:00           ` Biju Das
2022-07-28  3:28   ` Tudor.Ambarus
2022-07-28  3:28     ` Tudor.Ambarus
2022-07-29  1:40   ` Takahiro Kuwano
2022-07-29  1:40     ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 6/6] mtd: spi-nor: sysfs: print JEDEC ID for " Michael Walle
2022-05-13 13:35   ` Michael Walle
2022-07-29  1:25   ` Takahiro Kuwano
2022-07-29  1:25     ` Takahiro Kuwano
2022-07-26  8:06 ` [PATCH 0/6] mtd: spi-nor: " Tudor.Ambarus
2022-07-26  8:06   ` Tudor.Ambarus
2022-07-29  1:52   ` Takahiro Kuwano
2022-07-29  1:52     ` Takahiro Kuwano
2022-07-29  5:34     ` Tudor.Ambarus
2022-07-29  5:34       ` Tudor.Ambarus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220513133520.3945820-3-michael@walle.cc \
    --to=michael@walle.cc \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.