Skip to content

Commit

Permalink
usb: gadget: udc_core: Use right kobj when calling sysfs_notify
Browse files Browse the repository at this point in the history
The state attribute is connected to the kobj of the udc, not the gadget.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Andreas Larsson authored and Felipe Balbi committed Sep 16, 2014
1 parent 468bcc2 commit af54954
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion drivers/usb/gadget/udc/udc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,20 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
static void usb_gadget_state_work(struct work_struct *work)
{
struct usb_gadget *gadget = work_to_gadget(work);
struct usb_udc *udc = NULL;

mutex_lock(&udc_lock);
list_for_each_entry(udc, &udc_list, list)
if (udc->gadget == gadget)
goto found;
mutex_unlock(&udc_lock);

return;

found:
mutex_unlock(&udc_lock);

sysfs_notify(&gadget->dev.kobj, NULL, "state");
sysfs_notify(&udc->dev.kobj, NULL, "state");
}

void usb_gadget_set_state(struct usb_gadget *gadget,
Expand Down

0 comments on commit af54954

Please sign in to comment.