diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-06-02 04:35:42 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-06-03 07:10:47 +0200 |
commit | 5605f102378f59f4e87f33685bb273602622c643 (patch) | |
tree | 9a65fe40dbf0c1fcfe3dccb230e77e4ac7314829 /tools/net/ynl | |
parent | tools: ynl-gen: don't override pure nested struct (diff) | |
download | linux-5605f102378f59f4e87f33685bb273602622c643.tar.xz linux-5605f102378f59f4e87f33685bb273602622c643.zip |
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: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl')
-rwxr-xr-x | tools/net/ynl/ynl-gen-c.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py index 40f7c47407c8..2ceb4ce1423f 100755 --- a/tools/net/ynl/ynl-gen-c.py +++ b/tools/net/ynl/ynl-gen-c.py @@ -897,11 +897,12 @@ class RenderInfo: self.op_mode = op_mode # '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 \ - op["do"]["reply"] == op["dump"]["reply"]: - self.type_consistent = True - else: - self.type_consistent = op_mode == 'event' + self.type_consistent = True + if op_mode != 'do' and 'dump' in op and 'do' in op: + if ('reply' in op['do']) != ('reply' in op["dump"]): + self.type_consistent = False + elif 'reply' in op['do'] and op["do"]["reply"] != op["dump"]["reply"]: + self.type_consistent = False self.attr_set = attr_set if not self.attr_set: @@ -2245,7 +2246,7 @@ def main(): ri = RenderInfo(cw, parsed, args.mode, op, op_name, 'notify') has_ntf = True 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) if 'event' in op: @@ -2304,7 +2305,7 @@ def main(): ri = RenderInfo(cw, parsed, args.mode, op, op_name, 'notify') has_ntf = True 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) if 'event' in op: |