Re: [PATCH v2] nouveau/hmm: map pages after migration

From: Christoph Hellwig
Date: Wed Mar 04 2020 - 11:27:57 EST


On Tue, Mar 03, 2020 at 01:15:21PM -0800, Ralph Campbell wrote:
>>> +static inline struct nouveau_pfnmap_args *
>>> +nouveau_pfns_to_args(void *pfns)
>>
>> don't use static inline inside C files
>
> OK.
>
>>> +{
>>> + struct nvif_vmm_pfnmap_v0 *p =
>>> + container_of(pfns, struct nvif_vmm_pfnmap_v0, phys);
>>> +
>>> + return container_of(p, struct nouveau_pfnmap_args, p);
>>
>> And this should just be
>>
>> return container_of(pfns, struct nouveau_pfnmap_args, p.phys);
>
> Much simpler, thanks.

Btw, for the case where we just have an container_of wrapper I strongly
disagree with avoiding the inline - not inlining this would be stupid,
but unfortunately compilers often behave stupidly. It also is a very
clear marker.