summaryrefslogtreecommitdiff
path: root/drivers/core/device-remove.c
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 /drivers/core/device-remove.c
parent5a4219043d659514316e41d3d09866030c773e78 (diff)
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 'drivers/core/device-remove.c')
-rw-r--r--drivers/core/device-remove.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index e6ec6ff4212..73d2e9e4208 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -207,6 +207,10 @@ int device_remove(struct udevice *dev, uint flags)
if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED))
return 0;
+ ret = device_notify(dev, EVT_DM_PRE_REMOVE);
+ if (ret)
+ return ret;
+
/*
* If the child returns EKEYREJECTED, continue. It just means that it
* didn't match the flags.
@@ -256,6 +260,10 @@ int device_remove(struct udevice *dev, uint flags)
dev_bic_flags(dev, DM_FLAG_ACTIVATED);
+ ret = device_notify(dev, EVT_DM_POST_REMOVE);
+ if (ret)
+ goto err_remove;
+
return 0;
err_remove: