aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/riptide/riptide.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/riptide/riptide.c')
-rw-r--r--sound/pci/riptide/riptide.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 6a3596247348..e9f0706ed3e4 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -865,7 +865,8 @@ static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
865 struct riptideport *hwport; 865 struct riptideport *hwport;
866 struct cmdport *cmdport = NULL; 866 struct cmdport *cmdport = NULL;
867 867
868 snd_assert(cif, return -EINVAL); 868 if (snd_BUG_ON(!cif))
869 return -EINVAL;
869 870
870 hwport = cif->hwport; 871 hwport = cif->hwport;
871 if (cif->errcnt > MAX_ERROR_COUNT) { 872 if (cif->errcnt > MAX_ERROR_COUNT) {
@@ -1482,7 +1483,6 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
1482{ 1483{
1483 struct snd_riptide *chip = snd_pcm_substream_chip(substream); 1484 struct snd_riptide *chip = snd_pcm_substream_chip(substream);
1484 struct snd_pcm_runtime *runtime = substream->runtime; 1485 struct snd_pcm_runtime *runtime = substream->runtime;
1485 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
1486 struct pcmhw *data = get_pcmhwdev(substream); 1486 struct pcmhw *data = get_pcmhwdev(substream);
1487 struct cmdif *cif = chip->cif; 1487 struct cmdif *cif = chip->cif;
1488 unsigned char *lbuspath = NULL; 1488 unsigned char *lbuspath = NULL;
@@ -1490,7 +1490,8 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
1490 int err = 0; 1490 int err = 0;
1491 snd_pcm_format_t format; 1491 snd_pcm_format_t format;
1492 1492
1493 snd_assert(cif && data, return -EINVAL); 1493 if (snd_BUG_ON(!cif || !data))
1494 return -EINVAL;
1494 1495
1495 snd_printdd("prepare id %d ch: %d f:0x%x r:%d\n", data->id, 1496 snd_printdd("prepare id %d ch: %d f:0x%x r:%d\n", data->id,
1496 runtime->channels, runtime->format, runtime->rate); 1497 runtime->channels, runtime->format, runtime->rate);
@@ -1513,9 +1514,9 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
1513 lbuspath = data->paths.stereo; 1514 lbuspath = data->paths.stereo;
1514 break; 1515 break;
1515 } 1516 }
1516 snd_printdd("use sgdlist at 0x%p and buffer at 0x%p\n", 1517 snd_printdd("use sgdlist at 0x%p\n",
1517 data->sgdlist.area, sgbuf); 1518 data->sgdlist.area);
1518 if (data->sgdlist.area && sgbuf) { 1519 if (data->sgdlist.area) {
1519 unsigned int i, j, size, pages, f, pt, period; 1520 unsigned int i, j, size, pages, f, pt, period;
1520 struct sgd *c, *p = NULL; 1521 struct sgd *c, *p = NULL;
1521 1522
@@ -1533,6 +1534,7 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
1533 pt = 0; 1534 pt = 0;
1534 j = 0; 1535 j = 0;
1535 for (i = 0; i < pages; i++) { 1536 for (i = 0; i < pages; i++) {
1537 unsigned int ofs, addr;
1536 c = &data->sgdbuf[i]; 1538 c = &data->sgdbuf[i];
1537 if (p) 1539 if (p)
1538 p->dwNextLink = cpu_to_le32(data->sgdlist.addr + 1540 p->dwNextLink = cpu_to_le32(data->sgdlist.addr +
@@ -1540,8 +1542,9 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
1540 sizeof(struct 1542 sizeof(struct
1541 sgd))); 1543 sgd)));
1542 c->dwNextLink = cpu_to_le32(data->sgdlist.addr); 1544 c->dwNextLink = cpu_to_le32(data->sgdlist.addr);
1543 c->dwSegPtrPhys = 1545 ofs = j << PAGE_SHIFT;
1544 cpu_to_le32(sgbuf->table[j].addr + pt); 1546 addr = snd_pcm_sgbuf_get_addr(substream, ofs) + pt;
1547 c->dwSegPtrPhys = cpu_to_le32(addr);
1545 pt = (pt + f) % PAGE_SIZE; 1548 pt = (pt + f) % PAGE_SIZE;
1546 if (pt == 0) 1549 if (pt == 0)
1547 j++; 1550 j++;
@@ -1772,7 +1775,8 @@ snd_riptide_codec_write(struct snd_ac97 *ac97, unsigned short reg,
1772 union cmdret rptr = CMDRET_ZERO; 1775 union cmdret rptr = CMDRET_ZERO;
1773 int i = 0; 1776 int i = 0;
1774 1777
1775 snd_assert(cif, return); 1778 if (snd_BUG_ON(!cif))
1779 return;
1776 1780
1777 snd_printdd("Write AC97 reg 0x%x 0x%x\n", reg, val); 1781 snd_printdd("Write AC97 reg 0x%x 0x%x\n", reg, val);
1778 do { 1782 do {
@@ -1790,7 +1794,8 @@ static unsigned short snd_riptide_codec_read(struct snd_ac97 *ac97,
1790 struct cmdif *cif = chip->cif; 1794 struct cmdif *cif = chip->cif;
1791 union cmdret rptr = CMDRET_ZERO; 1795 union cmdret rptr = CMDRET_ZERO;
1792 1796
1793 snd_assert(cif, return 0); 1797 if (snd_BUG_ON(!cif))
1798 return 0;
1794 1799
1795 if (SEND_RACR(cif, reg, &rptr) != 0) 1800 if (SEND_RACR(cif, reg, &rptr) != 0)
1796 SEND_RACR(cif, reg, &rptr); 1801 SEND_RACR(cif, reg, &rptr);
@@ -1804,7 +1809,8 @@ static int snd_riptide_initialize(struct snd_riptide *chip)
1804 unsigned int device_id; 1809 unsigned int device_id;
1805 int err; 1810 int err;
1806 1811
1807 snd_assert(chip, return -EINVAL); 1812 if (snd_BUG_ON(!chip))
1813 return -EINVAL;
1808 1814
1809 cif = chip->cif; 1815 cif = chip->cif;
1810 if (!cif) { 1816 if (!cif) {
@@ -1836,7 +1842,8 @@ static int snd_riptide_free(struct snd_riptide *chip)
1836{ 1842{
1837 struct cmdif *cif; 1843 struct cmdif *cif;
1838 1844
1839 snd_assert(chip, return 0); 1845 if (!chip)
1846 return 0;
1840 1847
1841 if ((cif = chip->cif)) { 1848 if ((cif = chip->cif)) {
1842 SET_GRESET(cif->hwport); 1849 SET_GRESET(cif->hwport);