Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2939786ybi; Mon, 10 Jun 2019 01:08:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6gN9VHRtSogLaTxV+6aB91zytMeQl5iM1v0GnrchVt54zO1JOjGsy0cLfmTHIWQwvCnve X-Received: by 2002:a17:902:2ba9:: with SMTP id l38mr63113831plb.300.1560154090827; Mon, 10 Jun 2019 01:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560154090; cv=none; d=google.com; s=arc-20160816; b=bQZD0gGaqI+MGzLPkx63tm4szI0Z5yPl5VeD/9zEi2aRU51FNpUUTGS5COVJv/IzfT HFnLvVfM2CZnGz2wd3Xx3f2Ne7N/8tQviewCg8wuu6ftfpvXYJVXRVcMs8HaSTZUMQLI 4IigqWbX24ASAji6hgJmZ5mG1TeqgTwL0xOrm0ipIKojqyf2+7LsfPPEMKyxiYZ8WajB 1BpQ45XL3sVxQEfnIuP2YlaIEtRvocwCv8nIo+dJNteYXYmkFns0PDWf3cVDNoh/rcCo 5Px3tVwAoNsz1lRZ37J26oiMxpFj/euB9Lvt3mJHxx5xxEDn3yqImZjKT0o9atyi80qb 6pLg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=QLiEGuhD+SbDPXDSbjIVYGSYdXGiRtJ27wd+mmvzQ/4=; b=NZO4Ku8qf/oxPPX7tHDSs2CqQeaL4UjOW4u3ir/FEsE2HRcj2Iofq29ONcOycEnKcX UqopNxH684cTGCDrkss/MSUrAVdXBNX5nBucB0jBZHl2Q28if/MfRdldwUXlOfwXI996 /QWNKn0sSz5IhnJoI0LhBf+F5Cj+KQIB86NuomUBjHiIiezJ7RySZo+5dahsGGuWzl/Z bYvD+9/kCsuGMY2iXKBLuT713khjM5wycLuFkMoVMJ7SWua/F2eap+cap20ODQ0EcYA/ qJhkhxAUa+aEl+rEjCb0upT7Bx9Kqi2XH67JjWMVN9rSjrQtFeNFwf75IuHrT6viFZL1 t74w== 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 o16si7804418pgb.48.2019.06.10.01.07.53; Mon, 10 Jun 2019 01:08:10 -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 S2388301AbfFJIHK (ORCPT + 99 others); Mon, 10 Jun 2019 04:07:10 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:48048 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387781AbfFJIHJ (ORCPT ); Mon, 10 Jun 2019 04:07:09 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0A712111A3903471DAAB; Mon, 10 Jun 2019 16:07:07 +0800 (CST) Received: from [127.0.0.1] (10.74.221.148) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Mon, 10 Jun 2019 16:07:01 +0800 Subject: Re: [PATCH v2] intel_th: msu: Fix unused variable warning on arm64 platform To: References: <1558351973-62643-1-git-send-email-zhangshaokun@hisilicon.com> CC: Alexander Shishkin , "Greg Kroah-Hartman" From: Zhangshaokun Message-ID: Date: Mon, 10 Jun 2019 16:07:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1558351973-62643-1-git-send-email-zhangshaokun@hisilicon.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.221.148] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexander, A gentle ping. On 2019/5/20 19:32, Shaokun Zhang wrote: > 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); > >