Thread (21 messages) 21 messages, 5 authors, 2024-09-23

Re: [PATCH v5 3/8] mfd: syscon: Add reference counting and device managed support

From: Lee Jones <lee@kernel.org>
Date: 2024-09-03 15:38:48
Also in: linux-arm-kernel, linux-devicetree, linux-pci, lkml

On Thu, 08 Aug 2024, Herve Codina wrote:
From: Clément Léger <clement.leger@bootlin.com>

Syscon releasing is not supported.
Without release function, unbinding a driver that uses syscon whether
explicitly or due to a module removal left the used syscon in a in-use
state.

For instance a syscon_node_to_regmap() call from a consumer retrieves a
syscon regmap instance. Internally, syscon_node_to_regmap() can create
syscon instance and add it to the existing syscon list. No API is
available to release this syscon instance, remove it from the list and
free it when it is not used anymore.

Introduce reference counting in syscon in order to keep track of syscon
usage using syscon_{get,put}() and add a device managed version of
syscon_regmap_lookup_by_phandle(), to automatically release the syscon
instance on the consumer removal.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 drivers/mfd/syscon.c       | 138 ++++++++++++++++++++++++++++++++++---
 include/linux/mfd/syscon.h |  16 +++++
 2 files changed, 144 insertions(+), 10 deletions(-)
This doesn't look very popular.

What are the potential ramifications for existing users?

-- 
Lee Jones [李琼斯]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help