All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, maxime.ripard@free-electrons.com,
	Aban Bedel <albeu@free.fr>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH 02/11] nvmem: core: Allow allocating several anonymous nvmem devices
Date: Fri, 31 Mar 2017 13:44:46 +0100	[thread overview]
Message-ID: <1490964295-9647-3-git-send-email-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <1490964295-9647-1-git-send-email-srinivas.kandagatla@linaro.org>

From: Aban Bedel <albeu@free.fr>

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: Aban Bedel <albeu@free.fr>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 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

  parent reply	other threads:[~2017-03-31 12:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 12:44 [PATCH 00/11] nvmem: patches for v4.12 Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 01/11] MAINTAINERS: nvmem: Remove myself from maintainers Srinivas Kandagatla
2017-03-31 12:44 ` Srinivas Kandagatla [this message]
2017-03-31 12:44 ` [PATCH 03/11] nvmem: sunxi-sid: read NVMEM size from device compatible Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 04/11] nvmem: sunxi-sid: add support for H3's SID controller Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 05/11] nvmem: imx-ocotp: fix usage of "dev" pointers Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 06/11] nvmem: Add driver for the i.MX IIM Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 07/11] dt-bindings: nvmem: Add i.MX IIM binding doc Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 08/11] dt-bindings: imx-ocotp: add compatible string for i.MX7D/S Srinivas Kandagatla
2017-04-03 12:41   ` Rob Herring
2017-03-31 12:44 ` [PATCH 09/11] nvmem: octop: Add i.MX7D support Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 10/11] nvmem: imx-ocotp: clear error bit after reading locked values Srinivas Kandagatla
2017-03-31 12:44 ` [PATCH 11/11] nvmem: imx-ocotp: add write support 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=1490964295-9647-3-git-send-email-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=albeu@free.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.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.