Re: [PATCH v3] mailbox: add list of used channels to debugfs

From: Geert Uytterhoeven

Date: Tue Apr 14 2026 - 09:14:26 EST


Hi Wolfram,

On Mon, 13 Apr 2026 at 14:09, Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> During development, it is useful to see which mailboxes are currently
> obtained. Use a seq-file in debugfs to list the currently registered
> controllers and their used channels. Example output from a Renesas R-Car
> X5H based system:
>
> 189e0000.system-controller:
> 0: c1000000.mailbox_test_send_to_recv
> 1: c1000100.mailbox_test_recv_to_send
> 128: c1000100.mailbox_test_recv_to_send
> 129: c1000000.mailbox_test_send_to_recv
> 189e1000.system-controller:
> 4: scmi_dev.1
> 5: scmi_dev.2
>
> Note that mailbox controllers currently can be instantiated at any
> initcall stage. So, per-controller debugfs handling was discarded
> because it is not clear when to create the root "mailbox"-debugfs entry.
> A central file was chosen, similar to the GPIO subsystem, which is
> independent of the initcall stage because it will be accessed only when
> userspace is available anyhow.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Thanks for your patch, which looks useful!

> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c

> +static int __init mbox_init(void)
> +{
> + debugfs_create_file("mailbox_summary", 0444, NULL, NULL, &mbox_fops);

Can you please put it in a subdir, like all other summaries:

~ # ls /sys/kernel/debug/*/*summary
/sys/kernel/debug/clk/clk_orphan_summary
/sys/kernel/debug/clk/clk_summary
/sys/kernel/debug/devfreq/devfreq_summary
/sys/kernel/debug/dmaengine/summary
/sys/kernel/debug/pm_genpd/pm_genpd_summary
/sys/kernel/debug/regulator/regulator_summary

? More mailbox-related files might be added later.
(But more importantly, that way my summary grabbing script will save
it automatically ;-)

> + return 0;
> +}
> +subsys_initcall(mbox_init);
> +#endif /* DEBUG_FS */

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