[PATCH 03/14] ALSA: usb-audio: scarlett2: Coding style improvements
Geoffrey D. Bennett
g at b4.vu
Sun Jun 20 18:46:28 CEST 2021
Improve alignment and readability with:
- Whitespace fixes
- Add leading zeros to 32-bit flag values
- Rename SCARLETT2_USB_GET_METER_LEVELS to SCARLETT2_USB_GET_METER
- Rename SCARLETT2_PORT_DIRECTIONS to SCARLETT2_PORT_DIRNS
Signed-off-by: Geoffrey D. Bennett <g at b4.vu>
---
sound/usb/mixer_scarlett_gen2.c | 53 +++++++++++++++++----------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index e327f15b89ce..8026847d27b6 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -175,23 +175,23 @@ static const u16 scarlett2_mixer_values[SCARLETT2_MIXER_VALUE_COUNT] = {
* - PCM I/O
*/
enum {
- SCARLETT2_PORT_TYPE_NONE = 0,
+ SCARLETT2_PORT_TYPE_NONE = 0,
SCARLETT2_PORT_TYPE_ANALOGUE = 1,
- SCARLETT2_PORT_TYPE_SPDIF = 2,
- SCARLETT2_PORT_TYPE_ADAT = 3,
- SCARLETT2_PORT_TYPE_MIX = 4,
- SCARLETT2_PORT_TYPE_PCM = 5,
- SCARLETT2_PORT_TYPE_COUNT = 6,
+ SCARLETT2_PORT_TYPE_SPDIF = 2,
+ SCARLETT2_PORT_TYPE_ADAT = 3,
+ SCARLETT2_PORT_TYPE_MIX = 4,
+ SCARLETT2_PORT_TYPE_PCM = 5,
+ SCARLETT2_PORT_TYPE_COUNT = 6,
};
/* Count of total I/O and number available at each sample rate */
enum {
- SCARLETT2_PORT_IN = 0,
- SCARLETT2_PORT_OUT = 1,
- SCARLETT2_PORT_OUT_44 = 2,
- SCARLETT2_PORT_OUT_88 = 3,
+ SCARLETT2_PORT_IN = 0,
+ SCARLETT2_PORT_OUT = 1,
+ SCARLETT2_PORT_OUT_44 = 2,
+ SCARLETT2_PORT_OUT_88 = 3,
SCARLETT2_PORT_OUT_176 = 4,
- SCARLETT2_PORT_DIRECTIONS = 5,
+ SCARLETT2_PORT_DIRNS = 5,
};
/* Hardware buttons on the 18i20 */
@@ -210,7 +210,7 @@ static const char *const scarlett2_button_names[SCARLETT2_BUTTON_MAX] = {
*/
struct scarlett2_ports {
u16 id;
- int num[SCARLETT2_PORT_DIRECTIONS];
+ int num[SCARLETT2_PORT_DIRNS];
const char * const src_descr;
int src_num_offset;
const char * const dst_descr;
@@ -458,22 +458,23 @@ static int scarlett2_get_port_start_num(const struct scarlett2_ports *ports,
#define SCARLETT2_USB_INTERRUPT_INTERVAL 3
/* Interrupt flags for volume and mute/dim button changes */
-#define SCARLETT2_USB_INTERRUPT_VOL_CHANGE 0x400000
-#define SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE 0x200000
+#define SCARLETT2_USB_INTERRUPT_VOL_CHANGE 0x00400000
+#define SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE 0x00200000
/* Commands for sending/receiving requests/responses */
-#define SCARLETT2_USB_VENDOR_SPECIFIC_CMD_REQ 2
+#define SCARLETT2_USB_VENDOR_SPECIFIC_CMD_REQ 2
#define SCARLETT2_USB_VENDOR_SPECIFIC_CMD_RESP 3
-#define SCARLETT2_USB_INIT_SEQ 0x00000000
-#define SCARLETT2_USB_GET_METER_LEVELS 0x00001001
-#define SCARLETT2_USB_GET_MIX 0x00002001
-#define SCARLETT2_USB_SET_MIX 0x00002002
-#define SCARLETT2_USB_GET_MUX 0x00003001
-#define SCARLETT2_USB_SET_MUX 0x00003002
-#define SCARLETT2_USB_GET_DATA 0x00800000
-#define SCARLETT2_USB_SET_DATA 0x00800001
-#define SCARLETT2_USB_DATA_CMD 0x00800002
+#define SCARLETT2_USB_INIT_SEQ 0x00000000
+#define SCARLETT2_USB_GET_METER 0x00001001
+#define SCARLETT2_USB_GET_MIX 0x00002001
+#define SCARLETT2_USB_SET_MIX 0x00002002
+#define SCARLETT2_USB_GET_MUX 0x00003001
+#define SCARLETT2_USB_SET_MUX 0x00003002
+#define SCARLETT2_USB_GET_DATA 0x00800000
+#define SCARLETT2_USB_SET_DATA 0x00800001
+#define SCARLETT2_USB_DATA_CMD 0x00800002
+
#define SCARLETT2_USB_CONFIG_SAVE 6
#define SCARLETT2_USB_VOLUME_STATUS_OFFSET 0x31
@@ -835,7 +836,7 @@ static int scarlett2_usb_get_mix(struct usb_mixer_interface *mixer,
* (values obtained from private->mix[])
*/
static int scarlett2_usb_set_mix(struct usb_mixer_interface *mixer,
- int mix_num)
+ int mix_num)
{
struct scarlett2_mixer_data *private = mixer->private_data;
const struct scarlett2_device_info *info = private->info;
@@ -1056,7 +1057,7 @@ static int scarlett2_usb_get_meter_levels(struct usb_mixer_interface *mixer,
req.pad = 0;
req.num_meters = cpu_to_le16(SCARLETT2_NUM_METERS);
req.magic = cpu_to_le32(SCARLETT2_USB_METER_LEVELS_GET_MAGIC);
- err = scarlett2_usb(mixer, SCARLETT2_USB_GET_METER_LEVELS,
+ err = scarlett2_usb(mixer, SCARLETT2_USB_GET_METER,
&req, sizeof(req), resp, sizeof(resp));
if (err < 0)
return err;
--
2.31.1
More information about the Alsa-devel
mailing list