[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD=FV=WQnc+_mNw3QYmwy2YJjGiarQpUOxkj1h4WOyHoGjU3Lg@mail.gmail.com>
Date: Fri, 5 Mar 2021 16:28:38 -0800
From: Doug Anderson <dianders@...omium.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: Rob Clark <robdclark@...il.com>,
Jordan Crouse <jcrouse@...eaurora.org>,
Niklas Cassel <niklas.cassel@...aro.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Stephen Boyd <swboyd@...omium.org>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Akhil P Oommen <akhilpo@...eaurora.org>,
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@...aro.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] nvmem: core: Allow nvmem_cell_read_u16/32/64 to read
smaller cells
Hi,
On Fri, Mar 5, 2021 at 8:07 AM Srinivas Kandagatla
<srinivas.kandagatla@...aro.org> wrote:
>
> > If you think it's confusing to change the behavior of the existing
> > functions, would you be opposed to me adding a new function like
> > nvmem_cell_read_le_u32_or_smaller() (or provide me a better name) that
> > would be flexible like this?
>
> This should be perfectly okay!
> may be something like:
>
> int nvmem_read_variable_cell(struct device *dev, const char *cell_id,
> void *buf, size_t sz_min, size_t sz_max);
>
> It should return number of bytes it read and fail if cell size is less
> then sz_min!
The above API isn't really what I want, though. Specifically I want
the API to acknowledge that it's a number that is being read. The
client just wants a number and any conversion / zero-padding /
whatever needs to be abstracted out. The client also doesn't really
care how big the cell actually was as long as the data fits, so I
wouldn't want to return it.
OK, I've come up with a new proposal, so maybe we can continue the
conversation there. The API for my new function actually matches
exactly with the old cpr_read_efuse() which makes me feel like it's
the right way to go...
https://lore.kernel.org/r/20210305162546.1.I323dad4343256b48af2be160b84b1e87985cc9be@changeid
-Doug
Powered by blists - more mailing lists