Commit a3fe03f4 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: nm256: Use standard printk helpers

Convert with dev_err() and co from snd_printk(), etc.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6414e35d
...@@ -318,7 +318,8 @@ snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size) ...@@ -318,7 +318,8 @@ snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size)
offset -= chip->buffer_start; offset -= chip->buffer_start;
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
if (offset < 0 || offset >= chip->buffer_size) { if (offset < 0 || offset >= chip->buffer_size) {
snd_printk(KERN_ERR "write_buffer invalid offset = %d size = %d\n", dev_err(chip->card->dev,
"write_buffer invalid offset = %d size = %d\n",
offset, size); offset, size);
return; return;
} }
...@@ -366,7 +367,8 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number) ...@@ -366,7 +367,8 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET); NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET);
if (snd_nm256_readb(chip, poffset) & 1) { if (snd_nm256_readb(chip, poffset) & 1) {
snd_printd("NM256: Engine was enabled while loading coefficients!\n"); dev_dbg(chip->card->dev,
"NM256: Engine was enabled while loading coefficients!\n");
return; return;
} }
...@@ -466,7 +468,8 @@ static int snd_nm256_acquire_irq(struct nm256 *chip) ...@@ -466,7 +468,8 @@ static int snd_nm256_acquire_irq(struct nm256 *chip)
if (chip->irq < 0) { if (chip->irq < 0) {
if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED, if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) { KBUILD_MODNAME, chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); dev_err(chip->card->dev,
"unable to grab IRQ %d\n", chip->pci->irq);
mutex_unlock(&chip->irq_mutex); mutex_unlock(&chip->irq_mutex);
return -EBUSY; return -EBUSY;
} }
...@@ -1039,7 +1042,7 @@ snd_nm256_interrupt(int irq, void *dev_id) ...@@ -1039,7 +1042,7 @@ snd_nm256_interrupt(int irq, void *dev_id)
if (status & NM_MISC_INT_1) { if (status & NM_MISC_INT_1) {
status &= ~NM_MISC_INT_1; status &= ~NM_MISC_INT_1;
NM_ACK_INT(chip, NM_MISC_INT_1); NM_ACK_INT(chip, NM_MISC_INT_1);
snd_printd("NM256: Got misc interrupt #1\n"); dev_dbg(chip->card->dev, "NM256: Got misc interrupt #1\n");
snd_nm256_writew(chip, NM_INT_REG, 0x8000); snd_nm256_writew(chip, NM_INT_REG, 0x8000);
cbyte = snd_nm256_readb(chip, 0x400); cbyte = snd_nm256_readb(chip, 0x400);
snd_nm256_writeb(chip, 0x400, cbyte | 2); snd_nm256_writeb(chip, 0x400, cbyte | 2);
...@@ -1048,14 +1051,15 @@ snd_nm256_interrupt(int irq, void *dev_id) ...@@ -1048,14 +1051,15 @@ snd_nm256_interrupt(int irq, void *dev_id)
if (status & NM_MISC_INT_2) { if (status & NM_MISC_INT_2) {
status &= ~NM_MISC_INT_2; status &= ~NM_MISC_INT_2;
NM_ACK_INT(chip, NM_MISC_INT_2); NM_ACK_INT(chip, NM_MISC_INT_2);
snd_printd("NM256: Got misc interrupt #2\n"); dev_dbg(chip->card->dev, "NM256: Got misc interrupt #2\n");
cbyte = snd_nm256_readb(chip, 0x400); cbyte = snd_nm256_readb(chip, 0x400);
snd_nm256_writeb(chip, 0x400, cbyte & ~2); snd_nm256_writeb(chip, 0x400, cbyte & ~2);
} }
/* Unknown interrupt. */ /* Unknown interrupt. */
if (status) { if (status) {
snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n", dev_dbg(chip->card->dev,
"NM256: Fire in the hole! Unknown status 0x%x\n",
status); status);
/* Pray. */ /* Pray. */
NM_ACK_INT(chip, status); NM_ACK_INT(chip, status);
...@@ -1104,7 +1108,7 @@ snd_nm256_interrupt_zx(int irq, void *dev_id) ...@@ -1104,7 +1108,7 @@ snd_nm256_interrupt_zx(int irq, void *dev_id)
if (status & NM2_MISC_INT_1) { if (status & NM2_MISC_INT_1) {
status &= ~NM2_MISC_INT_1; status &= ~NM2_MISC_INT_1;
NM2_ACK_INT(chip, NM2_MISC_INT_1); NM2_ACK_INT(chip, NM2_MISC_INT_1);
snd_printd("NM256: Got misc interrupt #1\n"); dev_dbg(chip->card->dev, "NM256: Got misc interrupt #1\n");
cbyte = snd_nm256_readb(chip, 0x400); cbyte = snd_nm256_readb(chip, 0x400);
snd_nm256_writeb(chip, 0x400, cbyte | 2); snd_nm256_writeb(chip, 0x400, cbyte | 2);
} }
...@@ -1112,14 +1116,15 @@ snd_nm256_interrupt_zx(int irq, void *dev_id) ...@@ -1112,14 +1116,15 @@ snd_nm256_interrupt_zx(int irq, void *dev_id)
if (status & NM2_MISC_INT_2) { if (status & NM2_MISC_INT_2) {
status &= ~NM2_MISC_INT_2; status &= ~NM2_MISC_INT_2;
NM2_ACK_INT(chip, NM2_MISC_INT_2); NM2_ACK_INT(chip, NM2_MISC_INT_2);
snd_printd("NM256: Got misc interrupt #2\n"); dev_dbg(chip->card->dev, "NM256: Got misc interrupt #2\n");
cbyte = snd_nm256_readb(chip, 0x400); cbyte = snd_nm256_readb(chip, 0x400);
snd_nm256_writeb(chip, 0x400, cbyte & ~2); snd_nm256_writeb(chip, 0x400, cbyte & ~2);
} }
/* Unknown interrupt. */ /* Unknown interrupt. */
if (status) { if (status) {
snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n", dev_dbg(chip->card->dev,
"NM256: Fire in the hole! Unknown status 0x%x\n",
status); status);
/* Pray. */ /* Pray. */
NM2_ACK_INT(chip, status); NM2_ACK_INT(chip, status);
...@@ -1245,7 +1250,7 @@ snd_nm256_ac97_write(struct snd_ac97 *ac97, ...@@ -1245,7 +1250,7 @@ snd_nm256_ac97_write(struct snd_ac97 *ac97,
return; return;
} }
} }
snd_printd("nm256: ac97 codec not ready..\n"); dev_dbg(chip->card->dev, "nm256: ac97 codec not ready..\n");
} }
/* static resolution table */ /* static resolution table */
...@@ -1347,7 +1352,8 @@ snd_nm256_peek_for_sig(struct nm256 *chip) ...@@ -1347,7 +1352,8 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16); temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16);
if (temp == NULL) { if (temp == NULL) {
snd_printk(KERN_ERR "Unable to scan for card signature in video RAM\n"); dev_err(chip->card->dev,
"Unable to scan for card signature in video RAM\n");
return -EBUSY; return -EBUSY;
} }
...@@ -1361,12 +1367,14 @@ snd_nm256_peek_for_sig(struct nm256 *chip) ...@@ -1361,12 +1367,14 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
if (pointer == 0xffffffff || if (pointer == 0xffffffff ||
pointer < chip->buffer_size || pointer < chip->buffer_size ||
pointer > chip->buffer_end) { pointer > chip->buffer_end) {
snd_printk(KERN_ERR "invalid signature found: 0x%x\n", pointer); dev_err(chip->card->dev,
"invalid signature found: 0x%x\n", pointer);
iounmap(temp); iounmap(temp);
return -ENODEV; return -ENODEV;
} else { } else {
pointer_found = pointer; pointer_found = pointer;
printk(KERN_INFO "nm256: found card signature in video RAM: 0x%x\n", dev_info(chip->card->dev,
"found card signature in video RAM: 0x%x\n",
pointer); pointer);
} }
} }
...@@ -1411,8 +1419,7 @@ static int nm256_resume(struct device *dev) ...@@ -1411,8 +1419,7 @@ static int nm256_resume(struct device *dev)
pci_set_power_state(pci, PCI_D0); pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci); pci_restore_state(pci);
if (pci_enable_device(pci) < 0) { if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "nm256: pci_enable_device failed, " dev_err(dev, "pci_enable_device failed, disabling device\n");
"disabling device\n");
snd_card_disconnect(card); snd_card_disconnect(card);
return -EIO; return -EIO;
} }
...@@ -1520,14 +1527,15 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1520,14 +1527,15 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE, chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE,
card->driver); card->driver);
if (chip->res_cport == NULL) { if (chip->res_cport == NULL) {
snd_printk(KERN_ERR "memory region 0x%lx (size 0x%x) busy\n", dev_err(card->dev, "memory region 0x%lx (size 0x%x) busy\n",
chip->cport_addr, NM_PORT2_SIZE); chip->cport_addr, NM_PORT2_SIZE);
err = -EBUSY; err = -EBUSY;
goto __error; goto __error;
} }
chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE); chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE);
if (chip->cport == NULL) { if (chip->cport == NULL) {
snd_printk(KERN_ERR "unable to map control port %lx\n", chip->cport_addr); dev_err(card->dev, "unable to map control port %lx\n",
chip->cport_addr);
err = -ENOMEM; err = -ENOMEM;
goto __error; goto __error;
} }
...@@ -1537,12 +1545,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1537,12 +1545,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE);
if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) {
if (! force_ac97) { if (! force_ac97) {
printk(KERN_ERR "nm256: no ac97 is found!\n"); dev_err(card->dev,
printk(KERN_ERR " force the driver to load by " "no ac97 is found!\n");
"passing in the module parameter\n"); dev_err(card->dev,
printk(KERN_ERR " force_ac97=1\n"); "force the driver to load by passing in the module parameter\n");
printk(KERN_ERR " or try sb16, opl3sa2, or " dev_err(card->dev,
"cs423x drivers instead.\n"); " force_ac97=1\n");
dev_err(card->dev,
"or try sb16, opl3sa2, or cs423x drivers instead.\n");
err = -ENXIO; err = -ENXIO;
goto __error; goto __error;
} }
...@@ -1581,14 +1591,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1581,14 +1591,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
chip->buffer_start = chip->buffer_end - chip->buffer_size; chip->buffer_start = chip->buffer_end - chip->buffer_size;
chip->buffer_addr += chip->buffer_start; chip->buffer_addr += chip->buffer_start;
printk(KERN_INFO "nm256: Mapping port 1 from 0x%x - 0x%x\n", dev_info(card->dev, "Mapping port 1 from 0x%x - 0x%x\n",
chip->buffer_start, chip->buffer_end); chip->buffer_start, chip->buffer_end);
chip->res_buffer = request_mem_region(chip->buffer_addr, chip->res_buffer = request_mem_region(chip->buffer_addr,
chip->buffer_size, chip->buffer_size,
card->driver); card->driver);
if (chip->res_buffer == NULL) { if (chip->res_buffer == NULL) {
snd_printk(KERN_ERR "nm256: buffer 0x%lx (size 0x%x) busy\n", dev_err(card->dev, "buffer 0x%lx (size 0x%x) busy\n",
chip->buffer_addr, chip->buffer_size); chip->buffer_addr, chip->buffer_size);
err = -EBUSY; err = -EBUSY;
goto __error; goto __error;
...@@ -1596,7 +1606,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1596,7 +1606,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size); chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size);
if (chip->buffer == NULL) { if (chip->buffer == NULL) {
err = -ENOMEM; err = -ENOMEM;
snd_printk(KERN_ERR "unable to map ring buffer at %lx\n", chip->buffer_addr); dev_err(card->dev, "unable to map ring buffer at %lx\n",
chip->buffer_addr);
goto __error; goto __error;
} }
...@@ -1658,12 +1669,12 @@ static int snd_nm256_probe(struct pci_dev *pci, ...@@ -1658,12 +1669,12 @@ static int snd_nm256_probe(struct pci_dev *pci,
q = snd_pci_quirk_lookup(pci, nm256_quirks); q = snd_pci_quirk_lookup(pci, nm256_quirks);
if (q) { if (q) {
snd_printdd(KERN_INFO "nm256: Enabled quirk for %s.\n", dev_dbg(&pci->dev, "Enabled quirk for %s.\n",
snd_pci_quirk_name(q)); snd_pci_quirk_name(q));
switch (q->value) { switch (q->value) {
case NM_BLACKLISTED: case NM_BLACKLISTED:
printk(KERN_INFO "nm256: The device is blacklisted. " dev_info(&pci->dev,
"Loading stopped\n"); "The device is blacklisted. Loading stopped\n");
return -ENODEV; return -ENODEV;
case NM_RESET_WORKAROUND_2: case NM_RESET_WORKAROUND_2:
reset_workaround_2 = 1; reset_workaround_2 = 1;
...@@ -1689,7 +1700,7 @@ static int snd_nm256_probe(struct pci_dev *pci, ...@@ -1689,7 +1700,7 @@ static int snd_nm256_probe(struct pci_dev *pci,
strcpy(card->driver, "NM256XL+"); strcpy(card->driver, "NM256XL+");
break; break;
default: default:
snd_printk(KERN_ERR "invalid device id 0x%x\n", pci->device); dev_err(&pci->dev, "invalid device id 0x%x\n", pci->device);
snd_card_free(card); snd_card_free(card);
return -EINVAL; return -EINVAL;
} }
...@@ -1712,12 +1723,12 @@ static int snd_nm256_probe(struct pci_dev *pci, ...@@ -1712,12 +1723,12 @@ static int snd_nm256_probe(struct pci_dev *pci,
card->private_data = chip; card->private_data = chip;
if (reset_workaround) { if (reset_workaround) {
snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); dev_dbg(&pci->dev, "reset_workaround activated\n");
chip->reset_workaround = 1; chip->reset_workaround = 1;
} }
if (reset_workaround_2) { if (reset_workaround_2) {
snd_printdd(KERN_INFO "nm256: reset_workaround_2 activated\n"); dev_dbg(&pci->dev, "reset_workaround_2 activated\n");
chip->reset_workaround_2 = 1; chip->reset_workaround_2 = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment