Re: intel-iommu: Add for_each_iommu() and for_each_active_iommu()macros

From: Andrew Morton
Date: Mon Apr 06 2009 - 21:02:21 EST


On Mon, 6 Apr 2009 21:59:01 GMT
Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx> wrote:

> Gitweb: http://git.kernel.org/linus/8f912ba4d7cdaf7d31cf39fe5a9b7732308a256d
> Commit: 8f912ba4d7cdaf7d31cf39fe5a9b7732308a256d
> Parent: 20bec8ab1458c24bed0d5492ee15d87807fc415a
> Author: David Woodhouse <David.Woodhouse@xxxxxxxxx>
> AuthorDate: Fri Apr 3 15:19:32 2009 +0100
> Committer: David Woodhouse <David.Woodhouse@xxxxxxxxx>
> CommitDate: Fri Apr 3 21:45:46 2009 +0100

Three days old? Never been in linux-next afaict.

Please don't do that.

> intel-iommu: Add for_each_iommu() and for_each_active_iommu() macros
>
> Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
> Acked-by: Ingo Molnar <mingo@xxxxxxx>
> ---
> include/linux/dmar.h | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/dmar.h b/include/linux/dmar.h
> index 2f34274..0b4aa80 100644
> --- a/include/linux/dmar.h
> +++ b/include/linux/dmar.h
> @@ -44,6 +44,14 @@ extern struct list_head dmar_drhd_units;
> #define for_each_drhd_unit(drhd) \
> list_for_each_entry(drhd, &dmar_drhd_units, list)
>
> +#define for_each_active_iommu(i, drhd) \
> + list_for_each_entry(drhd, &dmar_drhd_units, list) \
> + if (i=drhd->iommu, drhd->ignored) {} else
> +
> +#define for_each_iommu(i, drhd) \
> + list_for_each_entry(drhd, &dmar_drhd_units, list) \
> + if (i=drhd->iommu, 0) {} else
> +
> extern int dmar_table_init(void);
> extern int dmar_dev_scope_init(void);

From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

drivers/pci/intel-iommu.c:2637:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c: In function 'init_iommu_hw':
drivers/pci/intel-iommu.c:2637: error: expected '(' before '{' token
drivers/pci/intel-iommu.c:2638: error: '______r' undeclared (first use in this function)
drivers/pci/intel-iommu.c:2638: error: (Each undeclared identifier is reported only once
drivers/pci/intel-iommu.c:2638: error: for each function it appears in.)
drivers/pci/intel-iommu.c:2641:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c:2641: error: expected '(' before '{' token
drivers/pci/intel-iommu.c:2662:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c: In function 'iommu_flush_all':
drivers/pci/intel-iommu.c:2662: error: expected '(' before '{' token
drivers/pci/intel-iommu.c:2676:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c: In function 'iommu_suspend':
drivers/pci/intel-iommu.c:2676: error: expected '(' before '{' token
drivers/pci/intel-iommu.c:2678: error: too few arguments to function 'kzalloc'
drivers/pci/intel-iommu.c:2685:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c:2685: error: expected '(' before '{' token
drivers/pci/intel-iommu.c:2688: error: '__dummy' undeclared (first use in this function)
drivers/pci/intel-iommu.c:2704:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c:2704: error: expected '(' before '{' token
drivers/pci/intel-iommu.c:2721:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c:2737:35: error: macro "if" passed 2 arguments, but takes just 1
drivers/pci/intel-iommu.c: At top level:
drivers/pci/intel-iommu.c:2745: error: 'iommu_resume' undeclared here (not in a function)

Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

include/linux/dmar.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN include/linux/dmar.h~include-linux-dmarh-fix-build-with-config_profile_all_branches include/linux/dmar.h
--- a/include/linux/dmar.h~include-linux-dmarh-fix-build-with-config_profile_all_branches
+++ a/include/linux/dmar.h
@@ -47,11 +47,11 @@ extern struct list_head dmar_drhd_units;

#define for_each_active_iommu(i, drhd) \
list_for_each_entry(drhd, &dmar_drhd_units, list) \
- if (i=drhd->iommu, drhd->ignored) {} else
+ if ((i=drhd->iommu, drhd->ignored)) {} else

#define for_each_iommu(i, drhd) \
list_for_each_entry(drhd, &dmar_drhd_units, list) \
- if (i=drhd->iommu, 0) {} else
+ if ((i=drhd->iommu, 0)) {} else

extern int dmar_table_init(void);
extern int dmar_dev_scope_init(void);
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/