Re: [PATCH v5 04/12] driver core: Constify API device_find_child() and adapt for various usages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 24 Dec 2024 21:05:03 +0800
Zijun Hu <zijun_hu@xxxxxxxxxx> wrote:

> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
> 
> 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.
> 
> BTW, various subsystem changes are squashed into this commit to meet
> 'git bisect' requirement, and this commit has the minimal and simplest
> changes to complement squashing shortcoming, and that may bring extra
> code improvement.
> 
> Reviewed-by: Alison Schofield <alison.schofield@xxxxxxxxx>
> Reviewed-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
> Acked-by: Uwe Kleine-König <ukleinek@xxxxxxxxxx> # for drivers/pwm
> Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>





[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux