Commit 3f05f868f1112b970e7fb9c0aa42cc99370098fe
Committed by
Jaroslav Kysela
1 parent
8d88bc3d36
Exists in
master
and in
20 other branches
[ALSA] nm256 - Code clean up
Modules: NM256 driver Clean up snd-nm256 driver code: - Simplify chip constructor function Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 1 changed file with 9 additions and 21 deletions Side-by-side Diff
sound/pci/nm256/nm256.c
... | ... | @@ -1375,10 +1375,6 @@ |
1375 | 1375 | |
1376 | 1376 | static int __devinit |
1377 | 1377 | snd_nm256_create(snd_card_t *card, struct pci_dev *pci, |
1378 | - int play_bufsize, int capt_bufsize, | |
1379 | - int force_load, | |
1380 | - u32 buffertop, | |
1381 | - int usecache, | |
1382 | 1378 | nm256_t **chip_ret) |
1383 | 1379 | { |
1384 | 1380 | nm256_t *chip; |
1385 | 1381 | |
... | ... | @@ -1401,13 +1397,14 @@ |
1401 | 1397 | |
1402 | 1398 | chip->card = card; |
1403 | 1399 | chip->pci = pci; |
1404 | - chip->use_cache = usecache; | |
1400 | + chip->use_cache = use_cache; | |
1405 | 1401 | spin_lock_init(&chip->reg_lock); |
1406 | 1402 | chip->irq = -1; |
1407 | 1403 | init_MUTEX(&chip->irq_mutex); |
1408 | 1404 | |
1409 | - chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = play_bufsize; | |
1410 | - chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capt_bufsize; | |
1405 | + /* store buffer sizes in bytes */ | |
1406 | + chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = playback_bufsize * 1024; | |
1407 | + chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capture_bufsize * 1024; | |
1411 | 1408 | |
1412 | 1409 | /* |
1413 | 1410 | * The NM256 has two memory ports. The first port is nothing |
... | ... | @@ -1440,7 +1437,7 @@ |
1440 | 1437 | /* Ok, try to see if this is a non-AC97 version of the hardware. */ |
1441 | 1438 | pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); |
1442 | 1439 | if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { |
1443 | - if (! force_load) { | |
1440 | + if (! force_ac97) { | |
1444 | 1441 | printk(KERN_ERR "nm256: no ac97 is found!\n"); |
1445 | 1442 | printk(KERN_ERR " force the driver to load by passing in the module parameter\n"); |
1446 | 1443 | printk(KERN_ERR " force_ac97=1\n"); |
... | ... | @@ -1471,8 +1468,8 @@ |
1471 | 1468 | else |
1472 | 1469 | chip->buffer_size += NM_MAX_PLAYBACK_COEF_SIZE + NM_MAX_RECORD_COEF_SIZE; |
1473 | 1470 | |
1474 | - if (buffertop >= chip->buffer_size && buffertop < chip->buffer_end) | |
1475 | - chip->buffer_end = buffertop; | |
1471 | + if (buffer_top >= chip->buffer_size && buffer_top < chip->buffer_end) | |
1472 | + chip->buffer_end = buffer_top; | |
1476 | 1473 | else { |
1477 | 1474 | /* get buffer end pointer from signature */ |
1478 | 1475 | if ((err = snd_nm256_peek_for_sig(chip)) < 0) |
... | ... | @@ -1567,7 +1564,6 @@ |
1567 | 1564 | snd_card_t *card; |
1568 | 1565 | nm256_t *chip; |
1569 | 1566 | int err; |
1570 | - unsigned int xbuffer_top; | |
1571 | 1567 | struct nm256_quirk *q; |
1572 | 1568 | u16 subsystem_vendor, subsystem_device; |
1573 | 1569 | |
... | ... | @@ -1611,9 +1607,7 @@ |
1611 | 1607 | } |
1612 | 1608 | |
1613 | 1609 | if (vaio_hack) |
1614 | - xbuffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ | |
1615 | - else | |
1616 | - xbuffer_top = buffer_top; | |
1610 | + buffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ | |
1617 | 1611 | |
1618 | 1612 | if (playback_bufsize < 4) |
1619 | 1613 | playback_bufsize = 4; |
... | ... | @@ -1623,13 +1617,7 @@ |
1623 | 1617 | capture_bufsize = 4; |
1624 | 1618 | if (capture_bufsize > 128) |
1625 | 1619 | capture_bufsize = 128; |
1626 | - if ((err = snd_nm256_create(card, pci, | |
1627 | - playback_bufsize * 1024, /* in bytes */ | |
1628 | - capture_bufsize * 1024, /* in bytes */ | |
1629 | - force_ac97, | |
1630 | - xbuffer_top, | |
1631 | - use_cache, | |
1632 | - &chip)) < 0) { | |
1620 | + if ((err = snd_nm256_create(card, pci, &chip)) < 0) { | |
1633 | 1621 | snd_card_free(card); |
1634 | 1622 | return err; |
1635 | 1623 | } |