LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: linux-kernel@vger.kernel.org, andrew.smirnov@gmail.com
Subject: Re: [PATCH RFC] drivers: nvmem: Export nvmem_add_cells()
Date: Tue, 8 May 2018 09:35:55 +0100	[thread overview]
Message-ID: <e36b58db-d8e3-cd89-e7d3-adca01991732@linaro.org> (raw)
In-Reply-To: <1525547507-1428-1-git-send-email-andrew@lunn.ch>



On 05/05/18 20:11, Andrew Lunn wrote:
> Not all platforms use device tree. It is useful to be able to add
> cells to a NVMEM device from code. Export nvmem_add_cells() so making
> this possible.
> 
> This required changing the parameters a bit, so that just the cells
> and the number of cells are passed, not the whole nvmem config
> structure.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

> ---
> 
> This is an RFC.
> 
> I have an intel platform with an AT24 EEPROM. I want to make use of
> nvmem, but don't have device tree to be able to specify cells. I have
> an x86 platform driver which does:
> 
> struct nvmem_cell_info nameplate_cells[] = {
>         {
>                 .name = "checksum",
>                 .offset = 2,
>                 .bytes = 1,
>         },
>         {
>                 .name = "part_number",
>                 .offset = 11,
>                 .bytes = 11,
>         },
> };
> 
>         err = nvmem_add_cells(nvmem, nameplate_cells,
>                               ARRAY_SIZE(nameplate_cells));
>         if (err) {
>                 dev_err(dev, "Error adding cells to nameplate nvmem device\n");
>                 return;
>         }
> 
>         cell = nvmem_cell_get(NULL, "checksum");
> 
> 
> drivers/nvmem/core.c           | 15 ++++++++-------
>   include/linux/nvmem-provider.h | 11 +++++++++++
>   2 files changed, 19 insertions(+), 7 deletions(-)
> 


Thanks Andrew for the patch,

Overall the patch looks good to me,
I would like to see some kernel doc for this new exported function

Thanks,
srini

  reply	other threads:[~2018-05-08  8:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-05 19:11 Andrew Lunn
2018-05-08  8:35 ` Srinivas Kandagatla [this message]
2018-05-08 13:16   ` Andrew Lunn
2018-05-08 19:36     ` Srinivas Kandagatla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e36b58db-d8e3-cd89-e7d3-adca01991732@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH RFC] drivers: nvmem: Export nvmem_add_cells()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).