Refine code by normailizing the way to detect whether IR is enabled. Signed-off-by: Jiang Liu <jiang....@linux.intel.com> --- drivers/iommu/irq_remapping.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c index fbd585e49ebd..c7ef51a2555a 100644 --- a/drivers/iommu/irq_remapping.c +++ b/drivers/iommu/irq_remapping.c @@ -112,22 +112,16 @@ int __init irq_remapping_enable(void) void irq_remapping_disable(void) { - if (!irq_remapping_enabled || - !remap_ops || - !remap_ops->disable) - return; - - remap_ops->disable(); + if (irq_remapping_enabled && remap_ops->disable) + remap_ops->disable(); } int irq_remapping_reenable(int mode) { - if (!irq_remapping_enabled || - !remap_ops || - !remap_ops->reenable) - return 0; + if (irq_remapping_enabled && remap_ops->reenable) + return remap_ops->reenable(mode); - return remap_ops->reenable(mode); + return 0; } int __init irq_remap_enable_fault_handling(void) @@ -135,7 +129,7 @@ int __init irq_remap_enable_fault_handling(void) if (!irq_remapping_enabled) return 0; - if (!remap_ops || !remap_ops->enable_faulting) + if (!remap_ops->enable_faulting) return -ENODEV; return remap_ops->enable_faulting(); @@ -176,10 +170,10 @@ void irq_remapping_print_chip(struct irq_data *data, struct seq_file *p) struct irq_domain * irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info) { - if (!remap_ops || !remap_ops->get_ir_irq_domain) - return NULL; + if (irq_remapping_enabled && remap_ops->get_ir_irq_domain) + return remap_ops->get_ir_irq_domain(info); - return remap_ops->get_ir_irq_domain(info); + return NULL; } /** @@ -194,8 +188,8 @@ irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info) struct irq_domain * irq_remapping_get_irq_domain(struct irq_alloc_info *info) { - if (!remap_ops || !remap_ops->get_irq_domain) - return NULL; + if (irq_remapping_enabled && remap_ops->get_irq_domain) + return remap_ops->get_irq_domain(info); - return remap_ops->get_irq_domain(info); + return NULL; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/