[U-Boot] [RFC PATCH 1/3] dm: core: Add pre-OS remove flag to device_remove()

Simon Glass sjg at chromium.org
Fri Mar 3 04:53:06 UTC 2017


Hi Stefan,

On 1 March 2017 at 03:23, Stefan Roese <sr at denx.de> wrote:
> This patch adds the pre_os_remove boolean flag to device_remove() and
> changes all calls to this function to provide the default value of
> "false". This is in preparation for the driver specific pre-OS remove
> support.
>
> Signed-off-by: Stefan Roese <sr at denx.de>
> Cc: Simon Glass <sjg at chromium.org>
> ---
>  arch/x86/cpu/queensbay/tnc.c   |  4 ++--
>  cmd/cros_ec.c                  |  2 +-
>  cmd/sf.c                       |  2 +-
>  drivers/block/blk-uclass.c     |  2 +-
>  drivers/block/sandbox.c        |  2 +-
>  drivers/core/device-remove.c   |  9 +++++----
>  drivers/core/device.c          |  2 +-
>  drivers/core/root.c            |  2 +-
>  drivers/core/uclass.c          |  2 +-
>  drivers/mmc/mmc-uclass.c       |  2 +-
>  drivers/mtd/spi/sandbox.c      |  2 +-
>  drivers/mtd/spi/sf-uclass.c    |  2 +-
>  drivers/spi/spi-uclass.c       |  4 ++--
>  drivers/usb/emul/sandbox_hub.c |  2 +-
>  drivers/usb/host/usb-uclass.c  |  4 ++--
>  include/dm/device-internal.h   |  5 +++--
>  include/dm/device.h            |  3 +++
>  test/dm/bus.c                  |  8 ++++----
>  test/dm/core.c                 | 16 ++++++++--------
>  test/dm/eth.c                  |  2 +-
>  test/dm/spi.c                  |  2 +-
>  21 files changed, 42 insertions(+), 37 deletions(-)

I think adding a parameter to device_remove() makes sense, but how
about using flags instead? The true/false meaning is not clear here
and your comment in device.h doesn't really help.

Also I think it is better to name it after the required function
rather than state related to the caller. IOW instead of 'pre-os' use
something like 'active_dma_only' or as a flag ONLY_REMOVE_ACTIVE_DMA.

Do you think the presence of DMA should be a device flag?

Regards,
Simon


More information about the U-Boot mailing list