diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-01-02 06:24:55 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-02 10:34:25 -0500 |
commit | 38c4718121804317e00a3a905612d17485f754c0 (patch) | |
tree | 08c2e5d3e143a272ae9148efbffe1fc887de0045 | |
parent | 1b16416fda21a8c5704bce809e0d7387bbfb097d (diff) |
ALSA: ymfpci: Remove always NULL parameters
The various PCM allocation functions in this driver take a pointer to a
pointer of a PCM where if this parameter is provided the newly allocated PCM
is stored. All callers pass NULL though, so remove the parameter. This makes
the code a bit shorter and cleaner.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/ymfpci/ymfpci.c | 8 | ||||
-rw-r--r-- | sound/pci/ymfpci/ymfpci.h | 8 | ||||
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 38 |
3 files changed, 14 insertions, 40 deletions
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 47a192369e8f..812e27a1bcbc 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -283,11 +283,11 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
283 | card->shortname, | 283 | card->shortname, |
284 | chip->reg_area_phys, | 284 | chip->reg_area_phys, |
285 | chip->irq); | 285 | chip->irq); |
286 | if ((err = snd_ymfpci_pcm(chip, 0, NULL)) < 0) { | 286 | if ((err = snd_ymfpci_pcm(chip, 0)) < 0) { |
287 | snd_card_free(card); | 287 | snd_card_free(card); |
288 | return err; | 288 | return err; |
289 | } | 289 | } |
290 | if ((err = snd_ymfpci_pcm_spdif(chip, 1, NULL)) < 0) { | 290 | if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) { |
291 | snd_card_free(card); | 291 | snd_card_free(card); |
292 | return err; | 292 | return err; |
293 | } | 293 | } |
@@ -297,12 +297,12 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
297 | return err; | 297 | return err; |
298 | } | 298 | } |
299 | if (chip->ac97->ext_id & AC97_EI_SDAC) { | 299 | if (chip->ac97->ext_id & AC97_EI_SDAC) { |
300 | err = snd_ymfpci_pcm_4ch(chip, 2, NULL); | 300 | err = snd_ymfpci_pcm_4ch(chip, 2); |
301 | if (err < 0) { | 301 | if (err < 0) { |
302 | snd_card_free(card); | 302 | snd_card_free(card); |
303 | return err; | 303 | return err; |
304 | } | 304 | } |
305 | err = snd_ymfpci_pcm2(chip, 3, NULL); | 305 | err = snd_ymfpci_pcm2(chip, 3); |
306 | if (err < 0) { | 306 | if (err < 0) { |
307 | snd_card_free(card); | 307 | snd_card_free(card); |
308 | return err; | 308 | return err; |
diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index 4631a2348915..149d4cb46998 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h | |||
@@ -379,10 +379,10 @@ void snd_ymfpci_free_gameport(struct snd_ymfpci *chip); | |||
379 | 379 | ||
380 | extern const struct dev_pm_ops snd_ymfpci_pm; | 380 | extern const struct dev_pm_ops snd_ymfpci_pm; |
381 | 381 | ||
382 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 382 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device); |
383 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 383 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device); |
384 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 384 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device); |
385 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 385 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device); |
386 | int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch); | 386 | int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch); |
387 | int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); | 387 | int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); |
388 | 388 | ||
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 81c916a5eb96..f5581a97d391 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -1145,13 +1145,11 @@ static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = { | |||
1145 | .pointer = snd_ymfpci_capture_pointer, | 1145 | .pointer = snd_ymfpci_capture_pointer, |
1146 | }; | 1146 | }; |
1147 | 1147 | ||
1148 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | 1148 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device) |
1149 | { | 1149 | { |
1150 | struct snd_pcm *pcm; | 1150 | struct snd_pcm *pcm; |
1151 | int err; | 1151 | int err; |
1152 | 1152 | ||
1153 | if (rpcm) | ||
1154 | *rpcm = NULL; | ||
1155 | if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) | 1153 | if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) |
1156 | return err; | 1154 | return err; |
1157 | pcm->private_data = chip; | 1155 | pcm->private_data = chip; |
@@ -1167,14 +1165,8 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | |||
1167 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1165 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1168 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1166 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1169 | 1167 | ||
1170 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1168 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1171 | snd_pcm_std_chmaps, 2, 0, NULL); | 1169 | snd_pcm_std_chmaps, 2, 0, NULL); |
1172 | if (err < 0) | ||
1173 | return err; | ||
1174 | |||
1175 | if (rpcm) | ||
1176 | *rpcm = pcm; | ||
1177 | return 0; | ||
1178 | } | 1170 | } |
1179 | 1171 | ||
1180 | static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { | 1172 | static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { |
@@ -1188,13 +1180,11 @@ static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { | |||
1188 | .pointer = snd_ymfpci_capture_pointer, | 1180 | .pointer = snd_ymfpci_capture_pointer, |
1189 | }; | 1181 | }; |
1190 | 1182 | ||
1191 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | 1183 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device) |
1192 | { | 1184 | { |
1193 | struct snd_pcm *pcm; | 1185 | struct snd_pcm *pcm; |
1194 | int err; | 1186 | int err; |
1195 | 1187 | ||
1196 | if (rpcm) | ||
1197 | *rpcm = NULL; | ||
1198 | if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) | 1188 | if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) |
1199 | return err; | 1189 | return err; |
1200 | pcm->private_data = chip; | 1190 | pcm->private_data = chip; |
@@ -1210,8 +1200,6 @@ int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | |||
1210 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1200 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1211 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1201 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1212 | 1202 | ||
1213 | if (rpcm) | ||
1214 | *rpcm = pcm; | ||
1215 | return 0; | 1203 | return 0; |
1216 | } | 1204 | } |
1217 | 1205 | ||
@@ -1226,14 +1214,11 @@ static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = { | |||
1226 | .pointer = snd_ymfpci_playback_pointer, | 1214 | .pointer = snd_ymfpci_playback_pointer, |
1227 | }; | 1215 | }; |
1228 | 1216 | ||
1229 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, | 1217 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device) |
1230 | struct snd_pcm **rpcm) | ||
1231 | { | 1218 | { |
1232 | struct snd_pcm *pcm; | 1219 | struct snd_pcm *pcm; |
1233 | int err; | 1220 | int err; |
1234 | 1221 | ||
1235 | if (rpcm) | ||
1236 | *rpcm = NULL; | ||
1237 | if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) | 1222 | if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) |
1238 | return err; | 1223 | return err; |
1239 | pcm->private_data = chip; | 1224 | pcm->private_data = chip; |
@@ -1248,8 +1233,6 @@ int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, | |||
1248 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1233 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1249 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1234 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1250 | 1235 | ||
1251 | if (rpcm) | ||
1252 | *rpcm = pcm; | ||
1253 | return 0; | 1236 | return 0; |
1254 | } | 1237 | } |
1255 | 1238 | ||
@@ -1272,14 +1255,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = { | |||
1272 | { } | 1255 | { } |
1273 | }; | 1256 | }; |
1274 | 1257 | ||
1275 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, | 1258 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device) |
1276 | struct snd_pcm **rpcm) | ||
1277 | { | 1259 | { |
1278 | struct snd_pcm *pcm; | 1260 | struct snd_pcm *pcm; |
1279 | int err; | 1261 | int err; |
1280 | 1262 | ||
1281 | if (rpcm) | ||
1282 | *rpcm = NULL; | ||
1283 | if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) | 1263 | if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) |
1284 | return err; | 1264 | return err; |
1285 | pcm->private_data = chip; | 1265 | pcm->private_data = chip; |
@@ -1294,14 +1274,8 @@ int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, | |||
1294 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1274 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1295 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1275 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1296 | 1276 | ||
1297 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1277 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1298 | surround_map, 2, 0, NULL); | 1278 | surround_map, 2, 0, NULL); |
1299 | if (err < 0) | ||
1300 | return err; | ||
1301 | |||
1302 | if (rpcm) | ||
1303 | *rpcm = pcm; | ||
1304 | return 0; | ||
1305 | } | 1279 | } |
1306 | 1280 | ||
1307 | static int snd_ymfpci_spdif_default_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1281 | static int snd_ymfpci_spdif_default_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |