提交 75aba7b0 编写于 作者: S Suravee Suthikulpanit 提交者: Marc Zyngier

irqdomain: Introduce is_fwnode_irqchip helper

Since there will be several places checking if fwnode.type
is equal FWNODE_IRQCHIP, this patch adds a convenient function
for this purpose.
Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: NSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
上级 471036b2
...@@ -972,7 +972,7 @@ static int gic_irq_domain_translate(struct irq_domain *d, ...@@ -972,7 +972,7 @@ static int gic_irq_domain_translate(struct irq_domain *d,
return 0; return 0;
} }
if (fwspec->fwnode->type == FWNODE_IRQCHIP) { if (is_fwnode_irqchip(fwspec->fwnode)) {
if(fwspec->param_count != 2) if(fwspec->param_count != 2)
return -EINVAL; return -EINVAL;
......
...@@ -211,6 +211,11 @@ static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node) ...@@ -211,6 +211,11 @@ static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node)
return node ? &node->fwnode : NULL; return node ? &node->fwnode : NULL;
} }
static inline bool is_fwnode_irqchip(struct fwnode_handle *fwnode)
{
return fwnode && fwnode->type == FWNODE_IRQCHIP;
}
static inline struct irq_domain *irq_find_matching_host(struct device_node *node, static inline struct irq_domain *irq_find_matching_host(struct device_node *node,
enum irq_domain_bus_token bus_token) enum irq_domain_bus_token bus_token)
{ {
......
...@@ -70,7 +70,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode) ...@@ -70,7 +70,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode)
{ {
struct irqchip_fwid *fwid; struct irqchip_fwid *fwid;
if (WARN_ON(fwnode->type != FWNODE_IRQCHIP)) if (WARN_ON(!is_fwnode_irqchip(fwnode)))
return; return;
fwid = container_of(fwnode, struct irqchip_fwid, fwnode); fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册