mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
tools: ynl: fix enum-as-flags in the generic CLI
Lorenzo points out that the generic CLI is broken for the netdev
family. When I added the support for documentation of enums
(and sparse enums) the client script was not updated.
It expects the values in enum to be a list of names,
now it can also be a dict (YAML object).
Reported-by: Lorenzo Bianconi <lorenzo@kernel.org>
Fixes: e4b48ed460
("tools: ynl: add a completely generic client")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -104,8 +104,9 @@ class SpecEnumSet(SpecElement):
|
||||
as declared in the "definitions" section of the spec.
|
||||
|
||||
Attributes:
|
||||
type enum or flags
|
||||
entries entries by name
|
||||
type enum or flags
|
||||
entries entries by name
|
||||
entries_by_val entries by value
|
||||
Methods:
|
||||
get_mask for flags compute the mask of all defined values
|
||||
"""
|
||||
@@ -117,9 +118,11 @@ class SpecEnumSet(SpecElement):
|
||||
prev_entry = None
|
||||
value_start = self.yaml.get('value-start', 0)
|
||||
self.entries = dict()
|
||||
self.entries_by_val = dict()
|
||||
for entry in self.yaml['entries']:
|
||||
e = self.new_entry(entry, prev_entry, value_start)
|
||||
self.entries[e.name] = e
|
||||
self.entries_by_val[e.raw_value()] = e
|
||||
prev_entry = e
|
||||
|
||||
def new_entry(self, entry, prev_entry, value_start):
|
||||
|
Reference in New Issue
Block a user