diff mbox series

ALSA: usb-audio: Reorder snd_djm_devices entries

Message ID Yaky19EeHagfRSTD@geday (mailing list archive)
State New, archived
Headers show
Series ALSA: usb-audio: Reorder snd_djm_devices entries | expand

Commit Message

Geraldo Nascimento Dec. 2, 2021, 8:55 p.m. UTC
Olivia Mackintosh has posted to alsa-devel reporting that
there's a potential bug that could break mixer quirks for Pioneer
devices introduced by 6d27788160362a7ee6c0d317636fe4b1ddbe59a7
"ALSA: usb-audio: Add support for the Pioneer DJM 750MK2
Mixer/Soundcard".

This happened because the DJM 750 MK2 was added last to the Pioneer DJM
device table index and defined as 0x4 but was added to snd_djm_devices[]
just after the DJM 750 (MK1) entry instead of last, after the DJM 900
NXS2. This escaped review.

Let's reorder the entries in snd_djm_devices[] so they match the Pioneer
DJM device table index #define's.

Reported-by: Olivia Mackintosh <livvy@base.nu>
Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>

Comments

Takashi Iwai Dec. 3, 2021, 1:37 p.m. UTC | #1
On Thu, 02 Dec 2021 21:55:51 +0100,
Geraldo Nascimento wrote:
> 
> Olivia Mackintosh has posted to alsa-devel reporting that
> there's a potential bug that could break mixer quirks for Pioneer
> devices introduced by 6d27788160362a7ee6c0d317636fe4b1ddbe59a7
> "ALSA: usb-audio: Add support for the Pioneer DJM 750MK2
> Mixer/Soundcard".
> 
> This happened because the DJM 750 MK2 was added last to the Pioneer DJM
> device table index and defined as 0x4 but was added to snd_djm_devices[]
> just after the DJM 750 (MK1) entry instead of last, after the DJM 900
> NXS2. This escaped review.
> 
> Let's reorder the entries in snd_djm_devices[] so they match the Pioneer
> DJM device table index #define's.
> 
> Reported-by: Olivia Mackintosh <livvy@base.nu>
> Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>

Thanks the patch.

The code change is OK, but better to use more explicit form in C99
style initialization, something like below.

Could you check whether this works?


thanks,

Takashi

--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -3016,11 +3016,11 @@ static const struct snd_djm_ctl snd_djm_ctls_750mk2[] = {
 
 
 static const struct snd_djm_device snd_djm_devices[] = {
-	SND_DJM_DEVICE(250mk2),
-	SND_DJM_DEVICE(750),
-	SND_DJM_DEVICE(750mk2),
-	SND_DJM_DEVICE(850),
-	SND_DJM_DEVICE(900nxs2)
+	[SND_DJM_250MK2_IDX] =	SND_DJM_DEVICE(250mk2),
+	[SND_DJM_750_IDX] =	SND_DJM_DEVICE(750),
+	[SND_DJM_850_IDX] =	SND_DJM_DEVICE(850),
+	[SND_DJM_900NXS2_IDX] =	SND_DJM_DEVICE(900nxs2),
+	[SND_DJM_750MK2_IDX] =	SND_DJM_DEVICE(750mk2),
 };
Geraldo Nascimento Dec. 3, 2021, 11:58 p.m. UTC | #2
On Fri, Dec 03, 2021 at 02:37:07PM +0100, Takashi Iwai wrote:
> On Thu, 02 Dec 2021 21:55:51 +0100,
> Geraldo Nascimento wrote:
> > 
> > Olivia Mackintosh has posted to alsa-devel reporting that
> > there's a potential bug that could break mixer quirks for Pioneer
> > devices introduced by 6d27788160362a7ee6c0d317636fe4b1ddbe59a7
> > "ALSA: usb-audio: Add support for the Pioneer DJM 750MK2
> > Mixer/Soundcard".
> > 
> > This happened because the DJM 750 MK2 was added last to the Pioneer DJM
> > device table index and defined as 0x4 but was added to snd_djm_devices[]
> > just after the DJM 750 (MK1) entry instead of last, after the DJM 900
> > NXS2. This escaped review.
> > 
> > Let's reorder the entries in snd_djm_devices[] so they match the Pioneer
> > DJM device table index #define's.
> > 
> > Reported-by: Olivia Mackintosh <livvy@base.nu>
> > Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com>
>

Hi, Takashi

> Thanks the patch.

My pleasure.

> 
> The code change is OK, but better to use more explicit form in C99
> style initialization, something like below.

I'll send v2 of the patch with C99-style designators as you have
suggested.

> 
> Could you check whether this works?

That's the problem, I don't own any DJM mixer, someone else needs to
test this.

Thanks,
Geraldo Nascimento

> 
> 
> thanks,
> 
> Takashi
> 
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c
> @@ -3016,11 +3016,11 @@ static const struct snd_djm_ctl snd_djm_ctls_750mk2[] = {
>  
>  
>  static const struct snd_djm_device snd_djm_devices[] = {
> -	SND_DJM_DEVICE(250mk2),
> -	SND_DJM_DEVICE(750),
> -	SND_DJM_DEVICE(750mk2),
> -	SND_DJM_DEVICE(850),
> -	SND_DJM_DEVICE(900nxs2)
> +	[SND_DJM_250MK2_IDX] =	SND_DJM_DEVICE(250mk2),
> +	[SND_DJM_750_IDX] =	SND_DJM_DEVICE(750),
> +	[SND_DJM_850_IDX] =	SND_DJM_DEVICE(850),
> +	[SND_DJM_900NXS2_IDX] =	SND_DJM_DEVICE(900nxs2),
> +	[SND_DJM_750MK2_IDX] =	SND_DJM_DEVICE(750mk2),
>  };
>  
>
diff mbox series

Patch

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index d489c1de3bae..d4cd880b5c6c 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -3018,9 +3018,9 @@  static const struct snd_djm_ctl snd_djm_ctls_750mk2[] = {
 static const struct snd_djm_device snd_djm_devices[] = {
 	SND_DJM_DEVICE(250mk2),
 	SND_DJM_DEVICE(750),
-	SND_DJM_DEVICE(750mk2),
 	SND_DJM_DEVICE(850),
-	SND_DJM_DEVICE(900nxs2)
+	SND_DJM_DEVICE(900nxs2),
+	SND_DJM_DEVICE(750mk2)
 };