From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2a 2/3] irqdomain: Allow giving name suffix for domain
Date: Fri, 9 Aug 2024 08:03:38 +0300 [thread overview]
Message-ID: <3f77a70a-2bcb-4cb2-ac4f-a5d785f6f7ff@gmail.com> (raw)
In-Reply-To: <871q2yvk5x.ffs@tglx>
On 8/8/24 23:23, Thomas Gleixner wrote:
>
> From: Matti Vaittinen <mazziesaccount@gmail.com>
>
> Devices can provide multiple interrupt lines. One reason for this is that
> a device has multiple subfunctions, each providing its own interrupt line.
> Another reason is that a device can be designed to be used (also) on a
> system where some of the interrupts can be routed to another processor.
>
> A line often further acts as a demultiplex for specific interrupts
> and has it's respective set of interrupt (status, mask, ack, ...)
> registers.
>
> Regmap supports the handling of these registers and demultiplexing
> interrupts, but the interrupt domain code ends up assigning the same name
> for the per interrupt line domains. This causes a naming collision in the
> debugFS code and leads to confusion, as /proc/interrupts shows two separate
> interrupts with the same domain name and hardware interrupt number.
>
> Instead of adding a workaround in regmap or driver code, allow giving a
> name suffix for the domain name when the domain is created.
>
> Add a name_suffix field in the irq_domain_info structure and make
> irq_domain_instantiate() use this suffix if it is given when a domain is
> created.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> Revision history:
> v2 => v2a:
> Update to name allocation cleanup patch. Fix the invalid NULL return.
> v1 => v2:
> - typofix in comment. 'collison' to 'collision'.
> ---
> include/linux/irqdomain.h | 3 +++
> kernel/irq/irqdomain.c | 32 +++++++++++++++++++++++---------
> 2 files changed, 26 insertions(+), 9 deletions(-)
>
> --- a/include/linux/irqdomain.h
> +++ b/include/linux/irqdomain.h
> @@ -295,6 +295,8 @@ struct irq_domain_chip_generic_info;
> * @virq_base: The first Linux interrupt number for legacy domains to
> * immediately associate the interrupts after domain creation
> * @bus_token: Domain bus token
> + * @name_suffix: Optional name suffix to avoid collisions when multiple
> + * domains are added using same fwnode
> * @ops: Domain operation callbacks
> * @host_data: Controller private data pointer
> * @dgc_info: Geneneric chip information structure pointer used to
> @@ -313,6 +315,7 @@ struct irq_domain_info {
> unsigned int hwirq_base;
> unsigned int virq_base;
> enum irq_domain_bus_token bus_token;
> + const char *name_suffix;
> const struct irq_domain_ops *ops;
> void *host_data;
> #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -140,11 +140,14 @@ static int alloc_name(struct irq_domain
> }
>
> static int alloc_fwnode_name(struct irq_domain *domain, const struct fwnode_handle *fwnode,
> - enum irq_domain_bus_token bus_token)
> + enum irq_domain_bus_token bus_token, const char *suffix)
> {
> - char *name = bus_token ? kasprintf(GFP_KERNEL, "%pfw-%d", fwnode, bus_token) :
> - kasprintf(GFP_KERNEL, "%pfw", fwnode);
> + const char *sep = suffix ? "-" : "";
> + const char *suf = suffix ? : "";
> + char *name;
>
> + name = bus_token ? kasprintf(GFP_KERNEL, "%pfw-%s%s%d", fwnode, suf, sep, bus_token) :
> + kasprintf(GFP_KERNEL, "%pfw-%s", fwnode, suf);
> if (!name)
> return -ENOMEM;
>
Thanks Thomas!
This looks much, much cleaner to me compared to my original version :)
> @@ -172,13 +175,24 @@ static int alloc_unknown_name(struct irq
> return 0;
> }
>
Yours,
-- Matti
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
next prev parent reply other threads:[~2024-08-09 5:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 12:32 [PATCH v2 0/3] regmap IRQ support for devices with multiple IRQs Matti Vaittinen
2024-08-08 12:34 ` [PATCH v2 1/3] irqdomain: simplify simple and legacy domain creation Matti Vaittinen
2024-08-13 10:19 ` Jiaxun Yang
2024-08-13 10:54 ` Matti Vaittinen
2024-08-13 12:02 ` Matti Vaittinen
2024-08-13 12:14 ` Jiaxun Yang
2024-08-13 14:20 ` [tip: irq/core] irqdomain: Always associate interrupts for legacy domains tip-bot2 for Matti Vaittinen
2024-08-20 15:21 ` tip-bot2 for Matti Vaittinen
2024-08-13 12:03 ` [PATCH v2 1/3] irqdomain: simplify simple and legacy domain creation Jiaxun Yang
2024-08-08 12:35 ` [PATCH v2 2/3] irqdomain: Allow giving name suffix for domain Matti Vaittinen
2024-08-08 20:17 ` Thomas Gleixner
2024-08-08 20:19 ` [PATCH] irqdomain: Cleanup domain name allocation Thomas Gleixner
2024-08-08 20:23 ` [PATCH v2a 2/3] irqdomain: Allow giving name suffix for domain Thomas Gleixner
2024-08-09 5:03 ` Matti Vaittinen [this message]
2024-08-09 21:14 ` [tip: irq/core] " tip-bot2 for Matti Vaittinen
2024-08-09 5:19 ` [PATCH] irqdomain: Cleanup domain name allocation Matti Vaittinen
2024-08-09 21:14 ` [tip: irq/core] " tip-bot2 for Thomas Gleixner
2024-08-08 12:36 ` [PATCH v2 3/3] regmap: Allow setting IRQ domain name suffix Matti Vaittinen
2024-08-09 21:09 ` Thomas Gleixner
2024-08-12 19:05 ` Andy Shevchenko
2024-08-13 9:11 ` Matti Vaittinen
2024-08-14 12:05 ` (subset) [PATCH v2 0/3] regmap IRQ support for devices with multiple IRQs Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f77a70a-2bcb-4cb2-ac4f-a5d785f6f7ff@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®