Re: [PATCH 10/10] iommu/vt-d: Misc macro clean up for SVM
From: Jacob Pan
Date: Mon Nov 18 2019 - 13:32:09 EST
On Mon, 18 Nov 2019 10:23:34 +0800
Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx> wrote:
> Hi,
>
> On 11/16/19 7:09 AM, Jacob Pan wrote:
> > Use combined macros for_each_svm_dev() to simplify SVM device
> > iteration and error checking.
> >
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Signed-off-by: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
> > Reviewed-by: Eric Auger <eric.auger@xxxxxxxxxx>
> > ---
> > drivers/iommu/intel-svm.c | 85
> > ++++++++++++++++++++++------------------------- 1 file changed, 40
> > insertions(+), 45 deletions(-)
> >
> > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> > index 189865501411..a7f67a9da3fc 100644
> > --- a/drivers/iommu/intel-svm.c
> > +++ b/drivers/iommu/intel-svm.c
> > @@ -226,6 +226,10 @@ static const struct mmu_notifier_ops
> > intel_mmuops = { static DEFINE_MUTEX(pasid_mutex);
> > static LIST_HEAD(global_svm_list);
> >
> > +#define for_each_svm_dev(sdev, svm, dev) \
> > + list_for_each_entry(sdev, &svm->devs, list) \
> > + if (dev != sdev->dev) {} else
>
> "dev" has been reused in "sdev->dev", how about below?
>
> #define for_each_svm_dev(sdev, svm, d) \
> list_for_each_entry((sdev), &(svm)->devs, list) \
> if ((d) != (sdev)->dev) {} else
>
sounds good. will do.
> Best regards,
> baolu
>
>
> [...]
[Jacob Pan]