* [PATCH] ALSA: core: avoid -Wempty-body warnings
@ 2021-03-22 10:31 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-03-22 10:31 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai; +Cc: Arnd Bergmann, alsa-devel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building with 'make W=1' shows some warnings about empty function-style
macros:
sound/core/pcm_memory.c: In function 'preallocate_pages':
sound/core/pcm_memory.c:236:49: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
236 | preallocate_info_init(substream);
sound/core/seq_device.c: In function 'snd_seq_device_dev_register':
sound/core/seq_device.c:163:41: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
163 | queue_autoload_drivers();
Change them to empty inline functions, which are more robust here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/core/oss/pcm_oss.c | 8 ++++++--
sound/core/pcm_memory.c | 4 +++-
sound/core/seq_device.c | 15 ++++++++++++---
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 142fc751a847..86c39ee01aaa 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -3069,8 +3069,12 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
}
}
#else /* !CONFIG_SND_VERBOSE_PROCFS */
-#define snd_pcm_oss_proc_init(pcm)
-#define snd_pcm_oss_proc_done(pcm)
+static inline void snd_pcm_oss_proc_init(struct snd_pcm *pcm)
+{
+}
+static inline void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
+{
+}
#endif /* CONFIG_SND_VERBOSE_PROCFS */
/*
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 289dd1fd8fe7..c440f67b34a3 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -210,7 +210,9 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
}
#else /* !CONFIG_SND_VERBOSE_PROCFS */
-#define preallocate_info_init(s)
+static inline void preallocate_info_init(struct snd_pcm_substream *substream)
+{
+}
#endif /* CONFIG_SND_VERBOSE_PROCFS */
/*
diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c
index 7ed13cb32ef8..382275c5b193 100644
--- a/sound/core/seq_device.c
+++ b/sound/core/seq_device.c
@@ -133,10 +133,19 @@ void snd_seq_device_load_drivers(void)
flush_work(&autoload_work);
}
EXPORT_SYMBOL(snd_seq_device_load_drivers);
-#define cancel_autoload_drivers() cancel_work_sync(&autoload_work)
+
+static inline void cancel_autoload_drivers(void)
+{
+ cancel_work_sync(&autoload_work);
+}
#else
-#define queue_autoload_drivers() /* NOP */
-#define cancel_autoload_drivers() /* NOP */
+static inline void queue_autoload_drivers(void)
+{
+}
+
+static inline void cancel_autoload_drivers(void)
+{
+}
#endif
/*
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ALSA: core: avoid -Wempty-body warnings
@ 2021-03-22 10:31 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2021-03-22 10:31 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai; +Cc: alsa-devel, linux-kernel, Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
Building with 'make W=1' shows some warnings about empty function-style
macros:
sound/core/pcm_memory.c: In function 'preallocate_pages':
sound/core/pcm_memory.c:236:49: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
236 | preallocate_info_init(substream);
sound/core/seq_device.c: In function 'snd_seq_device_dev_register':
sound/core/seq_device.c:163:41: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
163 | queue_autoload_drivers();
Change them to empty inline functions, which are more robust here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/core/oss/pcm_oss.c | 8 ++++++--
sound/core/pcm_memory.c | 4 +++-
sound/core/seq_device.c | 15 ++++++++++++---
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 142fc751a847..86c39ee01aaa 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -3069,8 +3069,12 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
}
}
#else /* !CONFIG_SND_VERBOSE_PROCFS */
-#define snd_pcm_oss_proc_init(pcm)
-#define snd_pcm_oss_proc_done(pcm)
+static inline void snd_pcm_oss_proc_init(struct snd_pcm *pcm)
+{
+}
+static inline void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
+{
+}
#endif /* CONFIG_SND_VERBOSE_PROCFS */
/*
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 289dd1fd8fe7..c440f67b34a3 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -210,7 +210,9 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
}
#else /* !CONFIG_SND_VERBOSE_PROCFS */
-#define preallocate_info_init(s)
+static inline void preallocate_info_init(struct snd_pcm_substream *substream)
+{
+}
#endif /* CONFIG_SND_VERBOSE_PROCFS */
/*
diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c
index 7ed13cb32ef8..382275c5b193 100644
--- a/sound/core/seq_device.c
+++ b/sound/core/seq_device.c
@@ -133,10 +133,19 @@ void snd_seq_device_load_drivers(void)
flush_work(&autoload_work);
}
EXPORT_SYMBOL(snd_seq_device_load_drivers);
-#define cancel_autoload_drivers() cancel_work_sync(&autoload_work)
+
+static inline void cancel_autoload_drivers(void)
+{
+ cancel_work_sync(&autoload_work);
+}
#else
-#define queue_autoload_drivers() /* NOP */
-#define cancel_autoload_drivers() /* NOP */
+static inline void queue_autoload_drivers(void)
+{
+}
+
+static inline void cancel_autoload_drivers(void)
+{
+}
#endif
/*
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: core: avoid -Wempty-body warnings
2021-03-22 10:31 ` Arnd Bergmann
@ 2021-03-22 11:26 ` Takashi Iwai
-1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-03-22 11:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jaroslav Kysela, Takashi Iwai, Arnd Bergmann, alsa-devel, linux-kernel
On Mon, 22 Mar 2021 11:31:10 +0100,
Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building with 'make W=1' shows some warnings about empty function-style
> macros:
>
> sound/core/pcm_memory.c: In function 'preallocate_pages':
> sound/core/pcm_memory.c:236:49: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 236 | preallocate_info_init(substream);
>
> sound/core/seq_device.c: In function 'snd_seq_device_dev_register':
> sound/core/seq_device.c:163:41: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 163 | queue_autoload_drivers();
>
> Change them to empty inline functions, which are more robust here.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: core: avoid -Wempty-body warnings
@ 2021-03-22 11:26 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-03-22 11:26 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel, alsa-devel, Takashi Iwai, Arnd Bergmann
On Mon, 22 Mar 2021 11:31:10 +0100,
Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building with 'make W=1' shows some warnings about empty function-style
> macros:
>
> sound/core/pcm_memory.c: In function 'preallocate_pages':
> sound/core/pcm_memory.c:236:49: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 236 | preallocate_info_init(substream);
>
> sound/core/seq_device.c: In function 'snd_seq_device_dev_register':
> sound/core/seq_device.c:163:41: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 163 | queue_autoload_drivers();
>
> Change them to empty inline functions, which are more robust here.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-22 11:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 10:31 [PATCH] ALSA: core: avoid -Wempty-body warnings Arnd Bergmann
2021-03-22 10:31 ` Arnd Bergmann
2021-03-22 11:26 ` Takashi Iwai
2021-03-22 11:26 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.