lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Jun 2016 10:24:44 +0300
From:	Roger Quadros <rogerq@...com>
To:	Peter Chen <hzpeterchen@...il.com>
CC:	<peter.chen@...escale.com>, <balbi@...nel.org>, <tony@...mide.com>,
	<gregkh@...uxfoundation.org>, <dan.j.williams@...el.com>,
	<mathias.nyman@...ux.intel.com>, <Joao.Pinto@...opsys.com>,
	<sergei.shtylyov@...entembedded.com>, <jun.li@...escale.com>,
	<grygorii.strashko@...com>, <yoshihiro.shimoda.uh@...esas.com>,
	<robh@...nel.org>, <nsekhar@...com>, <b-liu@...com>,
	<linux-usb@...r.kernel.org>, <linux-omap@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

On 08/06/16 15:42, Peter Chen wrote:
> On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote:
>> Hi,
>>
>> On 08/06/16 12:53, Peter Chen wrote:
>>> On Wed, Jun 08, 2016 at 12:03:40PM +0300, Roger Quadros wrote:
>>>> +int usb_otg_unregister(struct device *dev)
>>>> +{
>>>> +	struct usb_otg *otg;
>>>> +
>>>> +	mutex_lock(&otg_list_mutex);
>>>> +	otg = usb_otg_get_data(dev);
>>>> +	if (!otg) {
>>>> +		dev_err(dev, "otg: %s: device not in otg list\n",
>>>> +			__func__);
>>>> +		mutex_unlock(&otg_list_mutex);
>>>> +		return -EINVAL;
>>>> +	}
>>>> +
>>>> +	/* prevent unregister till both host & gadget have unregistered */
>>>> +	if (otg->host || otg->gadget) {
>>>> +		dev_err(dev, "otg: %s: host/gadget still registered\n",
>>>> +			__func__);
>>>
>>> You need to call mutex_unlock here
>>
>> Indeed. good catch.
>>>
>>>> +
>>>> +int usb_otg_gadget_ready(struct usb_gadget *gadget, bool ready)
>>>> +{
>>>
>>> What this API is for? Why need it in this version?
>>
>> we moved gadget to otg registration from udc_bind_to_driver() to usb_add_gadget_udc_release().
>> This means there is a window when gadget function driver (e.g. g_zero) is not loaded.
>> We don't want to start the gadget controller in that window.
>>
>> usb_otg_gadget_ready() is used by gadget core to notify the otg core when the function driver
>> is ready or not-ready.
>>
> 
> Why you need to move this from gadget's probe to udc's probe? Currently,
> the sequence of gadget and udc's probe is random, but udc_bind_to_driver
> is called when udc is ready.
> 
Because we need to support -EPROBE_DEFER at udc probe.
At udc_bind_to_driver there is no scope for -EPROBE_DEFER.

Another issue is that we need to register with otg and have otg->caps available
before driver->bind() is called in udc_bind_to_driver(). Else gadget function
will not have the correct OTG descriptor.

cheers,
-roger

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ