Re: [PATCH v3 05/12] phy: qualcomm: qcom-uniphy-pcie-usb3-28lp: Use bulk reset_control API
From: George Moussalem
Date: Sat Sep 05 2026 - 08:33:52 EST
On 9/1/26 17:16, Konrad Dybcio wrote:
> On 8/25/26 2:37 PM, George Moussalem via B4 Relay wrote:
>> From: George Moussalem <george.moussalem@xxxxxxxxxxx>
>>
>> Switch to using bulk reset_control functions to prepare the driver for
>> managing multiple resets, acquiring reset controls by name, and
>> uniformly storing resets in the private data structure to enable support
>> for future combo PHY functionality requiring multiple resets.
>>
>> Signed-off-by: George Moussalem <george.moussalem@xxxxxxxxxxx>
>> ---
>
> [...]
>
>> - phy->resets = devm_reset_control_array_get_exclusive(phy->dev);
>> - if (IS_ERR(phy->resets))
>> - return PTR_ERR(phy->resets);
>> + count = of_count_phandle_with_args(dev->of_node, "resets", "#reset-cells");
>> + if (count < 0)
>> + return count;
>> +
>> + phy->resets = devm_kcalloc(dev, count, sizeof(*phy->resets), GFP_KERNEL);
>> + if (!phy->resets)
>> + return -ENOMEM;
>> +
>> + for (i = 0; i < count; i++) {
>> + phy->resets[i].rstc = devm_reset_control_get_exclusive_by_index(dev, i);
>> + if (IS_ERR(phy->resets[i].rstc))
>> + return PTR_ERR(phy->resets[i].rstc);
>> + }
>
> reset_control_bulk_get_exclusive()
This breaks acquiring the resets for the pcie phys, or any phy with
multiple unnamed resets. Because __reset_control_bulk_get looks up the
reset by id (name):
rstcs[i].rstc = __reset_control_get(dev, rstcs[i].id, 0, flags);
it will pass for the first unnamed reset, but it will return -EBUSY for
the second as the same reset is returned (first one it finds with no
name set) which was already acquired with the exclusive flag.
We'll need to use _by_index and leave them unnamed in the DT so we don't
break the existing binding.
>
> Konrad
George