Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH 23/54] ALSA: cs4236: Use standard print API
Date: Wed,  7 Aug 2024 15:34:13 +0200	[thread overview]
Message-ID: <20240807133452.9424-24-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/isa/cs423x/cs4236.c     | 31 ++++++++++---------
 sound/isa/cs423x/cs4236_lib.c | 56 +++++++++++++++++------------------
 2 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 7226cbf2d7de..ad20bb2649bd 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -204,7 +204,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids);
 static int snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
 {
 	if (pnp_activate_dev(pdev) < 0) {
-		printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n");
+		dev_err(&pdev->dev, IDENT " WSS PnP configure failed for WSS (out of resources?)\n");
 		return -EBUSY;
 	}
 	port[dev] = pnp_port_start(pdev, 0);
@@ -214,10 +214,12 @@ static int snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
 	irq[dev] = pnp_irq(pdev, 0);
 	dma1[dev] = pnp_dma(pdev, 0);
 	dma2[dev] = pnp_dma(pdev, 1) == 4 ? -1 : (int)pnp_dma(pdev, 1);
-	snd_printdd("isapnp WSS: wss port=0x%lx, fm port=0x%lx, sb port=0x%lx\n",
-			port[dev], fm_port[dev], sb_port[dev]);
-	snd_printdd("isapnp WSS: irq=%i, dma1=%i, dma2=%i\n",
-			irq[dev], dma1[dev], dma2[dev]);
+	dev_dbg(&pdev->dev,
+		"isapnp WSS: wss port=0x%lx, fm port=0x%lx, sb port=0x%lx\n",
+		port[dev], fm_port[dev], sb_port[dev]);
+	dev_dbg(&pdev->dev,
+		"isapnp WSS: irq=%i, dma1=%i, dma2=%i\n",
+		irq[dev], dma1[dev], dma2[dev]);
 	return 0;
 }
 
@@ -225,11 +227,11 @@ static int snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
 static int snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
 {
 	if (pnp_activate_dev(pdev) < 0) {
-		printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n");
+		dev_err(&pdev->dev, IDENT " CTRL PnP configure failed for WSS (out of resources?)\n");
 		return -EBUSY;
 	}
 	cport[dev] = pnp_port_start(pdev, 0);
-	snd_printdd("isapnp CTRL: control port=0x%lx\n", cport[dev]);
+	dev_dbg(&pdev->dev, "isapnp CTRL: control port=0x%lx\n", cport[dev]);
 	return 0;
 }
 
@@ -237,7 +239,7 @@ static int snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
 static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
 {
 	if (pnp_activate_dev(pdev) < 0) {
-		printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n");
+		dev_err(&pdev->dev, IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n");
 		mpu_port[dev] = SNDRV_AUTO_PORT;
 		mpu_irq[dev] = SNDRV_AUTO_IRQ;
 	} else {
@@ -250,7 +252,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
 			mpu_irq[dev] = -1;	/* disable interrupt */
 		}
 	}
-	snd_printdd("isapnp MPU: port=0x%lx, irq=%i\n", mpu_port[dev], mpu_irq[dev]);
+	dev_dbg(&pdev->dev, "isapnp MPU: port=0x%lx, irq=%i\n", mpu_port[dev], mpu_irq[dev]);
 	return 0;
 }
 
@@ -333,7 +335,8 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
 	if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) {
 		if (!devm_request_region(card->dev, sb_port[dev], 16,
 					 IDENT " SB")) {
-			printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
+			dev_err(card->dev, IDENT ": unable to register SB port at 0x%lx\n",
+				sb_port[dev]);
 			return -EBUSY;
 		}
 	}
@@ -384,7 +387,7 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
 		if (snd_opl3_create(card,
 				    fm_port[dev], fm_port[dev] + 2,
 				    OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
-			printk(KERN_WARNING IDENT ": OPL3 not detected\n");
+			dev_warn(card->dev, IDENT ": OPL3 not detected\n");
 		} else {
 			err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
 			if (err < 0)
@@ -398,7 +401,7 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
 		if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
 					mpu_port[dev], 0,
 					mpu_irq[dev], NULL) < 0)
-			printk(KERN_WARNING IDENT ": MPU401 not detected\n");
+			dev_warn(card->dev, IDENT ": MPU401 not detected\n");
 	}
 
 	return snd_card_register(card);
@@ -521,7 +524,7 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
 		return err;
 	err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev);
 	if (err < 0) {
-		printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n");
+		dev_err(card->dev, "PnP BIOS detection failed for " IDENT "\n");
 		return err;
 	}
 	err = snd_cs423x_probe(card, dev);
@@ -573,7 +576,7 @@ static int snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
 		return res;
 	res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid);
 	if (res < 0) {
-		printk(KERN_ERR "isapnp detection failed and probing for " IDENT
+		dev_err(card->dev, "isapnp detection failed and probing for " IDENT
 		       " is not supported\n");
 		return res;
 	}
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index 35f25911adcf..1a03cff6915b 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -279,8 +279,8 @@ int snd_cs4236_create(struct snd_card *card,
 		return err;
 
 	if ((chip->hardware & WSS_HW_CS4236B_MASK) == 0) {
-		snd_printd("chip is not CS4236+, hardware=0x%x\n",
-			   chip->hardware);
+		dev_dbg(card->dev, "chip is not CS4236+, hardware=0x%x\n",
+			chip->hardware);
 		*rchip = chip;
 		return 0;
 	}
@@ -288,25 +288,25 @@ int snd_cs4236_create(struct snd_card *card,
 	{
 		int idx;
 		for (idx = 0; idx < 8; idx++)
-			snd_printk(KERN_DEBUG "CD%i = 0x%x\n",
-				   idx, inb(chip->cport + idx));
+			dev_dbg(card->dev, "CD%i = 0x%x\n",
+				idx, inb(chip->cport + idx));
 		for (idx = 0; idx < 9; idx++)
-			snd_printk(KERN_DEBUG "C%i = 0x%x\n",
-				   idx, snd_cs4236_ctrl_in(chip, idx));
+			dev_dbg(card->dev, "C%i = 0x%x\n",
+				idx, snd_cs4236_ctrl_in(chip, idx));
 	}
 #endif
 	if (cport < 0x100 || cport == SNDRV_AUTO_PORT) {
-		snd_printk(KERN_ERR "please, specify control port "
-			   "for CS4236+ chips\n");
+		dev_err(card->dev, "please, specify control port for CS4236+ chips\n");
 		return -ENODEV;
 	}
 	ver1 = snd_cs4236_ctrl_in(chip, 1);
 	ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION);
-	snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n",
-			cport, ver1, ver2);
+	dev_dbg(card->dev, "CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n",
+		cport, ver1, ver2);
 	if (ver1 != ver2) {
-		snd_printk(KERN_ERR "CS4236+ chip detected, but "
-			   "control port 0x%lx is not valid\n", cport);
+		dev_err(card->dev,
+			"CS4236+ chip detected, but control port 0x%lx is not valid\n",
+			cport);
 		return -ENODEV;
 	}
 	snd_cs4236_ctrl_out(chip, 0, 0x00);
@@ -934,14 +934,14 @@ static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
 	spin_lock_irqsave(&chip->reg_lock, flags);
 	ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0;
 #if 0
-	printk(KERN_DEBUG "get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, "
-	       "C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
-			snd_wss_in(chip, CS4231_ALT_FEATURE_1),
-			snd_cs4236_ctrl_in(chip, 3),
-			snd_cs4236_ctrl_in(chip, 4),
-			snd_cs4236_ctrl_in(chip, 5),
-			snd_cs4236_ctrl_in(chip, 6),
-			snd_cs4236_ctrl_in(chip, 8));
+	dev_dbg(chip->card->dev,
+		"get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
+		snd_wss_in(chip, CS4231_ALT_FEATURE_1),
+		snd_cs4236_ctrl_in(chip, 3),
+		snd_cs4236_ctrl_in(chip, 4),
+		snd_cs4236_ctrl_in(chip, 5),
+		snd_cs4236_ctrl_in(chip, 6),
+		snd_cs4236_ctrl_in(chip, 8));
 #endif
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	return 0;
@@ -972,14 +972,14 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
 	mutex_unlock(&chip->mce_mutex);
 
 #if 0
-	printk(KERN_DEBUG "set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, "
-	       "C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
-			snd_wss_in(chip, CS4231_ALT_FEATURE_1),
-			snd_cs4236_ctrl_in(chip, 3),
-			snd_cs4236_ctrl_in(chip, 4),
-			snd_cs4236_ctrl_in(chip, 5),
-			snd_cs4236_ctrl_in(chip, 6),
-			snd_cs4236_ctrl_in(chip, 8));
+	dev_dbg(chip->card->dev,
+		"set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
+		snd_wss_in(chip, CS4231_ALT_FEATURE_1),
+		snd_cs4236_ctrl_in(chip, 3),
+		snd_cs4236_ctrl_in(chip, 4),
+		snd_cs4236_ctrl_in(chip, 5),
+		snd_cs4236_ctrl_in(chip, 6),
+		snd_cs4236_ctrl_in(chip, 8));
 #endif
 	return change;
 }
-- 
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 ` Takashi Iwai [this message]
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 ` [PATCH 48/54] ALSA: pdaudiocf: " Takashi Iwai
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-24-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