[PATCH v2 0/2] Give more control of sync_state()

From: Saravana Kannan
Date: Fri Mar 03 2023 - 19:54:24 EST


In systems where some devices don't have drivers, sync_state() will
never get called for suppliers of those devices. This is working as
intended since those consumer devices might be powered on, and cutting
resources to those consumer devices might make the system unstable.

However, not all systems will the same concern. For example, the
consumer device might have been left powered off and unused. In such
cases, sync_state() never getting called might cause an unnecessary
power regression if the bootloader had left the supplier in a powered on
state.

So give more control of sync_state() in the form of a kernel commandline
for a global timeout or a per device sysfs control to trigger
sync_state().

These patches have been tested on my end and seem to work well.

Thanks,
Saravana

v1->v2:
Patch 1: Updated commit text, documentation and log message.
Patch 2: Check for "1" in the write, updated doc, fix error handling.

Cc: Abel Vesa <abel.vesa@xxxxxxxxxx>
Cc: Bjorn Andersson <andersson@xxxxxxxxxx>
Cc: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
Cc: Doug Anderson <dianders@xxxxxxxxxxxx>
Cc: Matthias Kaehlcke <mka@xxxxxxxxxxxx>

Saravana Kannan (2):
driver core: Add fw_devlink.sync_state command line param
driver core: Make state_synced device attribute writeable

.../ABI/testing/sysfs-devices-state_synced | 5 ++
.../admin-guide/kernel-parameters.txt | 14 +++++
drivers/base/base.h | 9 +++
drivers/base/core.c | 63 +++++++++++++++++--
drivers/base/dd.c | 29 ++++++++-
5 files changed, 115 insertions(+), 5 deletions(-)

--
2.40.0.rc0.216.gc4246ad0f0-goog