Commit 5605f102 authored by Jakub Kicinski's avatar Jakub Kicinski

tools: ynl-gen: loosen type consistency check for events

Both event and notify types are always consistent. Rewrite
the condition checking if we can reuse reply types to be
less picky and let notify thru.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 67c65ce7
...@@ -897,11 +897,12 @@ class RenderInfo: ...@@ -897,11 +897,12 @@ class RenderInfo:
self.op_mode = op_mode self.op_mode = op_mode
# 'do' and 'dump' response parsing is identical # 'do' and 'dump' response parsing is identical
if op_mode != 'do' and 'dump' in op and 'do' in op and 'reply' in op['do'] and \ self.type_consistent = True
op["do"]["reply"] == op["dump"]["reply"]: if op_mode != 'do' and 'dump' in op and 'do' in op:
self.type_consistent = True if ('reply' in op['do']) != ('reply' in op["dump"]):
else: self.type_consistent = False
self.type_consistent = op_mode == 'event' elif 'reply' in op['do'] and op["do"]["reply"] != op["dump"]["reply"]:
self.type_consistent = False
self.attr_set = attr_set self.attr_set = attr_set
if not self.attr_set: if not self.attr_set:
...@@ -2245,7 +2246,7 @@ def main(): ...@@ -2245,7 +2246,7 @@ def main():
ri = RenderInfo(cw, parsed, args.mode, op, op_name, 'notify') ri = RenderInfo(cw, parsed, args.mode, op, op_name, 'notify')
has_ntf = True has_ntf = True
if not ri.type_consistent: if not ri.type_consistent:
raise Exception('Only notifications with consistent types supported') raise Exception(f'Only notifications with consistent types supported ({op.name})')
print_wrapped_type(ri) print_wrapped_type(ri)
if 'event' in op: if 'event' in op:
...@@ -2304,7 +2305,7 @@ def main(): ...@@ -2304,7 +2305,7 @@ def main():
ri = RenderInfo(cw, parsed, args.mode, op, op_name, 'notify') ri = RenderInfo(cw, parsed, args.mode, op, op_name, 'notify')
has_ntf = True has_ntf = True
if not ri.type_consistent: if not ri.type_consistent:
raise Exception('Only notifications with consistent types supported') raise Exception(f'Only notifications with consistent types supported ({op.name})')
print_ntf_type_free(ri) print_ntf_type_free(ri)
if 'event' in op: if 'event' in op:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment