]> www.infradead.org Git - users/jedix/linux-maple.git/commit
driver core: Correct API device_for_each_child_reverse_from() prototype
authorZijun Hu <quic_zijuhu@quicinc.com>
Sun, 5 Jan 2025 08:34:07 +0000 (16:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jan 2025 14:26:12 +0000 (15:26 +0100)
commit523c6b3ed7702a638e0f8fd02708a7ed4f938269
tree23b25d18601bab6018b00e9f9f5bc30242de8d2b
parent037116a6cca3e4dbc97905b6e254e8fe7475d502
driver core: Correct API device_for_each_child_reverse_from() prototype

For API device_for_each_child_reverse_from(..., const void *data,
int (*fn)(struct device *dev, const void *data))

- Type of @data is const pointer, and means caller's data @*data is not
  allowed to be modified, but that usually is not proper for such non
  finding device iterating API.

- Types for both @data and @fn are not consistent with all other
  for_each device iterating APIs device_for_each_child(_reverse)(),
  bus_for_each_dev() and (driver|class)_for_each_device().

Correct its prototype by removing const from parameter types, then adapt
for various existing usages.

An dedicated typedef device_iter_t will be introduced as @fn() type for
various for_each device interating APIs later.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20250105-class_fix-v6-6-3a2f1768d4d4@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c
drivers/cxl/core/hdm.c
drivers/cxl/core/region.c
include/linux/device.h