[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170302210351.1f740ffc@bbrezillon>
Date: Thu, 2 Mar 2017 21:03:51 +0100
From: Boris Brezillon <boris.brezillon@...e-electrons.com>
To: Alban <albeu@...e.fr>
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-mtd@...ts.infradead.org,
Cyrille Pitchen <cyrille.pitchen@...el.com>,
Richard Weinberger <richard@....at>,
Marek Vasut <marek.vasut@...il.com>,
Brian Norris <computersforpeace@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
Mark Rutland <mark.rutland@....com>,
Rob Herring <robh+dt@...nel.org>,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Moritz Fischer <moritz.fischer@...us.com>
Subject: Re: [PATCH 3/3] nvmem: core: Allow allocating several anonymous
nvmem devices
On Thu, 2 Mar 2017 20:50:23 +0100
Alban <albeu@...e.fr> wrote:
> Currently the nvmem core expect the config to provide a name and ID
> that are then used to create the device name. When no device name is
> given 'nvmem' is used. However if there is several such anonymous
> devices they all get named 'nvmem0', which doesn't work.
>
> To fix this problem use the ID from the config only when the config
> also provides a name. When no name is provided take the uinque ID of
> the nvmem device instead.
>
> Signed-off-by: Alban <albeu@...e.fr>
Reviewed-by: Boris Brezillon <boris.brezillon@...e-electrons.com>
> ---
> drivers/nvmem/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 408b521..8c830a8 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -468,7 +468,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> np = config->dev->of_node;
> nvmem->dev.of_node = np;
> dev_set_name(&nvmem->dev, "%s%d",
> - config->name ? : "nvmem", config->id);
> + config->name ? : "nvmem",
> + config->name ? config->id : nvmem->id);
>
> nvmem->read_only = of_property_read_bool(np, "read-only") |
> config->read_only;
Powered by blists - more mailing lists