diff options
| author | Takashi Iwai <tiwai@suse.de> | 2026-02-16 17:12:06 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-02-16 17:13:35 +0300 |
| commit | 36adb51ac0b19edb32ffeea3fe66b174bad25ead (patch) | |
| tree | 815cc2204673678d7b979eed2f4958a7955849b0 | |
| parent | cf044e44190234a41a788de1cdbb6c21f4a52e1e (diff) | |
| download | linux-36adb51ac0b19edb32ffeea3fe66b174bad25ead.tar.xz | |
ALSA: usb-audio: Optimize the copy of packet sizes for implicit fb handling
We did manual copies over loop for the packet data update of the
implicit feedback, but this can be optimized with a simple memcpy().
Along with it, change the data type of snd_usb_packet_info struct to
align with other (from uint32_t to int).
No functional changes but only code optimizations.
Link: https://patch.msgid.link/20260216141209.1849200-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/usb/card.h | 2 | ||||
| -rw-r--r-- | sound/usb/endpoint.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h index 94404c24d240..e34d92d576a2 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -90,7 +90,7 @@ struct snd_usb_endpoint { struct snd_urb_ctx urb[MAX_URBS]; struct snd_usb_packet_info { - uint32_t packet_size[MAX_PACKS_HS]; + int packet_size[MAX_PACKS_HS]; int packets; } next_packet[MAX_URBS]; unsigned int next_packet_head; /* ring buffer offset to read */ diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 27ade2aa16f5..08cc2ee5707d 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -462,7 +462,7 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep, while (ep_state_running(ep)) { struct snd_usb_packet_info *packet; struct snd_urb_ctx *ctx = NULL; - int err, i; + int err; scoped_guard(spinlock_irqsave, &ep->lock) { if ((!implicit_fb || ep->next_packet_queued > 0) && @@ -482,8 +482,8 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep, /* copy over the length information */ if (implicit_fb) { ctx->packets = packet->packets; - for (i = 0; i < packet->packets; i++) - ctx->packet_size[i] = packet->packet_size[i]; + memcpy(ctx->packet_size, packet->packet_size, + packet->packets * sizeof(packet->packet_size[0])); } /* call the data handler to fill in playback data */ |
