[PATCH 2/2] tee: add a stub for tee_find_device

Etienne Carriere etienne.carriere at linaro.org
Fri Sep 3 12:08:02 CEST 2021


Hello Patrick,

On Thu, 2 Sept 2021 at 11:56, Patrick Delaunay <patrick.delaunay at foss.st.com>
wrote:

> Add stub for tee_find_device function when CONFIG_TEE is not activated
> to simplify the caller code.
>
> This patch allows to remove the CONFIG_IS_ENABLED(OPTEE) tests
> for stm32 platform.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
>
>  arch/arm/mach-stm32mp/fdt.c        |  1 -
>  board/st/common/stm32mp_mtdparts.c |  3 +--
>  include/tee.h                      | 11 +++++++++++
>  3 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/fdt.c b/arch/arm/mach-stm32mp/fdt.c
> index a19e954cf7..91330a68a4 100644
> --- a/arch/arm/mach-stm32mp/fdt.c
> +++ b/arch/arm/mach-stm32mp/fdt.c
> @@ -341,7 +341,6 @@ int ft_system_setup(void *blob, struct bd_info *bd)
>          * when FIP is not used by TF-A
>          */
>         if (CONFIG_IS_ENABLED(STM32MP15x_STM32IMAGE) &&
> -           CONFIG_IS_ENABLED(OPTEE) &&
>             !tee_find_device(NULL, NULL, NULL, NULL))
>                 stm32_fdt_disable_optee(blob);
>
> diff --git a/board/st/common/stm32mp_mtdparts.c
> b/board/st/common/stm32mp_mtdparts.c
> index 8b636d62fa..18878424c7 100644
> --- a/board/st/common/stm32mp_mtdparts.c
> +++ b/board/st/common/stm32mp_mtdparts.c
> @@ -119,8 +119,7 @@ void board_mtdparts_default(const char **mtdids, const
> char **mtdparts)
>         }
>
>  #ifdef CONFIG_STM32MP15x_STM32IMAGE
> -       if (!serial && CONFIG_IS_ENABLED(OPTEE) &&
> -           tee_find_device(NULL, NULL, NULL, NULL))
> +       if (!serial && tee_find_device(NULL, NULL, NULL, NULL))
>                 tee = true;
>  #endif
>
> diff --git a/include/tee.h b/include/tee.h
> index 2ef29bfc8f..44e9cd4321 100644
> --- a/include/tee.h
> +++ b/include/tee.h
> @@ -307,11 +307,22 @@ bool tee_shm_is_registered(struct tee_shm *shm,
> struct udevice *dev);
>   * Returns a probed TEE device of the first TEE device matched by the
>   * match() callback or NULL.
>   */
> +#if CONFIG_IS_ENABLED(TEE)
>  struct udevice *tee_find_device(struct udevice *start,
>                                 int (*match)(struct tee_version_data *vers,
>                                              const void *data),
>                                 const void *data,
>                                 struct tee_version_data *vers);
> +#else
> +static inline struct udevice *tee_find_device(struct udevice *start,
> +                                             int (*match)(struct
> tee_version_data *vers,
> +                                                          const void
> *data),
> +                                             const void *data,
> +                                             struct tee_version_data
> *vers)
> +{
> +       return NULL;
> +}
> +#endif
>
>  /**
>   * tee_get_version() - Query capabilities of TEE device
> --
> 2.25.1
>
>
Acked-by: Etienne Carriere <etienne.carriere at inaro.org>


More information about the U-Boot mailing list