Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: ynl: fix converting flags to names after recent cleanup

I recently cleaned up specs to not specify enum-as-flags
when target enum is already defined as flags.
YNL Python library did not convert flags, unfortunately,
so this caused breakage for Stan and Willem.

Note that the nlspec.py abstraction already hides the differences
between flags and enums (value vs user_value), so the changes
are pretty trivial.

Fixes: 0629f22ec130 ("ynl: netdev: drop unnecessary enum-as-flags")
Reported-and-tested-by: Willem de Bruijn <willemb@google.com>
Reported-and-tested-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/all/ZS10NtQgd_BJZ3RU@google.com/
Link: https://lore.kernel.org/r/20231016213937.1820386-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+1 -1
+1 -1
tools/net/ynl/lib/ynl.py
··· 474 474 475 475 def _decode_enum(self, raw, attr_spec): 476 476 enum = self.consts[attr_spec['enum']] 477 - if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']: 477 + if enum.type == 'flags' or attr_spec.get('enum-as-flags', False): 478 478 i = 0 479 479 value = set() 480 480 while raw: