Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DFC55C4332F for ; Fri, 16 Dec 2022 16:35:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C0113851D3; Fri, 16 Dec 2022 17:35:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1671208549; bh=Ma+TOXtfMHAlYOcGp/1b6m75yLhw+6KFzKIFE4sr7b8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bZZ15hQqXAdGe8L2Y8Q0W+7k/CLM0P/YGafHJEndf7TS/KXXCXIljSfO3WYccwk5i 7oUrCFRZ3ipydTNZULrLs7iHV8W9/DvOAxfPxFznk3vTy5+B1oNKUAEPVo6wxZX9ZP 1mQnVk4BvwM2SPJDIKY6A3HketySecf09R4m4+QsNlKMceJuhjKeg+ZHduKUqW5iQv 8RMS9WGdGm9Vg3V8/OrfrGGK+rqRcaTy0y+3OI9jGMvtG0Yj0sH9D5YGmUxHfndfLt m05GUqHtBhSXZ0rzpzqIikhvDvmFPXqTj2ZBZ372M+eHt8juRDoyZymM8Of6eAvWe1 fdLlJl47/EPlw== Received: from mail.denx.de (unknown [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lusus@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id ED9F3839D5; Fri, 16 Dec 2022 17:35:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1671208548; bh=Ma+TOXtfMHAlYOcGp/1b6m75yLhw+6KFzKIFE4sr7b8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CJSz74gucYtYmFM4atkxoJ5yvi3wBc1D8X9U/ON+Vu1t8I7sM4l3wOopOWsrUg3VO 1Hv7KjoGTrj0HYmpTrhZzxAVWAYpgp2at2uF/yjg55Wf8Nfv3gbnP7smafoXSo6Co+ xY6rVQgvlJWx8kPv2jLjotFQt92EPLKNlHrHiU0ZGA/0N70c6EiamS2/CwcMzEE+Ps oAg8N3DqtwkFPyESWQ5bsaUxP1Jdp2rE8mr3NsI0Ehy2wLJA/U66FjyKKx/twoO/Ao 7XZr/mxeGGQYIefwKbFi5zgbWKm57N/a8JB37126IJR/nAy4YQRneC66Sy3vJKi+HN MRhuwVdC9A0Sg== MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 16 Dec 2022 17:35:47 +0100 From: lusus@denx.de To: Marek Vasut Cc: u-boot@lists.denx.de, Lukasz Majewski , Ramon Fried Subject: Re: [PATCH] usb: gadget: ether: split start/stop from init/halt In-Reply-To: <93348484-8ea4-24fb-7983-668d898c2c9e@denx.de> References: <20221212152945.1870385-1-lusus@denx.de> <20221212152945.1870385-2-lusus@denx.de> <85189f43-e216-0cfd-fec9-a38b0e0bab12@denx.de> <93348484-8ea4-24fb-7983-668d898c2c9e@denx.de> Message-ID: <06dcacc981d90e2c559f3a8b5f41249f@denx.de> X-Sender: lusus@denx.de User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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@denx.de