diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 07:58:09 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 07:58:09 -0700 | 
| commit | 4bbba111d94781d34081c37856bbc5eb33f6c72a (patch) | |
| tree | b4d5358f92e6a0f695f34bef41f3df9158398f21 /sound/usb/card.c | |
| parent | 2130781e2aaab66e5a9f2fdc8af35da0153f405c (diff) | |
| parent | ce24f58a1187ca3058d72c3f897e3b574209ab20 (diff) | |
| download | olio-linux-3.10-4bbba111d94781d34081c37856bbc5eb33f6c72a.tar.xz olio-linux-3.10-4bbba111d94781d34081c37856bbc5eb33f6c72a.zip  | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: HDA: Realtek: Avoid unnecessary volume control index on Surround/Side
  ASoC: Support !REGULATOR build for sgtl5000
  ALSA: hda - VIA: Fix VT1708 can't build up Headphone control issue
  ALSA: hda - VIA: Correct stream names for VT1818S
  ALSA: hda - VIA: Fix codec type for VT1708BCE at the right timing
  ALSA: hda - VIA: Fix invalid A-A path volume adjust issue
  ALSA: hda - VIA: Add missing support for VT1718S in A-A path
  ALSA: hda - VIA: Fix independent headphone no sound issue
  ALSA: hda - VIA: Fix stereo mixer recording no sound issue
  ALSA: hda - Set EAPD for Realtek ALC665
  ALSA: usb - Remove trailing spaces from USB card name strings
  sound: read i_size with i_size_read()
  ASoC: Remove bogus check for register validity in debugfs write
  ASoC: mini2440: Fix uda134x codec problem.
Diffstat (limited to 'sound/usb/card.c')
| -rw-r--r-- | sound/usb/card.c | 22 | 
1 files changed, 18 insertions, 4 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index 40722f8711a..a90662af2d6 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -41,6 +41,7 @@  #include <linux/list.h>  #include <linux/slab.h>  #include <linux/string.h> +#include <linux/ctype.h>  #include <linux/usb.h>  #include <linux/moduleparam.h>  #include <linux/mutex.h> @@ -283,6 +284,15 @@ static int snd_usb_audio_dev_free(struct snd_device *device)  	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. @@ -351,7 +361,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,  	snd_component_add(card, component);  	/* retrieve the device string as shortname */ -	if (quirk && quirk->product_name) { +	if (quirk && quirk->product_name && *quirk->product_name) {  		strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname));  	} else {  		if (!dev->descriptor.iProduct || @@ -363,9 +373,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,  				USB_ID_PRODUCT(chip->usb_id));  		}  	} +	remove_trailing_spaces(card->shortname);  	/* retrieve the vendor and device strings as longname */ -	if (quirk && quirk->vendor_name) { +	if (quirk && quirk->vendor_name && *quirk->vendor_name) {  		len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));  	} else {  		if (dev->descriptor.iManufacturer) @@ -375,8 +386,11 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,  			len = 0;  		/* we don't really care if there isn't any vendor string */  	} -	if (len > 0) -		strlcat(card->longname, " ", sizeof(card->longname)); +	if (len > 0) { +		remove_trailing_spaces(card->longname); +		if (*card->longname) +			strlcat(card->longname, " ", sizeof(card->longname)); +	}  	strlcat(card->longname, card->shortname, sizeof(card->longname));  |