From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Geoffrey D. Bennett" <g@b4.vu>,
Philippe Perrot <philippe@perrot-net.fr>,
Takashi Iwai <tiwai@suse.de>, Sasha Levin <sashal@kernel.org>,
perex@perex.cz, tiwai@suse.com, peter.ujfalusi@linux.intel.com,
linux-sound@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 07/36] ALSA: scarlett2: Move USB IDs out from device_info struct
Date: Tue, 7 Nov 2023 10:45:49 -0500 [thread overview]
Message-ID: <20231107154654.3765336-7-sashal@kernel.org> (raw)
In-Reply-To: <20231107154654.3765336-1-sashal@kernel.org>
From: "Geoffrey D. Bennett" <g@b4.vu>
[ Upstream commit d98cc489029dba4d99714c2e8ec4f5ba249f6851 ]
By moving the USB IDs from the device_info struct into
scarlett2_devices[], that will allow for devices with different
USB IDs to share the same device_info.
Tested-by: Philippe Perrot <philippe@perrot-net.fr>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/8263368e8d49e6fcebc709817bd82ab79b404468.1694705811.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/mixer_scarlett_gen2.c | 63 ++++++++++++---------------------
1 file changed, 23 insertions(+), 40 deletions(-)
diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index d260be8cb6bc0..606dc6b5cedf9 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -317,8 +317,6 @@ struct scarlett2_mux_entry {
};
struct scarlett2_device_info {
- u32 usb_id; /* USB device identifier */
-
/* Gen 3 devices have an internal MSD mode switch that needs
* to be disabled in order to access the full functionality of
* the device.
@@ -440,8 +438,6 @@ struct scarlett2_data {
/*** Model-specific data ***/
static const struct scarlett2_device_info s6i6_gen2_info = {
- .usb_id = USB_ID(0x1235, 0x8203),
-
.config_set = SCARLETT2_CONFIG_SET_GEN_2,
.level_input_count = 2,
.pad_input_count = 2,
@@ -486,8 +482,6 @@ static const struct scarlett2_device_info s6i6_gen2_info = {
};
static const struct scarlett2_device_info s18i8_gen2_info = {
- .usb_id = USB_ID(0x1235, 0x8204),
-
.config_set = SCARLETT2_CONFIG_SET_GEN_2,
.level_input_count = 2,
.pad_input_count = 4,
@@ -535,8 +529,6 @@ static const struct scarlett2_device_info s18i8_gen2_info = {
};
static const struct scarlett2_device_info s18i20_gen2_info = {
- .usb_id = USB_ID(0x1235, 0x8201),
-
.config_set = SCARLETT2_CONFIG_SET_GEN_2,
.line_out_hw_vol = 1,
@@ -589,8 +581,6 @@ static const struct scarlett2_device_info s18i20_gen2_info = {
};
static const struct scarlett2_device_info solo_gen3_info = {
- .usb_id = USB_ID(0x1235, 0x8211),
-
.has_msd_mode = 1,
.config_set = SCARLETT2_CONFIG_SET_NO_MIXER,
.level_input_count = 1,
@@ -602,8 +592,6 @@ static const struct scarlett2_device_info solo_gen3_info = {
};
static const struct scarlett2_device_info s2i2_gen3_info = {
- .usb_id = USB_ID(0x1235, 0x8210),
-
.has_msd_mode = 1,
.config_set = SCARLETT2_CONFIG_SET_NO_MIXER,
.level_input_count = 2,
@@ -614,8 +602,6 @@ static const struct scarlett2_device_info s2i2_gen3_info = {
};
static const struct scarlett2_device_info s4i4_gen3_info = {
- .usb_id = USB_ID(0x1235, 0x8212),
-
.has_msd_mode = 1,
.config_set = SCARLETT2_CONFIG_SET_GEN_3,
.level_input_count = 2,
@@ -660,8 +646,6 @@ static const struct scarlett2_device_info s4i4_gen3_info = {
};
static const struct scarlett2_device_info s8i6_gen3_info = {
- .usb_id = USB_ID(0x1235, 0x8213),
-
.has_msd_mode = 1,
.config_set = SCARLETT2_CONFIG_SET_GEN_3,
.level_input_count = 2,
@@ -713,8 +697,6 @@ static const struct scarlett2_device_info s8i6_gen3_info = {
};
static const struct scarlett2_device_info s18i8_gen3_info = {
- .usb_id = USB_ID(0x1235, 0x8214),
-
.has_msd_mode = 1,
.config_set = SCARLETT2_CONFIG_SET_GEN_3,
.line_out_hw_vol = 1,
@@ -783,8 +765,6 @@ static const struct scarlett2_device_info s18i8_gen3_info = {
};
static const struct scarlett2_device_info s18i20_gen3_info = {
- .usb_id = USB_ID(0x1235, 0x8215),
-
.has_msd_mode = 1,
.config_set = SCARLETT2_CONFIG_SET_GEN_3,
.line_out_hw_vol = 1,
@@ -848,8 +828,6 @@ static const struct scarlett2_device_info s18i20_gen3_info = {
};
static const struct scarlett2_device_info clarett_8pre_info = {
- .usb_id = USB_ID(0x1235, 0x820c),
-
.config_set = SCARLETT2_CONFIG_SET_CLARETT,
.line_out_hw_vol = 1,
.level_input_count = 2,
@@ -902,25 +880,30 @@ static const struct scarlett2_device_info clarett_8pre_info = {
} },
};
-static const struct scarlett2_device_info *scarlett2_devices[] = {
+struct scarlett2_device_entry {
+ const u32 usb_id; /* USB device identifier */
+ const struct scarlett2_device_info *info;
+};
+
+static const struct scarlett2_device_entry scarlett2_devices[] = {
/* Supported Gen 2 devices */
- &s6i6_gen2_info,
- &s18i8_gen2_info,
- &s18i20_gen2_info,
+ { USB_ID(0x1235, 0x8203), &s6i6_gen2_info },
+ { USB_ID(0x1235, 0x8204), &s18i8_gen2_info },
+ { USB_ID(0x1235, 0x8201), &s18i20_gen2_info },
/* Supported Gen 3 devices */
- &solo_gen3_info,
- &s2i2_gen3_info,
- &s4i4_gen3_info,
- &s8i6_gen3_info,
- &s18i8_gen3_info,
- &s18i20_gen3_info,
+ { USB_ID(0x1235, 0x8211), &solo_gen3_info },
+ { USB_ID(0x1235, 0x8210), &s2i2_gen3_info },
+ { USB_ID(0x1235, 0x8212), &s4i4_gen3_info },
+ { USB_ID(0x1235, 0x8213), &s8i6_gen3_info },
+ { USB_ID(0x1235, 0x8214), &s18i8_gen3_info },
+ { USB_ID(0x1235, 0x8215), &s18i20_gen3_info },
/* Supported Clarett+ devices */
- &clarett_8pre_info,
+ { USB_ID(0x1235, 0x820c), &clarett_8pre_info },
/* End of list */
- NULL
+ { 0, NULL },
};
/* get the starting port index number for a given port type/direction */
@@ -4072,17 +4055,17 @@ static int scarlett2_init_notify(struct usb_mixer_interface *mixer)
static int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer)
{
- const struct scarlett2_device_info **info = scarlett2_devices;
+ const struct scarlett2_device_entry *entry = scarlett2_devices;
int err;
- /* Find device in scarlett2_devices */
- while (*info && (*info)->usb_id != mixer->chip->usb_id)
- info++;
- if (!*info)
+ /* Find entry in scarlett2_devices */
+ while (entry->usb_id && entry->usb_id != mixer->chip->usb_id)
+ entry++;
+ if (!entry->usb_id)
return -EINVAL;
/* Initialise private data */
- err = scarlett2_init_private(mixer, *info);
+ err = scarlett2_init_private(mixer, entry->info);
if (err < 0)
return err;
--
2.42.0
next prev parent reply other threads:[~2023-11-07 15:47 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 15:45 [PATCH AUTOSEL 6.6 01/36] ASoC: mediatek: mt8188-mt6359: support dynamic pinctrl Sasha Levin
2023-11-07 15:45 ` Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 02/36] ASoC: soc-card: Add storage for PCI SSID Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 03/36] ASoC: SOF: Pass PCI SSID to machine driver Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 04/36] ASoC: Intel: sof_sdw: Copy PCI SSID to struct snd_soc_card Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 05/36] ASoC: cs35l56: Use PCI SSID as the firmware UID Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 06/36] crypto: pcrypt - Fix hungtask for PADATA_RESET Sasha Levin
2023-11-07 15:45 ` Sasha Levin [this message]
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 08/36] ASoC: SOF: ipc4: handle EXCEPTION_CAUGHT notification from firmware Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 09/36] RDMA/hfi1: Use FIELD_GET() to extract Link Width Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 10/36] scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 11/36] scsi: ibmvfc: Remove BUG_ON in the case of an empty event pool Sasha Levin
2023-11-07 15:45 ` Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 12/36] fs/jfs: Add check for negative db_l2nbperpage Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 13/36] fs/jfs: Add validity check for db_maxag and db_agpref Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 14/36] jfs: fix array-index-out-of-bounds in dbFindLeaf Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 15/36] jfs: fix array-index-out-of-bounds in diAlloc Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 16/36] HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround Sasha Levin
2023-11-07 15:45 ` [PATCH AUTOSEL 6.6 17/36] ARM: 9320/1: fix stack depot IRQ stack filter Sasha Levin
2023-11-07 15:45 ` Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 18/36] ALSA: hda: Fix possible null-ptr-deref when assigning a stream Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 19/36] gpiolib: of: Add quirk for mt2701-cs42448 ASoC sound Sasha Levin
2023-11-07 15:46 ` Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 20/36] PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 21/36] PCI: mvebu: Use FIELD_PREP() with Link Width Sasha Levin
2023-11-07 15:46 ` Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 22/36] atm: iphase: Do PCI error checks on own line Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 23/36] PCI: Do error check on own line to split long "if" conditions Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 24/36] scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup() Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 25/36] PCI: Use FIELD_GET() to extract Link Width Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 26/36] PCI: Extract ATS disabling to a helper function Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 27/36] PCI: Disable ATS for specific Intel IPU E2000 devices Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 28/36] PCI: dwc: Add dw_pcie_link_set_max_link_width() Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 29/36] PCI: dwc: Add missing PCI_EXP_LNKCAP_MLW handling Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 30/36] misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 31/36] PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 32/36] ASoC: Intel: soc-acpi-cht: Add Lenovo Yoga Tab 3 Pro YT3-X90 quirk Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 33/36] crypto: hisilicon/qm - prevent soft lockup in receive loop Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 34/36] HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 35/36] exfat: support handle zero-size directory Sasha Levin
2023-11-07 15:46 ` [PATCH AUTOSEL 6.6 36/36] mfd: intel-lpss: Add Intel Lunar Lake-M PCI IDs Sasha Levin
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=20231107154654.3765336-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=g@b4.vu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=philippe@perrot-net.fr \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/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 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.