From 5b896ed5856f768cdd55cdeb44c5f8f6b6a7a18a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 4 Mar 2022 08:43:03 -0700 Subject: event: Add events for device probe/remove Generate events when devices are probed or removed, allowing hooks to be added for these situations. This is controlled by the DM_EVENT config option. Signed-off-by: Simon Glass --- include/dm/device-internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/dm') diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index 02002acb787..c420726287e 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -10,6 +10,7 @@ #ifndef _DM_DEVICE_INTERNAL_H #define _DM_DEVICE_INTERNAL_H +#include #include #include @@ -426,4 +427,13 @@ static inline void devres_release_all(struct udevice *dev) } #endif /* ! CONFIG_DEVRES */ + +static inline int device_notify(const struct udevice *dev, enum event_t type) +{ +#if CONFIG_IS_ENABLED(DM_EVENT) + return event_notify(type, &dev, sizeof(dev)); +#else + return 0; +#endif +} #endif -- cgit v1.3.1