Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp732283imm; Thu, 13 Sep 2018 06:59:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbWPs7g1dYbl1HAgozSRU+ctRFHIhl8W/MzD9T/kk/cDAtxP14MZpFjRZcwtS44YyWXrSzt X-Received: by 2002:a17:902:1c5:: with SMTP id b63-v6mr7580310plb.82.1536847186794; Thu, 13 Sep 2018 06:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847186; cv=none; d=google.com; s=arc-20160816; b=DBE0ZnthrCWf+p4R/Hn3LjtXZ67UZAokbmSHu6hh5rKjWI90QuFR4HxhzOFJDtPAMU I4tQim7503sw/3+D+INyoCI72TSSDnTp6tQnP7Divn+14dQQMzSAwVVv0sEORcYUUbcl XbPizsntNXQiBvDrNGYfZQcqewDQJY6yQCxaMycIH3pDrv2N3yDjKxRM6k+es5Fj31qn ANVekQlMF2nttorufX7rW4FPygXBKa2aV035u2gof+cZee2OTmyQH6plSXBzeqikNS3u RFjbKyvDDwLpmJZwk5PbHWc1DgqfLvHL5A5/yPdAyd9AuHGOIhVuVE2npASSw7SUK0bg rfMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=8gDMLbgGqAfDMCPM8GDaHz5oDwNtbJxtXAAmJJExlTg=; b=AczD0qZzDRRulLyNdnXMog2GVA4Bgqw8/Up3GNmKAbwAoEXwO5G9AyVzSQjkS8eTgX wv4jKigTukgpWqBFHxIZFuQFZT9Xx9icOK/Rh3N4JgqHhQdwtmFcB1KzBfeoenXGov5e XosRO5XcwBOWXOonjhRN7EzyNIs0x3wKRNMPhprFme3rK2aGbHpnQMq3YhIdQV1zYZ4s wcp2kZkBwHecNwem11Tnj1Fur3MLC8y2YHpPGqfUAfTyx8YWqaxzxt6LXTVH5v2NZsp9 3HpNjTQDMkadeW1aabuK2BFwQEwgeue6jsS+UwMXW5kLd3kwOMj4RUDGFUd5UamW8vIf yMVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3-v6si4320696pgk.610.2018.09.13.06.59.32; Thu, 13 Sep 2018 06:59:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731677AbeIMTIm (ORCPT + 99 others); Thu, 13 Sep 2018 15:08:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34774 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729011AbeIMTIm (ORCPT ); Thu, 13 Sep 2018 15:08:42 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 127F5D15; Thu, 13 Sep 2018 13:59:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jens Axboe , Sasha Levin Subject: [PATCH 4.18 119/197] cfq: Suppress compiler warnings about comparisons Date: Thu, 13 Sep 2018 15:31:08 +0200 Message-Id: <20180913131846.308563276@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche [ Upstream commit f7ecb1b109da1006a08d5675debe60990e824432 ] This patch does not change any functionality but avoids that gcc reports the following warnings when building with W=1: block/cfq-iosched.c: In function ?cfq_back_seek_max_store?: block/cfq-iosched.c:4741:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/cfq-iosched.c:4756:1: note: in expansion of macro ?STORE_FUNCTION? STORE_FUNCTION(cfq_back_seek_max_store, &cfqd->cfq_back_max, 0, UINT_MAX, 0); ^~~~~~~~~~~~~~ block/cfq-iosched.c: In function ?cfq_slice_idle_store?: block/cfq-iosched.c:4741:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/cfq-iosched.c:4759:1: note: in expansion of macro ?STORE_FUNCTION? STORE_FUNCTION(cfq_slice_idle_store, &cfqd->cfq_slice_idle, 0, UINT_MAX, 1); ^~~~~~~~~~~~~~ block/cfq-iosched.c: In function ?cfq_group_idle_store?: block/cfq-iosched.c:4741:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/cfq-iosched.c:4760:1: note: in expansion of macro ?STORE_FUNCTION? STORE_FUNCTION(cfq_group_idle_store, &cfqd->cfq_group_idle, 0, UINT_MAX, 1); ^~~~~~~~~~~~~~ block/cfq-iosched.c: In function ?cfq_low_latency_store?: block/cfq-iosched.c:4741:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/cfq-iosched.c:4765:1: note: in expansion of macro ?STORE_FUNCTION? STORE_FUNCTION(cfq_low_latency_store, &cfqd->cfq_latency, 0, 1, 0); ^~~~~~~~~~~~~~ block/cfq-iosched.c: In function ?cfq_slice_idle_us_store?: block/cfq-iosched.c:4775:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/cfq-iosched.c:4782:1: note: in expansion of macro ?USEC_STORE_FUNCTION? USEC_STORE_FUNCTION(cfq_slice_idle_us_store, &cfqd->cfq_slice_idle, 0, UINT_MAX); ^~~~~~~~~~~~~~~~~~~ block/cfq-iosched.c: In function ?cfq_group_idle_us_store?: block/cfq-iosched.c:4775:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (__data < (MIN)) \ ^ block/cfq-iosched.c:4783:1: note: in expansion of macro ?USEC_STORE_FUNCTION? USEC_STORE_FUNCTION(cfq_group_idle_us_store, &cfqd->cfq_group_idle, 0, UINT_MAX); ^~~~~~~~~~~~~~~~~~~ Signed-off-by: Bart Van Assche Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/cfq-iosched.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -4735,12 +4735,13 @@ USEC_SHOW_FUNCTION(cfq_target_latency_us static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \ { \ struct cfq_data *cfqd = e->elevator_data; \ - unsigned int __data; \ + unsigned int __data, __min = (MIN), __max = (MAX); \ + \ cfq_var_store(&__data, (page)); \ - if (__data < (MIN)) \ - __data = (MIN); \ - else if (__data > (MAX)) \ - __data = (MAX); \ + if (__data < __min) \ + __data = __min; \ + else if (__data > __max) \ + __data = __max; \ if (__CONV) \ *(__PTR) = (u64)__data * NSEC_PER_MSEC; \ else \ @@ -4769,12 +4770,13 @@ STORE_FUNCTION(cfq_target_latency_store, static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \ { \ struct cfq_data *cfqd = e->elevator_data; \ - unsigned int __data; \ + unsigned int __data, __min = (MIN), __max = (MAX); \ + \ cfq_var_store(&__data, (page)); \ - if (__data < (MIN)) \ - __data = (MIN); \ - else if (__data > (MAX)) \ - __data = (MAX); \ + if (__data < __min) \ + __data = __min; \ + else if (__data > __max) \ + __data = __max; \ *(__PTR) = (u64)__data * NSEC_PER_USEC; \ return count; \ }