]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drivers/base: Introduce device_match_t for device finding APIs
authorZijun Hu <quic_zijuhu@quicinc.com>
Tue, 13 Aug 2024 14:19:32 +0000 (22:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Sep 2024 10:48:51 +0000 (12:48 +0200)
commitb45ed06f46737f8c2ee65698f4305409f2386674
tree407512769416e7bc7f10c86715e7e8ed5be4eb45
parentf0e5311aa8022107d63c54e2f03684ec097d1394
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>
drivers/base/auxiliary.c
drivers/base/bus.c
drivers/base/class.c
drivers/base/driver.c
include/linux/auxiliary_bus.h
include/linux/device/bus.h
include/linux/device/class.h
include/linux/device/driver.h