Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1591434 > unrolled thread

[PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices

Started byAlban <albeu@free.fr>
First post2017-03-02 21:00 +0100
Last post2017-03-03 11:20 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices Alban <albeu@free.fr> - 2017-03-02 21:00 +0100
    Re: [PATCH 3/3] nvmem: core: Allow allocating several anonymous  nvmem devices Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-03-02 21:10 +0100
      Re: [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices Moritz Fischer <mdf@kernel.org> - 2017-03-03 03:00 +0100
    Re: [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem  devices Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-03-03 11:20 +0100

#1591434 — [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices

FromAlban <albeu@free.fr>
Date2017-03-02 21:00 +0100
Subject[PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices
Message-ID<tgF3l-72m-33@gated-at.bofh.it>
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@free.fr>
---
 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;
-- 
2.7.4

[toc] | [next] | [standalone]


#1591436 — Re: [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2017-03-02 21:10 +0100
SubjectRe: [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices
Message-ID<tgFcZ-7kK-9@gated-at.bofh.it>
In reply to#1591434
On Thu,  2 Mar 2017 20:50:23 +0100
Alban <albeu@free.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@free.fr>

Reviewed-by: Boris Brezillon <boris.brezillon@free-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;

[toc] | [prev] | [next] | [standalone]


#1591615

FromMoritz Fischer <mdf@kernel.org>
Date2017-03-03 03:00 +0100
Message-ID<tgKFH-2n3-3@gated-at.bofh.it>
In reply to#1591436
On Thu, Mar 2, 2017 at 12:03 PM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Thu,  2 Mar 2017 20:50:23 +0100
> Alban <albeu@free.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@free.fr>
>
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Moritz Fischer <mdf@kernel.org>

Thanks,
Moritz

[toc] | [prev] | [next] | [standalone]


#1591830 — Re: [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices

FromSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date2017-03-03 11:20 +0100
SubjectRe: [PATCH 3/3] nvmem: core: Allow allocating several anonymous nvmem devices
Message-ID<tgStA-8ce-43@gated-at.bofh.it>
In reply to#1591434

On 02/03/17 19:50, Alban 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@free.fr>
> ---

Thanks for the Fix, looks good to me, I will queue this up once rc1 is out.


>  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;
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web