All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jiri Prchal <jiri.prchal@aksignal.cz>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rob Herring <robh+dt@kernel.org>,
	Christian Eggers <ceggers@arri.de>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v8 4/5] nvmem: eeprom: at25: export FRAM serial num
Date: Tue, 8 Jun 2021 11:05:43 +0200	[thread overview]
Message-ID: <YL8y58QAtH8HbC1p@kroah.com> (raw)
In-Reply-To: <20210607161201.223697-5-jiri.prchal@aksignal.cz>

On Mon, Jun 07, 2021 at 06:12:00PM +0200, Jiri Prchal wrote:
> This exports serial number of FRAM in sysfs file named "sernum".
> Formatted in hex, each byte separated by space.
> Example:
> $ cat /sys/class/spi_master/spi0/spi0.0/sernum
> 0000a43644f2ae6c
> 
> Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz>
> ---
> v2: no change here
> v3: resend and added more recipients
> v4: resend
> v5: reworked up on Greg comments: no spaces in string, sysfs done correctly
> v6: no change here
> v7: moved FM25_SN_LEN, static array, used sysfs_emit, DEVICE_ATTR_RO
> v8: clarify sysfs_emit format
> ---
>  drivers/misc/eeprom/at25.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
> index e25cec7c474b..4a47a7e2d90d 100644
> --- a/drivers/misc/eeprom/at25.c
> +++ b/drivers/misc/eeprom/at25.c
> @@ -31,6 +31,7 @@
>   *   AT25M02, AT25128B
>   */
>  
> +#define	FM25_SN_LEN	8		/* serial number length */
>  struct at25_data {
>  	struct spi_device	*spi;
>  	struct mutex		lock;
> @@ -39,6 +40,7 @@ struct at25_data {
>  	struct nvmem_config	nvmem_config;
>  	struct nvmem_device	*nvmem;
>  	int has_sernum;
> +	u8 sernum[FM25_SN_LEN];
>  };
>  
>  #define	AT25_WREN	0x06		/* latch the write enable */
> @@ -172,6 +174,21 @@ static int fm25_aux_read(struct at25_data *at25, u8 *buf, uint8_t command,
>  	return status;
>  }
>  
> +static ssize_t sernum_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct at25_data *at25;
> +
> +	at25 = dev_get_drvdata(dev);
> +	return sysfs_emit(buf, "%*phN\n", sizeof at25->sernum, at25->sernum);

sizeof(at25->sernum) is the normal way to write this.

thanks,

greg k-h

  reply	other threads:[~2021-06-08  9:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 16:11 [PATCH v8 0/5] add support for FRAM Jiri Prchal
2021-06-07 16:11 ` [PATCH v8 1/5] nvmem: prepare basics for FRAM support Jiri Prchal
2021-06-07 16:11 ` [PATCH v8 2/5] nvmem: eeprom: at25: add support for FRAM Jiri Prchal
2021-06-08  9:07   ` Greg Kroah-Hartman
2021-06-08  9:57     ` Jiří Prchal
2021-06-07 16:11 ` [PATCH v8 3/5] dt-bindings: nvmem: at25: add for FRAM support Jiri Prchal
2021-06-07 16:12 ` [PATCH v8 4/5] nvmem: eeprom: at25: export FRAM serial num Jiri Prchal
2021-06-08  9:05   ` Greg Kroah-Hartman [this message]
2021-06-07 16:12 ` [PATCH v8 5/5] nvmem: eeprom: add documentation of sysfs fram and sernum file Jiri Prchal
2021-06-08  9:05   ` Greg Kroah-Hartman
2021-06-08  9:50     ` Jiří Prchal
2021-06-08 10:04       ` Greg Kroah-Hartman

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=YL8y58QAtH8HbC1p@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=ceggers@arri.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jiri.prchal@aksignal.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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.