Re: [PATCH 08/13] nvmem: add kvx otp non volatile regbank support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +static int kvx_otp_nv_read(void *context, unsigned int offset,
> > +			  void *_val, size_t bytes)
> > +{
> > +	struct kvx_otp_nv_priv *priv = context;
> > +	u8 *val = _val;
> > +	u32 tmp, copy_size;
> > +	u8 skip = offset & OTP_NV_ALIGN_MASK;
> > +
> > +	offset &= ~OTP_NV_ALIGN_MASK;
> > +
> > +	while (bytes) {
> > +		tmp = readl(priv->base + offset);
> > +		if (skip != 0)
> > +			copy_size = min(OTP_NV_ALIGN - skip, (int) bytes);
> > +		else
> > +			copy_size = min(bytes, sizeof(tmp));
> > +
> > +		memcpy(val, ((u8 *) &tmp) + skip, copy_size);
> > +		if (skip != 0)
> > +			skip = 0;
> 
> The if() here is unnecessary.
Indeed, thanks.






_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux