On Mon, Jun 22, 2020 at 03:39:40PM +0200, Andrew Lunn wrote: > The PHY subsystem cannot be the first to run into this problem, that > you need a device structure to make use of the regulator API, but you > need the regulator API to probe the device. How do other subsystems > work around this? If the bus includes power management for the devices on the bus the controller is generally responsible for that rather than the devices, the devices access this via facilities provided by the bus if needed. If the device is enumerated by firmware prior to being physically enumerable then the bus will generally instantiate the device model device and then arrange to wait for the physical device to appear and get joined up with the device model device, typically in such situations the physical device might appear and disappear dynamically at runtime based on what the driver is doing anyway. > Maybe it is time to add a lower level API to the regulator framework? I don't see any need for that here, this is far from the only thing that's keyed off a struct device and having the device appear and disappear at runtime can make things like runtime PM look really messy to userspace. We could use a pre-probe stage in the device model for hotpluggable buses in embedded contexts where you might need to bring things out of reset or power them up before they'll appear on the bus for enumeration but buses have mostly handled that at their level.
Attachment:
signature.asc
Description: PGP signature