Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1657056
| From | Heiner Kallweit <hkallweit1@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] nvmem: core: remove nvmem_mutex |
| Date | 2017-06-04 13:10 +0200 |
| Message-ID | <tOBzX-4bP-5@gated-at.bofh.it> (permalink) |
| References | <tOBgB-3Og-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Mutex nvmem_mutex is used in __nvmem_device_get only and isn't needed
due to:
- of_nvmem_find just calls bus_find_device which doesn't need locking
- nvmem_find_cell is protected by nvmem_cells_mutex
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/nvmem/core.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 1aa6d25a..783eb431 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -55,7 +55,6 @@ struct nvmem_cell {
struct list_head node;
};
-static DEFINE_MUTEX(nvmem_mutex);
static DEFINE_IDA(nvmem_ida);
static LIST_HEAD(nvmem_cells);
@@ -538,14 +537,10 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
{
struct nvmem_device *nvmem = NULL;
- mutex_lock(&nvmem_mutex);
-
if (np) {
nvmem = of_nvmem_find(np);
- if (!nvmem) {
- mutex_unlock(&nvmem_mutex);
+ if (!nvmem)
return ERR_PTR(-EPROBE_DEFER);
- }
} else {
struct nvmem_cell *cell = nvmem_find_cell(cell_id);
@@ -554,14 +549,10 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np,
*cellp = cell;
}
- if (!nvmem) {
- mutex_unlock(&nvmem_mutex);
+ if (!nvmem)
return ERR_PTR(-ENOENT);
- }
}
- mutex_unlock(&nvmem_mutex);
-
if (!try_module_get(nvmem->owner)) {
dev_err(&nvmem->dev,
"could not increase module refcount for cell %s\n",
--
2.13.0
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/3] nvmem: core: series with smaller refactorings Heiner Kallweit <hkallweit1@gmail.com> - 2017-06-04 12:50 +0200
[PATCH 1/3] nvmem: core: remove member users from struct nvmem_device Heiner Kallweit <hkallweit1@gmail.com> - 2017-06-04 13:10 +0200
Re: [PATCH 1/3] nvmem: core: remove member users from struct nvmem_device Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-06-07 17:40 +0200
[PATCH 2/3] nvmem: core: add locking to nvmem_find_cell Heiner Kallweit <hkallweit1@gmail.com> - 2017-06-04 13:10 +0200
Re: [PATCH 2/3] nvmem: core: add locking to nvmem_find_cell Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-06-07 17:40 +0200
[PATCH 3/3] nvmem: core: remove nvmem_mutex Heiner Kallweit <hkallweit1@gmail.com> - 2017-06-04 13:10 +0200
csiph-web