Commit 40b15de3 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: opti9xx: 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.

The card pointer is stored in struct snd_opti9xx and snd_miro to be
referred for dev_*() calls.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-30-tiwai@suse.de
parent 764a55bb
......@@ -72,6 +72,7 @@
#define ACI_SET_EQ7 0x46 /* ... to Treble */
struct snd_miro_aci {
struct snd_card *card;
unsigned long aci_port;
int aci_vendor;
int aci_product;
......
This diff is collapsed.
......@@ -109,6 +109,7 @@ MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver.");
#endif /* OPTi93X */
struct snd_opti9xx {
struct snd_card *card;
unsigned short hardware;
unsigned char password;
char name[7];
......@@ -218,7 +219,7 @@ static int snd_opti9xx_init(struct snd_opti9xx *chip,
#endif /* OPTi93X */
default:
snd_printk(KERN_ERR "chip %d not supported\n", hardware);
dev_err(chip->card->dev, "chip %d not supported\n", hardware);
return -ENODEV;
}
return 0;
......@@ -261,7 +262,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip,
#endif /* OPTi93X */
default:
snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware);
dev_err(chip->card->dev, "chip %d not supported\n", chip->hardware);
}
spin_unlock_irqrestore(&chip->lock, flags);
......@@ -304,7 +305,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
#endif /* OPTi93X */
default:
snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware);
dev_err(chip->card->dev, "chip %d not supported\n", chip->hardware);
}
spin_unlock_irqrestore(&chip->lock, flags);
......@@ -400,7 +401,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
#endif /* OPTi93X */
default:
snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware);
dev_err(chip->card->dev, "chip %d not supported\n", chip->hardware);
return -EINVAL;
}
......@@ -423,7 +424,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
wss_base_bits = 0x02;
break;
default:
snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port);
dev_warn(chip->card->dev, "WSS port 0x%lx not valid\n", port);
goto __skip_base;
}
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30);
......@@ -448,7 +449,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
irq_bits = 0x04;
break;
default:
snd_printk(KERN_WARNING "WSS irq # %d not valid\n", irq);
dev_warn(chip->card->dev, "WSS irq # %d not valid\n", irq);
goto __skip_resources;
}
......@@ -463,13 +464,13 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
dma_bits = 0x03;
break;
default:
snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", dma1);
dev_warn(chip->card->dev, "WSS dma1 # %d not valid\n", dma1);
goto __skip_resources;
}
#if defined(CS4231) || defined(OPTi93X)
if (dma1 == dma2) {
snd_printk(KERN_ERR "don't want to share dmas\n");
dev_err(chip->card->dev, "don't want to share dmas\n");
return -EBUSY;
}
......@@ -478,7 +479,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
case 1:
break;
default:
snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", dma2);
dev_warn(chip->card->dev, "WSS dma2 # %d not valid\n", dma2);
goto __skip_resources;
}
dma_bits |= 0x04;
......@@ -509,8 +510,8 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
mpu_port_bits = 0x00;
break;
default:
snd_printk(KERN_WARNING
"MPU-401 port 0x%lx not valid\n", mpu_port);
dev_warn(chip->card->dev,
"MPU-401 port 0x%lx not valid\n", mpu_port);
goto __skip_mpu;
}
......@@ -528,8 +529,8 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
mpu_irq_bits = 0x01;
break;
default:
snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n",
mpu_irq);
dev_warn(chip->card->dev, "MPU-401 irq # %d not valid\n",
mpu_irq);
goto __skip_mpu;
}
......@@ -603,7 +604,7 @@ static int snd_opti93x_mixer(struct snd_wss *chip)
strcpy(id2.name, "CD Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
snd_printk(KERN_ERR "Cannot rename opti93x control\n");
dev_err(card->dev, "Cannot rename opti93x control\n");
return err;
}
/* reassign AUX1 switch to FM */
......@@ -611,7 +612,7 @@ static int snd_opti93x_mixer(struct snd_wss *chip)
strcpy(id2.name, "FM Playback Switch");
err = snd_ctl_rename_id(card, &id1, &id2);
if (err < 0) {
snd_printk(KERN_ERR "Cannot rename opti93x control\n");
dev_err(card->dev, "Cannot rename opti93x control\n");
return err;
}
/* remove AUX1 volume */
......@@ -740,7 +741,7 @@ static int snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
err = pnp_activate_dev(pdev);
if (err < 0) {
snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err);
dev_err(chip->card->dev, "AUDIO pnp configure failure: %d\n", err);
return err;
}
......@@ -757,7 +758,7 @@ static int snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
err = pnp_activate_dev(devmc);
if (err < 0) {
snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err);
dev_err(chip->card->dev, "MC pnp configure failure: %d\n", err);
return err;
}
......@@ -781,7 +782,7 @@ static int snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
if (devmpu && mpu_port > 0) {
err = pnp_activate_dev(devmpu);
if (err < 0) {
snd_printk(KERN_ERR "MPU401 pnp configure failure\n");
dev_err(chip->card->dev, "MPU401 pnp configure failure\n");
mpu_port = -1;
} else {
mpu_port = pnp_port_start(devmpu, 0);
......@@ -811,7 +812,7 @@ static int snd_opti9xx_probe(struct snd_card *card)
if (port == SNDRV_AUTO_PORT) {
port = snd_legacy_find_free_ioport(possible_ports, 4);
if (port < 0) {
snd_printk(KERN_ERR "unable to find a free WSS port\n");
dev_err(card->dev, "unable to find a free WSS port\n");
return -EBUSY;
}
}
......@@ -850,7 +851,7 @@ static int snd_opti9xx_probe(struct snd_card *card)
error = devm_request_irq(card->dev, irq, snd_opti93x_interrupt,
0, DEV_NAME" - WSS", chip);
if (error < 0) {
snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", irq);
dev_err(card->dev, "opti9xx: can't grab IRQ %d\n", irq);
return error;
}
#endif
......@@ -876,8 +877,8 @@ static int snd_opti9xx_probe(struct snd_card *card)
error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
mpu_port, 0, mpu_irq, &rmidi);
if (error)
snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
mpu_port);
dev_warn(card->dev, "no MPU-401 device at 0x%lx?\n",
mpu_port);
}
if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) {
......@@ -900,8 +901,8 @@ static int snd_opti9xx_probe(struct snd_card *card)
#endif /* !OPTi93X */
if (!opl3 && snd_opl3_create(card, fm_port, fm_port + 2,
OPL3_HW_AUTO, 0, &opl3) < 0) {
snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n",
fm_port, fm_port + 4 - 1);
dev_warn(card->dev, "no OPL device at 0x%lx-0x%lx\n",
fm_port, fm_port + 4 - 1);
}
if (opl3) {
error = snd_opl3_hwdep_new(opl3, 0, 1, &synth);
......@@ -958,28 +959,28 @@ static int snd_opti9xx_isa_probe(struct device *devptr,
if (mpu_port == SNDRV_AUTO_PORT) {
mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2);
if (mpu_port < 0) {
snd_printk(KERN_ERR "unable to find a free MPU401 port\n");
dev_err(devptr, "unable to find a free MPU401 port\n");
return -EBUSY;
}
}
if (irq == SNDRV_AUTO_IRQ) {
irq = snd_legacy_find_free_irq(possible_irqs);
if (irq < 0) {
snd_printk(KERN_ERR "unable to find a free IRQ\n");
dev_err(devptr, "unable to find a free IRQ\n");
return -EBUSY;
}
}
if (mpu_irq == SNDRV_AUTO_IRQ) {
mpu_irq = snd_legacy_find_free_irq(possible_mpu_irqs);
if (mpu_irq < 0) {
snd_printk(KERN_ERR "unable to find a free MPU401 IRQ\n");
dev_err(devptr, "unable to find a free MPU401 IRQ\n");
return -EBUSY;
}
}
if (dma1 == SNDRV_AUTO_DMA) {
dma1 = snd_legacy_find_free_dma(possible_dma1s);
if (dma1 < 0) {
snd_printk(KERN_ERR "unable to find a free DMA1\n");
dev_err(devptr, "unable to find a free DMA1\n");
return -EBUSY;
}
}
......@@ -987,7 +988,7 @@ static int snd_opti9xx_isa_probe(struct device *devptr,
if (dma2 == SNDRV_AUTO_DMA) {
dma2 = snd_legacy_find_free_dma(possible_dma2s[dma1 % 4]);
if (dma2 < 0) {
snd_printk(KERN_ERR "unable to find a free DMA2\n");
dev_err(devptr, "unable to find a free DMA2\n");
return -EBUSY;
}
}
......@@ -1076,6 +1077,7 @@ static int snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
if (error < 0)
return error;
chip = card->private_data;
chip->card = card;
hw = snd_card_opti9xx_pnp(chip, pcard, pid);
switch (hw) {
......@@ -1097,7 +1099,7 @@ static int snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
return error;
error = snd_opti9xx_read_check(card, chip);
if (error) {
snd_printk(KERN_ERR "OPTI chip not found\n");
dev_err(card->dev, "OPTI chip not found\n");
return error;
}
error = snd_opti9xx_probe(card);
......
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