aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-12-09 22:29:08 -0500
committerJiri Kosina <jkosina@suse.cz>2010-12-10 09:14:43 -0500
commit504499f22c08a03e2e19dc88d31aa0ecd2ac815e (patch)
tree9cbd803c228103b37006ab2427981db8d7f66ab0 /drivers/hid
parenta3789a1783d37f2772ba5046b26416c98dfe1bfa (diff)
HID: simplify an index check in hid_lookup_collection
Save the struct hid_collection * in a temporary to shorten the generated code a bit and perhaps improve readability. $ size drivers/hid/hid-core.o* text data bss dec hex filename 16460 78 8 16546 40a2 drivers/hid/hid-core.o.new 16469 78 8 16555 40ab drivers/hid/hid-core.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 86b7155632fb..d4c1906313d2 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -178,10 +178,14 @@ static int close_collection(struct hid_parser *parser)
178 178
179static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) 179static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
180{ 180{
181 struct hid_collection *collection = parser->device->collection;
181 int n; 182 int n;
182 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) 183
183 if (parser->device->collection[parser->collection_stack[n]].type == type) 184 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) {
184 return parser->device->collection[parser->collection_stack[n]].usage; 185 unsigned index = parser->collection_stack[n];
186 if (collection[index].type == type)
187 return collection[index].usage;
188 }
185 return 0; /* we know nothing about this usage type */ 189 return 0; /* we know nothing about this usage type */
186} 190}
187 191