On Mon, Jul 21, 2025 at 09:55:19AM +0200, AngeloGioacchino Del Regno wrote:
Some devices connected over the SPMI bus may be big, in the sense
that those may be a complex of devices managed by a single chip
over the SPMI bus, reachable through a single SID.
Add new functions aimed at managing sub-devices of a SPMI device
spmi_subdevice_alloc_and_add() and a spmi_subdevice_put_and_remove()
for adding a new subdevice and removing it respectively, and also
add their devm_* variants.
The need for such functions comes from the existance of those
complex Power Management ICs (PMICs), which feature one or many
sub-devices, in some cases with these being even addressable on
the chip in form of SPMI register ranges.
Examples of those devices can be found in both Qualcomm platforms
with their PMICs having PON, RTC, SDAM, GPIO controller, and other
sub-devices, and in newer MediaTek platforms showing similar HW
features and a similar layout with those also having many subdevs.
...
EXPORT_SYMBOL_GPL(devm_spmi_controller_add);
+EXPORT_SYMBOL_GPL(devm_spmi_subdevice_alloc_and_add);
I am wondering how hard to move these to a dedicated namespace.
Basically you can define a default namespace, and at the same time
add import to all (current) users.
...
+ dev_set_name(&sdev->dev,
+ "%d-%02x.%d.auto", sdev->ctrl->nr, sdev->usid, sub_sdev->devid);
No error check?