Re: problems with boards with CONFIG_DM disabled

Marek Behun
2021-05-26T00:26:06Z

On Wed, 26 May 2021 01:27:56 +0200
Marek Behun <marek.behun@nic.cz> wrote:

> Tom, Simon,
>
> now that LTO is merged I am working on
> Support SPI NORs and OF partitions in `mtd list`
>
> but CI fails for some boards, see
> https://github.com/u-boot/u-boot/pull/55
>
> The reason is that there are still several boards which do not use
> CONFIG_DM.
>
> On the previous version Simon commented that I should use
> if (IS_ENABLED(...))
> instead of
> #if
> but this does not currently work for those boards with CONFIG_DM
> disabled (struct udevice's members are not visible at all, and
> functions from dm/device.h do not exist).
>
> There are multiple possible workarounds:
> - use #if (until all boards are at CONFIG_DM)
> - create static inline versions of functions from dm/device.h returning
> failures when CONFIG_DM is not set (this would be rather big :( )
> - wait till all those boards with CONFIG_DM disabled are removed
> - ...

Since there is rather a large number of defconfigs with CONFIG_DM
disabled, and since the relevant code was rather complex

if (!is_part && dev && mtd->dev == dev) ||
!strcmp(name, mtd->name) ||
(is_part && mtd->dev && !strcmp(name, mtd->dev->name))

I moved the code into a separate name matching function and for now
created a non-DM version.

Hopefully this will be acceptable and pass CI.

Marek