Re: [PATCH v13 06/12] spmi: Add helper to get a parent SPMI device
Abel Vesa <[email protected]>
| Newsgroups | org.kernel.vger.linux-pm,org.infradead.lists.linux-phy,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <tdx7aygeu3li6gjmzsxntg24mgcg5fkiz7c6oibuhucedupwjo@iqpnvtiohstz> |
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 <[email protected]> Looks good to me: Reviewed-by: Abel Vesa <[email protected]>