Commit aa8c7db4 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Linus Torvalds

kdev_t: always inline major/minor helper functions

Silly GCC doesn't always inline these trivial functions.

Fixes the following warning:

  arch/x86/kernel/sys_ia32.o: warning: objtool: cp_stat64()+0xd8: call to new_encode_dev() with UACCESS enabled

Link: https://lkml.kernel.org/r/984353b44a4484d86ba9f73884b7306232e25e30.1608737428.git.jpoimboe@redhat.comSigned-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>	[build-tested]
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8b0fac44
...@@ -21,61 +21,61 @@ ...@@ -21,61 +21,61 @@
}) })
/* acceptable for old filesystems */ /* acceptable for old filesystems */
static inline bool old_valid_dev(dev_t dev) static __always_inline bool old_valid_dev(dev_t dev)
{ {
return MAJOR(dev) < 256 && MINOR(dev) < 256; return MAJOR(dev) < 256 && MINOR(dev) < 256;
} }
static inline u16 old_encode_dev(dev_t dev) static __always_inline u16 old_encode_dev(dev_t dev)
{ {
return (MAJOR(dev) << 8) | MINOR(dev); return (MAJOR(dev) << 8) | MINOR(dev);
} }
static inline dev_t old_decode_dev(u16 val) static __always_inline dev_t old_decode_dev(u16 val)
{ {
return MKDEV((val >> 8) & 255, val & 255); return MKDEV((val >> 8) & 255, val & 255);
} }
static inline u32 new_encode_dev(dev_t dev) static __always_inline u32 new_encode_dev(dev_t dev)
{ {
unsigned major = MAJOR(dev); unsigned major = MAJOR(dev);
unsigned minor = MINOR(dev); unsigned minor = MINOR(dev);
return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12);
} }
static inline dev_t new_decode_dev(u32 dev) static __always_inline dev_t new_decode_dev(u32 dev)
{ {
unsigned major = (dev & 0xfff00) >> 8; unsigned major = (dev & 0xfff00) >> 8;
unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00);
return MKDEV(major, minor); return MKDEV(major, minor);
} }
static inline u64 huge_encode_dev(dev_t dev) static __always_inline u64 huge_encode_dev(dev_t dev)
{ {
return new_encode_dev(dev); return new_encode_dev(dev);
} }
static inline dev_t huge_decode_dev(u64 dev) static __always_inline dev_t huge_decode_dev(u64 dev)
{ {
return new_decode_dev(dev); return new_decode_dev(dev);
} }
static inline int sysv_valid_dev(dev_t dev) static __always_inline int sysv_valid_dev(dev_t dev)
{ {
return MAJOR(dev) < (1<<14) && MINOR(dev) < (1<<18); return MAJOR(dev) < (1<<14) && MINOR(dev) < (1<<18);
} }
static inline u32 sysv_encode_dev(dev_t dev) static __always_inline u32 sysv_encode_dev(dev_t dev)
{ {
return MINOR(dev) | (MAJOR(dev) << 18); return MINOR(dev) | (MAJOR(dev) << 18);
} }
static inline unsigned sysv_major(u32 dev) static __always_inline unsigned sysv_major(u32 dev)
{ {
return (dev >> 18) & 0x3fff; return (dev >> 18) & 0x3fff;
} }
static inline unsigned sysv_minor(u32 dev) static __always_inline unsigned sysv_minor(u32 dev)
{ {
return dev & 0x3ffff; return dev & 0x3ffff;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment