linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: fugang.duan@nxp.com
Cc: festevam@gmail.com, gregkh@linuxfoundation.org,
	s.hauer@pengutronix.de, linux-kernel@vger.kernel.org,
	srinivas.kandagatla@linaro.org, kernel@pengutronix.de,
	shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index
Date: Thu, 4 Jul 2019 17:45:43 +0200	[thread overview]
Message-ID: <20190704174543.194a0158@karo-electronics.de> (raw)
In-Reply-To: <20190704142015.10701-1-fugang.duan@nxp.com>

Hi,

On Thu,  4 Jul 2019 22:20:15 +0800 fugang.duan@nxp.com wrote:
> From: Fugang Duan <fugang.duan@nxp.com>
> 
> iMX8 fuse word index represent as one 4-bytes word,
> it should not be divided by 4.
> 
> Exp:
> - MAC0 address layout in fuse:
> offset 708: MAC[3] MAC[2] MAC[1] MAC[0]
> offset 709: XX     xx     MAC[5] MAC[4]
> 
> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
> ---
>  drivers/nvmem/imx-ocotp-scu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
> index d9dc482..be2f5f0 100644
> --- a/drivers/nvmem/imx-ocotp-scu.c
> +++ b/drivers/nvmem/imx-ocotp-scu.c
> @@ -71,8 +71,8 @@ static int imx_scu_ocotp_read(void *context, unsigned int offset,
>  	void *p;
>  	int i, ret;
>  
> -	index = offset >> 2;
> -	num_bytes = round_up((offset % 4) + bytes, 4);
> +	index = offset;
> +	num_bytes = round_up(bytes, 4);
>  	count = num_bytes >> 2;
>  
>  	if (count > (priv->data->nregs - index))
> @@ -100,7 +100,7 @@ static int imx_scu_ocotp_read(void *context, unsigned int offset,
>  		buf++;
>  	}
>  
> -	memcpy(val, (u8 *)p + offset % 4, bytes);
> +	memcpy(val, (u8 *)p, bytes);
>  
>  	kfree(p);
>  
With these changes you could use the 'val' pointer directly
as the destination for ocotp_read() without need for an intermediate
buffer.


Lothar Waßmann

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-07-04 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 14:20 [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index fugang.duan
2019-07-04 15:45 ` Lothar Waßmann [this message]
2019-07-04 16:07   ` [EXT] " Andy Duan
2019-07-05  2:46     ` Andy Duan
2019-07-05  7:12       ` Lothar Waßmann
2019-07-05  7:32         ` Andy Duan
2019-07-10  2:29           ` Andy Duan
2019-07-15  5:35 ` Andy Duan

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=20190704174543.194a0158@karo-electronics.de \
    --to=lw@karo-electronics.de \
    --cc=festevam@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=srinivas.kandagatla@linaro.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 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).