diff mbox

[1/3,v4] ALSA: usb-audio: Move mutex define to more general location

Message ID 1415612437-5557-2-git-send-email-damien@zamaudio.com (mailing list archive)
State New, archived
Headers show

Commit Message

Damien Zammit Nov. 10, 2014, 9:40 a.m. UTC
Allow quirks to lock/unlock the usb audio register mutex by moving
its definition to usbaudio.h

Signed-off-by: Damien Zammit <damien@zamaudio.com>
---
 sound/usb/card.c     | 1 -
 sound/usb/usbaudio.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Clemens Ladisch Nov. 10, 2014, 9:47 a.m. UTC | #1
Damien Zammit wrote:
> Allow quirks to lock/unlock the usb audio register mutex by moving
> its definition to usbaudio.h
>
> +++ b/sound/usb/usbaudio.h
>
> +static DEFINE_MUTEX(register_mutex);

This does not work in a header file.


Regards,
Clemens
Takashi Iwai Nov. 10, 2014, 9:48 a.m. UTC | #2
At Mon, 10 Nov 2014 20:40:35 +1100,
Damien Zammit wrote:
> 
> Allow quirks to lock/unlock the usb audio register mutex by moving
> its definition to usbaudio.h

No, no.  The quirk shouldn't touch it at all.

(And, even if so, you should never define a static mutex in a header
 file!)


Takashi

> 
> Signed-off-by: Damien Zammit <damien@zamaudio.com>
> ---
>  sound/usb/card.c     | 1 -
>  sound/usb/usbaudio.h | 2 ++
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 1fab977..d71025b 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -106,7 +106,6 @@ MODULE_PARM_DESC(autoclock, "Enable auto-clock selection for UAC2 devices (defau
>   * the all interfaces on the same card as one sound device.
>   */
>  
> -static DEFINE_MUTEX(register_mutex);
>  static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
>  static struct usb_driver usb_audio_driver;
>  
> diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
> index 91d0380..229978f 100644
> --- a/sound/usb/usbaudio.h
> +++ b/sound/usb/usbaudio.h
> @@ -115,4 +115,6 @@ struct snd_usb_audio_quirk {
>  #define combine_triple(s)  (combine_word(s) | ((unsigned int)(s)[2] << 16))
>  #define combine_quad(s)    (combine_triple(s) | ((unsigned int)(s)[3] << 24))
>  
> +static DEFINE_MUTEX(register_mutex);
> +
>  #endif /* __USBAUDIO_H */
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 1fab977..d71025b 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -106,7 +106,6 @@  MODULE_PARM_DESC(autoclock, "Enable auto-clock selection for UAC2 devices (defau
  * the all interfaces on the same card as one sound device.
  */
 
-static DEFINE_MUTEX(register_mutex);
 static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
 static struct usb_driver usb_audio_driver;
 
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 91d0380..229978f 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -115,4 +115,6 @@  struct snd_usb_audio_quirk {
 #define combine_triple(s)  (combine_word(s) | ((unsigned int)(s)[2] << 16))
 #define combine_quad(s)    (combine_triple(s) | ((unsigned int)(s)[3] << 24))
 
+static DEFINE_MUTEX(register_mutex);
+
 #endif /* __USBAUDIO_H */