linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmem: core: Allow ignoring length when reading a cell
@ 2016-12-19  6:53 Vivek Gautam
  2016-12-19 21:47 ` Stephen Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2016-12-19  6:53 UTC (permalink / raw)
  To: srinivas.kandagatla, maxime.ripard
  Cc: sboyd, linux-kernel, linux-arm-msm, Vivek Gautam

nvmem_cell_read() API fills in the argument 'len' with
the number of bytes read from the cell. Many users don't
care about this length value. So allow users to pass a
NULL pointer to this len field.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
---

Based on torvalds's master branch.
 - Tested against 'next-20161219' tag on db410c (apq8016) target
   for thermal sensors.

 drivers/nvmem/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 965911d..4c38842 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -970,7 +970,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
 	if (cell->bit_offset || cell->nbits)
 		nvmem_shift_read_buffer_in_place(cell, buf);
 
-	*len = cell->bytes;
+	if (len)
+		*len = cell->bytes;
 
 	return 0;
 }
@@ -979,7 +980,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
  * nvmem_cell_read() - Read a given nvmem cell
  *
  * @cell: nvmem cell to be read.
- * @len: pointer to length of cell which will be populated on successful read.
+ * @len: pointer to length of cell which will be populated on successful read;
+ *	 can be NULL.
  *
  * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
  * The buffer should be freed by the consumer with a kfree().
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell
  2016-12-19  6:53 [PATCH] nvmem: core: Allow ignoring length when reading a cell Vivek Gautam
@ 2016-12-19 21:47 ` Stephen Boyd
  2016-12-20  4:03   ` Vivek Gautam
  2017-01-05  5:34   ` Vivek Gautam
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Boyd @ 2016-12-19 21:47 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: srinivas.kandagatla, maxime.ripard, linux-kernel, linux-arm-msm

On 12/19, Vivek Gautam wrote:
> nvmem_cell_read() API fills in the argument 'len' with
> the number of bytes read from the cell. Many users don't
> care about this length value. So allow users to pass a
> NULL pointer to this len field.
> 
> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell
  2016-12-19 21:47 ` Stephen Boyd
@ 2016-12-20  4:03   ` Vivek Gautam
  2017-01-05  5:34   ` Vivek Gautam
  1 sibling, 0 replies; 6+ messages in thread
From: Vivek Gautam @ 2016-12-20  4:03 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Srinivas Kandagatla, Maxime Ripard, linux-kernel, linux-arm-msm

On Tue, Dec 20, 2016 at 3:17 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 12/19, Vivek Gautam wrote:
>> nvmem_cell_read() API fills in the argument 'len' with
>> the number of bytes read from the cell. Many users don't
>> care about this length value. So allow users to pass a
>> NULL pointer to this len field.
>>
>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>> ---
>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

Thanks Stephen.


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell
  2016-12-19 21:47 ` Stephen Boyd
  2016-12-20  4:03   ` Vivek Gautam
@ 2017-01-05  5:34   ` Vivek Gautam
  2017-01-05  9:40     ` Srinivas Kandagatla
  1 sibling, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2017-01-05  5:34 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Maxime Ripard, Stephen Boyd, linux-kernel, linux-arm-msm

Hi Srinivas,

On Tue, Dec 20, 2016 at 3:17 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 12/19, Vivek Gautam wrote:
>> nvmem_cell_read() API fills in the argument 'len' with
>> the number of bytes read from the cell. Many users don't
>> care about this length value. So allow users to pass a
>> NULL pointer to this len field.
>>
>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>> ---
>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

Can you please pick this patch as well, adding Stephen's 'Reviewed-by' tag.


Regards
Vivek
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell
  2017-01-05  5:34   ` Vivek Gautam
@ 2017-01-05  9:40     ` Srinivas Kandagatla
  2017-01-05  9:46       ` Vivek Gautam
  0 siblings, 1 reply; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-01-05  9:40 UTC (permalink / raw)
  To: Vivek Gautam; +Cc: Maxime Ripard, Stephen Boyd, linux-kernel, linux-arm-msm



On 05/01/17 05:34, Vivek Gautam wrote:
> Hi Srinivas,
>
> On Tue, Dec 20, 2016 at 3:17 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 12/19, Vivek Gautam wrote:
>>> nvmem_cell_read() API fills in the argument 'len' with
>>> the number of bytes read from the cell. Many users don't
>>> care about this length value. So allow users to pass a
>>> NULL pointer to this len field.
>>>
>>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>>> ---
>>
>> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
>
> Can you please pick this patch as well, adding Stephen's 'Reviewed-by' tag.
>
This is already in my queue for 4.11 release, as this is an enhancement. 
I will send them to Greg once we hit rc4 or rc5.

thanks,
srini

>
> Regards
> Vivek
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell
  2017-01-05  9:40     ` Srinivas Kandagatla
@ 2017-01-05  9:46       ` Vivek Gautam
  0 siblings, 0 replies; 6+ messages in thread
From: Vivek Gautam @ 2017-01-05  9:46 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Maxime Ripard, Stephen Boyd, linux-kernel, linux-arm-msm


On 01/05/2017 03:10 PM, Srinivas Kandagatla wrote:
>
>
> On 05/01/17 05:34, Vivek Gautam wrote:
>> Hi Srinivas,
>>
>> On Tue, Dec 20, 2016 at 3:17 AM, Stephen Boyd <sboyd@codeaurora.org> 
>> wrote:
>>> On 12/19, Vivek Gautam wrote:
>>>> nvmem_cell_read() API fills in the argument 'len' with
>>>> the number of bytes read from the cell. Many users don't
>>>> care about this length value. So allow users to pass a
>>>> NULL pointer to this len field.
>>>>
>>>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>>>> ---
>>>
>>> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
>>
>> Can you please pick this patch as well, adding Stephen's 
>> 'Reviewed-by' tag.
>>
> This is already in my queue for 4.11 release, as this is an 
> enhancement. I will send them to Greg once we hit rc4 or rc5.

Okay. Thanks for picking.


Regards
Vivek

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-05  9:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19  6:53 [PATCH] nvmem: core: Allow ignoring length when reading a cell Vivek Gautam
2016-12-19 21:47 ` Stephen Boyd
2016-12-20  4:03   ` Vivek Gautam
2017-01-05  5:34   ` Vivek Gautam
2017-01-05  9:40     ` Srinivas Kandagatla
2017-01-05  9:46       ` Vivek Gautam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).