[PATCH v2 01/19] mfd: syscon: Add reference counting and device managed support
Arnd Bergmann
arnd at arndb.de
Tue Jun 18 07:53:30 PDT 2024
On Mon, May 27, 2024, at 18:14, Herve Codina wrote:
> From: Clément Léger <clement.leger at 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 retrieve 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 at bootlin.com>
> Signed-off-by: Herve Codina <herve.codina at bootlin.com>
This all looks correct from an implementation perspective,
but it does add a lot of complexity if now every syscon user
feels compelled to actually free up their resources again,
while nothing else should actually depend on this.
The only reference I found in your series here is the
reset controller, and it only does a single update to
the regmap in the probe function.
Would it be possible to just make the syscon support in
the reset driver optional and instead poke the register
in the mfd driver itself when this is used as a pci device?
Or do you expect to see the syscon get used in other
places in the future for the PCI case?
Arnd
More information about the linux-arm-kernel
mailing list