diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bitmap.h | 8 | ||||
| -rw-r--r-- | include/linux/bitops.h | 4 | ||||
| -rw-r--r-- | include/linux/fs.h | 8 | ||||
| -rw-r--r-- | include/linux/kconfig.h | 15 | ||||
| -rw-r--r-- | include/linux/kernel.h | 12 | ||||
| -rw-r--r-- | include/linux/mfd/samsung/rtc.h | 2 | ||||
| -rw-r--r-- | include/linux/mm_types.h | 2 | ||||
| -rw-r--r-- | include/linux/sysctl.h | 3 | ||||
| -rw-r--r-- | include/linux/util_macros.h | 40 |
9 files changed, 79 insertions, 15 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index be4fa5ddf36c..ea17cca9e685 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
| @@ -283,16 +283,16 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) | |||
| 283 | { | 283 | { |
| 284 | if (small_const_nbits(nbits)) | 284 | if (small_const_nbits(nbits)) |
| 285 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); | 285 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
| 286 | else | 286 | |
| 287 | return __bitmap_empty(src, nbits); | 287 | return find_first_bit(src, nbits) == nbits; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) | 290 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) |
| 291 | { | 291 | { |
| 292 | if (small_const_nbits(nbits)) | 292 | if (small_const_nbits(nbits)) |
| 293 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); | 293 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
| 294 | else | 294 | |
| 295 | return __bitmap_full(src, nbits); | 295 | return find_first_zero_bit(src, nbits) == nbits; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) | 298 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 5d858e02997f..297f5bda4fdf 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -218,9 +218,9 @@ static inline unsigned long __ffs64(u64 word) | |||
| 218 | /** | 218 | /** |
| 219 | * find_last_bit - find the last set bit in a memory region | 219 | * find_last_bit - find the last set bit in a memory region |
| 220 | * @addr: The address to start the search at | 220 | * @addr: The address to start the search at |
| 221 | * @size: The maximum size to search | 221 | * @size: The number of bits to search |
| 222 | * | 222 | * |
| 223 | * Returns the bit number of the first set bit, or size. | 223 | * Returns the bit number of the last set bit, or size. |
| 224 | */ | 224 | */ |
| 225 | extern unsigned long find_last_bit(const unsigned long *addr, | 225 | extern unsigned long find_last_bit(const unsigned long *addr, |
| 226 | unsigned long size); | 226 | unsigned long size); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index f4d63544a791..c7496f263860 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -875,6 +875,7 @@ static inline struct file *get_file(struct file *f) | |||
| 875 | atomic_long_inc(&f->f_count); | 875 | atomic_long_inc(&f->f_count); |
| 876 | return f; | 876 | return f; |
| 877 | } | 877 | } |
| 878 | #define get_file_rcu(x) atomic_long_inc_not_zero(&(x)->f_count) | ||
| 878 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 879 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
| 879 | #define file_count(x) atomic_long_read(&(x)->f_count) | 880 | #define file_count(x) atomic_long_read(&(x)->f_count) |
| 880 | 881 | ||
| @@ -1046,6 +1047,9 @@ extern void lease_get_mtime(struct inode *, struct timespec *time); | |||
| 1046 | extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); | 1047 | extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); |
| 1047 | extern int vfs_setlease(struct file *, long, struct file_lock **, void **); | 1048 | extern int vfs_setlease(struct file *, long, struct file_lock **, void **); |
| 1048 | extern int lease_modify(struct file_lock *, int, struct list_head *); | 1049 | extern int lease_modify(struct file_lock *, int, struct list_head *); |
| 1050 | struct files_struct; | ||
| 1051 | extern void show_fd_locks(struct seq_file *f, | ||
| 1052 | struct file *filp, struct files_struct *files); | ||
| 1049 | #else /* !CONFIG_FILE_LOCKING */ | 1053 | #else /* !CONFIG_FILE_LOCKING */ |
| 1050 | static inline int fcntl_getlk(struct file *file, unsigned int cmd, | 1054 | static inline int fcntl_getlk(struct file *file, unsigned int cmd, |
| 1051 | struct flock __user *user) | 1055 | struct flock __user *user) |
| @@ -1182,6 +1186,10 @@ static inline int lease_modify(struct file_lock *fl, int arg, | |||
| 1182 | { | 1186 | { |
| 1183 | return -EINVAL; | 1187 | return -EINVAL; |
| 1184 | } | 1188 | } |
| 1189 | |||
| 1190 | struct files_struct; | ||
| 1191 | static inline void show_fd_locks(struct seq_file *f, | ||
| 1192 | struct file *filp, struct files_struct *files) {} | ||
| 1185 | #endif /* !CONFIG_FILE_LOCKING */ | 1193 | #endif /* !CONFIG_FILE_LOCKING */ |
| 1186 | 1194 | ||
| 1187 | 1195 | ||
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index be342b94c640..63ca8dacec59 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h | |||
| @@ -23,14 +23,6 @@ | |||
| 23 | #define ___config_enabled(__ignored, val, ...) val | 23 | #define ___config_enabled(__ignored, val, ...) val |
| 24 | 24 | ||
| 25 | /* | 25 | /* |
| 26 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | ||
| 27 | * 0 otherwise. | ||
| 28 | * | ||
| 29 | */ | ||
| 30 | #define IS_ENABLED(option) \ | ||
| 31 | (config_enabled(option) || config_enabled(option##_MODULE)) | ||
| 32 | |||
| 33 | /* | ||
| 34 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 | 26 | * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 |
| 35 | * otherwise. For boolean options, this is equivalent to | 27 | * otherwise. For boolean options, this is equivalent to |
| 36 | * IS_ENABLED(CONFIG_FOO). | 28 | * IS_ENABLED(CONFIG_FOO). |
| @@ -43,4 +35,11 @@ | |||
| 43 | */ | 35 | */ |
| 44 | #define IS_MODULE(option) config_enabled(option##_MODULE) | 36 | #define IS_MODULE(option) config_enabled(option##_MODULE) |
| 45 | 37 | ||
| 38 | /* | ||
| 39 | * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | ||
| 40 | * 0 otherwise. | ||
| 41 | */ | ||
| 42 | #define IS_ENABLED(option) \ | ||
| 43 | (IS_BUILTIN(option) || IS_MODULE(option)) | ||
| 44 | |||
| 46 | #endif /* __LINUX_KCONFIG_H */ | 45 | #endif /* __LINUX_KCONFIG_H */ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d6d630d31ef3..3a5b48e52a9e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -103,6 +103,18 @@ | |||
| 103 | (((__x) - ((__d) / 2)) / (__d)); \ | 103 | (((__x) - ((__d) / 2)) / (__d)); \ |
| 104 | } \ | 104 | } \ |
| 105 | ) | 105 | ) |
| 106 | /* | ||
| 107 | * Same as above but for u64 dividends. divisor must be a 32-bit | ||
| 108 | * number. | ||
| 109 | */ | ||
| 110 | #define DIV_ROUND_CLOSEST_ULL(x, divisor)( \ | ||
| 111 | { \ | ||
| 112 | typeof(divisor) __d = divisor; \ | ||
| 113 | unsigned long long _tmp = (x) + (__d) / 2; \ | ||
| 114 | do_div(_tmp, __d); \ | ||
| 115 | _tmp; \ | ||
| 116 | } \ | ||
| 117 | ) | ||
| 106 | 118 | ||
| 107 | /* | 119 | /* |
| 108 | * Multiplies an integer by a fraction, while avoiding unnecessary | 120 | * Multiplies an integer by a fraction, while avoiding unnecessary |
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h index b6401e7661c7..29c30ac36020 100644 --- a/include/linux/mfd/samsung/rtc.h +++ b/include/linux/mfd/samsung/rtc.h | |||
| @@ -105,6 +105,8 @@ enum s2mps_rtc_reg { | |||
| 105 | #define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT) | 105 | #define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT) |
| 106 | #define S2MPS_RTC_WUDR_SHIFT 4 | 106 | #define S2MPS_RTC_WUDR_SHIFT 4 |
| 107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) | 107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) |
| 108 | #define S2MPS13_RTC_AUDR_SHIFT 1 | ||
| 109 | #define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT) | ||
| 108 | #define S2MPS_RTC_RUDR_SHIFT 0 | 110 | #define S2MPS_RTC_RUDR_SHIFT 0 |
| 109 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) | 111 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) |
| 110 | #define RTC_TCON_SHIFT 1 | 112 | #define RTC_TCON_SHIFT 1 |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 590630eb59ba..8d37e26a1007 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -429,7 +429,7 @@ struct mm_struct { | |||
| 429 | #endif | 429 | #endif |
| 430 | 430 | ||
| 431 | /* store ref to file /proc/<pid>/exe symlink points to */ | 431 | /* store ref to file /proc/<pid>/exe symlink points to */ |
| 432 | struct file *exe_file; | 432 | struct file __rcu *exe_file; |
| 433 | #ifdef CONFIG_MMU_NOTIFIER | 433 | #ifdef CONFIG_MMU_NOTIFIER |
| 434 | struct mmu_notifier_mm *mmu_notifier_mm; | 434 | struct mmu_notifier_mm *mmu_notifier_mm; |
| 435 | #endif | 435 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index b7361f831226..795d5fea5697 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -212,4 +212,7 @@ static inline void setup_sysctl_set(struct ctl_table_set *p, | |||
| 212 | 212 | ||
| 213 | #endif /* CONFIG_SYSCTL */ | 213 | #endif /* CONFIG_SYSCTL */ |
| 214 | 214 | ||
| 215 | int sysctl_max_threads(struct ctl_table *table, int write, | ||
| 216 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
| 217 | |||
| 215 | #endif /* _LINUX_SYSCTL_H */ | 218 | #endif /* _LINUX_SYSCTL_H */ |
diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h new file mode 100644 index 000000000000..d5f4fb69dba3 --- /dev/null +++ b/include/linux/util_macros.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #ifndef _LINUX_HELPER_MACROS_H_ | ||
| 2 | #define _LINUX_HELPER_MACROS_H_ | ||
| 3 | |||
| 4 | #define __find_closest(x, a, as, op) \ | ||
| 5 | ({ \ | ||
| 6 | typeof(as) __fc_i, __fc_as = (as) - 1; \ | ||
| 7 | typeof(x) __fc_x = (x); \ | ||
| 8 | typeof(*a) *__fc_a = (a); \ | ||
| 9 | for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ | ||
| 10 | if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \ | ||
| 11 | __fc_a[__fc_i + 1], 2)) \ | ||
| 12 | break; \ | ||
| 13 | } \ | ||
| 14 | (__fc_i); \ | ||
| 15 | }) | ||
| 16 | |||
| 17 | /** | ||
| 18 | * find_closest - locate the closest element in a sorted array | ||
| 19 | * @x: The reference value. | ||
| 20 | * @a: The array in which to look for the closest element. Must be sorted | ||
| 21 | * in ascending order. | ||
| 22 | * @as: Size of 'a'. | ||
| 23 | * | ||
| 24 | * Returns the index of the element closest to 'x'. | ||
| 25 | */ | ||
| 26 | #define find_closest(x, a, as) __find_closest(x, a, as, <=) | ||
| 27 | |||
| 28 | /** | ||
| 29 | * find_closest_descending - locate the closest element in a sorted array | ||
| 30 | * @x: The reference value. | ||
| 31 | * @a: The array in which to look for the closest element. Must be sorted | ||
| 32 | * in descending order. | ||
| 33 | * @as: Size of 'a'. | ||
| 34 | * | ||
| 35 | * Similar to find_closest() but 'a' is expected to be sorted in descending | ||
| 36 | * order. | ||
| 37 | */ | ||
| 38 | #define find_closest_descending(x, a, as) __find_closest(x, a, as, >=) | ||
| 39 | |||
| 40 | #endif | ||
