On Tue, Feb 13, 2018 at 7:25 PM, Vivek Gautam
<vivek.gau...@codeaurora.org> wrote:
>>> +static int arm_smmu_init_clks(struct arm_smmu_device *smmu)
>>> +{
>>> +       int i;
>>> +       int num = smmu->num_clks;
>>> +       const struct arm_smmu_match_data *data;
>>> +
>>> +       if (num < 1)
>>> +               return 0;
>>> +
>>> +       smmu->clocks = devm_kcalloc(smmu->dev, num,
>>> +                                   sizeof(*smmu->clocks), GFP_KERNEL);
>>> +       if (!smmu->clocks)
>>> +               return -ENOMEM;
>>> +
>>> +       data = of_device_get_match_data(smmu->dev);
>>> +
>>> +       for (i = 0; i < num; i++)
>>> +               smmu->clocks[i].id = data->clks[i];
>>
>> I'd argue that arm_smmu_device_dt_probe() is a better place for all
>> the code above, since this function is called regardless of whether
>> the device is probed from DT or not. Going further,
>> arm_smmu_device_acpi_probe() could fill smmu->num_clks and ->clocks
>> using ACPI-like way (as opposed to OF match data) if necessary.
>
> Right, it's valid to fill the data in arm_smmu_device_dt_probe().
> Perhaps we can just keep the devm_clk_bulk_get() in arm_smmu_device_probe()
> at the point where we are currently doing arm_smmu_init_clks().

Sounds good to me. Thanks.

Best regards,
Tomasz

Reply via email to