Skip to content

Commit 1530486

Browse files
KAGA-KOKOaxboe
authored andcommitted
bfq: Suppress compiler warnings about comparisons
This patch avoids that the following warnings are reported when building with W=1: block/bfq-iosched.c: In function 'bfq_back_seek_max_store': block/bfq-iosched.c:4860:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/bfq-iosched.c:4876:1: note: in expansion of macro 'STORE_FUNCTION' STORE_FUNCTION(bfq_back_seek_max_store, &bfqd->bfq_back_max, 0, INT_MAX, 0); ^~~~~~~~~~~~~~ block/bfq-iosched.c: In function 'bfq_slice_idle_store': block/bfq-iosched.c:4860:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/bfq-iosched.c:4879:1: note: in expansion of macro 'STORE_FUNCTION' STORE_FUNCTION(bfq_slice_idle_store, &bfqd->bfq_slice_idle, 0, INT_MAX, 2); ^~~~~~~~~~~~~~ block/bfq-iosched.c: In function 'bfq_slice_idle_us_store': block/bfq-iosched.c:4892:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/bfq-iosched.c:4899:1: note: in expansion of macro 'USEC_STORE_FUNCTION' USEC_STORE_FUNCTION(bfq_slice_idle_us_store, &bfqd->bfq_slice_idle, 0, ^~~~~~~~~~~~~~~~~~~ Acked-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2f79136 commit 1530486

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎block/bfq-iosched.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4851,16 +4851,16 @@ static ssize_t \
48514851
__FUNC(struct elevator_queue *e, const char *page, size_t count) \
48524852
{ \
48534853
struct bfq_data *bfqd = e->elevator_data; \
4854-
unsigned long __data; \
4854+
unsigned long __data, __min = (MIN), __max = (MAX); \
48554855
int ret; \
48564856
\
48574857
ret = bfq_var_store(&__data, (page)); \
48584858
if (ret) \
48594859
return ret; \
4860-
if (__data < (MIN)) \
4861-
__data = (MIN); \
4862-
else if (__data > (MAX)) \
4863-
__data = (MAX); \
4860+
if (__data < __min) \
4861+
__data = __min; \
4862+
else if (__data > __max) \
4863+
__data = __max; \
48644864
if (__CONV == 1) \
48654865
*(__PTR) = msecs_to_jiffies(__data); \
48664866
else if (__CONV == 2) \
@@ -4883,16 +4883,16 @@ STORE_FUNCTION(bfq_slice_idle_store, &bfqd->bfq_slice_idle, 0, INT_MAX, 2);
48834883
static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count)\
48844884
{ \
48854885
struct bfq_data *bfqd = e->elevator_data; \
4886-
unsigned long __data; \
4886+
unsigned long __data, __min = (MIN), __max = (MAX); \
48874887
int ret; \
48884888
\
48894889
ret = bfq_var_store(&__data, (page)); \
48904890
if (ret) \
48914891
return ret; \
4892-
if (__data < (MIN)) \
4893-
__data = (MIN); \
4894-
else if (__data > (MAX)) \
4895-
__data = (MAX); \
4892+
if (__data < __min) \
4893+
__data = __min; \
4894+
else if (__data > __max) \
4895+
__data = __max; \
48964896
*(__PTR) = (u64)__data * NSEC_PER_USEC; \
48974897
return count; \
48984898
}

0 commit comments

Comments
 (0)