Hi Stephen,
On Thu, Mar 09, 2023 at 03:31:15PM -0800, Stephen Boyd wrote:
Quoting Maxime Ripard (2023-03-03 06:35:28)
On Fri, Mar 03, 2023 at 03:15:31PM +0800, David Gow wrote:
DRM has a similar thing already (albeit with a root_device, which is more common with KUnit tests generally): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/incl...
But that's reasonably drm-specific, so it makes sense that it lives with DRM stuff. platform_device is a bit more generic.
I'd be very happy to get something from the core to address the same thing.
I think the main thing we needed that isn't covered by this patch is we wanted the device to be bound to its driver, so with probe being called before calling the test (see 57a84a97bbda).
Can you clarify? This patch makes a poor attempt at waiting for the platform driver to bind, but in reality it may not be bound by the time the driver register function returns.
The issue was that devm will only clean up the resources if the device was bound to a driver so we were exhausting resources when running dozens of test in a sequence.
The way I solved it for vc4 was to create a dumb platform driver with a waitqueue, and wait for probe to be called.
I think we could make it more generic by allowing a pointer to a probe function and calling it into our own probe implementation. What do you think?
Maxime