diff options
author | Quentin Lambert <lambert.quentin@gmail.com> | 2015-02-06 04:59:53 -0500 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-03-03 08:13:20 -0500 |
commit | 2f119c7895af56ca26b8e94f4650145a4b1b0d12 (patch) | |
tree | c78e7a594d8ccaf516d6eeb7c20a1a3b4330640c | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) |
iommu/vt-d: Convert non-returned local variable to boolean when relevant
This patch was produced using Coccinelle. A simplified version of the
semantic patch is:
@r exists@
identifier f;
local idexpression u8 x;
identifier xname;
@@
f(...) {
...when any
(
x@xname = 1;
|
x@xname = 0;
)
...when any
}
@bad exists@
identifier r.f;
local idexpression u8 r.x
expression e1 != {0, 1}, e2;
@@
f(...) {
...when any
(
x = e1;
|
x + e2
)
...when any
}
@depends on !bad@
identifier r.f;
local idexpression u8 r.x;
identifier r.xname;
@@
f(...) {
...
++ bool xname;
- int xname;
<...
(
x =
- 1
+ true
|
x =
- -1
+ false
)
...>
}
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/intel-iommu.c | 13 | ||||
-rw-r--r-- | drivers/iommu/intel_irq_remapping.c | 12 |
2 files changed, 13 insertions, 12 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index ae4c1a854e57..d25cc6219a32 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -595,12 +595,13 @@ static void domain_update_iommu_coherency(struct dmar_domain *domain) | |||
595 | { | 595 | { |
596 | struct dmar_drhd_unit *drhd; | 596 | struct dmar_drhd_unit *drhd; |
597 | struct intel_iommu *iommu; | 597 | struct intel_iommu *iommu; |
598 | int i, found = 0; | 598 | bool found = false; |
599 | int i; | ||
599 | 600 | ||
600 | domain->iommu_coherency = 1; | 601 | domain->iommu_coherency = 1; |
601 | 602 | ||
602 | for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus) { | 603 | for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus) { |
603 | found = 1; | 604 | found = true; |
604 | if (!ecap_coherent(g_iommus[i]->ecap)) { | 605 | if (!ecap_coherent(g_iommus[i]->ecap)) { |
605 | domain->iommu_coherency = 0; | 606 | domain->iommu_coherency = 0; |
606 | break; | 607 | break; |
@@ -1267,7 +1268,7 @@ static struct device_domain_info * | |||
1267 | iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu, | 1268 | iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu, |
1268 | u8 bus, u8 devfn) | 1269 | u8 bus, u8 devfn) |
1269 | { | 1270 | { |
1270 | int found = 0; | 1271 | bool found = false; |
1271 | unsigned long flags; | 1272 | unsigned long flags; |
1272 | struct device_domain_info *info; | 1273 | struct device_domain_info *info; |
1273 | struct pci_dev *pdev; | 1274 | struct pci_dev *pdev; |
@@ -1282,7 +1283,7 @@ iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu, | |||
1282 | list_for_each_entry(info, &domain->devices, link) | 1283 | list_for_each_entry(info, &domain->devices, link) |
1283 | if (info->iommu == iommu && info->bus == bus && | 1284 | if (info->iommu == iommu && info->bus == bus && |
1284 | info->devfn == devfn) { | 1285 | info->devfn == devfn) { |
1285 | found = 1; | 1286 | found = true; |
1286 | break; | 1287 | break; |
1287 | } | 1288 | } |
1288 | spin_unlock_irqrestore(&device_domain_lock, flags); | 1289 | spin_unlock_irqrestore(&device_domain_lock, flags); |
@@ -4270,7 +4271,7 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
4270 | struct device_domain_info *info, *tmp; | 4271 | struct device_domain_info *info, *tmp; |
4271 | struct intel_iommu *iommu; | 4272 | struct intel_iommu *iommu; |
4272 | unsigned long flags; | 4273 | unsigned long flags; |
4273 | int found = 0; | 4274 | bool found = false; |
4274 | u8 bus, devfn; | 4275 | u8 bus, devfn; |
4275 | 4276 | ||
4276 | iommu = device_to_iommu(dev, &bus, &devfn); | 4277 | iommu = device_to_iommu(dev, &bus, &devfn); |
@@ -4302,7 +4303,7 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
4302 | * update iommu count and coherency | 4303 | * update iommu count and coherency |
4303 | */ | 4304 | */ |
4304 | if (info->iommu == iommu) | 4305 | if (info->iommu == iommu) |
4305 | found = 1; | 4306 | found = true; |
4306 | } | 4307 | } |
4307 | 4308 | ||
4308 | spin_unlock_irqrestore(&device_domain_lock, flags); | 4309 | spin_unlock_irqrestore(&device_domain_lock, flags); |
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 14de1ab223c8..6c25b3c5b729 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c | |||
@@ -631,7 +631,7 @@ static int __init intel_enable_irq_remapping(void) | |||
631 | { | 631 | { |
632 | struct dmar_drhd_unit *drhd; | 632 | struct dmar_drhd_unit *drhd; |
633 | struct intel_iommu *iommu; | 633 | struct intel_iommu *iommu; |
634 | int setup = 0; | 634 | bool setup = false; |
635 | int eim = 0; | 635 | int eim = 0; |
636 | 636 | ||
637 | if (x2apic_supported()) { | 637 | if (x2apic_supported()) { |
@@ -697,7 +697,7 @@ static int __init intel_enable_irq_remapping(void) | |||
697 | */ | 697 | */ |
698 | for_each_iommu(iommu, drhd) { | 698 | for_each_iommu(iommu, drhd) { |
699 | iommu_set_irq_remapping(iommu, eim); | 699 | iommu_set_irq_remapping(iommu, eim); |
700 | setup = 1; | 700 | setup = true; |
701 | } | 701 | } |
702 | 702 | ||
703 | if (!setup) | 703 | if (!setup) |
@@ -856,7 +856,7 @@ static int __init parse_ioapics_under_ir(void) | |||
856 | { | 856 | { |
857 | struct dmar_drhd_unit *drhd; | 857 | struct dmar_drhd_unit *drhd; |
858 | struct intel_iommu *iommu; | 858 | struct intel_iommu *iommu; |
859 | int ir_supported = 0; | 859 | bool ir_supported = false; |
860 | int ioapic_idx; | 860 | int ioapic_idx; |
861 | 861 | ||
862 | for_each_iommu(iommu, drhd) | 862 | for_each_iommu(iommu, drhd) |
@@ -864,7 +864,7 @@ static int __init parse_ioapics_under_ir(void) | |||
864 | if (ir_parse_ioapic_hpet_scope(drhd->hdr, iommu)) | 864 | if (ir_parse_ioapic_hpet_scope(drhd->hdr, iommu)) |
865 | return -1; | 865 | return -1; |
866 | 866 | ||
867 | ir_supported = 1; | 867 | ir_supported = true; |
868 | } | 868 | } |
869 | 869 | ||
870 | if (!ir_supported) | 870 | if (!ir_supported) |
@@ -917,7 +917,7 @@ static void disable_irq_remapping(void) | |||
917 | static int reenable_irq_remapping(int eim) | 917 | static int reenable_irq_remapping(int eim) |
918 | { | 918 | { |
919 | struct dmar_drhd_unit *drhd; | 919 | struct dmar_drhd_unit *drhd; |
920 | int setup = 0; | 920 | bool setup = false; |
921 | struct intel_iommu *iommu = NULL; | 921 | struct intel_iommu *iommu = NULL; |
922 | 922 | ||
923 | for_each_iommu(iommu, drhd) | 923 | for_each_iommu(iommu, drhd) |
@@ -933,7 +933,7 @@ static int reenable_irq_remapping(int eim) | |||
933 | 933 | ||
934 | /* Set up interrupt remapping for iommu.*/ | 934 | /* Set up interrupt remapping for iommu.*/ |
935 | iommu_set_irq_remapping(iommu, eim); | 935 | iommu_set_irq_remapping(iommu, eim); |
936 | setup = 1; | 936 | setup = true; |
937 | } | 937 | } |
938 | 938 | ||
939 | if (!setup) | 939 | if (!setup) |