diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 10:58:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 10:58:09 -0400 |
commit | 4bbba111d94781d34081c37856bbc5eb33f6c72a (patch) | |
tree | b4d5358f92e6a0f695f34bef41f3df9158398f21 /sound | |
parent | 2130781e2aaab66e5a9f2fdc8af35da0153f405c (diff) | |
parent | ce24f58a1187ca3058d72c3f897e3b574209ab20 (diff) |
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')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 27 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 58 | ||||
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 14 | ||||
-rw-r--r-- | sound/soc/codecs/uda134x.c | 3 | ||||
-rw-r--r-- | sound/soc/samsung/s3c24xx_uda134x.c | 3 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 2 | ||||
-rw-r--r-- | sound/sound_firmware.c | 2 | ||||
-rw-r--r-- | sound/usb/card.c | 22 |
8 files changed, 102 insertions, 29 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index f1a03f223495..5d582de91c19 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1265,6 +1265,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
1265 | case 0x10ec0660: | 1265 | case 0x10ec0660: |
1266 | case 0x10ec0662: | 1266 | case 0x10ec0662: |
1267 | case 0x10ec0663: | 1267 | case 0x10ec0663: |
1268 | case 0x10ec0665: | ||
1268 | case 0x10ec0862: | 1269 | case 0x10ec0862: |
1269 | case 0x10ec0889: | 1270 | case 0x10ec0889: |
1270 | set_eapd(codec, 0x14, 1); | 1271 | set_eapd(codec, 0x14, 1); |
@@ -4240,6 +4241,7 @@ static void alc_power_eapd(struct hda_codec *codec) | |||
4240 | case 0x10ec0660: | 4241 | case 0x10ec0660: |
4241 | case 0x10ec0662: | 4242 | case 0x10ec0662: |
4242 | case 0x10ec0663: | 4243 | case 0x10ec0663: |
4244 | case 0x10ec0665: | ||
4243 | case 0x10ec0862: | 4245 | case 0x10ec0862: |
4244 | case 0x10ec0889: | 4246 | case 0x10ec0889: |
4245 | set_eapd(codec, 0x14, 0); | 4247 | set_eapd(codec, 0x14, 0); |
@@ -16006,9 +16008,12 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
16006 | return err; | 16008 | return err; |
16007 | } else { | 16009 | } else { |
16008 | const char *name = pfx; | 16010 | const char *name = pfx; |
16009 | if (!name) | 16011 | int index = i; |
16012 | if (!name) { | ||
16010 | name = chname[i]; | 16013 | name = chname[i]; |
16011 | err = __alc861_create_out_sw(codec, name, nid, i, 3); | 16014 | index = 0; |
16015 | } | ||
16016 | err = __alc861_create_out_sw(codec, name, nid, index, 3); | ||
16012 | if (err < 0) | 16017 | if (err < 0) |
16013 | return err; | 16018 | return err; |
16014 | } | 16019 | } |
@@ -17159,16 +17164,19 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
17159 | return err; | 17164 | return err; |
17160 | } else { | 17165 | } else { |
17161 | const char *name = pfx; | 17166 | const char *name = pfx; |
17162 | if (!name) | 17167 | int index = i; |
17168 | if (!name) { | ||
17163 | name = chname[i]; | 17169 | name = chname[i]; |
17170 | index = 0; | ||
17171 | } | ||
17164 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | 17172 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
17165 | name, i, | 17173 | name, index, |
17166 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | 17174 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
17167 | HDA_OUTPUT)); | 17175 | HDA_OUTPUT)); |
17168 | if (err < 0) | 17176 | if (err < 0) |
17169 | return err; | 17177 | return err; |
17170 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | 17178 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
17171 | name, i, | 17179 | name, index, |
17172 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | 17180 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
17173 | HDA_INPUT)); | 17181 | HDA_INPUT)); |
17174 | if (err < 0) | 17182 | if (err < 0) |
@@ -19217,12 +19225,15 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
19217 | return err; | 19225 | return err; |
19218 | } else { | 19226 | } else { |
19219 | const char *name = pfx; | 19227 | const char *name = pfx; |
19220 | if (!name) | 19228 | int index = i; |
19229 | if (!name) { | ||
19221 | name = chname[i]; | 19230 | name = chname[i]; |
19222 | err = __alc662_add_vol_ctl(spec, name, nid, i, 3); | 19231 | index = 0; |
19232 | } | ||
19233 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); | ||
19223 | if (err < 0) | 19234 | if (err < 0) |
19224 | return err; | 19235 | return err; |
19225 | err = __alc662_add_sw_ctl(spec, name, mix, i, 3); | 19236 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
19226 | if (err < 0) | 19237 | if (err < 0) |
19227 | return err; | 19238 | return err; |
19228 | } | 19239 | } |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 63b0054200a8..1371b57c11e8 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -159,6 +159,7 @@ struct via_spec { | |||
159 | #endif | 159 | #endif |
160 | }; | 160 | }; |
161 | 161 | ||
162 | static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec); | ||
162 | static struct via_spec * via_new_spec(struct hda_codec *codec) | 163 | static struct via_spec * via_new_spec(struct hda_codec *codec) |
163 | { | 164 | { |
164 | struct via_spec *spec; | 165 | struct via_spec *spec; |
@@ -169,6 +170,10 @@ static struct via_spec * via_new_spec(struct hda_codec *codec) | |||
169 | 170 | ||
170 | codec->spec = spec; | 171 | codec->spec = spec; |
171 | spec->codec = codec; | 172 | spec->codec = codec; |
173 | spec->codec_type = get_codec_type(codec); | ||
174 | /* VT1708BCE & VT1708S are almost same */ | ||
175 | if (spec->codec_type == VT1708BCE) | ||
176 | spec->codec_type = VT1708S; | ||
172 | return spec; | 177 | return spec; |
173 | } | 178 | } |
174 | 179 | ||
@@ -1101,6 +1106,7 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
1101 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 1106 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
1102 | struct via_spec *spec = codec->spec; | 1107 | struct via_spec *spec = codec->spec; |
1103 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 1108 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
1109 | int ret; | ||
1104 | 1110 | ||
1105 | if (!spec->mux_nids[adc_idx]) | 1111 | if (!spec->mux_nids[adc_idx]) |
1106 | return -EINVAL; | 1112 | return -EINVAL; |
@@ -1109,12 +1115,14 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
1109 | AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0) | 1115 | AC_VERB_GET_POWER_STATE, 0x00) != AC_PWRST_D0) |
1110 | snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, | 1116 | snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, |
1111 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); | 1117 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
1112 | /* update jack power state */ | ||
1113 | set_jack_power_state(codec); | ||
1114 | 1118 | ||
1115 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 1119 | ret = snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
1116 | spec->mux_nids[adc_idx], | 1120 | spec->mux_nids[adc_idx], |
1117 | &spec->cur_mux[adc_idx]); | 1121 | &spec->cur_mux[adc_idx]); |
1122 | /* update jack power state */ | ||
1123 | set_jack_power_state(codec); | ||
1124 | |||
1125 | return ret; | ||
1118 | } | 1126 | } |
1119 | 1127 | ||
1120 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, | 1128 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, |
@@ -1188,8 +1196,16 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol, | |||
1188 | /* Get Independent Mode index of headphone pin widget */ | 1196 | /* Get Independent Mode index of headphone pin widget */ |
1189 | spec->hp_independent_mode = spec->hp_independent_mode_index == pinsel | 1197 | spec->hp_independent_mode = spec->hp_independent_mode_index == pinsel |
1190 | ? 1 : 0; | 1198 | ? 1 : 0; |
1191 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, pinsel); | 1199 | if (spec->codec_type == VT1718S) |
1200 | snd_hda_codec_write(codec, nid, 0, | ||
1201 | AC_VERB_SET_CONNECT_SEL, pinsel ? 2 : 0); | ||
1202 | else | ||
1203 | snd_hda_codec_write(codec, nid, 0, | ||
1204 | AC_VERB_SET_CONNECT_SEL, pinsel); | ||
1192 | 1205 | ||
1206 | if (spec->codec_type == VT1812) | ||
1207 | snd_hda_codec_write(codec, 0x35, 0, | ||
1208 | AC_VERB_SET_CONNECT_SEL, pinsel); | ||
1193 | if (spec->multiout.hp_nid && spec->multiout.hp_nid | 1209 | if (spec->multiout.hp_nid && spec->multiout.hp_nid |
1194 | != spec->multiout.dac_nids[HDA_FRONT]) | 1210 | != spec->multiout.dac_nids[HDA_FRONT]) |
1195 | snd_hda_codec_setup_stream(codec, spec->multiout.hp_nid, | 1211 | snd_hda_codec_setup_stream(codec, spec->multiout.hp_nid, |
@@ -1208,6 +1224,8 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol, | |||
1208 | activate_ctl(codec, "Headphone Playback Switch", | 1224 | activate_ctl(codec, "Headphone Playback Switch", |
1209 | spec->hp_independent_mode); | 1225 | spec->hp_independent_mode); |
1210 | } | 1226 | } |
1227 | /* update jack power state */ | ||
1228 | set_jack_power_state(codec); | ||
1211 | return 0; | 1229 | return 0; |
1212 | } | 1230 | } |
1213 | 1231 | ||
@@ -1248,9 +1266,12 @@ static int via_hp_build(struct hda_codec *codec) | |||
1248 | break; | 1266 | break; |
1249 | } | 1267 | } |
1250 | 1268 | ||
1251 | nums = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS); | 1269 | if (spec->codec_type != VT1708) { |
1252 | if (nums <= 1) | 1270 | nums = snd_hda_get_connections(codec, nid, |
1253 | return 0; | 1271 | conn, HDA_MAX_CONNECTIONS); |
1272 | if (nums <= 1) | ||
1273 | return 0; | ||
1274 | } | ||
1254 | 1275 | ||
1255 | knew = via_clone_control(spec, &via_hp_mixer[0]); | 1276 | knew = via_clone_control(spec, &via_hp_mixer[0]); |
1256 | if (knew == NULL) | 1277 | if (knew == NULL) |
@@ -1310,6 +1331,11 @@ static void mute_aa_path(struct hda_codec *codec, int mute) | |||
1310 | start_idx = 2; | 1331 | start_idx = 2; |
1311 | end_idx = 4; | 1332 | end_idx = 4; |
1312 | break; | 1333 | break; |
1334 | case VT1718S: | ||
1335 | nid_mixer = 0x21; | ||
1336 | start_idx = 1; | ||
1337 | end_idx = 3; | ||
1338 | break; | ||
1313 | default: | 1339 | default: |
1314 | return; | 1340 | return; |
1315 | } | 1341 | } |
@@ -2185,10 +2211,6 @@ static int via_init(struct hda_codec *codec) | |||
2185 | for (i = 0; i < spec->num_iverbs; i++) | 2211 | for (i = 0; i < spec->num_iverbs; i++) |
2186 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | 2212 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
2187 | 2213 | ||
2188 | spec->codec_type = get_codec_type(codec); | ||
2189 | if (spec->codec_type == VT1708BCE) | ||
2190 | spec->codec_type = VT1708S; /* VT1708BCE & VT1708S are almost | ||
2191 | same */ | ||
2192 | /* Lydia Add for EAPD enable */ | 2214 | /* Lydia Add for EAPD enable */ |
2193 | if (!spec->dig_in_nid) { /* No Digital In connection */ | 2215 | if (!spec->dig_in_nid) { /* No Digital In connection */ |
2194 | if (spec->dig_in_pin) { | 2216 | if (spec->dig_in_pin) { |
@@ -2438,7 +2460,14 @@ static int vt_auto_create_analog_input_ctls(struct hda_codec *codec, | |||
2438 | else | 2460 | else |
2439 | type_idx = 0; | 2461 | type_idx = 0; |
2440 | label = hda_get_autocfg_input_label(codec, cfg, i); | 2462 | label = hda_get_autocfg_input_label(codec, cfg, i); |
2441 | err = via_new_analog_input(spec, label, type_idx, idx, cap_nid); | 2463 | if (spec->codec_type == VT1708S || |
2464 | spec->codec_type == VT1702 || | ||
2465 | spec->codec_type == VT1716S) | ||
2466 | err = via_new_analog_input(spec, label, type_idx, | ||
2467 | idx+1, cap_nid); | ||
2468 | else | ||
2469 | err = via_new_analog_input(spec, label, type_idx, | ||
2470 | idx, cap_nid); | ||
2442 | if (err < 0) | 2471 | if (err < 0) |
2443 | return err; | 2472 | return err; |
2444 | snd_hda_add_imux_item(imux, label, idx, NULL); | 2473 | snd_hda_add_imux_item(imux, label, idx, NULL); |
@@ -4147,6 +4176,11 @@ static int patch_vt1708S(struct hda_codec *codec) | |||
4147 | spec->stream_name_analog = "VT1708BCE Analog"; | 4176 | spec->stream_name_analog = "VT1708BCE Analog"; |
4148 | spec->stream_name_digital = "VT1708BCE Digital"; | 4177 | spec->stream_name_digital = "VT1708BCE Digital"; |
4149 | } | 4178 | } |
4179 | /* correct names for VT1818S */ | ||
4180 | if (codec->vendor_id == 0x11060440) { | ||
4181 | spec->stream_name_analog = "VT1818S Analog"; | ||
4182 | spec->stream_name_digital = "VT1818S Digital"; | ||
4183 | } | ||
4150 | return 0; | 4184 | return 0; |
4151 | } | 4185 | } |
4152 | 4186 | ||
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 1f7217f703ee..ff29380c9ed3 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -772,6 +772,7 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream, | |||
772 | return 0; | 772 | return 0; |
773 | } | 773 | } |
774 | 774 | ||
775 | #ifdef CONFIG_REGULATOR | ||
775 | static int ldo_regulator_is_enabled(struct regulator_dev *dev) | 776 | static int ldo_regulator_is_enabled(struct regulator_dev *dev) |
776 | { | 777 | { |
777 | struct ldo_regulator *ldo = rdev_get_drvdata(dev); | 778 | struct ldo_regulator *ldo = rdev_get_drvdata(dev); |
@@ -901,6 +902,19 @@ static int ldo_regulator_remove(struct snd_soc_codec *codec) | |||
901 | 902 | ||
902 | return 0; | 903 | return 0; |
903 | } | 904 | } |
905 | #else | ||
906 | static int ldo_regulator_register(struct snd_soc_codec *codec, | ||
907 | struct regulator_init_data *init_data, | ||
908 | int voltage) | ||
909 | { | ||
910 | return -EINVAL; | ||
911 | } | ||
912 | |||
913 | static int ldo_regulator_remove(struct snd_soc_codec *codec) | ||
914 | { | ||
915 | return 0; | ||
916 | } | ||
917 | #endif | ||
904 | 918 | ||
905 | /* | 919 | /* |
906 | * set dac bias | 920 | * set dac bias |
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index e76847a9438b..48ffd406a71d 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -486,7 +486,8 @@ static struct snd_soc_dai_driver uda134x_dai = { | |||
486 | static int uda134x_soc_probe(struct snd_soc_codec *codec) | 486 | static int uda134x_soc_probe(struct snd_soc_codec *codec) |
487 | { | 487 | { |
488 | struct uda134x_priv *uda134x; | 488 | struct uda134x_priv *uda134x; |
489 | struct uda134x_platform_data *pd = dev_get_drvdata(codec->card->dev); | 489 | struct uda134x_platform_data *pd = codec->card->dev->platform_data; |
490 | |||
490 | int ret; | 491 | int ret; |
491 | 492 | ||
492 | printk(KERN_INFO "UDA134X SoC Audio Codec\n"); | 493 | printk(KERN_INFO "UDA134X SoC Audio Codec\n"); |
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c index 3cb700751078..dc9d551f6788 100644 --- a/sound/soc/samsung/s3c24xx_uda134x.c +++ b/sound/soc/samsung/s3c24xx_uda134x.c | |||
@@ -219,7 +219,7 @@ static struct snd_soc_ops s3c24xx_uda134x_ops = { | |||
219 | static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { | 219 | static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { |
220 | .name = "UDA134X", | 220 | .name = "UDA134X", |
221 | .stream_name = "UDA134X", | 221 | .stream_name = "UDA134X", |
222 | .codec_name = "uda134x-hifi", | 222 | .codec_name = "uda134x-codec", |
223 | .codec_dai_name = "uda134x-hifi", | 223 | .codec_dai_name = "uda134x-hifi", |
224 | .cpu_dai_name = "s3c24xx-iis", | 224 | .cpu_dai_name = "s3c24xx-iis", |
225 | .ops = &s3c24xx_uda134x_ops, | 225 | .ops = &s3c24xx_uda134x_ops, |
@@ -314,6 +314,7 @@ static int s3c24xx_uda134x_probe(struct platform_device *pdev) | |||
314 | 314 | ||
315 | platform_set_drvdata(s3c24xx_uda134x_snd_device, | 315 | platform_set_drvdata(s3c24xx_uda134x_snd_device, |
316 | &snd_soc_s3c24xx_uda134x); | 316 | &snd_soc_s3c24xx_uda134x); |
317 | platform_device_add_data(s3c24xx_uda134x_snd_device, &s3c24xx_uda134x, sizeof(s3c24xx_uda134x)); | ||
317 | ret = platform_device_add(s3c24xx_uda134x_snd_device); | 318 | ret = platform_device_add(s3c24xx_uda134x_snd_device); |
318 | if (ret) { | 319 | if (ret) { |
319 | printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n"); | 320 | printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n"); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 17efacdb248a..4dda58926bc5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -259,8 +259,6 @@ static ssize_t codec_reg_write_file(struct file *file, | |||
259 | while (*start == ' ') | 259 | while (*start == ' ') |
260 | start++; | 260 | start++; |
261 | reg = simple_strtoul(start, &start, 16); | 261 | reg = simple_strtoul(start, &start, 16); |
262 | if ((reg >= codec->driver->reg_cache_size) || (reg % step)) | ||
263 | return -EINVAL; | ||
264 | while (*start == ' ') | 262 | while (*start == ' ') |
265 | start++; | 263 | start++; |
266 | if (strict_strtoul(start, 16, &value)) | 264 | if (strict_strtoul(start, 16, &value)) |
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c index 340a0bc5303e..7e96249536b4 100644 --- a/sound/sound_firmware.c +++ b/sound/sound_firmware.c | |||
@@ -19,7 +19,7 @@ static int do_mod_firmware_load(const char *fn, char **fp) | |||
19 | printk(KERN_INFO "Unable to load '%s'.\n", fn); | 19 | printk(KERN_INFO "Unable to load '%s'.\n", fn); |
20 | return 0; | 20 | return 0; |
21 | } | 21 | } |
22 | l = filp->f_path.dentry->d_inode->i_size; | 22 | l = i_size_read(filp->f_path.dentry->d_inode); |
23 | if (l <= 0 || l > 131072) | 23 | if (l <= 0 || l > 131072) |
24 | { | 24 | { |
25 | printk(KERN_INFO "Invalid firmware '%s'\n", fn); | 25 | printk(KERN_INFO "Invalid firmware '%s'\n", fn); |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 40722f8711ad..a90662af2d6b 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/list.h> | 41 | #include <linux/list.h> |
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/string.h> | 43 | #include <linux/string.h> |
44 | #include <linux/ctype.h> | ||
44 | #include <linux/usb.h> | 45 | #include <linux/usb.h> |
45 | #include <linux/moduleparam.h> | 46 | #include <linux/moduleparam.h> |
46 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
@@ -283,6 +284,15 @@ static int snd_usb_audio_dev_free(struct snd_device *device) | |||
283 | return snd_usb_audio_free(chip); | 284 | return snd_usb_audio_free(chip); |
284 | } | 285 | } |
285 | 286 | ||
287 | static void remove_trailing_spaces(char *str) | ||
288 | { | ||
289 | char *p; | ||
290 | |||
291 | if (!*str) | ||
292 | return; | ||
293 | for (p = str + strlen(str) - 1; p >= str && isspace(*p); p--) | ||
294 | *p = 0; | ||
295 | } | ||
286 | 296 | ||
287 | /* | 297 | /* |
288 | * create a chip instance and set its names. | 298 | * create a chip instance and set its names. |
@@ -351,7 +361,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
351 | snd_component_add(card, component); | 361 | snd_component_add(card, component); |
352 | 362 | ||
353 | /* retrieve the device string as shortname */ | 363 | /* retrieve the device string as shortname */ |
354 | if (quirk && quirk->product_name) { | 364 | if (quirk && quirk->product_name && *quirk->product_name) { |
355 | strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname)); | 365 | strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname)); |
356 | } else { | 366 | } else { |
357 | if (!dev->descriptor.iProduct || | 367 | if (!dev->descriptor.iProduct || |
@@ -363,9 +373,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
363 | USB_ID_PRODUCT(chip->usb_id)); | 373 | USB_ID_PRODUCT(chip->usb_id)); |
364 | } | 374 | } |
365 | } | 375 | } |
376 | remove_trailing_spaces(card->shortname); | ||
366 | 377 | ||
367 | /* retrieve the vendor and device strings as longname */ | 378 | /* retrieve the vendor and device strings as longname */ |
368 | if (quirk && quirk->vendor_name) { | 379 | if (quirk && quirk->vendor_name && *quirk->vendor_name) { |
369 | len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname)); | 380 | len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname)); |
370 | } else { | 381 | } else { |
371 | if (dev->descriptor.iManufacturer) | 382 | if (dev->descriptor.iManufacturer) |
@@ -375,8 +386,11 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
375 | len = 0; | 386 | len = 0; |
376 | /* we don't really care if there isn't any vendor string */ | 387 | /* we don't really care if there isn't any vendor string */ |
377 | } | 388 | } |
378 | if (len > 0) | 389 | if (len > 0) { |
379 | strlcat(card->longname, " ", sizeof(card->longname)); | 390 | remove_trailing_spaces(card->longname); |
391 | if (*card->longname) | ||
392 | strlcat(card->longname, " ", sizeof(card->longname)); | ||
393 | } | ||
380 | 394 | ||
381 | strlcat(card->longname, card->shortname, sizeof(card->longname)); | 395 | strlcat(card->longname, card->shortname, sizeof(card->longname)); |
382 | 396 | ||