Skip to content

Commit 6a6544e

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
genirq/irqdomain: Remove auto-recursive hierarchy support
It did seem like a good idea at the time, but it never really caught on, and auto-recursive domains remain unused 3 years after having been introduced. Oh well, time for a late spring cleanup. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 96f0d93 commit 6a6544e

File tree

3 files changed

+17
-49
lines changed

3 files changed

+17
-49
lines changed

include/linux/irqdomain.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ enum {
180180
/* Irq domain is hierarchical */
181181
IRQ_DOMAIN_FLAG_HIERARCHY = (1 << 0),
182182

183-
/* Core calls alloc/free recursive through the domain hierarchy. */
184-
IRQ_DOMAIN_FLAG_AUTO_RECURSIVE = (1 << 1),
183+
/* Irq domain name was allocated in __irq_domain_add() */
184+
IRQ_DOMAIN_NAME_ALLOCATED = (1 << 6),
185185

186186
/* Irq domain is an IPI domain with virq per cpu */
187187
IRQ_DOMAIN_FLAG_IPI_PER_CPU = (1 << 2),
@@ -195,9 +195,6 @@ enum {
195195
/* Irq domain implements MSI remapping */
196196
IRQ_DOMAIN_FLAG_MSI_REMAP = (1 << 5),
197197

198-
/* Irq domain name was allocated in __irq_domain_add() */
199-
IRQ_DOMAIN_NAME_ALLOCATED = (1 << 6),
200-
201198
/*
202199
* Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
203200
* for implementation specific purposes and ignored by the
@@ -448,7 +445,7 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
448445
NULL);
449446
}
450447

451-
extern int irq_domain_alloc_irqs_recursive(struct irq_domain *domain,
448+
extern int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
452449
unsigned int irq_base,
453450
unsigned int nr_irqs, void *arg);
454451
extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain,

kernel/irq/irqdomain.c

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,43 +1342,18 @@ void irq_domain_free_irqs_top(struct irq_domain *domain, unsigned int virq,
13421342
irq_domain_free_irqs_common(domain, virq, nr_irqs);
13431343
}
13441344

1345-
static bool irq_domain_is_auto_recursive(struct irq_domain *domain)
1346-
{
1347-
return domain->flags & IRQ_DOMAIN_FLAG_AUTO_RECURSIVE;
1348-
}
1349-
1350-
static void irq_domain_free_irqs_recursive(struct irq_domain *domain,
1345+
static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain,
13511346
unsigned int irq_base,
13521347
unsigned int nr_irqs)
13531348
{
13541349
domain->ops->free(domain, irq_base, nr_irqs);
1355-
if (irq_domain_is_auto_recursive(domain)) {
1356-
BUG_ON(!domain->parent);
1357-
irq_domain_free_irqs_recursive(domain->parent, irq_base,
1358-
nr_irqs);
1359-
}
13601350
}
13611351

1362-
int irq_domain_alloc_irqs_recursive(struct irq_domain *domain,
1352+
int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
13631353
unsigned int irq_base,
13641354
unsigned int nr_irqs, void *arg)
13651355
{
1366-
int ret = 0;
1367-
struct irq_domain *parent = domain->parent;
1368-
bool recursive = irq_domain_is_auto_recursive(domain);
1369-
1370-
BUG_ON(recursive && !parent);
1371-
if (recursive)
1372-
ret = irq_domain_alloc_irqs_recursive(parent, irq_base,
1373-
nr_irqs, arg);
1374-
if (ret < 0)
1375-
return ret;
1376-
1377-
ret = domain->ops->alloc(domain, irq_base, nr_irqs, arg);
1378-
if (ret < 0 && recursive)
1379-
irq_domain_free_irqs_recursive(parent, irq_base, nr_irqs);
1380-
1381-
return ret;
1356+
return domain->ops->alloc(domain, irq_base, nr_irqs, arg);
13821357
}
13831358

13841359
/**
@@ -1439,7 +1414,7 @@ int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,
14391414
}
14401415

14411416
mutex_lock(&irq_domain_mutex);
1442-
ret = irq_domain_alloc_irqs_recursive(domain, virq, nr_irqs, arg);
1417+
ret = irq_domain_alloc_irqs_hierarchy(domain, virq, nr_irqs, arg);
14431418
if (ret < 0) {
14441419
mutex_unlock(&irq_domain_mutex);
14451420
goto out_free_irq_data;
@@ -1474,7 +1449,7 @@ void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs)
14741449
mutex_lock(&irq_domain_mutex);
14751450
for (i = 0; i < nr_irqs; i++)
14761451
irq_domain_remove_irq(virq + i);
1477-
irq_domain_free_irqs_recursive(data->domain, virq, nr_irqs);
1452+
irq_domain_free_irqs_hierarchy(data->domain, virq, nr_irqs);
14781453
mutex_unlock(&irq_domain_mutex);
14791454

14801455
irq_domain_free_irq_data(virq, nr_irqs);
@@ -1494,15 +1469,11 @@ int irq_domain_alloc_irqs_parent(struct irq_domain *domain,
14941469
unsigned int irq_base, unsigned int nr_irqs,
14951470
void *arg)
14961471
{
1497-
/* irq_domain_alloc_irqs_recursive() has called parent's alloc() */
1498-
if (irq_domain_is_auto_recursive(domain))
1499-
return 0;
1472+
if (!domain->parent)
1473+
return -ENOSYS;
15001474

1501-
domain = domain->parent;
1502-
if (domain)
1503-
return irq_domain_alloc_irqs_recursive(domain, irq_base,
1504-
nr_irqs, arg);
1505-
return -ENOSYS;
1475+
return irq_domain_alloc_irqs_hierarchy(domain->parent, irq_base,
1476+
nr_irqs, arg);
15061477
}
15071478
EXPORT_SYMBOL_GPL(irq_domain_alloc_irqs_parent);
15081479

@@ -1517,10 +1488,10 @@ EXPORT_SYMBOL_GPL(irq_domain_alloc_irqs_parent);
15171488
void irq_domain_free_irqs_parent(struct irq_domain *domain,
15181489
unsigned int irq_base, unsigned int nr_irqs)
15191490
{
1520-
/* irq_domain_free_irqs_recursive() will call parent's free */
1521-
if (!irq_domain_is_auto_recursive(domain) && domain->parent)
1522-
irq_domain_free_irqs_recursive(domain->parent, irq_base,
1523-
nr_irqs);
1491+
if (!domain->parent)
1492+
return;
1493+
1494+
irq_domain_free_irqs_hierarchy(domain->parent, irq_base, nr_irqs);
15241495
}
15251496
EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent);
15261497

kernel/irq/msi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
315315

316316
ops->set_desc(arg, desc);
317317
/* Assumes the domain mutex is held! */
318-
ret = irq_domain_alloc_irqs_recursive(domain, virq, 1, arg);
318+
ret = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg);
319319
if (ret)
320320
break;
321321

0 commit comments

Comments
 (0)