[alsa-devel] [PATCH 09/48] ALSA: bt87x: Use standard printk helpers

Takashi Iwai tiwai at suse.de
Wed Feb 26 16:53:11 CET 2014


Convert with dev_err() and co from snd_printk(), etc.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/pci/bt87x.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 06dc7d97cc0c..8546711d12f9 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -293,17 +293,23 @@ static void snd_bt87x_pci_error(struct snd_bt87x *chip, unsigned int status)
 		PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY;
 	pci_write_config_word(chip->pci, PCI_STATUS, pci_status);
 	if (pci_status != PCI_STATUS_DETECTED_PARITY)
-		snd_printk(KERN_ERR "Aieee - PCI error! status %#08x, PCI status %#04x\n",
+		dev_err(chip->card->dev,
+			"Aieee - PCI error! status %#08x, PCI status %#04x\n",
 			   status & ERROR_INTERRUPTS, pci_status);
 	else {
-		snd_printk(KERN_ERR "Aieee - PCI parity error detected!\n");
+		dev_err(chip->card->dev,
+			"Aieee - PCI parity error detected!\n");
 		/* error 'handling' similar to aic7xxx_pci.c: */
 		chip->pci_parity_errors++;
 		if (chip->pci_parity_errors > 20) {
-			snd_printk(KERN_ERR "Too many PCI parity errors observed.\n");
-			snd_printk(KERN_ERR "Some device on this bus is generating bad parity.\n");
-			snd_printk(KERN_ERR "This is an error *observed by*, not *generated by*, this card.\n");
-			snd_printk(KERN_ERR "PCI parity error checking has been disabled.\n");
+			dev_err(chip->card->dev,
+				"Too many PCI parity errors observed.\n");
+			dev_err(chip->card->dev,
+				"Some device on this bus is generating bad parity.\n");
+			dev_err(chip->card->dev,
+				"This is an error *observed by*, not *generated by*, this card.\n");
+			dev_err(chip->card->dev,
+				"PCI parity error checking has been disabled.\n");
 			chip->interrupt_mask &= ~(INT_PPERR | INT_RIPERR);
 			snd_bt87x_writel(chip, REG_INT_MASK, chip->interrupt_mask);
 		}
@@ -323,9 +329,11 @@ static irqreturn_t snd_bt87x_interrupt(int irq, void *dev_id)
 
 	if (irq_status & ERROR_INTERRUPTS) {
 		if (irq_status & (INT_FBUS | INT_FTRGT))
-			snd_printk(KERN_WARNING "FIFO overrun, status %#08x\n", status);
+			dev_warn(chip->card->dev,
+				 "FIFO overrun, status %#08x\n", status);
 		if (irq_status & INT_OCERR)
-			snd_printk(KERN_ERR "internal RISC error, status %#08x\n", status);
+			dev_err(chip->card->dev,
+				"internal RISC error, status %#08x\n", status);
 		if (irq_status & (INT_PPERR | INT_RIPERR | INT_PABORT))
 			snd_bt87x_pci_error(chip, irq_status);
 	}
@@ -747,7 +755,7 @@ static int snd_bt87x_create(struct snd_card *card,
 	}
 	chip->mmio = pci_ioremap_bar(pci, 0);
 	if (!chip->mmio) {
-		snd_printk(KERN_ERR "cannot remap io memory\n");
+		dev_err(card->dev, "cannot remap io memory\n");
 		err = -ENOMEM;
 		goto fail;
 	}
@@ -762,7 +770,7 @@ static int snd_bt87x_create(struct snd_card *card,
 	err = request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED,
 			  KBUILD_MODNAME, chip);
 	if (err < 0) {
-		snd_printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
+		dev_err(card->dev, "cannot grab irq %d\n", pci->irq);
 		goto fail;
 	}
 	chip->irq = pci->irq;
@@ -850,14 +858,15 @@ static int snd_bt87x_detect_card(struct pci_dev *pci)
 	for (i = 0; i < ARRAY_SIZE(blacklist); ++i)
 		if (blacklist[i].subvendor == pci->subsystem_vendor &&
 		    blacklist[i].subdevice == pci->subsystem_device) {
-			snd_printdd(KERN_INFO "card %#04x-%#04x:%#04x has no audio\n",
+			dev_dbg(&pci->dev,
+				"card %#04x-%#04x:%#04x has no audio\n",
 				    pci->device, pci->subsystem_vendor, pci->subsystem_device);
 			return -EBUSY;
 		}
 
-	snd_printk(KERN_INFO "unknown card %#04x-%#04x:%#04x\n",
+	dev_info(&pci->dev, "unknown card %#04x-%#04x:%#04x\n",
 		   pci->device, pci->subsystem_vendor, pci->subsystem_device);
-	snd_printk(KERN_DEBUG "please mail id, board name, and, "
+	dev_info(&pci->dev, "please mail id, board name, and, "
 		   "if it works, the correct digital_rate option to "
 		   "<alsa-devel at alsa-project.org>\n");
 	return SND_BT87X_BOARD_UNKNOWN;
@@ -925,7 +934,7 @@ static int snd_bt87x_probe(struct pci_dev *pci,
 		if (err < 0)
 			goto _error;
 	}
-	snd_printk(KERN_INFO "bt87x%d: Using board %d, %sanalog, %sdigital "
+	dev_info(card->dev, "bt87x%d: Using board %d, %sanalog, %sdigital "
 		   "(rate %d Hz)\n", dev, boardid,
 		   chip->board.no_analog ? "no " : "",
 		   chip->board.no_digital ? "no " : "", chip->board.dig_rate);
-- 
1.9.0



More information about the Alsa-devel mailing list