Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp76296yba; Mon, 20 May 2019 05:17:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4dzYlrgNVLHP77ABKMlZwFPHrgyc6y3Xla+xv1pKfFgou6Ib/Wc/DWpzl9jKQ9eUS4qWj X-Received: by 2002:a17:902:15c5:: with SMTP id a5mr76262834plh.39.1558354652817; Mon, 20 May 2019 05:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558354652; cv=none; d=google.com; s=arc-20160816; b=Ti0RxjlHSNV34piAHBLZ4wDejfbhxmCgKT7jxSkjAPtIVnEzL9lfaCk6jYBmRGA/sm AFveQ2g9EGXYjdOt8gkM2AO709O0/Stvmk6L/26/QULro2pgBZUby/rEHkINkQHCn4tQ yVyy9ArJD4v5x5J7tQM5YANc+PfPiNkuX43MfFIDCItTPhFKDgrFMgDZ9lIMvMyLMX+8 Mm28H45vIuwez17LLiUtep+VCvohPAVgKSzwEoFwqUipQmLvplCAC24KzBqKfE2VKFDz L1GacE4+A0b/TRV/kzxanJFtJZGrEosslsOfrhcbJAvr28BCjrHzG/sf6qu6x0xveOMs imzA== 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 :message-id:date:subject:cc:to:from; bh=9ZEL2hWu+KLv2KO0ZhpsZGki3MmxdSg6E076HjfJ7+4=; b=LXbMwOXfm61Yi0ZUqLSvDOlfFAUXA/8EzKPoqgRtobi8dumzszuTgIxFV6WpP6ntOd RjkAVknhB/37LxEnliTLBL97ucqqfd5le00PeW1ni1OegSyhZNHDVS62aRzT9ecyFK4k NKGPfRuYucoo5SGJqFfsMJD0ToLcyAyh/tnYCDaLlfC+vnfZxCJa6dyHEeLFe9aFNYMZ Nox0Srfegz37U7z0n9zhUyizEekbemms750H5asUnU/ri4uYiqVKuGD8ql33ZR2svRyK UFw6kQLm4hKU4KU0JxcMM0rPEISr4HugBGIK/iK+wfURkuHqmMlLMkPWTc/lIxvfoOBr Eshw== 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 b8si18142609plb.351.2019.05.20.05.17.17; Mon, 20 May 2019 05:17:32 -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 S1732171AbfETLec (ORCPT + 99 others); Mon, 20 May 2019 07:34:32 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8222 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727626AbfETLeb (ORCPT ); Mon, 20 May 2019 07:34:31 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 711B07BA39250D23F014; Mon, 20 May 2019 19:34:29 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Mon, 20 May 2019 19:34:19 +0800 From: Shaokun Zhang To: CC: Shaokun Zhang , Alexander Shishkin , Greg Kroah-Hartman Subject: [PATCH v2] intel_th: msu: Fix unused variable warning on arm64 platform Date: Mon, 20 May 2019 19:32:53 +0800 Message-ID: <1558351973-62643-1-git-send-email-zhangshaokun@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 on arm64 platform. Cc: Alexander Shishkin Cc: Greg Kroah-Hartman Suggested-by: Alexander Shishkin Signed-off-by: Shaokun Zhang --- drivers/hwtracing/intel_th/msu.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index 81bb54fa3ce8..49e64ca760e6 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -767,6 +767,30 @@ static int __msc_buffer_win_alloc(struct msc_window *win, 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 @@ static int __msc_buffer_win_alloc(struct msc_window *win, 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 msc *msc, unsigned int nr_blocks) 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 msc *msc, struct msc_window *win) */ 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 msc *msc, struct msc_window *win) 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); -- 2.7.4