[PATCH v2 4/4] dm: core: Rename dm_remove_devices_active()

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Apr 7 09:56:51 CEST 2025


On 07.04.25 03:35, Simon Glass wrote:
> This function doesn't have a great name, since we talk of devices being
> active once they are probed.
>
> Rename it to dm_remove_dma_devices().
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> Suggested-by: Jonas Karlman <jonas at kwiboo.se>
> ---
>
> (no changes since v1)
>
>   arch/arm/lib/bootm.c          | 4 ++--
>   arch/riscv/lib/bootm.c        | 2 +-
>   arch/x86/lib/bootm.c          | 2 +-
>   drivers/core/root.c           | 2 +-
>   include/dm/root.h             | 6 +++---
>   lib/efi_loader/efi_boottime.c | 2 +-
>   test/dm/core.c                | 2 +-
>   7 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> index 688c2f3f29b..ef859a2cd4c 100644
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -74,10 +74,10 @@ static void announce_and_cleanup(int fake)
>   	 * Call remove function of all devices with a removal flag set.
>   	 * This may be useful for last-stage operations, like cancelling
>   	 * of DMA operation or releasing device internal buffers.
> -	 * dm_remove_devices_active() ensures that vital devices are removed in
> +	 * dm_remove_dma_devices() ensures that vital devices are removed in
>   	 * a second round.
>   	 */
> -	dm_remove_devices_active();
> +	dm_remove_dma_devices();
>
>   	cleanup_before_linux();
>   }
> diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
> index 76c610bcee0..9aecaafef43 100644
> --- a/arch/riscv/lib/bootm.c
> +++ b/arch/riscv/lib/bootm.c
> @@ -57,7 +57,7 @@ static void announce_and_cleanup(int fake)
>   	 * This may be useful for last-stage operations, like cancelling
>   	 * of DMA operation or releasing device internal buffers.
>   	 */
> -	dm_remove_devices_active();
> +	dm_remove_dma_devices();
>
>   	cleanup_before_linux();
>   }
> diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
> index 3c420b00936..91e8de4e1ad 100644
> --- a/arch/x86/lib/bootm.c
> +++ b/arch/x86/lib/bootm.c
> @@ -50,7 +50,7 @@ void bootm_announce_and_cleanup(void)
>   	 * This may be useful for last-stage operations, like cancelling
>   	 * of DMA operation or releasing device internal buffers.
>   	 */
> -	dm_remove_devices_active();
> +	dm_remove_dma_devices();
>   }
>
>   #if defined(CONFIG_OF_LIBFDT) && !defined(CONFIG_OF_NO_KERNEL)
> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index c7fb58285ca..101cc4d43fa 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -148,7 +148,7 @@ int dm_remove_devices_flags(uint flags)
>   	return 0;
>   }
>
> -void dm_remove_devices_active(void)
> +void dm_remove_dma_devices(void)
>   {
>   	/* Remove non-vital devices first */
>   	device_remove(dm_root(), DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL);
> diff --git a/include/dm/root.h b/include/dm/root.h
> index 5651b868c8b..39a069cd465 100644
> --- a/include/dm/root.h
> +++ b/include/dm/root.h
> @@ -169,16 +169,16 @@ int dm_uninit(void);
>   int dm_remove_devices_flags(uint flags);
>
>   /**
> - * dm_remove_devices_active - Call remove function of all active drivers heeding
> + * dm_remove_dma_devices - Call remove function of all active drivers heeding
>    *                            device dependencies as far as know, i.e. removing
>    *                            devices marked with DM_FLAG_VITAL last.
>    *
>    * All active devices will be removed
>    */
> -void dm_remove_devices_active(void);
> +void dm_remove_dma_devices(void);

We have to remove all active devices. Not only DMA devices but also any
device that creates interrupts.

The renaming is misleading.

Best regards

Heinrich

>   #else
>   static inline int dm_remove_devices_flags(uint flags) { return 0; }
> -static inline void dm_remove_devices_active(void) { }
> +static inline void dm_remove_dma_devices(void) { }
>   #endif
>
>   /**
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index e525662f82f..8f78fcdf7c8 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -2281,7 +2281,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
>   		if (IS_ENABLED(CONFIG_USB_DEVICE))
>   			udc_disconnect();
>   		board_quiesce_devices();
> -		dm_remove_devices_active();
> +		dm_remove_dma_devices();
>   	}
>
>   out:
> diff --git a/test/dm/core.c b/test/dm/core.c
> index 959b834576f..1194e3250b5 100644
> --- a/test/dm/core.c
> +++ b/test/dm/core.c
> @@ -1057,7 +1057,7 @@ static int dm_test_remove_active(struct unit_test_state *uts)
>   	ut_asserteq(true, device_active(dma_vital));
>
>   	/* Remove active devices in an ordered way */
> -	dm_remove_devices_active();
> +	dm_remove_dma_devices();
>
>   	/* Check that all devices are inactive right now */
>   	ut_asserteq(true, device_active(normal));



More information about the U-Boot mailing list