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

From: Shivendra Pratap
Date: Tue Dec 02 2025 - 11:28:26 EST




On 12/1/2025 11:23 PM, Bartosz Golaszewski wrote:
> On Mon, Dec 1, 2025 at 6:43 PM Shivendra Pratap
> <shivendra.pratap@xxxxxxxxxxxxxxxx> wrote:
>>
>>>> @@ -132,9 +186,13 @@ int reboot_mode_unregister(struct reboot_mode_driver *reboot)
>>>> struct mode_info *info;
>>>>
>>>> unregister_reboot_notifier(&reboot->reboot_notifier);
>>>> + if (device_is_registered(&reboot->reboot_mode_device))
>>>> + device_unregister(&reboot->reboot_mode_device);
>>>
>>> If you bail out of reboot_mode_register_device(), you don't need the
>>> above check anymore because the device could
>>
>> We wanted to continue on failure, as per reviews.
>>
>
> You're probably referring to this bit:
>
> --
> On that note, I would argue that aborting the registration of
> reboot-modes, just because we failed to create the convenient "debug"
> interface, doesn't make sense. I think it would be better to just
> continue even when create_reboot_mode_device() returns an error.
> --

yes.

>
> Anything in sysfs is not "debug". It if is, then it should go into
> debugfs instead.
>
> Trying to register a sysfs object with the same name will result in a
> WARN() splat from sysfs core. I'd say we should definitely return an
> error if sysfs registration fails and just make sure it can't by
> assigning a unique name.

So, should we go ahead and make the change to fail reboot_mode_register, if
device registration fails?

thanks,
Shivendra