Re: [PATCH v3 04/11] driver core: Constify API device_find_child() then adapt for various usages
Zijun Hu <[email protected]>
| Newsgroups | gmane.linux.kernel.hwmon,gmane.linux.kernel,gmane.linux.sound,gmane.linux.ports.sparc,gmane.linux.block,gmane.linux.kernel.firewire.devel,gmane.linux.kernel.efi,gmane.linux.kernel.gpio,gmane.comp.video.dri.devel,gmane.linux.ports.arm.mediatek,gmane.linux.drivers.video-input-infrastructure,gmane.linux.pwm,gmane.linux.scsi,gmane.linux.iscsi.open-iscsi,gmane.linux.usb.general,gmane.linux.serial,gmane.linux.network |
|---|---|
| Message-ID | <[email protected]> |
On 2024/12/6 21:52, Takashi Sakamoto wrote: > Hi, > > On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu wrote: >> From: Zijun Hu <[email protected]> >> >> 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 <[email protected]> >> --- >> 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 the changes in FireWire subsystem: > > Reviewed-by: Takashi Sakamoto <[email protected]> > thank you for code review and previous cooperation to achieve this goal (^^). > > Thanks > > Takashi Sakamoto