On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu 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 by simply making > various match functions take 'const void *' as type of match data @data. > > Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> > --- > arch/sparc/kernel/vio.c | 6 +++--- > drivers/base/core.c | 6 +++--- > drivers/block/sunvdc.c | 6 +++--- > drivers/bus/fsl-mc/dprc-driver.c | 4 ++-- > drivers/cxl/core/pci.c | 4 ++-- > drivers/cxl/core/pmem.c | 2 +- > drivers/cxl/core/region.c | 21 ++++++++++++--------- > drivers/firewire/core-device.c | 4 ++-- > drivers/firmware/arm_scmi/bus.c | 4 ++-- > drivers/firmware/efi/dev-path-parser.c | 4 ++-- > drivers/gpio/gpio-sim.c | 2 +- > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +- > drivers/hwmon/hwmon.c | 2 +- > drivers/media/pci/mgb4/mgb4_core.c | 4 ++-- > drivers/nvdimm/bus.c | 2 +- > drivers/pwm/core.c | 2 +- > drivers/rpmsg/rpmsg_core.c | 4 ++-- > drivers/scsi/qla4xxx/ql4_os.c | 3 ++- > drivers/scsi/scsi_transport_iscsi.c | 10 +++++----- > drivers/slimbus/core.c | 8 ++++---- > drivers/thunderbolt/retimer.c | 2 +- > drivers/thunderbolt/xdomain.c | 2 +- > drivers/tty/serial/serial_core.c | 4 ++-- > drivers/usb/typec/class.c | 8 ++++---- > include/linux/device.h | 4 ++-- > include/scsi/scsi_transport_iscsi.h | 4 ++-- > net/dsa/dsa.c | 2 +- > tools/testing/cxl/test/cxl.c | 2 +- > 28 files changed, 66 insertions(+), 62 deletions(-) > For these cxl and nvdimm pieces: drivers/cxl/core/pci.c | 4 ++-- drivers/cxl/core/pmem.c | 2 +- drivers/cxl/core/region.c | 21 ++++++++++++--------- drivers/nvdimm/bus.c | 2 +- tools/testing/cxl/test/cxl.c | 2 +- Reviewed-by: Alison Schofield <alison.schofield@xxxxxxxxx> snip to end