Re: [PATCH v2 13/20] nvmem: core: drop priv pointer in post process callback

From: Michael Walle
Date: Fri Sep 09 2022 - 05:40:02 EST


Am 2022-09-09 11:08, schrieb Srinivas Kandagatla:
On 09/09/2022 09:58, Michael Walle wrote:
Am 2022-09-09 10:52, schrieb Srinivas Kandagatla:
On 01/09/2022 23:18, Michael Walle wrote:
It doesn't make any more sense to have a opaque pointer set up by the
nvmem device. Usually, the layout isn't associated with a particular
nvmem device.

This is really not a good idea to remove the context pointer, as this
is the only way for callback to get context which it can make use of.

In which case? As I mentioned it's the priv to the nvmem driver and all
the "normal" callbacks can do very little with it. If there will be a
future need, then there should be a proper opaque pointer associated
with the layout and not the nvmem driver.

Yes, the opaque object here is the layout priv which I agree with, but
removing the context totally from the callback is not a good idea.

We should have some context to callbacks to be able to allow them to
deal with some private info.

I agree, but my thinking was this: as the old priv pointer doesn't
make any sense and no one is using it at the moment for now, we can
remove it it. If it's needed again it can easily added together with
a user.

That being said, I could leave the pointer argument and just pass NULL,
so if someone (re)adds that, we don't have to modify all the callbacks.
Because we don't have any user for now, I could only speculate who should
or could set that pointer.

-michael