diff mbox series

[v5,5/9] qemu: arm: Remove platform specific function to get RNG device

Message ID 20220313144802.65687-6-sughosh.ganu@linaro.org
State Accepted
Commit 64437a05d255128392177984563e6a2128636834
Headers show
Series tpm: rng: Move TPM RNG functionality to driver model | expand

Commit Message

Sughosh Ganu March 13, 2022, 2:47 p.m. UTC
The Qemu platform has a function defined to get the random number
generator(RNG) device. However, the RNG device can be obtained simply
by searching for a device belonging to the RNG uclass. Remove the
superfluous platform function defined for the Qemu platform for
getting the RNG device.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes since V4: None

 board/emulation/qemu-arm/qemu-arm.c | 42 -----------------------------
 1 file changed, 42 deletions(-)

Comments

Sughosh Ganu March 24, 2022, 4:44 p.m. UTC | #1
hi Heinrich,

On Sun, 13 Mar 2022 at 20:18, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> The Qemu platform has a function defined to get the random number
> generator(RNG) device. However, the RNG device can be obtained simply
> by searching for a device belonging to the RNG uclass. Remove the
> superfluous platform function defined for the Qemu platform for
> getting the RNG device.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes since V4: None
>
>  board/emulation/qemu-arm/qemu-arm.c | 42 -----------------------------
>  1 file changed, 42 deletions(-)

Can you please pick this up, as this has been reviewed, and is not
related to the TPM RNG discussion. Thanks.

-sughosh

>
> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> index 16d5a97167..c9e886e44a 100644
> --- a/board/emulation/qemu-arm/qemu-arm.c
> +++ b/board/emulation/qemu-arm/qemu-arm.c
> @@ -107,48 +107,6 @@ void enable_caches(void)
>          dcache_enable();
>  }
>
> -#if defined(CONFIG_EFI_RNG_PROTOCOL)
> -#include <efi_loader.h>
> -#include <efi_rng.h>
> -
> -#include <dm/device-internal.h>
> -
> -efi_status_t platform_get_rng_device(struct udevice **dev)
> -{
> -       int ret;
> -       efi_status_t status = EFI_DEVICE_ERROR;
> -       struct udevice *bus, *devp;
> -
> -       for (uclass_first_device(UCLASS_VIRTIO, &bus); bus;
> -            uclass_next_device(&bus)) {
> -               for (device_find_first_child(bus, &devp); devp;
> -                    device_find_next_child(&devp)) {
> -                       if (device_get_uclass_id(devp) == UCLASS_RNG) {
> -                               *dev = devp;
> -                               status = EFI_SUCCESS;
> -                               break;
> -                       }
> -               }
> -       }
> -
> -       if (status != EFI_SUCCESS) {
> -               debug("No rng device found\n");
> -               return EFI_DEVICE_ERROR;
> -       }
> -
> -       if (*dev) {
> -               ret = device_probe(*dev);
> -               if (ret)
> -                       return EFI_DEVICE_ERROR;
> -       } else {
> -               debug("Couldn't get child device\n");
> -               return EFI_DEVICE_ERROR;
> -       }
> -
> -       return EFI_SUCCESS;
> -}
> -#endif /* CONFIG_EFI_RNG_PROTOCOL */
> -
>  #ifdef CONFIG_ARM64
>  #define __W    "w"
>  #else
> --
> 2.25.1
>
Heinrich Schuchardt March 24, 2022, 5:07 p.m. UTC | #2
On 3/24/22 17:44, Sughosh Ganu wrote:
> On Sun, 13 Mar 2022 at 20:18, Sughosh Ganu<sughosh.ganu@linaro.org>  wrote:
>> The Qemu platform has a function defined to get the random number
>> generator(RNG) device. However, the RNG device can be obtained simply
>> by searching for a device belonging to the RNG uclass. Remove the
>> superfluous platform function defined for the Qemu platform for
>> getting the RNG device.
>>
>> Signed-off-by: Sughosh Ganu<sughosh.ganu@linaro.org>
>> Tested-by: Heinrich Schuchardt<xypron.glpk@gmx.de>
>> Reviewed-by: Ilias Apalodimas<ilias.apalodimas@linaro.org>
>> Reviewed-by: Simon Glass<sjg@chromium.org>
>> ---
>>
>> Changes since V4: None
>>
>>   board/emulation/qemu-arm/qemu-arm.c | 42 -----------------------------
>>   1 file changed, 42 deletions(-)
> Can you please pick this up, as this has been reviewed, and is not
> related to the TPM RNG discussion. Thanks.
>
> -sughosh
>

Hello Sughosh,

I have added the patch to my queue.

Best regards

Heinrich
diff mbox series

Patch

diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 16d5a97167..c9e886e44a 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -107,48 +107,6 @@  void enable_caches(void)
 	 dcache_enable();
 }
 
-#if defined(CONFIG_EFI_RNG_PROTOCOL)
-#include <efi_loader.h>
-#include <efi_rng.h>
-
-#include <dm/device-internal.h>
-
-efi_status_t platform_get_rng_device(struct udevice **dev)
-{
-	int ret;
-	efi_status_t status = EFI_DEVICE_ERROR;
-	struct udevice *bus, *devp;
-
-	for (uclass_first_device(UCLASS_VIRTIO, &bus); bus;
-	     uclass_next_device(&bus)) {
-		for (device_find_first_child(bus, &devp); devp;
-		     device_find_next_child(&devp)) {
-			if (device_get_uclass_id(devp) == UCLASS_RNG) {
-				*dev = devp;
-				status = EFI_SUCCESS;
-				break;
-			}
-		}
-	}
-
-	if (status != EFI_SUCCESS) {
-		debug("No rng device found\n");
-		return EFI_DEVICE_ERROR;
-	}
-
-	if (*dev) {
-		ret = device_probe(*dev);
-		if (ret)
-			return EFI_DEVICE_ERROR;
-	} else {
-		debug("Couldn't get child device\n");
-		return EFI_DEVICE_ERROR;
-	}
-
-	return EFI_SUCCESS;
-}
-#endif /* CONFIG_EFI_RNG_PROTOCOL */
-
 #ifdef CONFIG_ARM64
 #define __W	"w"
 #else