Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1544338 > unrolled thread
| Started by | Vivek Gautam <vivek.gautam@codeaurora.org> |
|---|---|
| First post | 2016-12-19 08:00 +0100 |
| Last post | 2016-12-20 05:10 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] nvmem: core: Allow ignoring length when reading a cell Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-12-19 08:00 +0100
Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell Stephen Boyd <sboyd@codeaurora.org> - 2016-12-19 22:50 +0100
Re: [PATCH] nvmem: core: Allow ignoring length when reading a cell Vivek Gautam <vivek.gautam@codeaurora.org> - 2016-12-20 05:10 +0100
| From | Vivek Gautam <vivek.gautam@codeaurora.org> |
|---|---|
| Date | 2016-12-19 08:00 +0100 |
| Subject | [PATCH] nvmem: core: Allow ignoring length when reading a cell |
| Message-ID | <sQ05s-4jb-19@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-12-19 22:50 +0100 |
| Message-ID | <sQdYK-4Sg-19@gated-at.bofh.it> |
| In reply to | #1544338 |
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
[toc] | [prev] | [next] | [standalone]
| From | Vivek Gautam <vivek.gautam@codeaurora.org> |
|---|---|
| Date | 2016-12-20 05:10 +0100 |
| Message-ID | <sQjUu-sd-3@gated-at.bofh.it> |
| In reply to | #1544781 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web