summaryrefslogtreecommitdiff
path: root/include/linux/device/driver.h
diff options
context:
space:
mode:
authorZijun Hu <quic_zijuhu@quicinc.com>2024-08-13 17:19:32 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-03 13:48:51 +0300
commitb45ed06f46737f8c2ee65698f4305409f2386674 (patch)
tree407512769416e7bc7f10c86715e7e8ed5be4eb45 /include/linux/device/driver.h
parentf0e5311aa8022107d63c54e2f03684ec097d1394 (diff)
downloadlinux-b45ed06f46737f8c2ee65698f4305409f2386674.tar.xz
drivers/base: Introduce device_match_t for device finding APIs
There are several drivers/base APIs for finding a specific device, and they currently use the following good type for the @match parameter: int (*match)(struct device *dev, const void *data) Since these operations do not modify the caller-provided @*data, this type is worthy of a dedicated typedef: typedef int (*device_match_t)(struct device *dev, const void *data) Advantages of using device_match_t: - Shorter API declarations and definitions - Prevent further APIs from using a bad type for @match So introduce device_match_t and apply it to the existing (bus|class|driver|auxiliary)_find_device() APIs. Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20240813-dev_match_api-v3-1-6c6878a99b9f@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device/driver.h')
-rw-r--r--include/linux/device/driver.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index 1fc8b68786de..5c04b8e3833b 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -157,7 +157,7 @@ int __must_check driver_for_each_device(struct device_driver *drv, struct device
void *data, int (*fn)(struct device *dev, void *));
struct device *driver_find_device(const struct device_driver *drv,
struct device *start, const void *data,
- int (*match)(struct device *dev, const void *data));
+ device_match_t match);
/**
* driver_find_device_by_name - device iterator for locating a particular device