aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-25 08:21:18 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-26 10:45:17 -0500
commitebebecaa0a9a26a246f1c20ee2f9d90da37f70f8 (patch)
treef771ba56ebca367c774cee9d9b283f7f16454546
parent7ddbd1819ca2a04664394aef6d4c2bb24d6c698c (diff)
ALSA: es1938: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc. Some debug prints are replaced with dev_dbg(), too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/es1938.c74
1 files changed, 32 insertions, 42 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 33489bcc0aff..34d95bf916b5 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -254,7 +254,6 @@ MODULE_DEVICE_TABLE(pci, snd_es1938_ids);
254#define WRITE_LOOP_TIMEOUT 0x10000 254#define WRITE_LOOP_TIMEOUT 0x10000
255#define GET_LOOP_TIMEOUT 0x01000 255#define GET_LOOP_TIMEOUT 0x01000
256 256
257#undef REG_DEBUG
258/* ----------------------------------------------------------------- 257/* -----------------------------------------------------------------
259 * Write to a mixer register 258 * Write to a mixer register
260 * -----------------------------------------------------------------*/ 259 * -----------------------------------------------------------------*/
@@ -265,9 +264,7 @@ static void snd_es1938_mixer_write(struct es1938 *chip, unsigned char reg, unsig
265 outb(reg, SLSB_REG(chip, MIXERADDR)); 264 outb(reg, SLSB_REG(chip, MIXERADDR));
266 outb(val, SLSB_REG(chip, MIXERDATA)); 265 outb(val, SLSB_REG(chip, MIXERDATA));
267 spin_unlock_irqrestore(&chip->mixer_lock, flags); 266 spin_unlock_irqrestore(&chip->mixer_lock, flags);
268#ifdef REG_DEBUG 267 dev_dbg(chip->card->dev, "Mixer reg %02x set to %02x\n", reg, val);
269 snd_printk(KERN_DEBUG "Mixer reg %02x set to %02x\n", reg, val);
270#endif
271} 268}
272 269
273/* ----------------------------------------------------------------- 270/* -----------------------------------------------------------------
@@ -281,9 +278,7 @@ static int snd_es1938_mixer_read(struct es1938 *chip, unsigned char reg)
281 outb(reg, SLSB_REG(chip, MIXERADDR)); 278 outb(reg, SLSB_REG(chip, MIXERADDR));
282 data = inb(SLSB_REG(chip, MIXERDATA)); 279 data = inb(SLSB_REG(chip, MIXERDATA));
283 spin_unlock_irqrestore(&chip->mixer_lock, flags); 280 spin_unlock_irqrestore(&chip->mixer_lock, flags);
284#ifdef REG_DEBUG 281 dev_dbg(chip->card->dev, "Mixer reg %02x now is %02x\n", reg, data);
285 snd_printk(KERN_DEBUG "Mixer reg %02x now is %02x\n", reg, data);
286#endif
287 return data; 282 return data;
288} 283}
289 284
@@ -302,10 +297,9 @@ static int snd_es1938_mixer_bits(struct es1938 *chip, unsigned char reg,
302 if (val != oval) { 297 if (val != oval) {
303 new = (old & ~mask) | (val & mask); 298 new = (old & ~mask) | (val & mask);
304 outb(new, SLSB_REG(chip, MIXERDATA)); 299 outb(new, SLSB_REG(chip, MIXERDATA));
305#ifdef REG_DEBUG 300 dev_dbg(chip->card->dev,
306 snd_printk(KERN_DEBUG "Mixer reg %02x was %02x, set to %02x\n", 301 "Mixer reg %02x was %02x, set to %02x\n",
307 reg, old, new); 302 reg, old, new);
308#endif
309 } 303 }
310 spin_unlock_irqrestore(&chip->mixer_lock, flags); 304 spin_unlock_irqrestore(&chip->mixer_lock, flags);
311 return oval; 305 return oval;
@@ -324,7 +318,8 @@ static void snd_es1938_write_cmd(struct es1938 *chip, unsigned char cmd)
324 return; 318 return;
325 } 319 }
326 } 320 }
327 printk(KERN_ERR "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); 321 dev_err(chip->card->dev,
322 "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v);
328} 323}
329 324
330/* ----------------------------------------------------------------- 325/* -----------------------------------------------------------------
@@ -337,7 +332,7 @@ static int snd_es1938_get_byte(struct es1938 *chip)
337 for (i = GET_LOOP_TIMEOUT; i; i--) 332 for (i = GET_LOOP_TIMEOUT; i; i--)
338 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80) 333 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80)
339 return inb(SLSB_REG(chip, READDATA)); 334 return inb(SLSB_REG(chip, READDATA));
340 snd_printk(KERN_ERR "get_byte timeout: status 0x02%x\n", v); 335 dev_err(chip->card->dev, "get_byte timeout: status 0x02%x\n", v);
341 return -ENODEV; 336 return -ENODEV;
342} 337}
343 338
@@ -351,9 +346,7 @@ static void snd_es1938_write(struct es1938 *chip, unsigned char reg, unsigned ch
351 snd_es1938_write_cmd(chip, reg); 346 snd_es1938_write_cmd(chip, reg);
352 snd_es1938_write_cmd(chip, val); 347 snd_es1938_write_cmd(chip, val);
353 spin_unlock_irqrestore(&chip->reg_lock, flags); 348 spin_unlock_irqrestore(&chip->reg_lock, flags);
354#ifdef REG_DEBUG 349 dev_dbg(chip->card->dev, "Reg %02x set to %02x\n", reg, val);
355 snd_printk(KERN_DEBUG "Reg %02x set to %02x\n", reg, val);
356#endif
357} 350}
358 351
359/* ----------------------------------------------------------------- 352/* -----------------------------------------------------------------
@@ -368,9 +361,7 @@ static unsigned char snd_es1938_read(struct es1938 *chip, unsigned char reg)
368 snd_es1938_write_cmd(chip, reg); 361 snd_es1938_write_cmd(chip, reg);
369 val = snd_es1938_get_byte(chip); 362 val = snd_es1938_get_byte(chip);
370 spin_unlock_irqrestore(&chip->reg_lock, flags); 363 spin_unlock_irqrestore(&chip->reg_lock, flags);
371#ifdef REG_DEBUG 364 dev_dbg(chip->card->dev, "Reg %02x now is %02x\n", reg, val);
372 snd_printk(KERN_DEBUG "Reg %02x now is %02x\n", reg, val);
373#endif
374 return val; 365 return val;
375} 366}
376 367
@@ -391,10 +382,8 @@ static int snd_es1938_bits(struct es1938 *chip, unsigned char reg, unsigned char
391 snd_es1938_write_cmd(chip, reg); 382 snd_es1938_write_cmd(chip, reg);
392 new = (old & ~mask) | (val & mask); 383 new = (old & ~mask) | (val & mask);
393 snd_es1938_write_cmd(chip, new); 384 snd_es1938_write_cmd(chip, new);
394#ifdef REG_DEBUG 385 dev_dbg(chip->card->dev, "Reg %02x was %02x, set to %02x\n",
395 snd_printk(KERN_DEBUG "Reg %02x was %02x, set to %02x\n",
396 reg, old, new); 386 reg, old, new);
397#endif
398 } 387 }
399 spin_unlock_irqrestore(&chip->reg_lock, flags); 388 spin_unlock_irqrestore(&chip->reg_lock, flags);
400 return oval; 389 return oval;
@@ -416,7 +405,7 @@ static void snd_es1938_reset(struct es1938 *chip)
416 goto __next; 405 goto __next;
417 } 406 }
418 } 407 }
419 snd_printk(KERN_ERR "ESS Solo-1 reset failed\n"); 408 dev_err(chip->card->dev, "ESS Solo-1 reset failed\n");
420 409
421 __next: 410 __next:
422 snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT); 411 snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT);
@@ -1504,16 +1493,15 @@ static int es1938_resume(struct device *dev)
1504 pci_set_power_state(pci, PCI_D0); 1493 pci_set_power_state(pci, PCI_D0);
1505 pci_restore_state(pci); 1494 pci_restore_state(pci);
1506 if (pci_enable_device(pci) < 0) { 1495 if (pci_enable_device(pci) < 0) {
1507 printk(KERN_ERR "es1938: pci_enable_device failed, " 1496 dev_err(dev, "pci_enable_device failed, disabling device\n");
1508 "disabling device\n");
1509 snd_card_disconnect(card); 1497 snd_card_disconnect(card);
1510 return -EIO; 1498 return -EIO;
1511 } 1499 }
1512 1500
1513 if (request_irq(pci->irq, snd_es1938_interrupt, 1501 if (request_irq(pci->irq, snd_es1938_interrupt,
1514 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1502 IRQF_SHARED, KBUILD_MODNAME, chip)) {
1515 printk(KERN_ERR "es1938: unable to grab IRQ %d, " 1503 dev_err(dev, "unable to grab IRQ %d, disabling device\n",
1516 "disabling device\n", pci->irq); 1504 pci->irq);
1517 snd_card_disconnect(card); 1505 snd_card_disconnect(card);
1518 return -EIO; 1506 return -EIO;
1519 } 1507 }
@@ -1545,7 +1533,8 @@ static int snd_es1938_create_gameport(struct es1938 *chip)
1545 1533
1546 chip->gameport = gp = gameport_allocate_port(); 1534 chip->gameport = gp = gameport_allocate_port();
1547 if (!gp) { 1535 if (!gp) {
1548 printk(KERN_ERR "es1938: cannot allocate memory for gameport\n"); 1536 dev_err(chip->card->dev,
1537 "cannot allocate memory for gameport\n");
1549 return -ENOMEM; 1538 return -ENOMEM;
1550 } 1539 }
1551 1540
@@ -1612,7 +1601,8 @@ static int snd_es1938_create(struct snd_card *card,
1612 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1601 /* check, if we can restrict PCI DMA transfers to 24 bits */
1613 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1602 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
1614 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1603 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
1615 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1604 dev_err(card->dev,
1605 "architecture does not support 24bit PCI busmaster DMA\n");
1616 pci_disable_device(pci); 1606 pci_disable_device(pci);
1617 return -ENXIO; 1607 return -ENXIO;
1618 } 1608 }
@@ -1639,15 +1629,14 @@ static int snd_es1938_create(struct snd_card *card,
1639 chip->game_port = pci_resource_start(pci, 4); 1629 chip->game_port = pci_resource_start(pci, 4);
1640 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED, 1630 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED,
1641 KBUILD_MODNAME, chip)) { 1631 KBUILD_MODNAME, chip)) {
1642 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1632 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1643 snd_es1938_free(chip); 1633 snd_es1938_free(chip);
1644 return -EBUSY; 1634 return -EBUSY;
1645 } 1635 }
1646 chip->irq = pci->irq; 1636 chip->irq = pci->irq;
1647#ifdef ES1938_DDEBUG 1637 dev_dbg(card->dev,
1648 snd_printk(KERN_DEBUG "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", 1638 "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n",
1649 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port); 1639 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port);
1650#endif
1651 1640
1652 chip->ddma_port = chip->vc_port + 0x00; /* fix from Thomas Sailer */ 1641 chip->ddma_port = chip->vc_port + 0x00; /* fix from Thomas Sailer */
1653 1642
@@ -1673,21 +1662,22 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id)
1673 1662
1674 status = inb(SLIO_REG(chip, IRQCONTROL)); 1663 status = inb(SLIO_REG(chip, IRQCONTROL));
1675#if 0 1664#if 0
1676 printk(KERN_DEBUG "Es1938debug - interrupt status: =0x%x\n", status); 1665 dev_dbg(chip->card->dev,
1666 "Es1938debug - interrupt status: =0x%x\n", status);
1677#endif 1667#endif
1678 1668
1679 /* AUDIO 1 */ 1669 /* AUDIO 1 */
1680 if (status & 0x10) { 1670 if (status & 0x10) {
1681#if 0 1671#if 0
1682 printk(KERN_DEBUG 1672 dev_dbg(chip->card->dev,
1683 "Es1938debug - AUDIO channel 1 interrupt\n"); 1673 "Es1938debug - AUDIO channel 1 interrupt\n");
1684 printk(KERN_DEBUG 1674 dev_dbg(chip->card->dev,
1685 "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", 1675 "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n",
1686 inw(SLDM_REG(chip, DMACOUNT))); 1676 inw(SLDM_REG(chip, DMACOUNT)));
1687 printk(KERN_DEBUG 1677 dev_dbg(chip->card->dev,
1688 "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", 1678 "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n",
1689 inl(SLDM_REG(chip, DMAADDR))); 1679 inl(SLDM_REG(chip, DMAADDR)));
1690 printk(KERN_DEBUG 1680 dev_dbg(chip->card->dev,
1691 "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", 1681 "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n",
1692 inl(SLDM_REG(chip, DMASTATUS))); 1682 inl(SLDM_REG(chip, DMASTATUS)));
1693#endif 1683#endif
@@ -1703,12 +1693,12 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id)
1703 /* AUDIO 2 */ 1693 /* AUDIO 2 */
1704 if (status & 0x20) { 1694 if (status & 0x20) {
1705#if 0 1695#if 0
1706 printk(KERN_DEBUG 1696 dev_dbg(chip->card->dev,
1707 "Es1938debug - AUDIO channel 2 interrupt\n"); 1697 "Es1938debug - AUDIO channel 2 interrupt\n");
1708 printk(KERN_DEBUG 1698 dev_dbg(chip->card->dev,
1709 "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", 1699 "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n",
1710 inw(SLIO_REG(chip, AUDIO2DMACOUNT))); 1700 inw(SLIO_REG(chip, AUDIO2DMACOUNT)));
1711 printk(KERN_DEBUG 1701 dev_dbg(chip->card->dev,
1712 "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", 1702 "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n",
1713 inl(SLIO_REG(chip, AUDIO2DMAADDR))); 1703 inl(SLIO_REG(chip, AUDIO2DMAADDR)));
1714 1704
@@ -1842,7 +1832,7 @@ static int snd_es1938_probe(struct pci_dev *pci,
1842 SLSB_REG(chip, FMLOWADDR), 1832 SLSB_REG(chip, FMLOWADDR),
1843 SLSB_REG(chip, FMHIGHADDR), 1833 SLSB_REG(chip, FMHIGHADDR),
1844 OPL3_HW_OPL3, 1, &opl3) < 0) { 1834 OPL3_HW_OPL3, 1, &opl3) < 0) {
1845 printk(KERN_ERR "es1938: OPL3 not detected at 0x%lx\n", 1835 dev_err(card->dev, "OPL3 not detected at 0x%lx\n",
1846 SLSB_REG(chip, FMLOWADDR)); 1836 SLSB_REG(chip, FMLOWADDR));
1847 } else { 1837 } else {
1848 if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) { 1838 if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) {
@@ -1858,7 +1848,7 @@ static int snd_es1938_probe(struct pci_dev *pci,
1858 chip->mpu_port, 1848 chip->mpu_port,
1859 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK, 1849 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
1860 -1, &chip->rmidi) < 0) { 1850 -1, &chip->rmidi) < 0) {
1861 printk(KERN_ERR "es1938: unable to initialize MPU-401\n"); 1851 dev_err(card->dev, "unable to initialize MPU-401\n");
1862 } else { 1852 } else {
1863 // this line is vital for MIDI interrupt handling on ess-solo1 1853 // this line is vital for MIDI interrupt handling on ess-solo1
1864 // andreas@flying-snail.de 1854 // andreas@flying-snail.de