From: Marek Vasut Date: Sun, 22 Nov 2020 03:13:15 +0100 Subject: [PATCH V3] dm: core: Add late driver remove option In-Reply-To: References: <20201108140818.55172-1-marek.vasut+renesas@gmail.com> <20201118145346.GI5340@bill-the-cat> Message-ID: <0f9d329f-dfd5-4cc6-29da-9ca1dda25446@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/22/20 12:07 AM, Simon Glass wrote: [...] >>>>> That way we are describing the property of the device rather than what >>>>> we want to do with it. >>>> >>>> The device is not critical or vital, it just needs to be torn down late. >>> >>> What is it about the device that requires it to be torn down 'late'? >> >> I think perhaps the problem isn't that it needs to be "late", it's that >> it has perhaps not obviously described children. Which gets back to >> what you just said as well about "later" and "fairly late". It's an >> ordering problem. > > Yes it is. > > We currently don't record devices that depend on others. It would be > possible to add a refcount to DM to cope with this and implement it > for clocks. I wonder if that might be better than what we have here? This is still a bootloader, not a general-purpose OS, so I would argue we should not complicate this more than is necessary. The DM already adds a lot of bloat to U-Boot, no need to make that worse unless there is a real good reason for that. Also, in V1 of this patch, Simon did suggest that a simple approach is OK if I recall correctly.