[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172353884572.2215.16761185917267853525.tip-bot2@tip-bot2>
Date: Tue, 13 Aug 2024 08:47:25 -0000
From: "tip-bot2 for Andy Shevchenko" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
linux-kernel@...r.kernel.org, maz@...nel.org
Subject: [tip: irq/core] irqdomain: Clarify checks for bus_token
The following commit has been merged into the irq/core branch of tip:
Commit-ID: c0ece64497992473aabbcbb007e2afecc8d750a2
Gitweb: https://git.kernel.org/tip/c0ece64497992473aabbcbb007e2afecc8d750a2
Author: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
AuthorDate: Mon, 12 Aug 2024 22:29:39 +03:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 13 Aug 2024 10:40:09 +02:00
irqdomain: Clarify checks for bus_token
The code uses if (bus_token) and if (bus_token == DOMAIN_BUS_ANY).
Since bus_token is an enum, the latter is more robust against changes.
Convert all !bus_token checks to explicitely check for DOMAIN_BUS_ANY.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/all/20240812193101.1266625-2-andriy.shevchenko@linux.intel.com
---
kernel/irq/irqdomain.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 01001eb..18d253e 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -130,8 +130,10 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode);
static int alloc_name(struct irq_domain *domain, char *base, enum irq_domain_bus_token bus_token)
{
- domain->name = bus_token ? kasprintf(GFP_KERNEL, "%s-%d", base, bus_token) :
- kasprintf(GFP_KERNEL, "%s", base);
+ if (bus_token == DOMAIN_BUS_ANY)
+ domain->name = kasprintf(GFP_KERNEL, "%s", base);
+ else
+ domain->name = kasprintf(GFP_KERNEL, "%s-%d", base, bus_token);
if (!domain->name)
return -ENOMEM;
@@ -146,8 +148,10 @@ static int alloc_fwnode_name(struct irq_domain *domain, const struct fwnode_hand
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 (bus_token == DOMAIN_BUS_ANY)
+ name = kasprintf(GFP_KERNEL, "%pfw-%s", fwnode, suf);
+ else
+ name = kasprintf(GFP_KERNEL, "%pfw-%s%s%d", fwnode, suf, sep, bus_token);
if (!name)
return -ENOMEM;
@@ -166,11 +170,13 @@ static int alloc_unknown_name(struct irq_domain *domain, enum irq_domain_bus_tok
static atomic_t unknown_domains;
int id = atomic_inc_return(&unknown_domains);
- domain->name = bus_token ? kasprintf(GFP_KERNEL, "unknown-%d-%d", id, bus_token) :
- kasprintf(GFP_KERNEL, "unknown-%d", id);
-
+ if (bus_token == DOMAIN_BUS_ANY)
+ domain->name = kasprintf(GFP_KERNEL, "unknown-%d", id);
+ else
+ domain->name = kasprintf(GFP_KERNEL, "unknown-%d-%d", id, bus_token);
if (!domain->name)
return -ENOMEM;
+
domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
return 0;
}
@@ -200,7 +206,7 @@ static int irq_domain_set_name(struct irq_domain *domain, const struct irq_domai
return alloc_name(domain, fwid->name, bus_token);
default:
domain->name = fwid->name;
- if (bus_token)
+ if (bus_token != DOMAIN_BUS_ANY)
return alloc_name(domain, fwid->name, bus_token);
}
Powered by blists - more mailing lists