* [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify
@ 2014-09-15 10:42 Andreas Larsson
2014-09-16 2:02 ` Peter Chen
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Larsson @ 2014-09-15 10:42 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, software
The state attribute is connected to the kobj of the udc, not the gadget.
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index b0d9817..37c129a 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -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,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify
2014-09-15 10:42 [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify Andreas Larsson
@ 2014-09-16 2:02 ` Peter Chen
2014-09-16 5:15 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen @ 2014-09-16 2:02 UTC (permalink / raw)
To: Andreas Larsson
Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel,
software
On Mon, Sep 15, 2014 at 12:42:27PM +0200, Andreas Larsson wrote:
> The state attribute is connected to the kobj of the udc, not the gadget.
>
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
> ---
> drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
> index b0d9817..37c129a 100644
> --- a/drivers/usb/gadget/udc/udc-core.c
> +++ b/drivers/usb/gadget/udc/udc-core.c
> @@ -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,
What's the user mode difference with and without this patch?
--
Best Regards,
Peter Chen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify
2014-09-16 2:02 ` Peter Chen
@ 2014-09-16 5:15 ` Felipe Balbi
2014-09-16 6:46 ` Andreas Larsson
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2014-09-16 5:15 UTC (permalink / raw)
To: Peter Chen
Cc: Andreas Larsson, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
linux-kernel, software
[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]
Hi,
On Tue, Sep 16, 2014 at 10:02:25AM +0800, Peter Chen wrote:
> On Mon, Sep 15, 2014 at 12:42:27PM +0200, Andreas Larsson wrote:
> > The state attribute is connected to the kobj of the udc, not the gadget.
> >
> > Signed-off-by: Andreas Larsson <andreas@gaisler.com>
> > ---
> > drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++-
> > 1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
> > index b0d9817..37c129a 100644
> > --- a/drivers/usb/gadget/udc/udc-core.c
> > +++ b/drivers/usb/gadget/udc/udc-core.c
> > @@ -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,
>
> What's the user mode difference with and without this patch?
poll() will actually wakeup ?
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify
2014-09-16 5:15 ` Felipe Balbi
@ 2014-09-16 6:46 ` Andreas Larsson
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Larsson @ 2014-09-16 6:46 UTC (permalink / raw)
To: balbi, Peter Chen; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, software
On 2014-09-16 07:15, Felipe Balbi wrote:
> Hi,
>
> On Tue, Sep 16, 2014 at 10:02:25AM +0800, Peter Chen wrote:
>> On Mon, Sep 15, 2014 at 12:42:27PM +0200, Andreas Larsson wrote:
>>> The state attribute is connected to the kobj of the udc, not the gadget.
>>>
>>> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
>>> ---
>>> drivers/usb/gadget/udc/udc-core.c | 14 +++++++++++++-
>>> 1 file changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
>>> index b0d9817..37c129a 100644
>>> --- a/drivers/usb/gadget/udc/udc-core.c
>>> +++ b/drivers/usb/gadget/udc/udc-core.c
>>> @@ -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,
>>
>> What's the user mode difference with and without this patch?
>
> poll() will actually wakeup ?
Yes, that is indeed the difference.
Cheers,
Andreas Larsson
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-16 7:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15 10:42 [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify Andreas Larsson
2014-09-16 2:02 ` Peter Chen
2014-09-16 5:15 ` Felipe Balbi
2014-09-16 6:46 ` Andreas Larsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox