env: mmc: refactor mmc_offset_try_partition()

In preparation for fixing the handling of a the case of redundant
environment defined in two separate partitions with the U-Boot env
GUID, refactor the

  for ()
    if (str)
      ...
  #ifdef CONFIG_FOO
    if (!str)
      ..
  #endif

to

  if (str)
    for ()
  else if (CONFIG_FOO && !str)
    for ()

and put those for loops in separate functions.

No functional change intended, but I did change the direct access of
info.type_guid into using the disk_partition_type_guid() helper, so
that I could avoid the #ifdef and use IS_ENABLED() in the if() statement.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
1 file changed