linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Yicong Yang <yangyicong@hisilicon.com>
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Pratyush Yadav <p.yadav@ti.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH 2/2] mtd: spi-nor: add initial sysfs support
Date: Sat, 20 Mar 2021 20:17:23 +0100	[thread overview]
Message-ID: <94797376448f4a276dea8489b2ac9e44@walle.cc> (raw)
In-Reply-To: <925fb92b-39da-ebc5-c0ac-6dba02628956@hisilicon.com>

Hi Yicong,

Am 2021-03-20 05:16, schrieb Yicong Yang:
> On 2021/3/18 17:24, Michael Walle wrote:
>> Add support to show the name and JEDEC identifier as well as to dump 
>> the
>> SFDP table. Not all flashes list their SFDP table contents in their
>> datasheet. So having that is useful. It might also be helpful in bug
>> reports from users.
>> 
>> The idea behind the sysfs module is also to have raw access to the SPI
>> NOR flash device registers, which can also be useful for debugging.
> 
> I like the idea to dump the sfdp data,it will make debug easier.
> should it go in debugfs?
> we already have debugfs files for partname and partid of the flash.

I've seen that, but thats for the MTD subsystem and is per MTD. Well,
one could add an own debugfs for spi-nor, but I still fear it might
not be available just when its needed. Of course a developer can
easily enable it for its debugging kernel. But I'm not sure if thats
the only use case.

I'd guess it boils down to, whether there could also be tooling
around this. Eg. think of something like "lssfdp".

I'd prefer sysfs, but lets hear what the maintainers think.

[..]

>> +static ssize_t name_show(struct device *dev,
>> +			 struct device_attribute *attr, char *buf)
>> +{
>> +	struct spi_device *spi = to_spi_device(dev);
>> +	struct spi_mem *spimem = spi_get_drvdata(spi);
>> +	struct spi_nor *nor = spi_mem_get_drvdata(spimem);
>> +
>> +	return sprintf(buf, "%s\n", nor->info->name);
> 
> perhaps sysfs_emit() instead if we go sysfs? as suggested by [1].

Thanks, didn't know about that new helper.

-michael

  reply	other threads:[~2021-03-20 19:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18  9:24 [PATCH 0/2] mtd: spi-nor: support dumping sfdp tables Michael Walle
2021-03-18  9:24 ` [PATCH 1/2] mtd: spi-nor: sfdp: save a copy of the SFDP data Michael Walle
2021-03-22 14:21   ` Pratyush Yadav
2021-03-22 15:32     ` Michael Walle
2021-03-22 15:48       ` Michael Walle
2021-03-22 18:42       ` Pratyush Yadav
2021-03-22 22:31         ` Michael Walle
2021-03-23  9:37           ` Pratyush Yadav
2021-04-05 13:11   ` Tudor.Ambarus
2021-04-05 15:07     ` Michael Walle
2021-04-05 15:42       ` Tudor.Ambarus
2021-04-05 16:03         ` Michael Walle
2021-03-18  9:24 ` [PATCH 2/2] mtd: spi-nor: add initial sysfs support Michael Walle
2021-03-20  4:16   ` Yicong Yang
2021-03-20 19:17     ` Michael Walle [this message]
2021-03-22 14:43   ` Pratyush Yadav
2021-03-22 14:57     ` Michael Walle
2021-04-06  7:56   ` Vignesh Raghavendra
2021-04-06  8:47     ` Michael Walle
2021-04-06 11:43       ` Vignesh Raghavendra
2021-04-29 15:37   ` Alexander Williams
2021-04-29 15:46     ` Michael Walle

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=94797376448f4a276dea8489b2ac9e44@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 \
    --cc=yangyicong@hisilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).