Re: [PATCH v7 3/3] hwspinlock: add low level debug capabilities

From: Geert Uytterhoeven

Date: Wed Sep 16 2026 - 10:22:46 EST


Hi Wolfram,

Thanks for your patch!

On Sat, 12 Sept 2026 at 21:19, Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> While developing the hwspinlock core or a device driver, it can be
> really helpful to change states from userspace. Add a debugsfs interface

debugfs

> to request, free, lock, unlock, and test hwspinlocks. Because this is a
> potentially dangerous interface, it can only be enabled via source code.

... code,

> Similar to writeable attributes for clocks where this idea stems from.

similar ...

> The created files take a single id for a single lock. To test all locks
> in a system, one could use this oneliner while in the debugfs directory:
>
> for l in $(cut -d: -f1 hwspinlock_summary); do echo $l > test_lock; done
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

> --- a/drivers/hwspinlock/hwspinlock_core.c
> +++ b/drivers/hwspinlock/hwspinlock_core.c

> +static void hwspin_lock_low_level_debug_init(struct dentry *rootdir)
> +{
> + debugfs_create_file("request", 0200, rootdir, NULL, &fops_request);
> + debugfs_create_file("free", 0200, rootdir, NULL, &fops_free);
> + debugfs_create_file("lock", 0200, rootdir, NULL, &fops_trylock_raw);
> + debugfs_create_file("unlock", 0200, rootdir, NULL, &fops_unlock_raw);
> + debugfs_create_file("test_lock", 0200, rootdir, NULL, &fops_test);

Perhaps just "test"?

> +}
> +#endif
> +
> /*
> * subsys_initcall() is used here but controllers may already have been
> * registered earlier or will be later. The rationale is that debugfs is

The rest LGTM, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds