
On 6/8/22 16:39, Jan Kiszka wrote:
[...]
If you want to make this into a generic patch, can you somehow reduce the ever-growing ifdeffery, so that the patch won't add to it so much ? I suspect the code above can help with that, maybe it can be used to remove at least the env_locations[] reordering ifdeffery ?
Your code is not generic enough as it ignores the config-selected storage device. It would only happen to cover all our boards, but we are not the world. That's why I had to add some ifdeffery.
That storage device part is trivial to fix, right.
I could try write an alternative arch_env_get_location that does the required logic with a single ifdef. The prize might be some code duplication, though.
Can you use CONFIG_IS_ENABLED()/IS_ENABLED() in arch_env_get_location() to avoid the #if ... and outright return ENVL_NOWHERE or whatever to avoid adding ifdefs to env_locations[] array ?
That should likely be possible.
[...]