Re: [PATCH v4 01/11] libnvdimm: Replace namespace_match() with device_find_child_by_name()

Zijun Hu
2025-01-03T00:29:58Z

On 2025/1/3 02:17, Fan Ni wrote:
>> -
>> static bool is_idle(struct device *dev, struct nd_namespace_common *ndns)
>> {
>> struct nd_region *nd_region = to_nd_region(dev->parent);
>> @@ -168,7 +161,7 @@ ssize_t nd_namespace_store(struct device *dev,
>> goto out;
>> }
>>
>> - found = device_find_child(dev->parent, name, namespace_match);
>> + found = device_find_child_by_name(dev->parent, name);
> Looks good to me.
> Just one general question.
> The function device_find_child checks parent and parent->p, but
> device_find_child_by_name only checks parent although they share the
> code except the match function. Why that?
>

Thank you Fan for code review.

I did not touch device_find_child_by_name() parameter checking at
that time.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=903c44939abc02e2f3d6f2ad65fa090f7e5df5b6

since
[PATCH v5 05/12] will come finally.
https://lore.kernel.org/all/20241224-const_dfc_done-v5-5-6623037414d4@quicinc.com/

> Fan