Re: [PATCH v2 4/4] net: qcom/emac: Prevent device_find_child() from modifying caller's match data

Greg Kroah-Hartman
2024-08-24T05:18:42Z

On Thu, Aug 15, 2024 at 10:58:05PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
>
> To prepare for constifying the following old driver core API:
>
> struct device *device_find_child(struct device *dev, void *data,
> int (*match)(struct device *dev, void *data));
> to new:
> struct device *device_find_child(struct device *dev, const void *data,
> int (*match)(struct device *dev, const void *data));
>
> The new API does not allow its match function (*match)() to modify
> caller's match data @*data, but emac_sgmii_acpi_match() as the old
> API's match function indeed modifies relevant match data, so it is not
> suitable for the new API any more, fixed by implementing a equivalent
> emac_device_find_child() instead of the old API usage.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 36 +++++++++++++++++++++++--
> 1 file changed, 34 insertions(+), 2 deletions(-)

Can you rewrite this based on the cxl change to make it a bit more less
of a "wrap the logic in yet another layer" type of change like this one
is?

thanks,

greg k-h