Re: [PATCH v2] fpga: dfl: afu: use PFN_DOWN() and PFN_PHYS() helper macros

From: Xu Yilun
Date: Wed Jun 28 2023 - 04:39:38 EST


On 2023-06-27 at 21:23:03 +0300, Andy Shevchenko wrote:
> On Tue, Jun 27, 2023 at 02:26:27PM +0800, Xu Yilun wrote:
> > On 2023-06-19 at 15:56:34 -0400, Peter Colberg wrote:
>
> ...
>
> > > - int npages = region->length >> PAGE_SHIFT;
> > > + int npages = PFN_DOWN(region->length);
> >
> > I don't much prefer this change, it is not doing the phy addr to pfn
> > convertion. The macro name doesn't match what is doing here.
>
> This macro converts length to pages. And it's not about phy addr.

You are right.

> > > - offset = vma->vm_pgoff << PAGE_SHIFT;
> > > + offset = PFN_PHYS(vma->vm_pgoff);
> >
> > ditto. The variables are offsets within file, not phys addr & pfn.
>
> Here I probably can agree.

OK. Remove this one, and others LGTM.

Thanks,
Yilun

>
> --
> With Best Regards,
> Andy Shevchenko
>
>