Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+4 -4
+1 -1
sound/usb/card.h
··· 90 90 struct snd_urb_ctx urb[MAX_URBS]; 91 91 92 92 struct snd_usb_packet_info { 93 - uint32_t packet_size[MAX_PACKS_HS]; 93 + int packet_size[MAX_PACKS_HS]; 94 94 int packets; 95 95 } next_packet[MAX_URBS]; 96 96 unsigned int next_packet_head; /* ring buffer offset to read */
+3 -3
sound/usb/endpoint.c
··· 462 462 while (ep_state_running(ep)) { 463 463 struct snd_usb_packet_info *packet; 464 464 struct snd_urb_ctx *ctx = NULL; 465 - int err, i; 465 + int err; 466 466 467 467 scoped_guard(spinlock_irqsave, &ep->lock) { 468 468 if ((!implicit_fb || ep->next_packet_queued > 0) && ··· 482 482 /* copy over the length information */ 483 483 if (implicit_fb) { 484 484 ctx->packets = packet->packets; 485 - for (i = 0; i < packet->packets; i++) 486 - ctx->packet_size[i] = packet->packet_size[i]; 485 + memcpy(ctx->packet_size, packet->packet_size, 486 + packet->packets * sizeof(packet->packet_size[0])); 487 487 } 488 488 489 489 /* call the data handler to fill in playback data */