Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68158006 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras
Browse files

[POWERPC] Provide a default irq_host match, which matches on an exact of_node



The most common match semantic is an exact match based on the device node.
So provide a default implementation that does this, and hook it up if no
match routine is specified.

Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 8528ab84
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -418,6 +418,11 @@ irq_hw_number_t virq_to_hw(unsigned int virq)
}
}
EXPORT_SYMBOL_GPL(virq_to_hw);
EXPORT_SYMBOL_GPL(virq_to_hw);


static int default_irq_host_match(struct irq_host *h, struct device_node *np)
{
	return h->of_node != NULL && h->of_node == np;
}

__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
				unsigned int revmap_type,
				unsigned int revmap_type,
				unsigned int revmap_arg,
				unsigned int revmap_arg,
@@ -449,6 +454,9 @@ __init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
	host->ops = ops;
	host->ops = ops;
	host->of_node = of_node;
	host->of_node = of_node;


	if (host->ops->match == NULL)
		host->ops->match = default_irq_host_match;

	spin_lock_irqsave(&irq_big_lock, flags);
	spin_lock_irqsave(&irq_big_lock, flags);


	/* If it's a legacy controller, check for duplicates and
	/* If it's a legacy controller, check for duplicates and
@@ -523,7 +531,7 @@ struct irq_host *irq_find_host(struct device_node *node)
	 */
	 */
	spin_lock_irqsave(&irq_big_lock, flags);
	spin_lock_irqsave(&irq_big_lock, flags);
	list_for_each_entry(h, &irq_hosts, link)
	list_for_each_entry(h, &irq_hosts, link)
		if (h->ops->match != NULL && h->ops->match(h, node)) {
		if (h->ops->match(h, node)) {
			found = h;
			found = h;
			break;
			break;
		}
		}
+0 −7
Original line number Original line Diff line number Diff line
@@ -241,12 +241,6 @@ static struct irq_chip mpc52xx_sdma_irqchip = {
 * irq_host
 * irq_host
*/
*/


static int mpc52xx_irqhost_match(struct irq_host *h, struct device_node *node)
{
	pr_debug("%s: node=%p\n", __func__, node);
	return h->of_node == node;
}

static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
				 u32 * intspec, unsigned int intsize,
				 u32 * intspec, unsigned int intsize,
				 irq_hw_number_t * out_hwirq,
				 irq_hw_number_t * out_hwirq,
@@ -367,7 +361,6 @@ static int mpc52xx_irqhost_map(struct irq_host *h, unsigned int virq,
}
}


static struct irq_host_ops mpc52xx_irqhost_ops = {
static struct irq_host_ops mpc52xx_irqhost_ops = {
	.match = mpc52xx_irqhost_match,
	.xlate = mpc52xx_irqhost_xlate,
	.xlate = mpc52xx_irqhost_xlate,
	.map = mpc52xx_irqhost_map,
	.map = mpc52xx_irqhost_map,
};
};
+0 −6
Original line number Original line Diff line number Diff line
@@ -398,11 +398,6 @@ m82xx_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
	}
	}
}
}


static int pci_pic_host_match(struct irq_host *h, struct device_node *node)
{
	return h->of_node == node;
}

static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
			    irq_hw_number_t hw)
			    irq_hw_number_t hw)
{
{
@@ -418,7 +413,6 @@ static void pci_host_unmap(struct irq_host *h, unsigned int virq)
}
}


static struct irq_host_ops pci_pic_host_ops = {
static struct irq_host_ops pci_pic_host_ops = {
	.match = pci_pic_host_match,
	.map = pci_pic_host_map,
	.map = pci_pic_host_map,
	.unmap = pci_host_unmap,
	.unmap = pci_host_unmap,
};
};
+0 −6
Original line number Original line Diff line number Diff line
@@ -294,13 +294,7 @@ static int msic_host_map(struct irq_host *h, unsigned int virq,
	return 0;
	return 0;
}
}


static int msic_host_match(struct irq_host *host, struct device_node *dn)
{
	return host->of_node == dn;
}

static struct irq_host_ops msic_host_ops = {
static struct irq_host_ops msic_host_ops = {
	.match	= msic_host_match,
	.map	= msic_host_map,
	.map	= msic_host_map,
};
};


+0 −6
Original line number Original line Diff line number Diff line
@@ -175,11 +175,6 @@ static struct irq_chip spider_pic = {
	.set_type = spider_set_irq_type,
	.set_type = spider_set_irq_type,
};
};


static int spider_host_match(struct irq_host *h, struct device_node *node)
{
	return h->of_node == node;
}

static int spider_host_map(struct irq_host *h, unsigned int virq,
static int spider_host_map(struct irq_host *h, unsigned int virq,
			irq_hw_number_t hw)
			irq_hw_number_t hw)
{
{
@@ -206,7 +201,6 @@ static int spider_host_xlate(struct irq_host *h, struct device_node *ct,
}
}


static struct irq_host_ops spider_host_ops = {
static struct irq_host_ops spider_host_ops = {
	.match = spider_host_match,
	.map = spider_host_map,
	.map = spider_host_map,
	.xlate = spider_host_xlate,
	.xlate = spider_host_xlate,
};
};
Loading