diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-25 11:57:42 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-26 10:45:29 -0500 |
commit | a3fe03f412daf40ab39ba0fbd3f78bf1f0d62856 (patch) | |
tree | ba83f677c9151a913c238e8e476ab24f775dfa08 | |
parent | 6414e35deb59117ee0883c5acca7670a2a24ca98 (diff) |
ALSA: nm256: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/nm256/nm256.c | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index b7afd9c8dcd7..ddc60215cc10 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -318,7 +318,8 @@ snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size) | |||
318 | offset -= chip->buffer_start; | 318 | offset -= chip->buffer_start; |
319 | #ifdef CONFIG_SND_DEBUG | 319 | #ifdef CONFIG_SND_DEBUG |
320 | if (offset < 0 || offset >= chip->buffer_size) { | 320 | if (offset < 0 || offset >= chip->buffer_size) { |
321 | snd_printk(KERN_ERR "write_buffer invalid offset = %d size = %d\n", | 321 | dev_err(chip->card->dev, |
322 | "write_buffer invalid offset = %d size = %d\n", | ||
322 | offset, size); | 323 | offset, size); |
323 | return; | 324 | return; |
324 | } | 325 | } |
@@ -366,7 +367,8 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number) | |||
366 | NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET); | 367 | NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET); |
367 | 368 | ||
368 | if (snd_nm256_readb(chip, poffset) & 1) { | 369 | if (snd_nm256_readb(chip, poffset) & 1) { |
369 | snd_printd("NM256: Engine was enabled while loading coefficients!\n"); | 370 | dev_dbg(chip->card->dev, |
371 | "NM256: Engine was enabled while loading coefficients!\n"); | ||
370 | return; | 372 | return; |
371 | } | 373 | } |
372 | 374 | ||
@@ -466,7 +468,8 @@ static int snd_nm256_acquire_irq(struct nm256 *chip) | |||
466 | if (chip->irq < 0) { | 468 | if (chip->irq < 0) { |
467 | if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED, | 469 | if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED, |
468 | KBUILD_MODNAME, chip)) { | 470 | KBUILD_MODNAME, chip)) { |
469 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); | 471 | dev_err(chip->card->dev, |
472 | "unable to grab IRQ %d\n", chip->pci->irq); | ||
470 | mutex_unlock(&chip->irq_mutex); | 473 | mutex_unlock(&chip->irq_mutex); |
471 | return -EBUSY; | 474 | return -EBUSY; |
472 | } | 475 | } |
@@ -1039,7 +1042,7 @@ snd_nm256_interrupt(int irq, void *dev_id) | |||
1039 | if (status & NM_MISC_INT_1) { | 1042 | if (status & NM_MISC_INT_1) { |
1040 | status &= ~NM_MISC_INT_1; | 1043 | status &= ~NM_MISC_INT_1; |
1041 | NM_ACK_INT(chip, NM_MISC_INT_1); | 1044 | NM_ACK_INT(chip, NM_MISC_INT_1); |
1042 | snd_printd("NM256: Got misc interrupt #1\n"); | 1045 | dev_dbg(chip->card->dev, "NM256: Got misc interrupt #1\n"); |
1043 | snd_nm256_writew(chip, NM_INT_REG, 0x8000); | 1046 | snd_nm256_writew(chip, NM_INT_REG, 0x8000); |
1044 | cbyte = snd_nm256_readb(chip, 0x400); | 1047 | cbyte = snd_nm256_readb(chip, 0x400); |
1045 | snd_nm256_writeb(chip, 0x400, cbyte | 2); | 1048 | snd_nm256_writeb(chip, 0x400, cbyte | 2); |
@@ -1048,14 +1051,15 @@ snd_nm256_interrupt(int irq, void *dev_id) | |||
1048 | if (status & NM_MISC_INT_2) { | 1051 | if (status & NM_MISC_INT_2) { |
1049 | status &= ~NM_MISC_INT_2; | 1052 | status &= ~NM_MISC_INT_2; |
1050 | NM_ACK_INT(chip, NM_MISC_INT_2); | 1053 | NM_ACK_INT(chip, NM_MISC_INT_2); |
1051 | snd_printd("NM256: Got misc interrupt #2\n"); | 1054 | dev_dbg(chip->card->dev, "NM256: Got misc interrupt #2\n"); |
1052 | cbyte = snd_nm256_readb(chip, 0x400); | 1055 | cbyte = snd_nm256_readb(chip, 0x400); |
1053 | snd_nm256_writeb(chip, 0x400, cbyte & ~2); | 1056 | snd_nm256_writeb(chip, 0x400, cbyte & ~2); |
1054 | } | 1057 | } |
1055 | 1058 | ||
1056 | /* Unknown interrupt. */ | 1059 | /* Unknown interrupt. */ |
1057 | if (status) { | 1060 | if (status) { |
1058 | snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n", | 1061 | dev_dbg(chip->card->dev, |
1062 | "NM256: Fire in the hole! Unknown status 0x%x\n", | ||
1059 | status); | 1063 | status); |
1060 | /* Pray. */ | 1064 | /* Pray. */ |
1061 | NM_ACK_INT(chip, status); | 1065 | NM_ACK_INT(chip, status); |
@@ -1104,7 +1108,7 @@ snd_nm256_interrupt_zx(int irq, void *dev_id) | |||
1104 | if (status & NM2_MISC_INT_1) { | 1108 | if (status & NM2_MISC_INT_1) { |
1105 | status &= ~NM2_MISC_INT_1; | 1109 | status &= ~NM2_MISC_INT_1; |
1106 | NM2_ACK_INT(chip, NM2_MISC_INT_1); | 1110 | NM2_ACK_INT(chip, NM2_MISC_INT_1); |
1107 | snd_printd("NM256: Got misc interrupt #1\n"); | 1111 | dev_dbg(chip->card->dev, "NM256: Got misc interrupt #1\n"); |
1108 | cbyte = snd_nm256_readb(chip, 0x400); | 1112 | cbyte = snd_nm256_readb(chip, 0x400); |
1109 | snd_nm256_writeb(chip, 0x400, cbyte | 2); | 1113 | snd_nm256_writeb(chip, 0x400, cbyte | 2); |
1110 | } | 1114 | } |
@@ -1112,14 +1116,15 @@ snd_nm256_interrupt_zx(int irq, void *dev_id) | |||
1112 | if (status & NM2_MISC_INT_2) { | 1116 | if (status & NM2_MISC_INT_2) { |
1113 | status &= ~NM2_MISC_INT_2; | 1117 | status &= ~NM2_MISC_INT_2; |
1114 | NM2_ACK_INT(chip, NM2_MISC_INT_2); | 1118 | NM2_ACK_INT(chip, NM2_MISC_INT_2); |
1115 | snd_printd("NM256: Got misc interrupt #2\n"); | 1119 | dev_dbg(chip->card->dev, "NM256: Got misc interrupt #2\n"); |
1116 | cbyte = snd_nm256_readb(chip, 0x400); | 1120 | cbyte = snd_nm256_readb(chip, 0x400); |
1117 | snd_nm256_writeb(chip, 0x400, cbyte & ~2); | 1121 | snd_nm256_writeb(chip, 0x400, cbyte & ~2); |
1118 | } | 1122 | } |
1119 | 1123 | ||
1120 | /* Unknown interrupt. */ | 1124 | /* Unknown interrupt. */ |
1121 | if (status) { | 1125 | if (status) { |
1122 | snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n", | 1126 | dev_dbg(chip->card->dev, |
1127 | "NM256: Fire in the hole! Unknown status 0x%x\n", | ||
1123 | status); | 1128 | status); |
1124 | /* Pray. */ | 1129 | /* Pray. */ |
1125 | NM2_ACK_INT(chip, status); | 1130 | NM2_ACK_INT(chip, status); |
@@ -1245,7 +1250,7 @@ snd_nm256_ac97_write(struct snd_ac97 *ac97, | |||
1245 | return; | 1250 | return; |
1246 | } | 1251 | } |
1247 | } | 1252 | } |
1248 | snd_printd("nm256: ac97 codec not ready..\n"); | 1253 | dev_dbg(chip->card->dev, "nm256: ac97 codec not ready..\n"); |
1249 | } | 1254 | } |
1250 | 1255 | ||
1251 | /* static resolution table */ | 1256 | /* static resolution table */ |
@@ -1347,7 +1352,8 @@ snd_nm256_peek_for_sig(struct nm256 *chip) | |||
1347 | 1352 | ||
1348 | temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16); | 1353 | temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16); |
1349 | if (temp == NULL) { | 1354 | if (temp == NULL) { |
1350 | snd_printk(KERN_ERR "Unable to scan for card signature in video RAM\n"); | 1355 | dev_err(chip->card->dev, |
1356 | "Unable to scan for card signature in video RAM\n"); | ||
1351 | return -EBUSY; | 1357 | return -EBUSY; |
1352 | } | 1358 | } |
1353 | 1359 | ||
@@ -1361,12 +1367,14 @@ snd_nm256_peek_for_sig(struct nm256 *chip) | |||
1361 | if (pointer == 0xffffffff || | 1367 | if (pointer == 0xffffffff || |
1362 | pointer < chip->buffer_size || | 1368 | pointer < chip->buffer_size || |
1363 | pointer > chip->buffer_end) { | 1369 | pointer > chip->buffer_end) { |
1364 | snd_printk(KERN_ERR "invalid signature found: 0x%x\n", pointer); | 1370 | dev_err(chip->card->dev, |
1371 | "invalid signature found: 0x%x\n", pointer); | ||
1365 | iounmap(temp); | 1372 | iounmap(temp); |
1366 | return -ENODEV; | 1373 | return -ENODEV; |
1367 | } else { | 1374 | } else { |
1368 | pointer_found = pointer; | 1375 | pointer_found = pointer; |
1369 | printk(KERN_INFO "nm256: found card signature in video RAM: 0x%x\n", | 1376 | dev_info(chip->card->dev, |
1377 | "found card signature in video RAM: 0x%x\n", | ||
1370 | pointer); | 1378 | pointer); |
1371 | } | 1379 | } |
1372 | } | 1380 | } |
@@ -1411,8 +1419,7 @@ static int nm256_resume(struct device *dev) | |||
1411 | pci_set_power_state(pci, PCI_D0); | 1419 | pci_set_power_state(pci, PCI_D0); |
1412 | pci_restore_state(pci); | 1420 | pci_restore_state(pci); |
1413 | if (pci_enable_device(pci) < 0) { | 1421 | if (pci_enable_device(pci) < 0) { |
1414 | printk(KERN_ERR "nm256: pci_enable_device failed, " | 1422 | dev_err(dev, "pci_enable_device failed, disabling device\n"); |
1415 | "disabling device\n"); | ||
1416 | snd_card_disconnect(card); | 1423 | snd_card_disconnect(card); |
1417 | return -EIO; | 1424 | return -EIO; |
1418 | } | 1425 | } |
@@ -1520,14 +1527,15 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, | |||
1520 | chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE, | 1527 | chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE, |
1521 | card->driver); | 1528 | card->driver); |
1522 | if (chip->res_cport == NULL) { | 1529 | if (chip->res_cport == NULL) { |
1523 | snd_printk(KERN_ERR "memory region 0x%lx (size 0x%x) busy\n", | 1530 | dev_err(card->dev, "memory region 0x%lx (size 0x%x) busy\n", |
1524 | chip->cport_addr, NM_PORT2_SIZE); | 1531 | chip->cport_addr, NM_PORT2_SIZE); |
1525 | err = -EBUSY; | 1532 | err = -EBUSY; |
1526 | goto __error; | 1533 | goto __error; |
1527 | } | 1534 | } |
1528 | chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE); | 1535 | chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE); |
1529 | if (chip->cport == NULL) { | 1536 | if (chip->cport == NULL) { |
1530 | snd_printk(KERN_ERR "unable to map control port %lx\n", chip->cport_addr); | 1537 | dev_err(card->dev, "unable to map control port %lx\n", |
1538 | chip->cport_addr); | ||
1531 | err = -ENOMEM; | 1539 | err = -ENOMEM; |
1532 | goto __error; | 1540 | goto __error; |
1533 | } | 1541 | } |
@@ -1537,12 +1545,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, | |||
1537 | pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); | 1545 | pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); |
1538 | if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { | 1546 | if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { |
1539 | if (! force_ac97) { | 1547 | if (! force_ac97) { |
1540 | printk(KERN_ERR "nm256: no ac97 is found!\n"); | 1548 | dev_err(card->dev, |
1541 | printk(KERN_ERR " force the driver to load by " | 1549 | "no ac97 is found!\n"); |
1542 | "passing in the module parameter\n"); | 1550 | dev_err(card->dev, |
1543 | printk(KERN_ERR " force_ac97=1\n"); | 1551 | "force the driver to load by passing in the module parameter\n"); |
1544 | printk(KERN_ERR " or try sb16, opl3sa2, or " | 1552 | dev_err(card->dev, |
1545 | "cs423x drivers instead.\n"); | 1553 | " force_ac97=1\n"); |
1554 | dev_err(card->dev, | ||
1555 | "or try sb16, opl3sa2, or cs423x drivers instead.\n"); | ||
1546 | err = -ENXIO; | 1556 | err = -ENXIO; |
1547 | goto __error; | 1557 | goto __error; |
1548 | } | 1558 | } |
@@ -1581,14 +1591,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, | |||
1581 | chip->buffer_start = chip->buffer_end - chip->buffer_size; | 1591 | chip->buffer_start = chip->buffer_end - chip->buffer_size; |
1582 | chip->buffer_addr += chip->buffer_start; | 1592 | chip->buffer_addr += chip->buffer_start; |
1583 | 1593 | ||
1584 | printk(KERN_INFO "nm256: Mapping port 1 from 0x%x - 0x%x\n", | 1594 | dev_info(card->dev, "Mapping port 1 from 0x%x - 0x%x\n", |
1585 | chip->buffer_start, chip->buffer_end); | 1595 | chip->buffer_start, chip->buffer_end); |
1586 | 1596 | ||
1587 | chip->res_buffer = request_mem_region(chip->buffer_addr, | 1597 | chip->res_buffer = request_mem_region(chip->buffer_addr, |
1588 | chip->buffer_size, | 1598 | chip->buffer_size, |
1589 | card->driver); | 1599 | card->driver); |
1590 | if (chip->res_buffer == NULL) { | 1600 | if (chip->res_buffer == NULL) { |
1591 | snd_printk(KERN_ERR "nm256: buffer 0x%lx (size 0x%x) busy\n", | 1601 | dev_err(card->dev, "buffer 0x%lx (size 0x%x) busy\n", |
1592 | chip->buffer_addr, chip->buffer_size); | 1602 | chip->buffer_addr, chip->buffer_size); |
1593 | err = -EBUSY; | 1603 | err = -EBUSY; |
1594 | goto __error; | 1604 | goto __error; |
@@ -1596,7 +1606,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, | |||
1596 | chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size); | 1606 | chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size); |
1597 | if (chip->buffer == NULL) { | 1607 | if (chip->buffer == NULL) { |
1598 | err = -ENOMEM; | 1608 | err = -ENOMEM; |
1599 | snd_printk(KERN_ERR "unable to map ring buffer at %lx\n", chip->buffer_addr); | 1609 | dev_err(card->dev, "unable to map ring buffer at %lx\n", |
1610 | chip->buffer_addr); | ||
1600 | goto __error; | 1611 | goto __error; |
1601 | } | 1612 | } |
1602 | 1613 | ||
@@ -1658,12 +1669,12 @@ static int snd_nm256_probe(struct pci_dev *pci, | |||
1658 | 1669 | ||
1659 | q = snd_pci_quirk_lookup(pci, nm256_quirks); | 1670 | q = snd_pci_quirk_lookup(pci, nm256_quirks); |
1660 | if (q) { | 1671 | if (q) { |
1661 | snd_printdd(KERN_INFO "nm256: Enabled quirk for %s.\n", | 1672 | dev_dbg(&pci->dev, "Enabled quirk for %s.\n", |
1662 | snd_pci_quirk_name(q)); | 1673 | snd_pci_quirk_name(q)); |
1663 | switch (q->value) { | 1674 | switch (q->value) { |
1664 | case NM_BLACKLISTED: | 1675 | case NM_BLACKLISTED: |
1665 | printk(KERN_INFO "nm256: The device is blacklisted. " | 1676 | dev_info(&pci->dev, |
1666 | "Loading stopped\n"); | 1677 | "The device is blacklisted. Loading stopped\n"); |
1667 | return -ENODEV; | 1678 | return -ENODEV; |
1668 | case NM_RESET_WORKAROUND_2: | 1679 | case NM_RESET_WORKAROUND_2: |
1669 | reset_workaround_2 = 1; | 1680 | reset_workaround_2 = 1; |
@@ -1689,7 +1700,7 @@ static int snd_nm256_probe(struct pci_dev *pci, | |||
1689 | strcpy(card->driver, "NM256XL+"); | 1700 | strcpy(card->driver, "NM256XL+"); |
1690 | break; | 1701 | break; |
1691 | default: | 1702 | default: |
1692 | snd_printk(KERN_ERR "invalid device id 0x%x\n", pci->device); | 1703 | dev_err(&pci->dev, "invalid device id 0x%x\n", pci->device); |
1693 | snd_card_free(card); | 1704 | snd_card_free(card); |
1694 | return -EINVAL; | 1705 | return -EINVAL; |
1695 | } | 1706 | } |
@@ -1712,12 +1723,12 @@ static int snd_nm256_probe(struct pci_dev *pci, | |||
1712 | card->private_data = chip; | 1723 | card->private_data = chip; |
1713 | 1724 | ||
1714 | if (reset_workaround) { | 1725 | if (reset_workaround) { |
1715 | snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); | 1726 | dev_dbg(&pci->dev, "reset_workaround activated\n"); |
1716 | chip->reset_workaround = 1; | 1727 | chip->reset_workaround = 1; |
1717 | } | 1728 | } |
1718 | 1729 | ||
1719 | if (reset_workaround_2) { | 1730 | if (reset_workaround_2) { |
1720 | snd_printdd(KERN_INFO "nm256: reset_workaround_2 activated\n"); | 1731 | dev_dbg(&pci->dev, "reset_workaround_2 activated\n"); |
1721 | chip->reset_workaround_2 = 1; | 1732 | chip->reset_workaround_2 = 1; |
1722 | } | 1733 | } |
1723 | 1734 | ||