From: Heiner Kallweit <hkallweit1@gmail.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] nvmem: core: remove member users from struct nvmem_device
Date: Sun, 4 Jun 2017 13:01:43 +0200 [thread overview]
Message-ID: <d3022765-e68c-1399-9580-9ec8e000e098@gmail.com> (raw)
In-Reply-To: <32c019d9-656d-6214-af2a-bef7e91dc1de@gmail.com>
Member users is used only to check whether we're allowed to remove
the module. So in case of built-in it's not used at all and in case
that owner is a module we have the module refcount for the same
purpose already. Whenever users is incremented the owner's refcount
is incremented too. Therefore users isn't needed.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/nvmem/core.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 8c830a80..4e07f3f8 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -33,7 +33,6 @@ struct nvmem_device {
int word_size;
int ncells;
int id;
- int users;
size_t size;
bool read_only;
int flags;
@@ -517,13 +516,6 @@ EXPORT_SYMBOL_GPL(nvmem_register);
*/
int nvmem_unregister(struct nvmem_device *nvmem)
{
- mutex_lock(&nvmem_mutex);
- if (nvmem->users) {
- mutex_unlock(&nvmem_mutex);
- return -EBUSY;
- }
- mutex_unlock(&nvmem_mutex);
-
if (nvmem->flags & FLAG_COMPAT)
device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom);
@@ -562,7 +554,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
}
}
- nvmem->users++;
mutex_unlock(&nvmem_mutex);
if (!try_module_get(nvmem->owner)) {
@@ -570,10 +561,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
"could not increase module refcount for cell %s\n",
nvmem->name);
- mutex_lock(&nvmem_mutex);
- nvmem->users--;
- mutex_unlock(&nvmem_mutex);
-
return ERR_PTR(-EINVAL);
}
@@ -583,9 +570,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
static void __nvmem_device_put(struct nvmem_device *nvmem)
{
module_put(nvmem->owner);
- mutex_lock(&nvmem_mutex);
- nvmem->users--;
- mutex_unlock(&nvmem_mutex);
}
static int nvmem_match(struct device *dev, void *data)
--
2.13.0
next prev parent reply other threads:[~2017-06-04 11:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-04 10:48 [PATCH 0/3] nvmem: core: series with smaller refactorings Heiner Kallweit
2017-06-04 11:01 ` Heiner Kallweit [this message]
2017-06-07 15:30 ` [PATCH 1/3] nvmem: core: remove member users from struct nvmem_device Srinivas Kandagatla
2017-06-07 21:51 ` Heiner Kallweit
2017-06-08 6:34 ` Srinivas Kandagatla
2017-06-04 11:01 ` [PATCH 2/3] nvmem: core: add locking to nvmem_find_cell Heiner Kallweit
2017-06-07 15:30 ` Srinivas Kandagatla
2017-06-04 11:02 ` [PATCH 3/3] nvmem: core: remove nvmem_mutex Heiner Kallweit
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=d3022765-e68c-1399-9580-9ec8e000e098@gmail.com \
--to=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox