aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/nm256
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 05:12:06 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:27 -0500
commit3f05f868f1112b970e7fb9c0aa42cc99370098fe (patch)
tree7ce21b25e3e67161aa0e751842722e9fe9c1abd4 /sound/pci/nm256
parent8d88bc3d361bdd81a214eb9c5d06b291d06c603a (diff)
[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>
Diffstat (limited to 'sound/pci/nm256')
-rw-r--r--sound/pci/nm256/nm256.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 089d23b4a002..a01b3e577966 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1375,10 +1375,6 @@ static int snd_nm256_dev_free(snd_device_t *device)
1375 1375
1376static int __devinit 1376static int __devinit
1377snd_nm256_create(snd_card_t *card, struct pci_dev *pci, 1377snd_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 nm256_t **chip_ret) 1378 nm256_t **chip_ret)
1383{ 1379{
1384 nm256_t *chip; 1380 nm256_t *chip;
@@ -1401,13 +1397,14 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1401 1397
1402 chip->card = card; 1398 chip->card = card;
1403 chip->pci = pci; 1399 chip->pci = pci;
1404 chip->use_cache = usecache; 1400 chip->use_cache = use_cache;
1405 spin_lock_init(&chip->reg_lock); 1401 spin_lock_init(&chip->reg_lock);
1406 chip->irq = -1; 1402 chip->irq = -1;
1407 init_MUTEX(&chip->irq_mutex); 1403 init_MUTEX(&chip->irq_mutex);
1408 1404
1409 chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = play_bufsize; 1405 /* store buffer sizes in bytes */
1410 chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capt_bufsize; 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 * The NM256 has two memory ports. The first port is nothing 1410 * The NM256 has two memory ports. The first port is nothing
@@ -1440,7 +1437,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1440 /* Ok, try to see if this is a non-AC97 version of the hardware. */ 1437 /* Ok, try to see if this is a non-AC97 version of the hardware. */
1441 pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); 1438 pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE);
1442 if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { 1439 if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) {
1443 if (! force_load) { 1440 if (! force_ac97) {
1444 printk(KERN_ERR "nm256: no ac97 is found!\n"); 1441 printk(KERN_ERR "nm256: no ac97 is found!\n");
1445 printk(KERN_ERR " force the driver to load by passing in the module parameter\n"); 1442 printk(KERN_ERR " force the driver to load by passing in the module parameter\n");
1446 printk(KERN_ERR " force_ac97=1\n"); 1443 printk(KERN_ERR " force_ac97=1\n");
@@ -1471,8 +1468,8 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1471 else 1468 else
1472 chip->buffer_size += NM_MAX_PLAYBACK_COEF_SIZE + NM_MAX_RECORD_COEF_SIZE; 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) 1471 if (buffer_top >= chip->buffer_size && buffer_top < chip->buffer_end)
1475 chip->buffer_end = buffertop; 1472 chip->buffer_end = buffer_top;
1476 else { 1473 else {
1477 /* get buffer end pointer from signature */ 1474 /* get buffer end pointer from signature */
1478 if ((err = snd_nm256_peek_for_sig(chip)) < 0) 1475 if ((err = snd_nm256_peek_for_sig(chip)) < 0)
@@ -1567,7 +1564,6 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1567 snd_card_t *card; 1564 snd_card_t *card;
1568 nm256_t *chip; 1565 nm256_t *chip;
1569 int err; 1566 int err;
1570 unsigned int xbuffer_top;
1571 struct nm256_quirk *q; 1567 struct nm256_quirk *q;
1572 u16 subsystem_vendor, subsystem_device; 1568 u16 subsystem_vendor, subsystem_device;
1573 1569
@@ -1611,9 +1607,7 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1611 } 1607 }
1612 1608
1613 if (vaio_hack) 1609 if (vaio_hack)
1614 xbuffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ 1610 buffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */
1615 else
1616 xbuffer_top = buffer_top;
1617 1611
1618 if (playback_bufsize < 4) 1612 if (playback_bufsize < 4)
1619 playback_bufsize = 4; 1613 playback_bufsize = 4;
@@ -1623,13 +1617,7 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1623 capture_bufsize = 4; 1617 capture_bufsize = 4;
1624 if (capture_bufsize > 128) 1618 if (capture_bufsize > 128)
1625 capture_bufsize = 128; 1619 capture_bufsize = 128;
1626 if ((err = snd_nm256_create(card, pci, 1620 if ((err = snd_nm256_create(card, pci, &chip)) < 0) {
1627 playback_bufsize * 1024, /* in bytes */
1628 capture_bufsize * 1024, /* in bytes */
1629 force_ac97,
1630 xbuffer_top,
1631 use_cache,
1632 &chip)) < 0) {
1633 snd_card_free(card); 1621 snd_card_free(card);
1634 return err; 1622 return err;
1635 } 1623 }