alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Fabian Lesniak <fabian@lesniak-it.de>
Cc: alsa-devel@alsa-project.org, "Olivia Mackintosh" <livvy@base.nu>,
	"Franti��ek Ku��era" <franta-linux@frantovo.cz>
Subject: Re: [PATCH] ALSA: usb-audio: Add DJM750 to Pioneer mixer quirk
Date: Fri, 29 Jan 2021 16:13:01 +0100	[thread overview]
Message-ID: <s5hmtwrlqte.wl-tiwai@suse.de> (raw)
In-Reply-To: <3031135.XsSY7s2paC@artex>

On Fri, 29 Jan 2021 15:09:11 +0100,
Fabian Lesniak wrote:
> 
> Hi Olivia,
> 
> perfect time for this patch since I'm currently working on similar quirks for
> the DJM-900NXS2 model. I will stick to your method for now. I do have some
> minor comments below.
> 
> In general, I'm wondering whether it is a good way to implement more and more
> Pioneer devices in such a hard coded way. mixer_quirks.c already has >3k LOC,
> and the 900NXS2 support will add at least 100 more if written in the same
> scheme. It may be good to either dynamically create controls depending on the
> model or move pioneer support to an extra file. I'd like to hear what Takashi
> thinks about that.

If we can reduce the code, it's really appreciated.  But I'm afraid
that we won't reduce much for now, and the current amount is still
manageable.  Let's see how much we need for 900NXS2.


thanks,

Takashi


> 
> Cheers
> Fabian
> 
> > +static const struct snd_pioneer_djm_device snd_pioneer_djm_devices[] = {
> > +	{ .name = "DJM-250Mk2", .controls = snd_pioneer_djm250mk2_option_groups, .ncontrols = 7},
> > +	{ .name = "DJM-750", .controls = snd_pioneer_djm750_option_groups, .ncontrols = 5}
> > +};
> These fixed values for ncontrols can easily be overlooked, consider ARRAY_SIZE
> instead. Maybe introduce a macro similar to snd_pioneer_djm_option_group_item.
> 
> > +	const struct snd_pioneer_djm_device device = snd_pioneer_djm_devices[device_idx];
> This makes a local copy, which can be avoided by using a pointer instead:
> const struct snd_pioneer_djm_device *device = &snd_pioneer_djm_devices[device_idx];
> 
> > usb_mixer_interface *mixer, u1 err = snd_usb_ctl_msg(
> >  		mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
> >  		USB_REQ_SET_FEATURE,
> > -		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> > -		snd_pioneer_djm_option_groups[group].options[value].wValue,
> > -		snd_pioneer_djm_option_groups[group].options[value].wIndex,
> > +		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> > device.controls[group].options[value].wValue,
> > +		device.controls[group].options[value].wIndex,
> >  		NULL, 0);
> Rather keep these arguments aligned.
> 
> > -		err = snd_pioneer_djm_controls_create(mixer);
> > +		err = snd_pioneer_djm_controls_create(mixer, 0x00);
> > +		break;
> > +	case USB_ID(0x08e4, 0x017f): /* Pioneer DJ DJM-750 */
> > +		err = snd_pioneer_djm_controls_create(mixer, 0x01);
> >  		break;
> I'd introduce defines for the different models instead of raw values.
> 
> 

  reply	other threads:[~2021-01-29 15:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 16:03 [PATCH] ALSA: usb-audio: Add DJM750 to Pioneer mixer quirk Olivia Mackintosh
2021-01-29 14:09 ` Fabian Lesniak
2021-01-29 15:13   ` Takashi Iwai [this message]
2021-01-29 15:21   ` Olivia Mackintosh
2021-02-01 15:34   ` František Kučera
2021-02-01 21:37     ` Fabian Lesniak
2021-02-02  1:08       ` Olivia Mackintosh
2021-02-04  3:44 ` [PATCH v2 0/2] Add DJM-750 and simplify Olivia Mackintosh
2021-02-04  7:03   ` Takashi Iwai
2021-02-04 19:39     ` [PATCH v3 0/1] " Olivia Mackintosh
2021-02-04 19:39       ` [PATCH v3 1/1] ALSA: usb-audio: Add DJM750 to Pioneer mixer quirk Olivia Mackintosh
2021-02-04 21:33         ` Takashi Iwai
2021-02-05 18:42           ` [PATCH v4 0/1] Add DJM-750 and simplify Olivia Mackintosh
2021-02-05 18:42             ` [PATCH v4 1/1] ALSA: usb-audio: Add DJM750 to Pioneer mixer quirk Olivia Mackintosh
2021-02-05 22:18               ` Takashi Iwai
2021-02-04  3:44 ` [PATCH v2 1/2] " Olivia Mackintosh
2021-02-04  3:44 ` [PATCH v2 2/2] ALSA: usb-audio: Simplify DJM mixer quirks Olivia Mackintosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hmtwrlqte.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=fabian@lesniak-it.de \
    --cc=franta-linux@frantovo.cz \
    --cc=livvy@base.nu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).