Skip to content

Commit

Permalink
irqdomain: Introduce is_fwnode_irqchip helper
Browse files Browse the repository at this point in the history
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: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
  • Loading branch information
Suravee Suthikulpanit authored and Marc Zyngier committed Dec 21, 2015
1 parent 471036b commit 75aba7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ static int gic_irq_domain_translate(struct irq_domain *d,
return 0;
}

if (fwspec->fwnode->type == FWNODE_IRQCHIP) {
if (is_fwnode_irqchip(fwspec->fwnode)) {
if(fwspec->param_count != 2)
return -EINVAL;

Expand Down
5 changes: 5 additions & 0 deletions include/linux/irqdomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node)
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,
enum irq_domain_bus_token bus_token)
{
Expand Down
2 changes: 1 addition & 1 deletion kernel/irq/irqdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode)
{
struct irqchip_fwid *fwid;

if (WARN_ON(fwnode->type != FWNODE_IRQCHIP))
if (WARN_ON(!is_fwnode_irqchip(fwnode)))
return;

fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
Expand Down

0 comments on commit 75aba7b

Please sign in to comment.