include/linux/hugetlb.h: is_file_hugepages() can be boolean
authorYaowei Bai <baiyaowei@cmss.chinamobile.com>
Thu, 14 Jan 2016 23:18:51 +0000 (15:18 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Jan 2016 00:00:49 +0000 (16:00 -0800)
Make is_file_hugepages() return bool to improve readability due to this
particular function only using either one or zero as its return value.

This patch also removed the if condition to make is_file_hugepages
return directly.

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/hugetlb.h

index b0eb06423d5eccba6cb850078af6ffc60d97c382..e76574d8f9b586127f8534d93a7c778bc89e8c0d 100644 (file)
@@ -263,20 +263,18 @@ struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct,
                                struct user_struct **user, int creat_flags,
                                int page_size_log);
 
-static inline int is_file_hugepages(struct file *file)
+static inline bool is_file_hugepages(struct file *file)
 {
        if (file->f_op == &hugetlbfs_file_operations)
-               return 1;
-       if (is_file_shm_hugepages(file))
-               return 1;
+               return true;
 
-       return 0;
+       return is_file_shm_hugepages(file);
 }
 
 
 #else /* !CONFIG_HUGETLBFS */
 
-#define is_file_hugepages(file)                        0
+#define is_file_hugepages(file)                        false
 static inline struct file *
 hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
                struct user_struct **user, int creat_flags,