Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

freezer: convert freezable helpers to static inline where possible

Some of the freezable helpers have to be macros because their
condition argument needs to get evaluated every time through
the wait loop. Convert the others to static inline to make
future changes easier.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Colin Cross and committed by
Rafael J. Wysocki
8ee492d6 b0123586

+29 -29
+29 -29
include/linux/freezer.h
··· 159 159 } 160 160 161 161 /* 162 - * These macros are intended to be used whenever you want allow a sleeping 162 + * These functions are intended to be used whenever you want allow a sleeping 163 163 * task to be frozen. Note that neither return any clear indication of 164 164 * whether a freeze event happened while in this function. 165 165 */ 166 166 167 167 /* Like schedule(), but should not block the freezer. */ 168 - #define freezable_schedule() \ 169 - ({ \ 170 - freezer_do_not_count(); \ 171 - schedule(); \ 172 - freezer_count(); \ 173 - }) 168 + static inline void freezable_schedule(void) 169 + { 170 + freezer_do_not_count(); 171 + schedule(); 172 + freezer_count(); 173 + } 174 174 175 175 /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ 176 - #define freezable_schedule_unsafe() \ 177 - ({ \ 178 - freezer_do_not_count(); \ 179 - schedule(); \ 180 - freezer_count_unsafe(); \ 181 - }) 176 + static inline void freezable_schedule_unsafe(void) 177 + { 178 + freezer_do_not_count(); 179 + schedule(); 180 + freezer_count_unsafe(); 181 + } 182 182 183 183 /* Like schedule_timeout_killable(), but should not block the freezer. */ 184 - #define freezable_schedule_timeout_killable(timeout) \ 185 - ({ \ 186 - long __retval; \ 187 - freezer_do_not_count(); \ 188 - __retval = schedule_timeout_killable(timeout); \ 189 - freezer_count(); \ 190 - __retval; \ 191 - }) 184 + static inline long freezable_schedule_timeout_killable(long timeout) 185 + { 186 + long __retval; 187 + freezer_do_not_count(); 188 + __retval = schedule_timeout_killable(timeout); 189 + freezer_count(); 190 + return __retval; 191 + } 192 192 193 193 /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ 194 - #define freezable_schedule_timeout_killable_unsafe(timeout) \ 195 - ({ \ 196 - long __retval; \ 197 - freezer_do_not_count(); \ 198 - __retval = schedule_timeout_killable(timeout); \ 199 - freezer_count_unsafe(); \ 200 - __retval; \ 201 - }) 194 + static inline long freezable_schedule_timeout_killable_unsafe(long timeout) 195 + { 196 + long __retval; 197 + freezer_do_not_count(); 198 + __retval = schedule_timeout_killable(timeout); 199 + freezer_count_unsafe(); 200 + return __retval; 201 + } 202 202 203 203 /* 204 204 * Freezer-friendly wrappers around wait_event_interruptible(),