linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] intel_th: msu: fix unused variables
@ 2019-05-07 13:52 Anders Roxell
  2019-05-08  9:10 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Roxell @ 2019-05-07 13:52 UTC (permalink / raw)
  To: alexander.shishkin; +Cc: linux-kernel, Anders Roxell

When building and CONFIG_X86 isn't set the compiler rightly complains
about an unused varable 'i', see the warning below:

../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;
      ^

Rework so that an else part is added where empty functions are created
for set_memory_uc() and set_memory_wb(), in that way we could remove
'#ifdef CONFIG_X86' in function msc_buffer_win_alloc() and
msc_buffer_win_free().

Fixes: ba39bd830605 ("intel_th: msu: Switch over to scatterlist")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/hwtracing/intel_th/msu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 81bb54fa3ce8..5e839d52df87 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -21,6 +21,11 @@
 
 #ifdef CONFIG_X86
 #include <asm/set_memory.h>
+#else
+static void set_memory_uc(unsigned long addr, int numpages)
+{}
+static void set_memory_wb(unsigned long addr, int numpages)
+{}
 #endif
 
 #include "intel_th.h"
@@ -811,11 +816,9 @@ 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
 
 	win->nr_blocks = ret;
 
@@ -870,11 +873,9 @@ 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_win_free(msc, win);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] intel_th: msu: fix unused variables
  2019-05-07 13:52 [PATCH] intel_th: msu: fix unused variables Anders Roxell
@ 2019-05-08  9:10 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-05-08  9:10 UTC (permalink / raw)
  To: Anders Roxell; +Cc: Alexander Shishkin, Linux Kernel Mailing List

On Tue, May 7, 2019 at 3:53 PM Anders Roxell <anders.roxell@linaro.org> wrote:
> When building and CONFIG_X86 isn't set the compiler rightly complains
> about an unused varable 'i', see the warning below:
>
> ../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;
>       ^
>
> Rework so that an else part is added where empty functions are created
> for set_memory_uc() and set_memory_wb(), in that way we could remove
> '#ifdef CONFIG_X86' in function msc_buffer_win_alloc() and
> msc_buffer_win_free().
>
> Fixes: ba39bd830605 ("intel_th: msu: Switch over to scatterlist")
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Thanks for your patch!

> --- a/drivers/hwtracing/intel_th/msu.c
> +++ b/drivers/hwtracing/intel_th/msu.c
> @@ -21,6 +21,11 @@
>
>  #ifdef CONFIG_X86
>  #include <asm/set_memory.h>
> +#else
> +static void set_memory_uc(unsigned long addr, int numpages)

static inline?

> +{}
> +static void set_memory_wb(unsigned long addr, int numpages)

static inline?

> +{}
>  #endif

Regardless:
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-08  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 13:52 [PATCH] intel_th: msu: fix unused variables Anders Roxell
2019-05-08  9:10 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).