All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of()
Date: Mon, 20 Mar 2023 09:23:11 +0100	[thread overview]
Message-ID: <01b2adc922951f7d8cd74bc7bb1b42f1@walle.cc> (raw)
In-Reply-To: <20230317132620.31142-4-zajec5@gmail.com>

Am 2023-03-17 14:26, schrieb Rafał Miłecki:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This symbol can be cleanly re-used by the fixed NVMEM layout driver.
> Allow passing DT node as argument to make it a bit more generic.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  drivers/nvmem/core.c           | 7 ++++---
>  include/linux/nvmem-provider.h | 7 +++++++
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 212c5ba5789f..985a42cfb0a2 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -694,7 +694,7 @@ static int nvmem_validate_keepouts(struct
> nvmem_device *nvmem)
>  	return 0;
>  }
> 
> -static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
> +int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct 
> device_node *np)

I'm not sure, how to feel about exposing an "internal" function to
the layouts module. I mean all these nvmem_add_cells_from_* are internal
to the core. Also the help text of the add_cells() callback tells you to
use nvmem_add_one_cell().

Although there is a bit of code duplication, I'd rather refactor
the nvmem_add_cells_from_of() to split it into parsing and adding.
Then re-use just the parsing from the fixed layout module and
call the appropriate nvmem_add_one_cell() yourself there.

-michael

  parent reply	other threads:[~2023-03-20  8:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 13:26 [PATCH V4 0/4] nvmem: add fixed cells layout Rafał Miłecki
2023-03-17 13:26 ` [PATCH V4 1/4] dt-bindings: nvmem: layouts: add fixed-layout Rafał Miłecki
2023-03-17 13:26 ` [PATCH V4 2/4] dt-bindings: nvmem: convert base example to use NVMEM fixed cells layout Rafał Miłecki
2023-03-17 13:26 ` [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of() Rafał Miłecki
2023-03-18  0:06   ` kernel test robot
2023-03-20  8:23   ` Michael Walle [this message]
2023-03-17 13:26 ` [PATCH V4 4/4] nvmem: layouts: add fixed cells layout Rafał Miłecki
2023-03-17 15:54   ` kernel test robot
2023-03-17 16:04     ` Rafał Miłecki

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=01b2adc922951f7d8cd74bc7bb1b42f1@walle.cc \
    --to=michael@walle.cc \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=rafal@milecki.pl \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=zajec5@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.