From: "Geoffrey D. Bennett" <g@b4.vu>
To: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>,
Vladimir Sadovnikov <sadko4u@gmail.com>
Subject: [PATCH 13/14] ALSA: usb-audio: scarlett2: Don't copy struct scarlett2_config
Date: Mon, 21 Jun 2021 02:16:48 +0930 [thread overview]
Message-ID: <20210620164648.GA9231@m.b4.vu> (raw)
scarlett2_usb_set_config() and scarlett2_usb_get_config() were copying
struct scarlett2_config. Use a pointer instead.
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
---
sound/usb/mixer_scarlett_gen2.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index 49c4662531a3..45fd540920b9 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -706,8 +706,8 @@ static int scarlett2_usb_set_config(
struct usb_mixer_interface *mixer,
int config_item_num, int index, int value)
{
- const struct scarlett2_config config_item =
- scarlett2_config_items[config_item_num];
+ const struct scarlett2_config *config_item =
+ &scarlett2_config_items[config_item_num];
struct {
__le32 offset;
__le32 bytes;
@@ -721,17 +721,17 @@ static int scarlett2_usb_set_config(
cancel_delayed_work_sync(&private->work);
/* Send the configuration parameter data */
- req.offset = cpu_to_le32(config_item.offset + index * config_item.size);
- req.bytes = cpu_to_le32(config_item.size);
+ req.offset = cpu_to_le32(config_item->offset + index * config_item->size);
+ req.bytes = cpu_to_le32(config_item->size);
req.value = cpu_to_le32(value);
err = scarlett2_usb(mixer, SCARLETT2_USB_SET_DATA,
- &req, sizeof(u32) * 2 + config_item.size,
+ &req, sizeof(u32) * 2 + config_item->size,
NULL, 0);
if (err < 0)
return err;
/* Activate the change */
- req2 = cpu_to_le32(config_item.activate);
+ req2 = cpu_to_le32(config_item->activate);
err = scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD,
&req2, sizeof(req2), NULL, 0);
if (err < 0)
@@ -764,11 +764,11 @@ static int scarlett2_usb_get_config(
struct usb_mixer_interface *mixer,
int config_item_num, int count, void *buf)
{
- const struct scarlett2_config config_item =
- scarlett2_config_items[config_item_num];
- int size = config_item.size * count;
+ const struct scarlett2_config *config_item =
+ &scarlett2_config_items[config_item_num];
+ int size = config_item->size * count;
- return scarlett2_usb_get(mixer, config_item.offset, buf, size);
+ return scarlett2_usb_get(mixer, config_item->offset, buf, size);
}
/* Send a USB message to get volume status; result placed in *buf */
--
2.31.1
reply other threads:[~2021-06-20 16:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210620164648.GA9231@m.b4.vu \
--to=g@b4.vu \
--cc=alsa-devel@alsa-project.org \
--cc=htl10@users.sourceforge.net \
--cc=sadko4u@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox