public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Larsson <andreas@gaisler.com>
To: balbi@ti.com, Peter Chen <peter.chen@freescale.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	software@gaisler.com
Subject: Re: [PATCH] usb: gadget: udc_core: Use right kobj when calling sysfs_notify
Date: Tue, 16 Sep 2014 08:46:07 +0200	[thread overview]
Message-ID: <5417DCAF.5000303@gaisler.com> (raw)
In-Reply-To: <20140916051529.GB10498@saruman.home>

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

      reply	other threads:[~2014-09-16  7:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5417DCAF.5000303@gaisler.com \
    --to=andreas@gaisler.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@freescale.com \
    --cc=software@gaisler.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox