aboutsummaryrefslogtreecommitdiffstats
path: root/include/dm/device-internal.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-03-04 08:43:03 -0700
committerTom Rini <trini@konsulko.com>2022-03-10 08:28:36 -0500
commit5b896ed5856f768cdd55cdeb44c5f8f6b6a7a18a (patch)
tree427918a7828619a8620cd9b95d547539c9eb6733 /include/dm/device-internal.h
parent5a4219043d659514316e41d3d09866030c773e78 (diff)
downloadu-boot-5b896ed5856f768cdd55cdeb44c5f8f6b6a7a18a.tar.gz
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 <sjg@chromium.org>
Diffstat (limited to 'include/dm/device-internal.h')
-rw-r--r--include/dm/device-internal.h10
1 files changed, 10 insertions, 0 deletions
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 <event.h>
#include <linker_lists.h>
#include <dm/ofnode.h>
@@ -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