lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 09 Sep 2022 10:58:01 +0200
From:   Michael Walle <michael@...le.cc>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     Miquel Raynal <miquel.raynal@...tlin.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Shawn Guo <shawnguo@...nel.org>, Li Yang <leoyang.li@....com>,
        Rafał Miłecki <rafal@...ecki.pl>,
        Frank Rowand <frowand.list@...il.com>,
        linux-mtd@...ts.infradead.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        Ahmad Fatoum <a.fatoum@...gutronix.de>,
        Philipp Zabel <p.zabel@...gutronix.de>
Subject: Re: [PATCH v2 13/20] nvmem: core: drop priv pointer in post process
 callback

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.

-michael

> I would prefer this to be left as it is.
> 
> --srini
> 
>> Signed-off-by: Michael Walle <michael@...le.cc>
>> ---
>> changes since v1:
>>   - new patch
>> 
>>   drivers/nvmem/core.c           | 4 ++--
>>   drivers/nvmem/imx-ocotp.c      | 4 ++--
>>   include/linux/nvmem-provider.h | 5 +++--
>>   3 files changed, 7 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
>> index d31d3f0ab517..6910796937f9 100644
>> --- a/drivers/nvmem/core.c
>> +++ b/drivers/nvmem/core.c
>> @@ -1523,8 +1523,8 @@ static int __nvmem_cell_read(struct nvmem_device 
>> *nvmem,
>>   		nvmem_shift_read_buffer_in_place(cell, buf);
>>     	if (cell->read_post_process) {
>> -		rc = cell->read_post_process(nvmem->priv, id, index,
>> -					     cell->offset, buf, cell->bytes);
>> +		rc = cell->read_post_process(id, index, cell->offset, buf,
>> +					     cell->bytes);
>>   		if (rc)
>>   			return rc;
>>   	}
>> diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
>> index ac0edb6398f1..5e869d4a81c5 100644
>> --- a/drivers/nvmem/imx-ocotp.c
>> +++ b/drivers/nvmem/imx-ocotp.c
>> @@ -222,8 +222,8 @@ static int imx_ocotp_read(void *context, unsigned 
>> int offset,
>>   	return ret;
>>   }
>>   -static int imx_ocotp_cell_pp(void *context, const char *id, int 
>> index,
>> -			     unsigned int offset, void *data, size_t bytes)
>> +static int imx_ocotp_cell_pp(const char *id, int index, unsigned int 
>> offset,
>> +			     void *data, size_t bytes)
>>   {
>>   	u8 *buf = data;
>>   	int i;
>> diff --git a/include/linux/nvmem-provider.h 
>> b/include/linux/nvmem-provider.h
>> index 9d22dc5a3fa5..46067a6a0395 100644
>> --- a/include/linux/nvmem-provider.h
>> +++ b/include/linux/nvmem-provider.h
>> @@ -19,8 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *priv, unsigned 
>> int offset,
>>   typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
>>   				 void *val, size_t bytes);
>>   /* used for vendor specific post processing of cell data */
>> -typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, 
>> int index,
>> -					 unsigned int offset, void *buf, size_t bytes);
>> +typedef int (*nvmem_cell_post_process_t)(const char *id, int index,
>> +					 unsigned int offset, void *buf,
>> +					 size_t bytes);
>>     enum nvmem_type {
>>   	NVMEM_TYPE_UNKNOWN = 0,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ