All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro
@ 2017-05-18 13:35 ` Arnd Bergmann
  0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-05-18 13:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Arnd Bergmann, Jaroslav Kysela, alsa-devel, linux-kernel

Recent compilers produce a harmless warning for the new pcm_call_notify()
macro when CONFIG_SND_PCM_OSS is disabled:

sound/core/pcm.c: In function 'snd_pcm_free':
sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

This turns the empty macro into a 'do {} while (0)' statement to avoid
the warning.

Fixes: 58f30d650c7f ("ALSA: pcm: Build pcm notifier code conditionally")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/core/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 24acbfb5c531..d30dba0ee688 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -894,7 +894,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
 			_notify->call(pcm);				\
 	} while (0)
 #else
-#define pcm_call_notify(pcm, call) /* NOP */
+#define pcm_call_notify(pcm, call) do {} while (0)
 #endif
 
 static int snd_pcm_free(struct snd_pcm *pcm)
-- 
2.9.0

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

* [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro
@ 2017-05-18 13:35 ` Arnd Bergmann
  0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-05-18 13:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, linux-kernel, Arnd Bergmann

Recent compilers produce a harmless warning for the new pcm_call_notify()
macro when CONFIG_SND_PCM_OSS is disabled:

sound/core/pcm.c: In function 'snd_pcm_free':
sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

This turns the empty macro into a 'do {} while (0)' statement to avoid
the warning.

Fixes: 58f30d650c7f ("ALSA: pcm: Build pcm notifier code conditionally")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/core/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 24acbfb5c531..d30dba0ee688 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -894,7 +894,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
 			_notify->call(pcm);				\
 	} while (0)
 #else
-#define pcm_call_notify(pcm, call) /* NOP */
+#define pcm_call_notify(pcm, call) do {} while (0)
 #endif
 
 static int snd_pcm_free(struct snd_pcm *pcm)
-- 
2.9.0

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

* [PATCH 2/2] ALSA: pcm/oss: mark snd_pcm_plug_slave_format arg as const
  2017-05-18 13:35 ` Arnd Bergmann
@ 2017-05-18 13:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-05-18 13:35 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Arnd Bergmann, Jaroslav Kysela, Takashi Sakamoto, alsa-devel,
	linux-kernel

Only one of the two declarations has the const modifier in the
argument list, so we get a warning when CONFIG_SND_PCM_OSS_PLUGINS
is disabled:

sound/core/oss/pcm_oss.c: In function 'snd_pcm_oss_change_params':
sound/core/oss/pcm_oss.c:898:47: error: passing argument 2 of 'snd_pcm_plug_slave_format' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

This makes the two declarations match again.

Fixes: e76bf3c4b4e4 ("ALSA: pcm/oss: refer to parameters instead of copying to reduce usage of kernel stack")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/core/oss/pcm_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
index 38e2c14cb893..73c068abaca5 100644
--- a/sound/core/oss/pcm_plugin.h
+++ b/sound/core/oss/pcm_plugin.h
@@ -172,7 +172,7 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream,
 
 static inline snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t drv_size) { return drv_size; }
 static inline snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t clt_size) { return clt_size; }
-static inline int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) { return format; }
+static inline int snd_pcm_plug_slave_format(int format, const struct snd_mask *format_mask) { return format; }
 
 #endif
 
-- 
2.9.0

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

* [PATCH 2/2] ALSA: pcm/oss: mark snd_pcm_plug_slave_format arg as const
@ 2017-05-18 13:35   ` Arnd Bergmann
  0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-05-18 13:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Takashi Sakamoto, linux-kernel, Arnd Bergmann

Only one of the two declarations has the const modifier in the
argument list, so we get a warning when CONFIG_SND_PCM_OSS_PLUGINS
is disabled:

sound/core/oss/pcm_oss.c: In function 'snd_pcm_oss_change_params':
sound/core/oss/pcm_oss.c:898:47: error: passing argument 2 of 'snd_pcm_plug_slave_format' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

This makes the two declarations match again.

Fixes: e76bf3c4b4e4 ("ALSA: pcm/oss: refer to parameters instead of copying to reduce usage of kernel stack")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/core/oss/pcm_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
index 38e2c14cb893..73c068abaca5 100644
--- a/sound/core/oss/pcm_plugin.h
+++ b/sound/core/oss/pcm_plugin.h
@@ -172,7 +172,7 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream,
 
 static inline snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t drv_size) { return drv_size; }
 static inline snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t clt_size) { return clt_size; }
-static inline int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) { return format; }
+static inline int snd_pcm_plug_slave_format(int format, const struct snd_mask *format_mask) { return format; }
 
 #endif
 
-- 
2.9.0

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

* Re: [PATCH 2/2] ALSA: pcm/oss: mark snd_pcm_plug_slave_format arg as const
  2017-05-18 13:35   ` Arnd Bergmann
  (?)
@ 2017-05-18 14:08   ` Takashi Sakamoto
  -1 siblings, 0 replies; 7+ messages in thread
From: Takashi Sakamoto @ 2017-05-18 14:08 UTC (permalink / raw)
  To: Arnd Bergmann, Takashi Iwai; +Cc: Jaroslav Kysela, alsa-devel, linux-kernel

Hi,

On May 18 2017 22:35, Arnd Bergmann wrote:
> Only one of the two declarations has the const modifier in the
> argument list, so we get a warning when CONFIG_SND_PCM_OSS_PLUGINS
> is disabled:
>
> sound/core/oss/pcm_oss.c: In function 'snd_pcm_oss_change_params':
> sound/core/oss/pcm_oss.c:898:47: error: passing argument 2 of 'snd_pcm_plug_slave_format' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
>
> This makes the two declarations match again.
>
> Fixes: e76bf3c4b4e4 ("ALSA: pcm/oss: refer to parameters instead of copying to reduce usage of kernel stack")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  sound/core/oss/pcm_plugin.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Indeed. I overlooked that it's conditional...

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

> diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
> index 38e2c14cb893..73c068abaca5 100644
> --- a/sound/core/oss/pcm_plugin.h
> +++ b/sound/core/oss/pcm_plugin.h
> @@ -172,7 +172,7 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream,
>
>  static inline snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t drv_size) { return drv_size; }
>  static inline snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t clt_size) { return clt_size; }
> -static inline int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) { return format; }
> +static inline int snd_pcm_plug_slave_format(int format, const struct snd_mask *format_mask) { return format; }
>
>  #endif

Thanks :D

Takashi Sakamoto

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

* Re: [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro
  2017-05-18 13:35 ` Arnd Bergmann
@ 2017-05-18 14:39   ` Takashi Iwai
  -1 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2017-05-18 14:39 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: alsa-devel, Jaroslav Kysela, linux-kernel

On Thu, 18 May 2017 15:35:54 +0200,
Arnd Bergmann wrote:
> 
> Recent compilers produce a harmless warning for the new pcm_call_notify()
> macro when CONFIG_SND_PCM_OSS is disabled:
> 
> sound/core/pcm.c: In function 'snd_pcm_free':
> sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 
> This turns the empty macro into a 'do {} while (0)' statement to avoid
> the warning.
> 
> Fixes: 58f30d650c7f ("ALSA: pcm: Build pcm notifier code conditionally")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks, applied both patches now.


Takashi

> ---
>  sound/core/pcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 24acbfb5c531..d30dba0ee688 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -894,7 +894,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
>  			_notify->call(pcm);				\
>  	} while (0)
>  #else
> -#define pcm_call_notify(pcm, call) /* NOP */
> +#define pcm_call_notify(pcm, call) do {} while (0)
>  #endif
>  
>  static int snd_pcm_free(struct snd_pcm *pcm)
> -- 
> 2.9.0
> 
> 

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

* Re: [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro
@ 2017-05-18 14:39   ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2017-05-18 14:39 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: alsa-devel, linux-kernel

On Thu, 18 May 2017 15:35:54 +0200,
Arnd Bergmann wrote:
> 
> Recent compilers produce a harmless warning for the new pcm_call_notify()
> macro when CONFIG_SND_PCM_OSS is disabled:
> 
> sound/core/pcm.c: In function 'snd_pcm_free':
> sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 
> This turns the empty macro into a 'do {} while (0)' statement to avoid
> the warning.
> 
> Fixes: 58f30d650c7f ("ALSA: pcm: Build pcm notifier code conditionally")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks, applied both patches now.


Takashi

> ---
>  sound/core/pcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 24acbfb5c531..d30dba0ee688 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -894,7 +894,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
>  			_notify->call(pcm);				\
>  	} while (0)
>  #else
> -#define pcm_call_notify(pcm, call) /* NOP */
> +#define pcm_call_notify(pcm, call) do {} while (0)
>  #endif
>  
>  static int snd_pcm_free(struct snd_pcm *pcm)
> -- 
> 2.9.0
> 
> 

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

end of thread, other threads:[~2017-05-18 14:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 13:35 [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro Arnd Bergmann
2017-05-18 13:35 ` Arnd Bergmann
2017-05-18 13:35 ` [PATCH 2/2] ALSA: pcm/oss: mark snd_pcm_plug_slave_format arg as const Arnd Bergmann
2017-05-18 13:35   ` Arnd Bergmann
2017-05-18 14:08   ` Takashi Sakamoto
2017-05-18 14:39 ` [PATCH 1/2] ALSA: pcm: use "do {} while (0)" for empty macro Takashi Iwai
2017-05-18 14:39   ` 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.