ALSA: cs4236: Use standard print API

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.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-24-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2024-08-07 15:34:13 +02:00
parent 6aa5cb8540
commit 257d0c813b
2 changed files with 45 additions and 42 deletions

View File

@ -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) static int snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
{ {
if (pnp_activate_dev(pdev) < 0) { 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; return -EBUSY;
} }
port[dev] = pnp_port_start(pdev, 0); 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); irq[dev] = pnp_irq(pdev, 0);
dma1[dev] = pnp_dma(pdev, 0); dma1[dev] = pnp_dma(pdev, 0);
dma2[dev] = pnp_dma(pdev, 1) == 4 ? -1 : (int)pnp_dma(pdev, 1); 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", dev_dbg(&pdev->dev,
port[dev], fm_port[dev], sb_port[dev]); "isapnp WSS: wss port=0x%lx, fm port=0x%lx, sb port=0x%lx\n",
snd_printdd("isapnp WSS: irq=%i, dma1=%i, dma2=%i\n", port[dev], fm_port[dev], sb_port[dev]);
irq[dev], dma1[dev], dma2[dev]); dev_dbg(&pdev->dev,
"isapnp WSS: irq=%i, dma1=%i, dma2=%i\n",
irq[dev], dma1[dev], dma2[dev]);
return 0; 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) static int snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
{ {
if (pnp_activate_dev(pdev) < 0) { 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; return -EBUSY;
} }
cport[dev] = pnp_port_start(pdev, 0); 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; 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) static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
{ {
if (pnp_activate_dev(pdev) < 0) { 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_port[dev] = SNDRV_AUTO_PORT;
mpu_irq[dev] = SNDRV_AUTO_IRQ; mpu_irq[dev] = SNDRV_AUTO_IRQ;
} else { } else {
@ -250,7 +252,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
mpu_irq[dev] = -1; /* disable interrupt */ 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; 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 (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) {
if (!devm_request_region(card->dev, sb_port[dev], 16, if (!devm_request_region(card->dev, sb_port[dev], 16,
IDENT " SB")) { 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; return -EBUSY;
} }
} }
@ -384,7 +387,7 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
if (snd_opl3_create(card, if (snd_opl3_create(card,
fm_port[dev], fm_port[dev] + 2, fm_port[dev], fm_port[dev] + 2,
OPL3_HW_OPL3_CS, 0, &opl3) < 0) { 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 { } else {
err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (err < 0) 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, if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
mpu_port[dev], 0, mpu_port[dev], 0,
mpu_irq[dev], NULL) < 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); return snd_card_register(card);
@ -521,7 +524,7 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
return err; return err;
err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev); err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev);
if (err < 0) { 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; return err;
} }
err = snd_cs423x_probe(card, dev); err = snd_cs423x_probe(card, dev);
@ -573,7 +576,7 @@ static int snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
return res; return res;
res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid); res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid);
if (res < 0) { 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"); " is not supported\n");
return res; return res;
} }

View File

@ -279,8 +279,8 @@ int snd_cs4236_create(struct snd_card *card,
return err; return err;
if ((chip->hardware & WSS_HW_CS4236B_MASK) == 0) { if ((chip->hardware & WSS_HW_CS4236B_MASK) == 0) {
snd_printd("chip is not CS4236+, hardware=0x%x\n", dev_dbg(card->dev, "chip is not CS4236+, hardware=0x%x\n",
chip->hardware); chip->hardware);
*rchip = chip; *rchip = chip;
return 0; return 0;
} }
@ -288,25 +288,25 @@ int snd_cs4236_create(struct snd_card *card,
{ {
int idx; int idx;
for (idx = 0; idx < 8; idx++) for (idx = 0; idx < 8; idx++)
snd_printk(KERN_DEBUG "CD%i = 0x%x\n", dev_dbg(card->dev, "CD%i = 0x%x\n",
idx, inb(chip->cport + idx)); idx, inb(chip->cport + idx));
for (idx = 0; idx < 9; idx++) for (idx = 0; idx < 9; idx++)
snd_printk(KERN_DEBUG "C%i = 0x%x\n", dev_dbg(card->dev, "C%i = 0x%x\n",
idx, snd_cs4236_ctrl_in(chip, idx)); idx, snd_cs4236_ctrl_in(chip, idx));
} }
#endif #endif
if (cport < 0x100 || cport == SNDRV_AUTO_PORT) { if (cport < 0x100 || cport == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR "please, specify control port " dev_err(card->dev, "please, specify control port for CS4236+ chips\n");
"for CS4236+ chips\n");
return -ENODEV; return -ENODEV;
} }
ver1 = snd_cs4236_ctrl_in(chip, 1); ver1 = snd_cs4236_ctrl_in(chip, 1);
ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION); ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION);
snd_printdd("CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n", dev_dbg(card->dev, "CS4236: [0x%lx] C1 (version) = 0x%x, ext = 0x%x\n",
cport, ver1, ver2); cport, ver1, ver2);
if (ver1 != ver2) { if (ver1 != ver2) {
snd_printk(KERN_ERR "CS4236+ chip detected, but " dev_err(card->dev,
"control port 0x%lx is not valid\n", cport); "CS4236+ chip detected, but control port 0x%lx is not valid\n",
cport);
return -ENODEV; return -ENODEV;
} }
snd_cs4236_ctrl_out(chip, 0, 0x00); 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); spin_lock_irqsave(&chip->reg_lock, flags);
ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0; ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0;
#if 0 #if 0
printk(KERN_DEBUG "get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, " dev_dbg(chip->card->dev,
"C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", "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_wss_in(chip, CS4231_ALT_FEATURE_1),
snd_cs4236_ctrl_in(chip, 3), snd_cs4236_ctrl_in(chip, 3),
snd_cs4236_ctrl_in(chip, 4), snd_cs4236_ctrl_in(chip, 4),
snd_cs4236_ctrl_in(chip, 5), snd_cs4236_ctrl_in(chip, 5),
snd_cs4236_ctrl_in(chip, 6), snd_cs4236_ctrl_in(chip, 6),
snd_cs4236_ctrl_in(chip, 8)); snd_cs4236_ctrl_in(chip, 8));
#endif #endif
spin_unlock_irqrestore(&chip->reg_lock, flags); spin_unlock_irqrestore(&chip->reg_lock, flags);
return 0; return 0;
@ -972,14 +972,14 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
mutex_unlock(&chip->mce_mutex); mutex_unlock(&chip->mce_mutex);
#if 0 #if 0
printk(KERN_DEBUG "set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, " dev_dbg(chip->card->dev,
"C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", "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_wss_in(chip, CS4231_ALT_FEATURE_1),
snd_cs4236_ctrl_in(chip, 3), snd_cs4236_ctrl_in(chip, 3),
snd_cs4236_ctrl_in(chip, 4), snd_cs4236_ctrl_in(chip, 4),
snd_cs4236_ctrl_in(chip, 5), snd_cs4236_ctrl_in(chip, 5),
snd_cs4236_ctrl_in(chip, 6), snd_cs4236_ctrl_in(chip, 6),
snd_cs4236_ctrl_in(chip, 8)); snd_cs4236_ctrl_in(chip, 8));
#endif #endif
return change; return change;
} }