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

From: Zijun Hu
Date: Sat Aug 24 2024 - 03:11:29 EST


On 2024/8/24 11:29, Greg Kroah-Hartman wrote:
> On Thu, Aug 15, 2024 at 10:58:05PM +0800, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>>
>> 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@xxxxxxxxxxx>
>> ---
>> 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?
>
sure. will do it today.
> thanks,
>
> greg k-h