public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_loader: avoid using HandleProtocol in helloworld.efi
@ 2023-04-04  5:17 Heinrich Schuchardt
  2023-04-04  7:35 ` Ilias Apalodimas
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2023-04-04  5:17 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: u-boot, Heinrich Schuchardt

HandleProtocol() is deprecated and leaves an OpenedProtocolInformation
behind. Use OpenProtocol(GET_PROTOCOL) instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/helloworld.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c
index 49fa8cc2f0..6405f58ec3 100644
--- a/lib/efi_loader/helloworld.c
+++ b/lib/efi_loader/helloworld.c
@@ -197,8 +197,10 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 	print_config_tables();
 
 	/* Get the loaded image protocol */
-	ret = boottime->handle_protocol(handle, &loaded_image_guid,
-					(void **)&loaded_image);
+	ret = boottime->open_protocol(handle, &loaded_image_guid,
+				      (void **)&loaded_image, NULL, NULL,
+				      EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
 	if (ret != EFI_SUCCESS) {
 		con_out->output_string
 			(con_out, u"Cannot open loaded image protocol\r\n");
@@ -219,9 +221,10 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
 			(con_out, u"Missing device handle\r\n");
 		goto out;
 	}
-	ret = boottime->handle_protocol(loaded_image->device_handle,
-					&device_path_guid,
-					(void **)&device_path);
+	ret = boottime->open_protocol(loaded_image->device_handle,
+				      &device_path_guid,
+				      (void **)&device_path, NULL, NULL,
+				      EFI_OPEN_PROTOCOL_GET_PROTOCOL);
 	if (ret != EFI_SUCCESS) {
 		con_out->output_string
 			(con_out, u"Missing device path for device handle\r\n");
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] efi_loader: avoid using HandleProtocol in helloworld.efi
  2023-04-04  5:17 [PATCH 1/1] efi_loader: avoid using HandleProtocol in helloworld.efi Heinrich Schuchardt
@ 2023-04-04  7:35 ` Ilias Apalodimas
  0 siblings, 0 replies; 2+ messages in thread
From: Ilias Apalodimas @ 2023-04-04  7:35 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: u-boot

On Tue, Apr 04, 2023 at 07:17:48AM +0200, Heinrich Schuchardt wrote:
> HandleProtocol() is deprecated and leaves an OpenedProtocolInformation
> behind. Use OpenProtocol(GET_PROTOCOL) instead.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/helloworld.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c
> index 49fa8cc2f0..6405f58ec3 100644
> --- a/lib/efi_loader/helloworld.c
> +++ b/lib/efi_loader/helloworld.c
> @@ -197,8 +197,10 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
>  	print_config_tables();
>
>  	/* Get the loaded image protocol */
> -	ret = boottime->handle_protocol(handle, &loaded_image_guid,
> -					(void **)&loaded_image);
> +	ret = boottime->open_protocol(handle, &loaded_image_guid,
> +				      (void **)&loaded_image, NULL, NULL,
> +				      EFI_OPEN_PROTOCOL_GET_PROTOCOL);
> +
>  	if (ret != EFI_SUCCESS) {
>  		con_out->output_string
>  			(con_out, u"Cannot open loaded image protocol\r\n");
> @@ -219,9 +221,10 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
>  			(con_out, u"Missing device handle\r\n");
>  		goto out;
>  	}
> -	ret = boottime->handle_protocol(loaded_image->device_handle,
> -					&device_path_guid,
> -					(void **)&device_path);
> +	ret = boottime->open_protocol(loaded_image->device_handle,
> +				      &device_path_guid,
> +				      (void **)&device_path, NULL, NULL,
> +				      EFI_OPEN_PROTOCOL_GET_PROTOCOL);
>  	if (ret != EFI_SUCCESS) {
>  		con_out->output_string
>  			(con_out, u"Missing device path for device handle\r\n");
> --
> 2.39.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-04  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-04  5:17 [PATCH 1/1] efi_loader: avoid using HandleProtocol in helloworld.efi Heinrich Schuchardt
2023-04-04  7:35 ` Ilias Apalodimas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox