mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
HID: core: store the collections as a basic tree
For each collection parsed, store a pointer to the parent collection (if any). This makes it a lot easier to look up which collection(s) any given item is part of Signed-off-by: Peter Hutterer <[email protected]> Verified-by: Harry Cutts <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
This commit is contained in:
parent
52ea899637
commit
c53431eb69
2 changed files with 6 additions and 0 deletions
|
|
@ -172,6 +172,8 @@ static int open_collection(struct hid_parser *parser, unsigned type)
|
|||
collection->type = type;
|
||||
collection->usage = usage;
|
||||
collection->level = parser->collection_stack_ptr - 1;
|
||||
collection->parent = parser->active_collection;
|
||||
parser->active_collection = collection;
|
||||
|
||||
if (type == HID_COLLECTION_APPLICATION)
|
||||
parser->device->maxapplication++;
|
||||
|
|
@ -190,6 +192,8 @@ static int close_collection(struct hid_parser *parser)
|
|||
return -EINVAL;
|
||||
}
|
||||
parser->collection_stack_ptr--;
|
||||
if (parser->active_collection)
|
||||
parser->active_collection = parser->active_collection->parent;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue