Re: [PATCH v16 05/14] power: reset: reboot-mode: Expose sysfs for registered reboot_modes

From: Nirmesh Kumar Singh

Date: Wed Oct 15 2025 - 04:45:44 EST



On 10/15/2025 10:08 AM, Shivendra Pratap wrote:
Currently, there is no standardized mechanism for userspace to
discover which reboot-modes are supported on a given platform.
This limitation forces tools and scripts to rely on hardcoded
assumptions about the supported reboot-modes.

Create a class 'reboot-mode' and a device under it to expose a
sysfs interface to show the available reboot mode arguments to
userspace. Use the driver_name field of the struct
reboot_mode_driver to create the device. For device-based
drivers, configure the device driver name as driver_name.

This results in the creation of:
/sys/class/reboot-mode/<driver>/reboot_modes

This read-only sysfs file will exposes the list of supported
reboot modes arguments provided by the driver, enabling userspace
to query the list of arguments.

Align the clean up path to maintain backward compatibility for
existing reboot-mode based drivers.

Signed-off-by: Shivendra Pratap <shivendra.pratap@xxxxxxxxxxxxxxxx>
---
drivers/power/reset/reboot-mode.c | 127 ++++++++++++++++++++++++++++++--------
include/linux/reboot-mode.h | 2 +
2 files changed, 103 insertions(+), 26 deletions(-)
Reviewed-by: Nirmesh Kumar Singh <nirmesh.singh@xxxxxxxxxxxxxxxx>

Thanks,
Nirmesh