[PATCH v3 04/11] driver core: Constify API device_find_child() then adapt for various usages
Uwe Kleine-König
ukleinek at kernel.org
Fri Dec 6 07:21:01 UTC 2024
Hello,
On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu at quicinc.com>
>
> Constify the following API:
> struct device *device_find_child(struct device *dev, void *data,
> int (*match)(struct device *dev, void *data));
> To :
> struct device *device_find_child(struct device *dev, const void *data,
> device_match_t match);
> typedef int (*device_match_t)(struct device *dev, const void *data);
> with the following reasons:
>
> - Protect caller's match data @*data which is for comparison and lookup
> and the API does not actually need to modify @*data.
>
> - Make the API's parameters (@match)() and @data have the same type as
> all of other device finding APIs (bus|class|driver)_find_device().
>
> - All kinds of existing device match functions can be directly taken
> as the API's argument, they were exported by driver core.
>
> Constify the API and adapt for various existing usages by simply making
> various match functions take 'const void *' as type of match data @data.
With the discussion that a new name would ease the conversion, maybe
consider device_find_child_device() to also align the name (somewhat) to
the above mentioned (bus|class|driver)_find_device()?
Do you have a merge plan already? I guess this patch will go through
Greg's driver core tree?
Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20241206/e8f077d7/attachment.sig>
More information about the dri-devel
mailing list