usb: gadget: udc_core: Use right kobj when calling sysfs_notify
PATCH 1/1 usb: gadget: udc_core: Use right kobj when calling sysfs_notify
The state attribute is connected to the kobj of the udc, not the gadget.
--- drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/udc-core.c +13 -1
@@ -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,
Signature · 1 line
1.7.10.4
Quoted 23 lines · Andreas Larsson
The state attribute is connected to the kobj of the udc, not the gadget.
Signed-off-by Andreas Larsson <[email protected]>--- drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/usb/gadget/udc/udc-core.c +8
-0@@ -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); +
drivers/usb/gadget/udc/udc-core.c EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); · line 128
Quoted 10 lines
drivers/usb/gadget/udc/udc-core.c +5
-1+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,
What's the user mode difference with and without this patch?
Signature · 2 lines
Best Regards, Peter Chen
Hi,
Quoted 29 lines · Peter Chen
Quoted 28 lines · Andreas Larsson
The state attribute is connected to the kobj of the udc, not the gadget.
Signed-off-by Andreas Larsson <[email protected]>--- drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/usb/gadget/udc/udc-core.c +12
-0@@ -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);
Quoted 7 lines
drivers/usb/gadget/udc/udc-core.c EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); · line 128
Quoted 5 lines
drivers/usb/gadget/udc/udc-core.c +1
-1-sysfs_notify (&gadget->dev.kobj,NULL ,"state" ); +sysfs_notify (&udc->dev.kobj,NULL ,"state" ); } void usb_gadget_set_state(struct usb_gadget *gadget,What's the user mode difference with and without this patch?
poll() will actually wakeup ?
Signature · 1 line
balbi
Quoted 36 lines · Felipe Balbi
Hi,
Quoted 33 lines · Peter Chen
Quoted 32 lines · Andreas Larsson
The state attribute is connected to the kobj of the udc, not the gadget.
Signed-off-by Andreas Larsson <[email protected]>--- drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/usb/gadget/udc/udc-core.c +13
-1@@ -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" ); }
Quoted 5 lines
Quoted 3 lines
drivers/usb/gadget/udc/udc-core.c EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); · line 128
Quoted 1 line
drivers/usb/gadget/udc/udc-core.c +0
-0void usb_gadget_set_state(struct usb_gadget *gadget,What's the user mode difference with and without this patch?
poll()will actually wakeup ?
Yes, that is indeed the difference.
Cheers,
Andreas Larsson