mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 14:43:16 +00:00
tools: ynl-gen: handle do ops with no input attrs
The code supports dumps with no input attributes currently thru a combination of special-casing and luck. Clean up the handling of ops with no inputs. Create empty Structs, and skip printing of empty types. This makes dos with no inputs work. Tested-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Link: https://lore.kernel.org/r/20231006135032.3328523-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a4cd2f311a
commit
8cea95b0bd
@ -1041,9 +1041,11 @@ class RenderInfo:
|
|||||||
if op_mode == 'notify':
|
if op_mode == 'notify':
|
||||||
op_mode = 'do'
|
op_mode = 'do'
|
||||||
for op_dir in ['request', 'reply']:
|
for op_dir in ['request', 'reply']:
|
||||||
if op and op_dir in op[op_mode]:
|
if op:
|
||||||
self.struct[op_dir] = Struct(family, self.attr_set,
|
type_list = []
|
||||||
type_list=op[op_mode][op_dir]['attributes'])
|
if op_dir in op[op_mode]:
|
||||||
|
type_list = op[op_mode][op_dir]['attributes']
|
||||||
|
self.struct[op_dir] = Struct(family, self.attr_set, type_list=type_list)
|
||||||
if op_mode == 'event':
|
if op_mode == 'event':
|
||||||
self.struct['reply'] = Struct(family, self.attr_set, type_list=op['event']['attributes'])
|
self.struct['reply'] = Struct(family, self.attr_set, type_list=op['event']['attributes'])
|
||||||
|
|
||||||
@ -1752,6 +1754,8 @@ def print_type_helpers(ri, direction, deref=False):
|
|||||||
|
|
||||||
|
|
||||||
def print_req_type_helpers(ri):
|
def print_req_type_helpers(ri):
|
||||||
|
if len(ri.struct["request"].attr_list) == 0:
|
||||||
|
return
|
||||||
print_alloc_wrapper(ri, "request")
|
print_alloc_wrapper(ri, "request")
|
||||||
print_type_helpers(ri, "request")
|
print_type_helpers(ri, "request")
|
||||||
|
|
||||||
@ -1773,6 +1777,8 @@ def print_parse_prototype(ri, direction, terminate=True):
|
|||||||
|
|
||||||
|
|
||||||
def print_req_type(ri):
|
def print_req_type(ri):
|
||||||
|
if len(ri.struct["request"].attr_list) == 0:
|
||||||
|
return
|
||||||
print_type(ri, "request")
|
print_type(ri, "request")
|
||||||
|
|
||||||
|
|
||||||
@ -2515,7 +2521,6 @@ def main():
|
|||||||
if 'dump' in op:
|
if 'dump' in op:
|
||||||
cw.p(f"/* {op.enum_name} - dump */")
|
cw.p(f"/* {op.enum_name} - dump */")
|
||||||
ri = RenderInfo(cw, parsed, args.mode, op, 'dump')
|
ri = RenderInfo(cw, parsed, args.mode, op, 'dump')
|
||||||
if 'request' in op['dump']:
|
|
||||||
print_req_type(ri)
|
print_req_type(ri)
|
||||||
print_req_type_helpers(ri)
|
print_req_type_helpers(ri)
|
||||||
if not ri.type_consistent:
|
if not ri.type_consistent:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user