[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c5103e6c-a7b5-d100-c731-7502fd34dbed@suse.com>
Date: Thu, 9 Mar 2023 12:16:59 +0100
From: Oliver Neukum <oneukum@...e.com>
To: Wesley Cheng <quic_wcheng@...cinc.com>,
srinivas.kandagatla@...aro.org, mathias.nyman@...el.com,
perex@...ex.cz, broonie@...nel.org, lgirdwood@...il.com,
krzysztof.kozlowski+dt@...aro.org, agross@...nel.org,
Thinh.Nguyen@...opsys.com, bgoswami@...cinc.com,
andersson@...nel.org, robh+dt@...nel.org,
gregkh@...uxfoundation.org, tiwai@...e.com
Cc: linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-usb@...r.kernel.org, quic_jackp@...cinc.com,
quic_plai@...cinc.com
Subject: Re: [PATCH v3 09/28] sound: usb: card: Introduce USB SND platform op
callbacks
On 09.03.23 00:57, Wesley Cheng wrote:
> Allow for different platforms to be notified on USB SND connect/disconnect
> seqeunces. This allows for platform USB SND modules to properly initialize
> and populate internal structures with references to the USB SND chip
> device.
>
> Signed-off-by: Wesley Cheng <quic_wcheng@...cinc.com>
> ---
> sound/usb/card.c | 36 ++++++++++++++++++++++++++++++++++++
> sound/usb/card.h | 20 ++++++++++++++++++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 26268ffb8274..9bcbaa0c0a55 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -117,6 +117,30 @@ MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no)
> static DEFINE_MUTEX(register_mutex);
> static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
> static struct usb_driver usb_audio_driver;
> +static struct snd_usb_platform_ops *platform_ops;
> +
> +int snd_usb_register_platform_ops(struct snd_usb_platform_ops *ops)
> +{
> + if (platform_ops)
> + return -EEXIST;
> +
> + mutex_lock(®ister_mutex);
> + platform_ops = ops;
> + mutex_unlock(®ister_mutex);
This looks _highly_ suspicious.
Why does the assignment need a lock, but the check does not?
Regards
Oliver
Powered by blists - more mailing lists