[PATCH] usb: gadget: ether: split start/stop from init/halt

lusus at denx.de lusus at denx.de
Fri Dec 16 17:35:47 CET 2022


Hi Marek,

On 2022-12-15 06:58, Marek Vasut wrote:
> On 12/13/22 12:01, Niel Fourie wrote:
>> Hi Marek,
> 
> Hi,
> 
>> On 12/12/2022 17:46, Marek Vasut wrote:
>>> On 12/12/22 16:29, Niel Fourie wrote:
>>>> Split out _usb_eth_start() from _usb_eth_init() and
>>>> usb_eth_stop() from _usb_eth_halt(). Now _usb_eth_init() only
>>>> initialises and registers the gadget device, which _usb_eth_halt()
>>>> reverses, and together are used for probing and removing the
>>>> device. The _usb_eth_start() and _usb_eth_stop() functions connect
>>>> and disconnect the gadget as expected by the start()/stop()
>>>> callbacks.
>>>> 
>>>> Previously the gadget device was probed on every start() and
>>>> removed on every stop(), which is inconsistent with other DM_ETH
>>>> drivers. For non-DM gadget drivers the old behaviour has been
>>>> retained.
>>> 
>>> Does this mean the udevice pointer and associated private date are 
>>> retained during the entire operation of the USB gadget , i.e. even 
>>> between stop/start cycles ?
>> 
>> In the DM_ETH case, yes. The drivers/devices remain registered the 
>> whole time between _usb_eth_init() and _usb_eth_halt(), and the need 
>> for revalidating the private data pointer falls away as was done in my 
>> previous patch.
> 
> Perfect.
> 
>> I tested this on imx8mp with the dwc3 gadget driver, and the data 
>> structures, specifically the private data, remained intact from 
>> probe() until remove(). I also tested that probing again after removal 
>> works as expected.
> 
> Excellent.
> 
> [...]
> 
> Should "[PATCH v2] net: eth-uclass: revalidate priv after stop() in
> eth_halt()" be dropped ? It seems this patch fully replaces it.

That old patch only exists for in case there were showstopper issues 
with the new patch which I missed, or as a stopgap if major changes were 
needed first. I did my best to test the new patch on the hardware I 
have, but if any other gadget drivers were to misbehave, I would not 
know about it, for example. But if you are happy with this new patch, 
that old patch could gladly be dropped.

Best regards,
Niel Fourie

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-21 Fax: +49-8142-66989-80  Email: lusus at denx.de


More information about the U-Boot mailing list