Re: [PATCH v5 06/13] soc: qcom: geni-se: Introduce helper API for attaching power domains

From: Konrad Dybcio

Date: Thu Feb 19 2026 - 10:08:49 EST


On 2/19/26 3:58 PM, Praveen Talari wrote:
> Hi
>
> On 2/17/2026 5:09 PM, Konrad Dybcio wrote:
>> On 2/6/26 6:41 PM, Praveen Talari wrote:
>>> The GENI Serial Engine drivers (I2C, SPI, and SERIAL) currently handle
>>> the attachment of power domains. This often leads to duplicated code
>>> logic across different driver probe functions.
>>>
>>> Introduce a new helper API, geni_se_domain_attach(), to centralize
>>> the logic for attaching "power" and "perf" domains to the GENI SE
>>> device.
>>>
>>> Signed-off-by: Praveen Talari <praveen.talari@xxxxxxxxxxxxxxxx>
>>> ---
>>
>> [...]
>>
>>> +int geni_se_domain_attach(struct geni_se *se)
>>> +{
>>> +    struct dev_pm_domain_attach_data pd_data = {
>>> +        .pd_flags = PD_FLAG_DEV_LINK_ON,
>>> +        .pd_names = (const char*[]) { "power", "perf" },
>>> +        .num_pd_names = 2,
>>> +    };
>>> +    int ret;
>>> +
>>> +    ret = devm_pm_domain_attach_list(se->dev,
>>> +                     &pd_data, &se->pd_list);
>>> +    if (ret <= 0)
>>> +        return -EINVAL;
>>
>> I think we should preserve the original retval for the < 0 cases
>>
>> For == 0, this can mean a number of different things.. but in this
>> specific case (where we always set pd_data.num_pd_names == 2) it seems
>> that it would only be an issue if dev->of_node == NULL, at which point
>> this function would have never been called
>
> I hope the below is acceptable.
>
> +int geni_se_domain_attach(struct geni_se *se)
> +{
> +       struct dev_pm_domain_attach_data pd_data = {
> +               .pd_flags = PD_FLAG_DEV_LINK_ON,
> +               .pd_names = (const char*[]) { "power", "perf" },
> +               .num_pd_names = 2,
> +       };
> +       int ret;
> +
> +       ret = devm_pm_domain_attach_list(se->dev,
> +                                        &pd_data, &se->pd_list);
> +       if (ret == 0)
> +               return -ENODEV;
> +       else if (ret < 0)
> +               return ret;

Yeah, thanks!

Konrad