All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] nvmem: trivial fixes / cleanups
@ 2017-09-04 11:41 Masahiro Yamada
  2017-09-04 11:41 ` [PATCH 1/3] nvmem: add missing of_node_put() in of_nvmem_cell_get() Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-09-04 11:41 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: Masahiro Yamada, linux-kernel




Masahiro Yamada (3):
  nvmem: add missing of_node_put() in of_nvmem_cell_get()
  nvmem: remove inline in drivers/nvmem/core.c
  nvmem: remove unneeded IS_ENABLED(CONFIG_NVMEM) conditional

 drivers/nvmem/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] nvmem: add missing of_node_put() in of_nvmem_cell_get()
  2017-09-04 11:41 [PATCH 0/3] nvmem: trivial fixes / cleanups Masahiro Yamada
@ 2017-09-04 11:41 ` Masahiro Yamada
  2017-09-04 11:41 ` [PATCH 2/3] nvmem: remove inline in drivers/nvmem/core.c Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-09-04 11:41 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: Masahiro Yamada, linux-kernel

of_get_next_parent() increments the refcount of the returned node.
It should be put when done.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/nvmem/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 4c49285..ebd673c 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -789,6 +789,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
 		return ERR_PTR(-EINVAL);
 
 	nvmem = __nvmem_device_get(nvmem_np, NULL, NULL);
+	of_node_put(nvmem_np);
 	if (IS_ERR(nvmem))
 		return ERR_CAST(nvmem);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] nvmem: remove inline in drivers/nvmem/core.c
  2017-09-04 11:41 [PATCH 0/3] nvmem: trivial fixes / cleanups Masahiro Yamada
  2017-09-04 11:41 ` [PATCH 1/3] nvmem: add missing of_node_put() in of_nvmem_cell_get() Masahiro Yamada
@ 2017-09-04 11:41 ` Masahiro Yamada
  2017-09-04 11:41 ` [PATCH 3/3] nvmem: remove unneeded IS_ENABLED(CONFIG_NVMEM) conditional Masahiro Yamada
  2017-09-05 10:52 ` [PATCH 0/3] nvmem: trivial fixes / cleanups Srinivas Kandagatla
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-09-04 11:41 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: Masahiro Yamada, linux-kernel

These two functions are defined in .c file, but called just once
(at least for now).  So, the compiler will fold them into their
callers even without the "inline" markers.

However, this kind of optimization should not be done by hand.
It is compiler's judge after all.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/nvmem/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index ebd673c..8d915da 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -946,8 +946,7 @@ void nvmem_cell_put(struct nvmem_cell *cell)
 }
 EXPORT_SYMBOL_GPL(nvmem_cell_put);
 
-static inline void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell,
-						    void *buf)
+static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf)
 {
 	u8 *p, *b;
 	int i, bit_offset = cell->bit_offset;
@@ -1028,8 +1027,8 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
 }
 EXPORT_SYMBOL_GPL(nvmem_cell_read);
 
-static inline void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell,
-						    u8 *_buf, int len)
+static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell,
+					     u8 *_buf, int len)
 {
 	struct nvmem_device *nvmem = cell->nvmem;
 	int i, rc, nbits, bit_offset = cell->bit_offset;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] nvmem: remove unneeded IS_ENABLED(CONFIG_NVMEM) conditional
  2017-09-04 11:41 [PATCH 0/3] nvmem: trivial fixes / cleanups Masahiro Yamada
  2017-09-04 11:41 ` [PATCH 1/3] nvmem: add missing of_node_put() in of_nvmem_cell_get() Masahiro Yamada
  2017-09-04 11:41 ` [PATCH 2/3] nvmem: remove inline in drivers/nvmem/core.c Masahiro Yamada
@ 2017-09-04 11:41 ` Masahiro Yamada
  2017-09-05 10:52 ` [PATCH 0/3] nvmem: trivial fixes / cleanups Srinivas Kandagatla
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2017-09-04 11:41 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: Masahiro Yamada, linux-kernel

As you see in drivers/nvmem/Makefile, this C file is compiled only
when CONFIG_NVMEM is y or m.

So, IS_ENABLED(CONFIG_NVMEM) is always evaluated to 1 in this file.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/nvmem/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 8d915da..ebdc817 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -615,7 +615,7 @@ static struct nvmem_device *nvmem_find(const char *name)
 	return to_nvmem_device(d);
 }
 
-#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)
+#if IS_ENABLED(CONFIG_OF)
 /**
  * of_nvmem_device_get() - Get nvmem device from a given id
  *
@@ -753,7 +753,7 @@ static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_id)
 	return cell;
 }
 
-#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)
+#if IS_ENABLED(CONFIG_OF)
 /**
  * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id
  *
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] nvmem: trivial fixes / cleanups
  2017-09-04 11:41 [PATCH 0/3] nvmem: trivial fixes / cleanups Masahiro Yamada
                   ` (2 preceding siblings ...)
  2017-09-04 11:41 ` [PATCH 3/3] nvmem: remove unneeded IS_ENABLED(CONFIG_NVMEM) conditional Masahiro Yamada
@ 2017-09-05 10:52 ` Srinivas Kandagatla
  3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2017-09-05 10:52 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kernel



On 04/09/17 12:41, Masahiro Yamada wrote:
> Masahiro Yamada (3):
>    nvmem: add missing of_node_put() in of_nvmem_cell_get()
>    nvmem: remove inline in drivers/nvmem/core.c
>    nvmem: remove unneeded IS_ENABLED(CONFIG_NVMEM) conditional
> 
>   drivers/nvmem/core.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 

Thanks for the fixes they all look good!

I will send them to Greg KH this week along with other patches.

--srini

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-05 10:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 11:41 [PATCH 0/3] nvmem: trivial fixes / cleanups Masahiro Yamada
2017-09-04 11:41 ` [PATCH 1/3] nvmem: add missing of_node_put() in of_nvmem_cell_get() Masahiro Yamada
2017-09-04 11:41 ` [PATCH 2/3] nvmem: remove inline in drivers/nvmem/core.c Masahiro Yamada
2017-09-04 11:41 ` [PATCH 3/3] nvmem: remove unneeded IS_ENABLED(CONFIG_NVMEM) conditional Masahiro Yamada
2017-09-05 10:52 ` [PATCH 0/3] nvmem: trivial fixes / cleanups Srinivas Kandagatla

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.