On Wed, Oct 29, 2025 at 12:56:47PM -0500, Bjorn Helgaas wrote: > On Wed, Oct 29, 2025 at 05:33:33PM +0100, Thierry Reding wrote: > > From: Thierry Reding <[email protected]> > > > > Pass the driver-specific data via the syscore struct and use it in the > > syscore ops. > > Some of these things in drivers/clk/ are also platform_device drivers > (though not this one) and use generic power management, e.g., > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/q6sstop-qcs404.c?id=v6.17#n209 > > I have no idea if that's desirable or practical here, but using the > platform_device model instead of syscore could have advantages in > terms of modeling device dependencies and ordering.
Similar to the MIPS/Alchemy PCI driver, although there's no git log reference in this case, I suspect this was not in driver PM on purpose. The pattern I've seen quite often is very low-level device driver code doing this using syscore_ops because they run very late/early during suspend/resume, respectively, so the driver PM callbacks often aren't sufficient. In recent years, some of the issues have been alleviated by things such as device links, so a conversion may work now. However, often these are also exotic and/or old devices that are difficult to find testers for, so I've been trying to keep the changes in this series as minimal as possible, so that we can be reasonably sure things will continue to work just by reviewing the code. The most important bit in the series is patch 1, which lays the groundwork for avoiding these global variables for new code. Also, in particular I have a concrete case where the global variable approach doesn't work because an IP block that used to be a guaranteed singleton now no longer is. I have looked at various drivers that I ended up not converting because they use a global variable not only for syscore but also for other things and fixing that up would've been way out of scope of this series. Thierry
signature.asc
Description: PGP signature
