[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1418194071-13785-9-git-send-email-jiang.liu@linux.intel.com>
Date: Wed, 10 Dec 2014 14:47:50 +0800
From: Jiang Liu <jiang.liu@...ux.intel.com>
To: "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>,
Borislav Petkov <bp@...en8.de>
Cc: Jiang Liu <jiang.liu@...ux.intel.com>,
Tony Luck <tony.luck@...el.com>,
iommu@...ts.linux-foundation.org, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [RFC Patch V1 8/9] iommu/irq_remapping: Normailize the way to detect whether IR is enabled
Refine code by normailizing the way to detect whether IR is enabled.
Signed-off-by: Jiang Liu <jiang.liu@...ux.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists