diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-01-02 06:24:48 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-02 10:32:28 -0500 |
commit | 50b8d94e1819768e8eccae4d24698a17b8940776 (patch) | |
tree | 8908902a53b5eafe5750b99867733a8d9281eb0d | |
parent | 72134c4d9e97bcde376a8746510408da3fe039cc (diff) |
ALSA: ens1370: Remove always NULL parameters
The various PCM and MIDI allocation functions in this driver take a pointer
to a pointer of a PCM/MIDI object where if this parameter is provided the
newly allocated object 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/ens1370.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index d94cb3ca7a64..bb1f4d22df5f 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -1268,14 +1268,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = { | |||
1268 | { } | 1268 | { } |
1269 | }; | 1269 | }; |
1270 | 1270 | ||
1271 | static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device, | 1271 | static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device) |
1272 | struct snd_pcm **rpcm) | ||
1273 | { | 1272 | { |
1274 | struct snd_pcm *pcm; | 1273 | struct snd_pcm *pcm; |
1275 | int err; | 1274 | int err; |
1276 | 1275 | ||
1277 | if (rpcm) | ||
1278 | *rpcm = NULL; | ||
1279 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); | 1276 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); |
1280 | if (err < 0) | 1277 | if (err < 0) |
1281 | return err; | 1278 | return err; |
@@ -1302,22 +1299,14 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device, | |||
1302 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1299 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1303 | snd_pcm_std_chmaps, 2, 0, NULL); | 1300 | snd_pcm_std_chmaps, 2, 0, NULL); |
1304 | #endif | 1301 | #endif |
1305 | if (err < 0) | 1302 | return err; |
1306 | return err; | ||
1307 | |||
1308 | if (rpcm) | ||
1309 | *rpcm = pcm; | ||
1310 | return 0; | ||
1311 | } | 1303 | } |
1312 | 1304 | ||
1313 | static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device, | 1305 | static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device) |
1314 | struct snd_pcm **rpcm) | ||
1315 | { | 1306 | { |
1316 | struct snd_pcm *pcm; | 1307 | struct snd_pcm *pcm; |
1317 | int err; | 1308 | int err; |
1318 | 1309 | ||
1319 | if (rpcm) | ||
1320 | *rpcm = NULL; | ||
1321 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); | 1310 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); |
1322 | if (err < 0) | 1311 | if (err < 0) |
1323 | return err; | 1312 | return err; |
@@ -1342,12 +1331,7 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device, | |||
1342 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1331 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1343 | surround_map, 2, 0, NULL); | 1332 | surround_map, 2, 0, NULL); |
1344 | #endif | 1333 | #endif |
1345 | if (err < 0) | 1334 | return err; |
1346 | return err; | ||
1347 | |||
1348 | if (rpcm) | ||
1349 | *rpcm = pcm; | ||
1350 | return 0; | ||
1351 | } | 1335 | } |
1352 | 1336 | ||
1353 | /* | 1337 | /* |
@@ -2362,14 +2346,11 @@ static struct snd_rawmidi_ops snd_ensoniq_midi_input = | |||
2362 | .trigger = snd_ensoniq_midi_input_trigger, | 2346 | .trigger = snd_ensoniq_midi_input_trigger, |
2363 | }; | 2347 | }; |
2364 | 2348 | ||
2365 | static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device, | 2349 | static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device) |
2366 | struct snd_rawmidi **rrawmidi) | ||
2367 | { | 2350 | { |
2368 | struct snd_rawmidi *rmidi; | 2351 | struct snd_rawmidi *rmidi; |
2369 | int err; | 2352 | int err; |
2370 | 2353 | ||
2371 | if (rrawmidi) | ||
2372 | *rrawmidi = NULL; | ||
2373 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) | 2354 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) |
2374 | return err; | 2355 | return err; |
2375 | strcpy(rmidi->name, CHIP_NAME); | 2356 | strcpy(rmidi->name, CHIP_NAME); |
@@ -2379,8 +2360,6 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device, | |||
2379 | SNDRV_RAWMIDI_INFO_DUPLEX; | 2360 | SNDRV_RAWMIDI_INFO_DUPLEX; |
2380 | rmidi->private_data = ensoniq; | 2361 | rmidi->private_data = ensoniq; |
2381 | ensoniq->rmidi = rmidi; | 2362 | ensoniq->rmidi = rmidi; |
2382 | if (rrawmidi) | ||
2383 | *rrawmidi = rmidi; | ||
2384 | return 0; | 2363 | return 0; |
2385 | } | 2364 | } |
2386 | 2365 | ||
@@ -2462,15 +2441,15 @@ static int snd_audiopci_probe(struct pci_dev *pci, | |||
2462 | return err; | 2441 | return err; |
2463 | } | 2442 | } |
2464 | #endif | 2443 | #endif |
2465 | if ((err = snd_ensoniq_pcm(ensoniq, 0, NULL)) < 0) { | 2444 | if ((err = snd_ensoniq_pcm(ensoniq, 0)) < 0) { |
2466 | snd_card_free(card); | 2445 | snd_card_free(card); |
2467 | return err; | 2446 | return err; |
2468 | } | 2447 | } |
2469 | if ((err = snd_ensoniq_pcm2(ensoniq, 1, NULL)) < 0) { | 2448 | if ((err = snd_ensoniq_pcm2(ensoniq, 1)) < 0) { |
2470 | snd_card_free(card); | 2449 | snd_card_free(card); |
2471 | return err; | 2450 | return err; |
2472 | } | 2451 | } |
2473 | if ((err = snd_ensoniq_midi(ensoniq, 0, NULL)) < 0) { | 2452 | if ((err = snd_ensoniq_midi(ensoniq, 0)) < 0) { |
2474 | snd_card_free(card); | 2453 | snd_card_free(card); |
2475 | return err; | 2454 | return err; |
2476 | } | 2455 | } |