Re: [PATCH v13 06/12] spmi: Add helper to get a parent SPMI device

From: Abel Vesa

Date: Mon Jul 27 2026 - 10:33:22 EST


On 26-07-21 11:36:20, AngeloGioacchino Del Regno wrote:
> Drivers that register a SPMI sub-device as a platform_driver are
> not guaranteed to have a SPMI device as their parent: add a new
> helper `spmi_get_parent_spmi_device()` that takes a struct device
> and checks if there's a parent, and if that parent is actually a
> SPMI device by checking if its device type matches with SPMI: if
> so, returns a pointer to the relative struct spmi_device without
> incrementing any refcount.
>
> As a note, in the specific case of using this helper to retrieve
> a SPMI subdevice's parent, the spmi_subdevice_alloc_and_add()
> function does actually call device_add(), which will already take
> care of raising the refcount of the associated parent device.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>

Looks good to me:

Reviewed-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>