Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH 48/54] ALSA: pdaudiocf: Use standard print API
Date: Wed,  7 Aug 2024 15:34:38 +0200	[thread overview]
Message-ID: <20240807133452.9424-49-tiwai@suse.de> (raw)
In-Reply-To: <20240807133452.9424-1-tiwai@suse.de>

Use the standard print API with dev_*() instead of the old house-baked
one.  It gives better information and allows dynamically control of
debug prints.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pcmcia/pdaudiocf/pdaudiocf.c      | 21 ++++-----------
 sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 36 ++++++++++++-------------
 sound/pcmcia/pdaudiocf/pdaudiocf_irq.c  |  3 +--
 3 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 8363ec08df5d..494460746614 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -85,14 +85,13 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
 		.dev_free =	snd_pdacf_dev_free,
 	};
 
-	snd_printdd(KERN_DEBUG "pdacf_attach called\n");
 	/* find an empty slot from the card list */
 	for (i = 0; i < SNDRV_CARDS; i++) {
 		if (! card_list[i])
 			break;
 	}
 	if (i >= SNDRV_CARDS) {
-		snd_printk(KERN_ERR "pdacf: too many cards found\n");
+		dev_err(&link->dev, "pdacf: too many cards found\n");
 		return -EINVAL;
 	}
 	if (! enable[i])
@@ -102,7 +101,7 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
 	err = snd_card_new(&link->dev, index[i], id[i], THIS_MODULE,
 			   0, &card);
 	if (err < 0) {
-		snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
+		dev_err(&link->dev, "pdacf: cannot create a card instance\n");
 		return err;
 	}
 
@@ -152,7 +151,7 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq
 	int err;
 	struct snd_card *card = pdacf->card;
 
-	snd_printdd(KERN_DEBUG "pdacf assign resources: port = 0x%x, irq = %d\n", port, irq);
+	dev_dbg(card->dev, "pdacf assign resources: port = 0x%x, irq = %d\n", port, irq);
 	pdacf->port = port;
 	pdacf->irq = irq;
 	pdacf->chip_status |= PDAUDIOCF_STAT_IS_CONFIGURED;
@@ -185,8 +184,6 @@ static void snd_pdacf_detach(struct pcmcia_device *link)
 {
 	struct snd_pdacf *chip = link->priv;
 
-	snd_printdd(KERN_DEBUG "pdacf_detach called\n");
-
 	if (chip->chip_status & PDAUDIOCF_STAT_IS_CONFIGURED)
 		snd_pdacf_powerdown(chip);
 	chip->chip_status |= PDAUDIOCF_STAT_IS_STALE; /* to be sure */
@@ -203,7 +200,6 @@ static int pdacf_config(struct pcmcia_device *link)
 	struct snd_pdacf *pdacf = link->priv;
 	int ret;
 
-	snd_printdd(KERN_DEBUG "pdacf_config called\n");
 	link->config_index = 0x5;
 	link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
 
@@ -241,11 +237,8 @@ static int pdacf_suspend(struct pcmcia_device *link)
 {
 	struct snd_pdacf *chip = link->priv;
 
-	snd_printdd(KERN_DEBUG "SUSPEND\n");
-	if (chip) {
-		snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
+	if (chip)
 		snd_pdacf_suspend(chip);
-	}
 
 	return 0;
 }
@@ -254,14 +247,10 @@ static int pdacf_resume(struct pcmcia_device *link)
 {
 	struct snd_pdacf *chip = link->priv;
 
-	snd_printdd(KERN_DEBUG "RESUME\n");
 	if (pcmcia_dev_present(link)) {
-		if (chip) {
-			snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
+		if (chip)
 			snd_pdacf_resume(chip);
-		}
 	}
-	snd_printdd(KERN_DEBUG "resume done!\n");
 
 	return 0;
 }
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
index 5537c0882aa5..11aacc7e3f0b 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
@@ -28,7 +28,7 @@ static unsigned char pdacf_ak4117_read(void *private_data, unsigned char reg)
 		udelay(5);
 		if (--timeout == 0) {
 			spin_unlock_irqrestore(&chip->ak4117_lock, flags);
-			snd_printk(KERN_ERR "AK4117 ready timeout (read)\n");
+			dev_err(chip->card->dev, "AK4117 ready timeout (read)\n");
 			return 0;
 		}
 	}
@@ -38,7 +38,7 @@ static unsigned char pdacf_ak4117_read(void *private_data, unsigned char reg)
 		udelay(5);
 		if (--timeout == 0) {
 			spin_unlock_irqrestore(&chip->ak4117_lock, flags);
-			snd_printk(KERN_ERR "AK4117 read timeout (read2)\n");
+			dev_err(chip->card->dev, "AK4117 read timeout (read2)\n");
 			return 0;
 		}
 	}
@@ -59,7 +59,7 @@ static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned c
 		udelay(5);
 		if (--timeout == 0) {
 			spin_unlock_irqrestore(&chip->ak4117_lock, flags);
-			snd_printk(KERN_ERR "AK4117 ready timeout (write)\n");
+			dev_err(chip->card->dev, "AK4117 ready timeout (write)\n");
 			return;
 		}
 	}
@@ -70,21 +70,21 @@ static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned c
 #if 0
 void pdacf_dump(struct snd_pdacf *chip)
 {
-	printk(KERN_DEBUG "PDAUDIOCF DUMP (0x%lx):\n", chip->port);
-	printk(KERN_DEBUG "WPD         : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_WDP));
-	printk(KERN_DEBUG "RDP         : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_RDP));
-	printk(KERN_DEBUG "TCR         : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_TCR));
-	printk(KERN_DEBUG "SCR         : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_SCR));
-	printk(KERN_DEBUG "ISR         : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_ISR));
-	printk(KERN_DEBUG "IER         : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_IER));
-	printk(KERN_DEBUG "AK_IFR      : 0x%x\n",
-	       inw(chip->port + PDAUDIOCF_REG_AK_IFR));
+	dev_dbg(chip->card->dev, "PDAUDIOCF DUMP (0x%lx):\n", chip->port);
+	dev_dbg(chip->card->dev, "WPD         : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_WDP));
+	dev_dbg(chip->card->dev, "RDP         : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_RDP));
+	dev_dbg(chip->card->dev, "TCR         : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_TCR));
+	dev_dbg(chip->card->dev, "SCR         : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_SCR));
+	dev_dbg(chip->card->dev, "ISR         : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_ISR));
+	dev_dbg(chip->card->dev, "IER         : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_IER));
+	dev_dbg(chip->card->dev, "AK_IFR      : 0x%x\n",
+		inw(chip->port + PDAUDIOCF_REG_AK_IFR));
 }
 #endif
 
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
index f134b4a4622f..af40a2c8789a 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
@@ -27,7 +27,7 @@ irqreturn_t pdacf_interrupt(int irq, void *dev)
 	stat = inw(chip->port + PDAUDIOCF_REG_ISR);
 	if (stat & (PDAUDIOCF_IRQLVL|PDAUDIOCF_IRQOVR)) {
 		if (stat & PDAUDIOCF_IRQOVR)	/* should never happen */
-			snd_printk(KERN_ERR "PDAUDIOCF SRAM buffer overrun detected!\n");
+			dev_err(chip->card->dev, "PDAUDIOCF SRAM buffer overrun detected!\n");
 		if (chip->pcm_substream)
 			wake_thread = true;
 		if (!(stat & PDAUDIOCF_IRQAKM))
@@ -257,7 +257,6 @@ irqreturn_t pdacf_threaded_irq(int irq, void *dev)
 
 	rdp = inw(chip->port + PDAUDIOCF_REG_RDP);
 	wdp = inw(chip->port + PDAUDIOCF_REG_WDP);
-	/* printk(KERN_DEBUG "TASKLET: rdp = %x, wdp = %x\n", rdp, wdp); */
 	size = wdp - rdp;
 	if (size < 0)
 		size += 0x10000;
-- 
2.43.0


  parent reply	other threads:[~2024-08-07 13:34 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 13:33 [PATCH 00/54] ALSA: Drop legacy snd_print*() Takashi Iwai
2024-08-07 13:33 ` [PATCH 01/54] ALSA: portman2x4: Use standard print API Takashi Iwai
2024-08-07 13:33 ` [PATCH 02/54] ALSA: mts64: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 03/54] ALSA: mpu401: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 04/54] ALSA: mpu401_uart: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 05/54] ALSA: mtpav: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 06/54] ALSA: opl3: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 07/54] ALSA: opl4: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 08/54] ALSA: serial-u16550: " Takashi Iwai
2024-08-07 13:33 ` [PATCH 09/54] ALSA: virmidi: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 10/54] ALSA: vx_core: Drop unused dev field Takashi Iwai
2024-08-07 13:34 ` [PATCH 11/54] ALSA: vx_core: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 12/54] ALSA: aloop: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 13/54] ALSA: dummy: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 14/54] ALSA: pcsp: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 15/54] ALSA: i2c: cs8427: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 16/54] ALSA: i2c: pt2258: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 17/54] ALSA: i2c: Drop commented old debug prints Takashi Iwai
2024-08-07 13:34 ` [PATCH 18/54] ALSA: ad1816a: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 19/54] ALSA: als100: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 20/54] ALSA: azt2320: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 21/54] ALSA: cmi8328: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 22/54] ALSA: cmi8330: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 23/54] ALSA: cs4236: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 24/54] ALSA: es1688: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 25/54] ALSA: es18xx: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 26/54] ALSA: gus: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 27/54] ALSA: msnd: " Takashi Iwai
2024-08-08  6:43   ` Takashi Iwai
2024-08-07 13:34 ` [PATCH 28/54] ALSA: opl3sa2: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 29/54] ALSA: opti9xx: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 30/54] ALSA: sb: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 31/54] ALSA: control_led: Use dev_err() Takashi Iwai
2024-08-07 13:34 ` [PATCH 32/54] ALSA: pcm: oss: Use pr_debug() Takashi Iwai
2024-08-07 13:34 ` [PATCH 33/54] ALSA: sc6000: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 34/54] ALSA: sscape: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 35/54] ALSA: wavefront: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 36/54] ALSA: wss: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 37/54] ALSA: riptide: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 38/54] ALSA: korg1212: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 39/54] ALSA: lx6464es: Cleanup the print API usages Takashi Iwai
2024-08-07 13:34 ` [PATCH 40/54] ALSA: azt3328: Use pr_warn() Takashi Iwai
2024-08-07 13:34 ` [PATCH 41/54] ALSA: emu10k1: Use dev_warn() Takashi Iwai
2024-08-07 13:34 ` [PATCH 42/54] ALSA: trident: Use standard print API Takashi Iwai
2024-08-07 13:34 ` [PATCH 43/54] ALSA: emux: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 44/54] ALSA: usx2y: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 45/54] ALSA: usb-audio: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 46/54] ALSA: intel8x0: Drop unused snd_printd() calls Takashi Iwai
2024-08-07 13:34 ` [PATCH 47/54] ALSA: vxpocket: Use standard print API Takashi Iwai
2024-08-07 13:34 ` Takashi Iwai [this message]
2024-08-07 13:34 ` [PATCH 49/54] ALSA: ppc: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 50/54] ALSA: sh: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 51/54] ALSA: sparc: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 52/54] ALSA: asihpi: " Takashi Iwai
2024-08-07 13:34 ` [PATCH 53/54] ALSA: docs: Drop snd_print*() stuff Takashi Iwai
2024-08-07 13:34 ` [PATCH 54/54] ALSA: core: Drop snd_print stuff and co Takashi Iwai
2024-08-07 14:30 ` [PATCH 00/54] ALSA: Drop legacy snd_print*() Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240807133452.9424-49-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-sound@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox