Re: [PATCH v23 2/2] power: reset: reboot-mode: Expose sysfs for registered reboot_modes

From: Bartosz Golaszewski

Date: Fri Feb 06 2026 - 10:20:40 EST


On Thu, 5 Feb 2026 18:17:14 +0100, Shivendra Pratap
<shivendra.pratap@xxxxxxxxxxxxxxxx> said:
> Currently, there is no standardized mechanism for userspace to discover
> supported reboot modes on a platform. This limits userspace scripts, to
> rely on hardcoded assumptions about the available reboot-modes.
>
> Create a class 'reboot-mode' and a device under it. Use the name of the
> registering driver as device name. Expose a sysfs interface under this
> device to show available reboot mode arguments.
>
> This results in the creation of:
> /sys/class/reboot-mode/<driver>/reboot_modes
>
> This read-only sysfs file will exposes the supported reboot mode
> arguments provided by the registering driver, enabling userspace to
> query the list of arguments.
>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@xxxxxxxxxxxxxxxx>
> ---

There are some nits from my side below but nothing serious so LGTM anyway.

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>

> +
> +static inline void reboot_mode_release_list(struct list_head *head)

I would have passed priv here as passing list_head as argument looks a bit
weird.

> +{
> + struct mode_info *info;
> + struct mode_info *next;
> +

These could be on the same line.

> + sysfs_info->mode = kstrdup_const(info->mode, GFP_KERNEL);
> + if (!sysfs_info->mode) {
> + kfree(sysfs_info);
> + ret = -ENOMEM;
> + goto error;
> + }
> +
> + list_add_tail(&sysfs_info->list, &priv->head);
> + }
> +
> + priv->reboot_mode_device = device_create(&reboot_mode_class, NULL, 0,
> + (void *)priv, reboot->dev->driver->name);
> +

Stray newline.

> + if (IS_ERR(priv->reboot_mode_device)) {
> + ret = PTR_ERR(priv->reboot_mode_device);
> + goto error;
> + }
> +
> + return 0;

As I said, these are nits so fix them or not but let's get this upstream after
v7.0-rc1.

Bartosz