aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_driver
diff options
context:
space:
mode:
authorHeinrich Schuchardt2022-10-06 07:29:41 +0200
committerHeinrich Schuchardt2022-10-06 22:54:58 +0200
commitf05911a126bd6b8536c8d43fd6c1d837008fcda1 (patch)
tree13516e69b377dd0132a5b895a62c0f3f73ecadf3 /lib/efi_driver
parent564e55c7f4a335abb766c921eb2ae1e05ce1253c (diff)
efi_driver: move event registration to driver
Move the registration of events for the addition and removal of block devices to the block device driver. Here we can add a reference to the EFI Driver Binding protocol as context. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib/efi_driver')
-rw-r--r--lib/efi_driver/efi_block_device.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index bd3688848ba..add00eeebbe 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -205,6 +205,22 @@ static efi_status_t efi_bl_bind(
static efi_status_t
efi_bl_init(struct efi_driver_binding_extended_protocol *this)
{
+ int ret;
+
+ ret = event_register("efi_disk add", EVT_DM_POST_PROBE,
+ efi_disk_probe, this);
+ if (ret) {
+ log_err("Event registration for efi_disk add failed\n");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ret = event_register("efi_disk del", EVT_DM_PRE_REMOVE,
+ efi_disk_remove, this);
+ if (ret) {
+ log_err("Event registration for efi_disk del failed\n");
+ return EFI_OUT_OF_RESOURCES;
+ }
+
return EFI_SUCCESS;
}