lkml.org 
[lkml]   [2014]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC Patch V1 8/9] iommu/irq_remapping: Normailize the way to detect whether IR is enabled
Date
Refine code by normailizing the way to detect whether IR is enabled.

Signed-off-by: Jiang Liu <jiang.liu@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


\
 
 \ /
  Last update: 2014-12-10 08:21    [W:0.062 / U:6.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site