Skip to content

Commit c1740d1

Browse files
MadCatXJiri Kosina
authored andcommitted
HID: hid-lg4ff: Fix "undefined reference" build issue with CONFIG_USB disabled
Fix "undefined reference" build issue with CONFIG_USB disabled; make the driver use generic HID API instead. Reported-by: kbuild test robot <[email protected]> Signed-off-by: Michal Malý <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f31a2de commit c1740d1

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/hid/hid-lg4ff.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,19 +569,20 @@ static const struct lg4ff_compat_mode_switch *lg4ff_get_mode_switch_command(cons
569569

570570
static int lg4ff_switch_compatibility_mode(struct hid_device *hid, const struct lg4ff_compat_mode_switch *s)
571571
{
572-
struct usb_device *usbdev = hid_to_usb_dev(hid);
573-
struct usbhid_device *usbhid = hid->driver_data;
572+
struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
573+
struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
574+
__s32 *value = report->field[0]->value;
574575
u8 i;
575576

576577
for (i = 0; i < s->cmd_count; i++) {
577-
int xferd, ret;
578-
u8 data[7];
578+
u8 j;
579579

580-
memcpy(data, s->cmd + (7*i), 7);
581-
ret = usb_interrupt_msg(usbdev, usbhid->urbout->pipe, data, 7, &xferd, USB_CTRL_SET_TIMEOUT);
582-
if (ret)
583-
return ret;
580+
for (j = 0; j < 7; j++)
581+
value[j] = s->cmd[j + (7*i)];
582+
583+
hid_hw_request(hid, report, HID_REQ_SET_REPORT);
584584
}
585+
hid_hw_wait(hid);
585586
return 0;
586587
}
587588

0 commit comments

Comments
 (0)