/* Climb up the stack, search for the specified collection type and return the usage.  */
static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
/* Climb up the stack, search for the specified collection type and return the usage.  */
static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
{
	int n;
	for (n = parser->collection_stack_ptr - 1; n >= 0; n--)
		if (parser->device->collection[parser->collection_stack[n]].type == type)
			return parser->device->collection[parser->collection_stack[n]].usage;
	return 0;
}