@@ -418,38 +418,15 @@ static int hammer_event(struct hid_device *hid, struct hid_field *field,
418418 return 0 ;
419419}
420420
421- static bool hammer_has_usage (struct hid_device * hdev , unsigned int report_type ,
422- unsigned application , unsigned usage )
423- {
424- struct hid_report_enum * re = & hdev -> report_enum [report_type ];
425- struct hid_report * report ;
426- int i , j ;
427-
428- list_for_each_entry (report , & re -> report_list , list ) {
429- if (report -> application != application )
430- continue ;
431-
432- for (i = 0 ; i < report -> maxfield ; i ++ ) {
433- struct hid_field * field = report -> field [i ];
434-
435- for (j = 0 ; j < field -> maxusage ; j ++ )
436- if (field -> usage [j ].hid == usage )
437- return true;
438- }
439- }
440-
441- return false;
442- }
443-
444421static bool hammer_has_folded_event (struct hid_device * hdev )
445422{
446- return hammer_has_usage (hdev , HID_INPUT_REPORT ,
423+ return !! hid_find_field (hdev , HID_INPUT_REPORT ,
447424 HID_GD_KEYBOARD , HID_USAGE_KBD_FOLDED );
448425}
449426
450427static bool hammer_has_backlight_control (struct hid_device * hdev )
451428{
452- return hammer_has_usage (hdev , HID_OUTPUT_REPORT ,
429+ return !! hid_find_field (hdev , HID_OUTPUT_REPORT ,
453430 HID_GD_KEYBOARD , HID_AD_BRIGHTNESS );
454431}
455432
0 commit comments