提交 ae366c20 编写于 作者: T Takashi Iwai

ALSA: usb-audio: Use strim() instead of open code

Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 a6cece9d
...@@ -321,16 +321,6 @@ static int snd_usb_audio_dev_free(struct snd_device *device) ...@@ -321,16 +321,6 @@ static int snd_usb_audio_dev_free(struct snd_device *device)
return snd_usb_audio_free(chip); return snd_usb_audio_free(chip);
} }
static void remove_trailing_spaces(char *str)
{
char *p;
if (!*str)
return;
for (p = str + strlen(str) - 1; p >= str && isspace(*p); p--)
*p = 0;
}
/* /*
* create a chip instance and set its names. * create a chip instance and set its names.
*/ */
...@@ -414,7 +404,7 @@ static int snd_usb_audio_create(struct usb_interface *intf, ...@@ -414,7 +404,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
USB_ID_PRODUCT(chip->usb_id)); USB_ID_PRODUCT(chip->usb_id));
} }
} }
remove_trailing_spaces(card->shortname); strim(card->shortname);
/* retrieve the vendor and device strings as longname */ /* retrieve the vendor and device strings as longname */
if (quirk && quirk->vendor_name && *quirk->vendor_name) { if (quirk && quirk->vendor_name && *quirk->vendor_name) {
...@@ -428,7 +418,7 @@ static int snd_usb_audio_create(struct usb_interface *intf, ...@@ -428,7 +418,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,
/* we don't really care if there isn't any vendor string */ /* we don't really care if there isn't any vendor string */
} }
if (len > 0) { if (len > 0) {
remove_trailing_spaces(card->longname); strim(card->longname);
if (*card->longname) if (*card->longname)
strlcat(card->longname, " ", sizeof(card->longname)); strlcat(card->longname, " ", sizeof(card->longname));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册