Re: [PATCH 10/10] iommu/vt-d: Misc macro clean up for SVM

Jacob Pan
2019-11-18T18:32:09Z

On Mon, 18 Nov 2019 10:23:34 +0800
Lu Baolu <baolu.lu@linux.intel.com> 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@linux.intel.com>
> > Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > Reviewed-by: Eric Auger <eric.auger@redhat.com>
> > ---
> > 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]