From: Thorsten Blum <blum@kernel.org>
To: "Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Cássio Gabriel" <cassiogabrielcontato@gmail.com>,
"Cen Zhang" <zzzccc427@gmail.com>,
"Will Porter" <mrwillporter@gmail.com>
Cc: Thorsten Blum <blum@kernel.org>, Takashi Iwai <tiwai@suse.de>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] ALSA: usb-audio: Simplify usb_audio_make_shortname()
Date: Sun, 18 Oct 2026 14:41:54 +0200 [thread overview]
Message-ID: <20261018124155.2081-3-blum@kernel.org> (raw)
Copy the preset and quirk product names directly and remove the local
char s pointer. Return after trimming the device product name and use
the USB device ID as a fallback.
No functional change.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
sound/usb/card.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 9307da95efbe..8a62e8e1c6fc 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -618,30 +618,24 @@ static void usb_audio_make_shortname(struct usb_device *dev,
{
struct snd_card *card = chip->card;
const struct usb_audio_device_name *preset;
- const char *s = NULL;
+ *card->shortname = 0;
preset = lookup_device_name(chip->usb_id);
if (preset && preset->product_name)
- s = preset->product_name;
+ strscpy(card->shortname, preset->product_name);
else if (quirk && quirk->product_name)
- s = quirk->product_name;
- if (s && *s) {
- strscpy(card->shortname, s, sizeof(card->shortname));
+ strscpy(card->shortname, quirk->product_name);
+ if (*card->shortname)
return;
- }
- /* retrieve the device string as shortname */
if (dev->product && *dev->product) {
strscpy(card->shortname, dev->product);
- } else {
- /* no name available from anywhere, so use ID */
- scnprintf(card->shortname, sizeof(card->shortname),
- "USB Device %#04x:%#04x",
- USB_ID_VENDOR(chip->usb_id),
- USB_ID_PRODUCT(chip->usb_id));
+ strim(card->shortname);
+ return;
}
- strim(card->shortname);
+ scnprintf(card->shortname, sizeof(card->shortname), "USB Device %#04x:%#04x",
+ USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id));
}
static void usb_audio_make_longname(struct usb_device *dev,
next reply other threads:[~2026-10-18 12:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 12:41 Thorsten Blum [this message]
2026-10-18 12:41 ` [PATCH 2/2] ALSA: usb-audio: Simplify usb_audio_make_longname() Thorsten Blum
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=20261018124155.2081-3-blum@kernel.org \
--to=blum@kernel.org \
--cc=cassiogabrielcontato@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mrwillporter@gmail.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=zzzccc427@gmail.com \
/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
all inboxes | Powered by JetHome®