include-uapi-linux-swab-Fix-potentially-missing-__always_inline.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From 2b7d2ece0b60b8f450f29119f28668dc74bb692e Mon Sep 17 00:00:00 2001
  2. From: Matt Redfearn <matt.redfearn@mips.com>
  3. Date: Wed, 3 Jan 2018 09:57:30 +0000
  4. Subject: [PATCH] include/uapi/linux/swab: Fix potentially missing
  5. __always_inline
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Commit bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining
  10. of some byteswap operations") added __always_inline to swab functions
  11. and commit 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to
  12. userspace headers") added a definition of __always_inline for use in
  13. exported headers when the kernel's compiler.h is not available.
  14. However, since swab.h does not include stddef.h, if the header soup does
  15. not indirectly include it, the definition of __always_inline is missing,
  16. resulting in a compilation failure, which was observed compiling the
  17. perf tool using exported headers containing this commit:
  18. In file included from /usr/include/linux/byteorder/little_endian.h:12:0,
  19. from /usr/include/asm/byteorder.h:14,
  20. from tools/include/uapi/linux/perf_event.h:20,
  21. from perf.h:8,
  22. from builtin-bench.c:18:
  23. /usr/include/linux/swab.h:160:8: error: unknown type name ‘__always_inline’
  24. static __always_inline __u16 __swab16p(const __u16 *p)
  25. Fix this by replacing the inclusion of linux/compiler.h with
  26. linux/stddef.h to ensure that we pick up that definition if required,
  27. without relying on it's indirect inclusion. compiler.h is then included
  28. indirectly, via stddef.h.
  29. Fixes: 283d75737837 ("uapi/linux/stddef.h: Provide __always_inline to userspace headers")
  30. Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
  31. ---
  32. include/uapi/linux/swab.h | 2 +-
  33. 1 file changed, 1 insertion(+), 1 deletion(-)
  34. diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
  35. index 7272f85d6d6a..3736f2fe1541 100644
  36. --- a/include/uapi/linux/swab.h
  37. +++ b/include/uapi/linux/swab.h
  38. @@ -3,7 +3,7 @@
  39. #define _UAPI_LINUX_SWAB_H
  40. #include <linux/types.h>
  41. -#include <linux/compiler.h>
  42. +#include <linux/stddef.h>
  43. #include <asm/bitsperlong.h>
  44. #include <asm/swab.h>
  45. --
  46. 2.27.0