Re: [PATCH v20 2/2] power: reset: reboot-mode: Expose sysfs for registered reboot_modes
From: Bartosz Golaszewski
Date: Mon Dec 01 2025 - 12:55:44 EST
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.
--
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.
Bartosz