• Ingo Molnar's avatar
    mm/gup: Remove the macro overload API migration helpers from the get_user*() APIs · c12d2da5
    Ingo Molnar authored
    The pkeys changes brought about a truly hideous set of macros in:
      cde70140 ("mm/gup: Overload get_user_pages() functions")
    ... which macros are (ab-)using the fact that __VA_ARGS__ can be used
    to shift parameter positions in macro arguments without breaking the
    build and so can be used to call separate C functions depending on
    the number of arguments of the macro.
    This allowed easy migration of these 3 GUP APIs, as both these variants
    worked at the C level:
    	ret = get_user_pages(current, current->mm, address, 1, 1, 0, &page, NULL);
    	ret = get_user_pages(address, 1, 1, 0, &page, NULL);
    ... while we also generated a (functionally harmless but noticeable) build
    time warning if the old API was used. As there are over 300 uses of these
    APIs, this trick eased the migration of the API and avoided excessive
    migration pain in linux-next.
    Now, with its work done, get rid of all of that complication and ugliness:
        3 files changed, 16 insertions(+), 140 deletions(-)
    ... where the linecount of the migration hack was further inflated by the
    fact that there are NOMMU variants of these GUP APIs as well.
    Much of the conversion was done in linux-next over the past couple of months,
    and Linus recently removed all remaining old API uses from the upstream tree
    in the following upstrea commit:
     ("Convert straggling drivers to new six-argument get_user_pages()")
    There was one more old-API usage in mm/gup.c, in the CONFIG_HAVE_GENERIC_RCU_GUP
    code path that ARM, ARM64 and PowerPC uses.
    After this commit any old API usage will break the build.
    [ Also fixed a PowerPC/HAVE_GENERIC_RCU_GUP warning reported by Stephen Rothwell. ]
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Dave Hansen <dave@sr71.net>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mm@kvack.org
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
gup.c 42.5 KB