[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0402MB3600D635FF12DC861FAD9BF6FFFA0@VI1PR0402MB3600.eurprd04.prod.outlook.com>
Date: Thu, 4 Jul 2019 16:07:38 +0000
From: Andy Duan <fugang.duan@....com>
To: Lothar Waßmann <LW@...O-electronics.de>
CC: "srinivas.kandagatla@...aro.org" <srinivas.kandagatla@...aro.org>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: RE: [EXT] Re: [PATCH nvmem 1/1] nvmem: imx: correct the fuse word
index
From: Lothar Waßmann <LW@...O-electronics.de> Sent: Thursday, July 4, 2019 11:46 PM
> Hi,
>
> On Thu, 4 Jul 2019 22:20:15 +0800 fugang.duan@....com wrote:
> > From: Fugang Duan <fugang.duan@....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@....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
You are right, in fact, we can remove "p" and "buf" pointer.
Thanks for your review, I will send out the V2.
Powered by blists - more mailing lists