Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: f_hid: use usb_gstrings_attach

Before configfs is integrated the usb_gstrings_attach() interface
must be used.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andrzej Pietrasiewicz and committed by
Felipe Balbi
5ca8d3ec 5d66a391

+6 -8
+6 -8
drivers/usb/gadget/function/f_hid.c
··· 582 582 { 583 583 struct usb_ep *ep; 584 584 struct f_hidg *hidg = func_to_hidg(f); 585 + struct usb_string *us; 585 586 struct device *device; 586 587 int status; 587 588 dev_t dev; 588 589 589 590 /* maybe allocate device-global string IDs, and patch descriptors */ 590 - if (ct_func_string_defs[CT_FUNC_HID_IDX].id == 0) { 591 - status = usb_string_id(c->cdev); 592 - if (status < 0) 593 - return status; 594 - ct_func_string_defs[CT_FUNC_HID_IDX].id = status; 595 - hidg_interface_desc.iInterface = status; 596 - } 591 + us = usb_gstrings_attach(c->cdev, ct_func_strings, 592 + ARRAY_SIZE(ct_func_string_defs)); 593 + if (IS_ERR(us)) 594 + return PTR_ERR(us); 595 + hidg_interface_desc.iInterface = us[CT_FUNC_HID_IDX].id; 597 596 598 597 /* allocate instance-specific interface IDs, and patch descriptors */ 599 598 status = usb_interface_id(c, f); ··· 805 806 } 806 807 807 808 hidg->func.name = "hid"; 808 - hidg->func.strings = ct_func_strings; 809 809 hidg->func.bind = hidg_bind; 810 810 hidg->func.unbind = hidg_unbind; 811 811 hidg->func.set_alt = hidg_set_alt;