Re: [PATCH RFC] power: reset: restart-poweroff: convert to module
From: Sverdlin, Alexander
Date: Thu Feb 22 2024 - 02:16:35 EST
On Wed, 2024-02-21 at 22:56 +0100, Andrew Lunn wrote:
> > @@ -47,15 +45,8 @@ static const struct of_device_id of_restart_poweroff_match[] = {
> > };
> > MODULE_DEVICE_TABLE(of, of_restart_poweroff_match);
> >
> > -static struct platform_driver restart_poweroff_driver = {
> > - .probe = restart_poweroff_probe,
> > - .remove = restart_poweroff_remove,
> > - .driver = {
> > - .name = "poweroff-restart",
> > - .of_match_table = of_restart_poweroff_match,
> > - },
> > -};
>
> of_restart_poweroff_match now seems to be disconnected from the
> driver.
>
> kirkwood-linkstation.dtsi: compatible = "restart-poweroff";
> kirkwood-lsxl.dtsi: compatible = "restart-poweroff";
> orion5x-linkstation.dtsi: compatible = "restart-poweroff";
> orion5x-lswsgl.dts: compatible = "restart-poweroff";
>
> How do these devices get this driver loaded?
>
> This appears to be another reason to NACK it.
That's why MODULE_DEVICE_TABLE() was preserved for backwards compatibility,
because *loading* happens via MODULE_DEVICE_TABLE(). But I didn't realize
it was never buildable as module as Sebastian pointed out, because of
machine_restart().
For your use case it would continue to work as before I believe, just
the callback would be installed because of the fact the code
was compiled-in, not because there was a fake platform device.
I also didn't understand what is so special about bootloader support
for this functionality if no data is passed to the bootloader.
After ARM-specifics was removed from the code quite some time ago
any platform could re-use the code for the deployments which meant
to be "always on".
But If the resistance is so serious, so be it.
--
Alexander Sverdlin
Siemens AG
www.siemens.com