Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9979662ybi; Wed, 24 Jul 2019 13:27:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNPE+PXOSWq9BrMKgztBGMzfnK9wHA9LrBxy2JAA6gjA3vtFWXV/ADCLy5lrAHhOjtV3CI X-Received: by 2002:a62:6:: with SMTP id 6mr12771552pfa.159.1564000027241; Wed, 24 Jul 2019 13:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000027; cv=none; d=google.com; s=arc-20160816; b=w/PkrYg/yLyXivAlFZwQv8o/yvpjiOYGSwCO6m0ee8IP2QWPWV7MhcJf9Y00sQNSiI xOOS6VHohczne47NZCnroqUvNo1dL0sYgrn8dE6pqQDgWE+Qp/x+2ojA98emuT6jg7mE 7dr4jKwQQwmAK4A3tLV21Iu37h7L+byJYPLr2SYH7/g6wU+eaaSju2rJ8iuPhnZoqSh3 9xYRUglM7cEQ94/NnZsqjRfs7X7+oavuxThZBQBn8JuFYglLiKcE/EFCHzU7TsqqJuiT IQLJLBxcRie6/RtAL07yE8mi2IXOXdL7iWYQcgvfBrGNGqIKfXFFhDpxdysn4+hbCU+I S44g== 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:dkim-signature; bh=FWAmdV/y2qQwrGrkwCdhrAAhok2BWg4TLKDvFvDvOT8=; b=E4TJlFcx5tbCaH/a6/nZVKRCTwktQ5MSHTr4dUV6x/4ra/FyFn54hX7vvujAaEuzJX iw0UMp6w+euZDwY+4wqMeHJPy9PoV3QBYIu82vie2wrBnJ7/Fs83HGM4FwqYvSs/Zesr 9C53WFNRZXx37qRvfHymC7xKxkXg2jf8iZbd2VWcYNjIxK63wZP/nDvkqpGJAPhAeHME GdC9BAG9dR29fyexoX4QBc4wsKFoTtpo+Nm2eVr4RlazdJJR1/hwmUEKZwygmWV5FALl Yqiu2QL0r+Zm3bvbi29qHIhF/iMjEg8pJmJHq1dMGRGK5lQPaYeNPF1pTVroQATx0+vf dhRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Da02D36u; 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 z5si14712587pgj.213.2019.07.24.13.26.52; Wed, 24 Jul 2019 13:27:07 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Da02D36u; 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 S2389909AbfGXTjX (ORCPT + 99 others); Wed, 24 Jul 2019 15:39:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:40316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389890AbfGXTjU (ORCPT ); Wed, 24 Jul 2019 15:39:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7DC9229F3; Wed, 24 Jul 2019 19:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997159; bh=0KgvDU0XhNL47yNK+Ou6qumBEZgbCbUo9x6GoEBJEdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Da02D36uyrubblU+nMM5odvjKx34No97lpjFXXdxhpXtYCHDdYB6Q8tgcqCtvwLPb X5jBGIqV4FQStjOQSWhcJ8aR3jycR1JJzbi/yMCh83mv2TfWEr+M+9UqV0HQueQAxu 2NiFizZVblbzKGaOOvRly+qHJ/DNlysU0deW5RMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Shishkin , Shaokun Zhang , Andy Shevchenko Subject: [PATCH 5.2 339/413] intel_th: msu: Fix unused variable warning on arm64 platform Date: Wed, 24 Jul 2019 21:20:30 +0200 Message-Id: <20190724191800.091699497@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Shaokun Zhang commit b96fb368b08f1637cbf780a6b83e36c2c5ed4ff5 upstream. Commit ba39bd8306057 ("intel_th: msu: Switch over to scatterlist") introduced the following warnings on non-x86 architectures, as a result of reordering the multi mode buffer allocation sequence: > drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_alloc’: > drivers/hwtracing/intel_th/msu.c:783:21: warning: unused variable ‘i’ > [-Wunused-variable] > int ret = -ENOMEM, i; > ^ > drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_free’: > drivers/hwtracing/intel_th/msu.c:863:6: warning: unused variable ‘i’ > [-Wunused-variable] > int i; > ^ Fix this compiler warning by factoring out set_memory sequences and making them x86-only. Suggested-by: Alexander Shishkin Signed-off-by: Shaokun Zhang Fixes: ba39bd8306057 ("intel_th: msu: Switch over to scatterlist") Reviewed-by: Andy Shevchenko Signed-off-by: Alexander Shishkin Cc: stable Link: https://lore.kernel.org/r/20190621161930.60785-2-alexander.shishkin@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/hwtracing/intel_th/msu.c | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -767,6 +767,30 @@ err_nomem: return -ENOMEM; } +#ifdef CONFIG_X86 +static void msc_buffer_set_uc(struct msc_window *win, unsigned int nr_blocks) +{ + int i; + + for (i = 0; i < nr_blocks; i++) + /* Set the page as uncached */ + set_memory_uc((unsigned long)msc_win_block(win, i), 1); +} + +static void msc_buffer_set_wb(struct msc_window *win) +{ + int i; + + for (i = 0; i < win->nr_blocks; i++) + /* Reset the page to write-back */ + set_memory_wb((unsigned long)msc_win_block(win, i), 1); +} +#else /* !X86 */ +static inline void +msc_buffer_set_uc(struct msc_window *win, unsigned int nr_blocks) {} +static inline void msc_buffer_set_wb(struct msc_window *win) {} +#endif /* CONFIG_X86 */ + /** * msc_buffer_win_alloc() - alloc a window for a multiblock mode * @msc: MSC device @@ -780,7 +804,7 @@ err_nomem: static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks) { struct msc_window *win; - int ret = -ENOMEM, i; + int ret = -ENOMEM; if (!nr_blocks) return 0; @@ -811,11 +835,7 @@ static int msc_buffer_win_alloc(struct m if (ret < 0) goto err_nomem; -#ifdef CONFIG_X86 - for (i = 0; i < ret; i++) - /* Set the page as uncached */ - set_memory_uc((unsigned long)msc_win_block(win, i), 1); -#endif + msc_buffer_set_uc(win, ret); win->nr_blocks = ret; @@ -860,8 +880,6 @@ static void __msc_buffer_win_free(struct */ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win) { - int i; - msc->nr_pages -= win->nr_blocks; list_del(&win->entry); @@ -870,11 +888,7 @@ static void msc_buffer_win_free(struct m msc->base_addr = 0; } -#ifdef CONFIG_X86 - for (i = 0; i < win->nr_blocks; i++) - /* Reset the page to write-back */ - set_memory_wb((unsigned long)msc_win_block(win, i), 1); -#endif + msc_buffer_set_wb(win); __msc_buffer_win_free(msc, win);