Re: [PATCH v7 2/2] ARM hibernation / suspend-to-disk

From: Sebastian Capella
Date: Mon Mar 17 2014 - 18:08:03 EST


Thanks Russell!

On 16 March 2014 02:46, Russell King - ARM Linux <linux@xxxxxxxxxxxxxxxx> wrote:
> On Mon, Mar 10, 2014 at 11:32:17AM -0700, Sebastian Capella wrote:
...
> Let's look at the implementations...
>
> #define __pa(x) __virt_to_phys((unsigned long)(x))
> static inline phys_addr_t __virt_to_phys(unsigned long x)
> {
> return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
> }
>
> So, __pa() returns a phys_addr_t (which may be either 32-bit or 64-bit).
>
> #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
>
> And that will do an appropriate shift to convert the phys_addr_t to a PFN,
> which will be fine to assign to an unsigned long variable.
>
> #define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
>
> This does the same thing, but has an explicit cast.
>
> So, the only difference between the two suggestions is that additional
> cast, which has no effect here.

Sounds good, thanks!

I was a little unsure about the page sizes that could affect all of
the implementations.

I'll make this change and repost, basically using virt_to_pfn in place
of the previous __pa_symbol, and remove unused declarations.

Thanks again!

Sebastian
--
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/