Commit 8b4ac542 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: wavefront: 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: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-36-tiwai@suse.de
parent 610f04ca
...@@ -137,8 +137,4 @@ extern int snd_wavefront_fx_ioctl (struct snd_hwdep *, ...@@ -137,8 +137,4 @@ extern int snd_wavefront_fx_ioctl (struct snd_hwdep *,
extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *); extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *);
extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *); extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *);
/* prefix in all snd_printk() delivered messages */
#define LOGNAME "WaveFront: "
#endif /* __SOUND_SND_WAVEFRONT_H__ */ #endif /* __SOUND_SND_WAVEFRONT_H__ */
...@@ -140,7 +140,7 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c ...@@ -140,7 +140,7 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
err = pnp_activate_dev(pdev); err = pnp_activate_dev(pdev);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "PnP WSS pnp configure failure\n"); dev_err(&pdev->dev, "PnP WSS pnp configure failure\n");
return err; return err;
} }
...@@ -156,7 +156,7 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c ...@@ -156,7 +156,7 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
err = pnp_activate_dev(pdev); err = pnp_activate_dev(pdev);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n"); dev_err(&pdev->dev, "PnP ICS2115 pnp configure failure\n");
return err; return err;
} }
...@@ -174,19 +174,20 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c ...@@ -174,19 +174,20 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
err = pnp_activate_dev(pdev); err = pnp_activate_dev(pdev);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n"); dev_err(&pdev->dev, "PnP MPU401 pnp configure failure\n");
cs4232_mpu_port[dev] = SNDRV_AUTO_PORT; cs4232_mpu_port[dev] = SNDRV_AUTO_PORT;
} else { } else {
cs4232_mpu_port[dev] = pnp_port_start(pdev, 0); cs4232_mpu_port[dev] = pnp_port_start(pdev, 0);
cs4232_mpu_irq[dev] = pnp_irq(pdev, 0); cs4232_mpu_irq[dev] = pnp_irq(pdev, 0);
} }
snd_printk (KERN_INFO "CS4232 MPU: port=0x%lx, irq=%i\n", dev_info(&pdev->dev, "CS4232 MPU: port=0x%lx, irq=%i\n",
cs4232_mpu_port[dev], cs4232_mpu_port[dev],
cs4232_mpu_irq[dev]); cs4232_mpu_irq[dev]);
} }
snd_printdd ("CS4232: pcm port=0x%lx, fm port=0x%lx, dma1=%i, dma2=%i, irq=%i\nICS2115: port=0x%lx, irq=%i\n", dev_dbg(&pdev->dev,
"CS4232: pcm port=0x%lx, fm port=0x%lx, dma1=%i, dma2=%i, irq=%i\nICS2115: port=0x%lx, irq=%i\n",
cs4232_pcm_port[dev], cs4232_pcm_port[dev],
fm_port[dev], fm_port[dev],
dma1[dev], dma1[dev],
...@@ -251,7 +252,7 @@ static struct snd_hwdep *snd_wavefront_new_fx(struct snd_card *card, ...@@ -251,7 +252,7 @@ static struct snd_hwdep *snd_wavefront_new_fx(struct snd_card *card,
struct snd_hwdep *fx_processor; struct snd_hwdep *fx_processor;
if (snd_wavefront_fx_start (&acard->wavefront)) { if (snd_wavefront_fx_start (&acard->wavefront)) {
snd_printk (KERN_ERR "cannot initialize YSS225 FX processor"); dev_err(card->dev, "cannot initialize YSS225 FX processor");
return NULL; return NULL;
} }
...@@ -282,7 +283,7 @@ static struct snd_rawmidi *snd_wavefront_new_midi(struct snd_card *card, ...@@ -282,7 +283,7 @@ static struct snd_rawmidi *snd_wavefront_new_midi(struct snd_card *card,
first = 0; first = 0;
acard->wavefront.midi.base = port; acard->wavefront.midi.base = port;
if (snd_wavefront_midi_start (acard)) { if (snd_wavefront_midi_start (acard)) {
snd_printk (KERN_ERR "cannot initialize MIDI interface\n"); dev_err(card->dev, "cannot initialize MIDI interface\n");
return NULL; return NULL;
} }
} }
...@@ -349,7 +350,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -349,7 +350,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
cs4232_pcm_irq[dev], dma1[dev], dma2[dev], cs4232_pcm_irq[dev], dma1[dev], dma2[dev],
WSS_HW_DETECT, 0, &chip); WSS_HW_DETECT, 0, &chip);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "can't allocate WSS device\n"); dev_err(card->dev, "can't allocate WSS device\n");
return err; return err;
} }
...@@ -369,7 +370,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -369,7 +370,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
err = snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2, err = snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2,
OPL3_HW_OPL3_CS, 0, &opl3); OPL3_HW_OPL3_CS, 0, &opl3);
if (err < 0) { if (err < 0) {
snd_printk (KERN_ERR "can't allocate or detect OPL3 synth\n"); dev_err(card->dev, "can't allocate or detect OPL3 synth\n");
return err; return err;
} }
...@@ -385,14 +386,14 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -385,14 +386,14 @@ snd_wavefront_probe (struct snd_card *card, int dev)
devm_request_region(card->dev, ics2115_port[dev], 16, devm_request_region(card->dev, ics2115_port[dev], 16,
"ICS2115"); "ICS2115");
if (acard->wavefront.res_base == NULL) { if (acard->wavefront.res_base == NULL) {
snd_printk(KERN_ERR "unable to grab ICS2115 i/o region 0x%lx-0x%lx\n", dev_err(card->dev, "unable to grab ICS2115 i/o region 0x%lx-0x%lx\n",
ics2115_port[dev], ics2115_port[dev] + 16 - 1); ics2115_port[dev], ics2115_port[dev] + 16 - 1);
return -EBUSY; return -EBUSY;
} }
if (devm_request_irq(card->dev, ics2115_irq[dev], if (devm_request_irq(card->dev, ics2115_irq[dev],
snd_wavefront_ics2115_interrupt, snd_wavefront_ics2115_interrupt,
0, "ICS2115", acard)) { 0, "ICS2115", acard)) {
snd_printk(KERN_ERR "unable to use ICS2115 IRQ %d\n", ics2115_irq[dev]); dev_err(card->dev, "unable to use ICS2115 IRQ %d\n", ics2115_irq[dev]);
return -EBUSY; return -EBUSY;
} }
...@@ -402,7 +403,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -402,7 +403,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
wavefront_synth = snd_wavefront_new_synth(card, hw_dev, acard); wavefront_synth = snd_wavefront_new_synth(card, hw_dev, acard);
if (wavefront_synth == NULL) { if (wavefront_synth == NULL) {
snd_printk (KERN_ERR "can't create WaveFront synth device\n"); dev_err(card->dev, "can't create WaveFront synth device\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -414,7 +415,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -414,7 +415,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
err = snd_wss_mixer(chip); err = snd_wss_mixer(chip);
if (err < 0) { if (err < 0) {
snd_printk (KERN_ERR "can't allocate mixer device\n"); dev_err(card->dev, "can't allocate mixer device\n");
return err; return err;
} }
...@@ -425,7 +426,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -425,7 +426,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
cs4232_mpu_port[dev], 0, cs4232_mpu_port[dev], 0,
cs4232_mpu_irq[dev], NULL); cs4232_mpu_irq[dev], NULL);
if (err < 0) { if (err < 0) {
snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n"); dev_err(card->dev, "can't allocate CS4232 MPU-401 device\n");
return err; return err;
} }
midi_dev++; midi_dev++;
...@@ -441,7 +442,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -441,7 +442,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
ics2115_port[dev], ics2115_port[dev],
internal_mpu); internal_mpu);
if (ics2115_internal_rmidi == NULL) { if (ics2115_internal_rmidi == NULL) {
snd_printk (KERN_ERR "can't setup ICS2115 internal MIDI device\n"); dev_err(card->dev, "can't setup ICS2115 internal MIDI device\n");
return -ENOMEM; return -ENOMEM;
} }
midi_dev++; midi_dev++;
...@@ -457,7 +458,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -457,7 +458,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
ics2115_port[dev], ics2115_port[dev],
external_mpu); external_mpu);
if (ics2115_external_rmidi == NULL) { if (ics2115_external_rmidi == NULL) {
snd_printk (KERN_ERR "can't setup ICS2115 external MIDI device\n"); dev_err(card->dev, "can't setup ICS2115 external MIDI device\n");
return -ENOMEM; return -ENOMEM;
} }
midi_dev++; midi_dev++;
...@@ -471,7 +472,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) ...@@ -471,7 +472,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
acard, acard,
ics2115_port[dev]); ics2115_port[dev]);
if (fx_processor == NULL) { if (fx_processor == NULL) {
snd_printk (KERN_ERR "can't setup FX device\n"); dev_err(card->dev, "can't setup FX device\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -525,11 +526,11 @@ static int snd_wavefront_isa_match(struct device *pdev, ...@@ -525,11 +526,11 @@ static int snd_wavefront_isa_match(struct device *pdev,
return 0; return 0;
#endif #endif
if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR "specify CS4232 port\n"); dev_err(pdev, "specify CS4232 port\n");
return 0; return 0;
} }
if (ics2115_port[dev] == SNDRV_AUTO_PORT) { if (ics2115_port[dev] == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR "specify ICS2115 port\n"); dev_err(pdev, "specify ICS2115 port\n");
return 0; return 0;
} }
return 1; return 1;
...@@ -585,7 +586,7 @@ static int snd_wavefront_pnp_detect(struct pnp_card_link *pcard, ...@@ -585,7 +586,7 @@ static int snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
snd_printk (KERN_ERR "isapnp detection failed\n"); dev_err(card->dev, "isapnp detection failed\n");
return -ENODEV; return -ENODEV;
} }
} }
......
...@@ -38,7 +38,7 @@ wavefront_fx_idle (snd_wavefront_t *dev) ...@@ -38,7 +38,7 @@ wavefront_fx_idle (snd_wavefront_t *dev)
} }
if (x & 0x80) { if (x & 0x80) {
snd_printk ("FX device never idle.\n"); dev_err(dev->card->dev, "FX device never idle.\n");
return 0; return 0;
} }
...@@ -64,14 +64,14 @@ wavefront_fx_memset (snd_wavefront_t *dev, ...@@ -64,14 +64,14 @@ wavefront_fx_memset (snd_wavefront_t *dev,
unsigned short *data) unsigned short *data)
{ {
if (page < 0 || page > 7) { if (page < 0 || page > 7) {
snd_printk ("FX memset: " dev_err(dev->card->dev,
"page must be >= 0 and <= 7\n"); "FX memset: page must be >= 0 and <= 7\n");
return -EINVAL; return -EINVAL;
} }
if (addr < 0 || addr > 0x7f) { if (addr < 0 || addr > 0x7f) {
snd_printk ("FX memset: " dev_err(dev->card->dev,
"addr must be >= 0 and <= 7f\n"); "FX memset: addr must be >= 0 and <= 7f\n");
return -EINVAL; return -EINVAL;
} }
...@@ -83,7 +83,7 @@ wavefront_fx_memset (snd_wavefront_t *dev, ...@@ -83,7 +83,7 @@ wavefront_fx_memset (snd_wavefront_t *dev,
outb ((data[0] >> 8), dev->fx_dsp_msb); outb ((data[0] >> 8), dev->fx_dsp_msb);
outb ((data[0] & 0xff), dev->fx_dsp_lsb); outb ((data[0] & 0xff), dev->fx_dsp_lsb);
snd_printk ("FX: addr %d:%x set to 0x%x\n", dev_err(dev->card->dev, "FX: addr %d:%x set to 0x%x\n",
page, addr, data[0]); page, addr, data[0]);
} else { } else {
...@@ -102,8 +102,8 @@ wavefront_fx_memset (snd_wavefront_t *dev, ...@@ -102,8 +102,8 @@ wavefront_fx_memset (snd_wavefront_t *dev,
} }
if (i != cnt) { if (i != cnt) {
snd_printk ("FX memset " dev_err(dev->card->dev,
"(0x%x, 0x%x, 0x%lx, %d) incomplete\n", "FX memset (0x%x, 0x%x, 0x%lx, %d) incomplete\n",
page, addr, (unsigned long) data, cnt); page, addr, (unsigned long) data, cnt);
return -EIO; return -EIO;
} }
...@@ -123,7 +123,7 @@ snd_wavefront_fx_detect (snd_wavefront_t *dev) ...@@ -123,7 +123,7 @@ snd_wavefront_fx_detect (snd_wavefront_t *dev)
*/ */
if (inb (dev->fx_status) & 0x80) { if (inb (dev->fx_status) & 0x80) {
snd_printk ("Hmm, probably a Maui or Tropez.\n"); dev_err(dev->card->dev, "Hmm, probably a Maui or Tropez.\n");
return -1; return -1;
} }
...@@ -180,15 +180,15 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file, ...@@ -180,15 +180,15 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file,
case WFFX_MEMSET: case WFFX_MEMSET:
if (r.data[2] <= 0) { if (r.data[2] <= 0) {
snd_printk ("cannot write " dev_err(dev->card->dev,
"<= 0 bytes to FX\n"); "cannot write <= 0 bytes to FX\n");
return -EIO; return -EIO;
} else if (r.data[2] == 1) { } else if (r.data[2] == 1) {
pd = (unsigned short *) &r.data[3]; pd = (unsigned short *) &r.data[3];
} else { } else {
if (r.data[2] > 256) { if (r.data[2] > 256) {
snd_printk ("cannot write " dev_err(dev->card->dev,
"> 512 bytes to FX\n"); "cannot write > 512 bytes to FX\n");
return -EIO; return -EIO;
} }
page_data = memdup_array_user((unsigned char __user *) page_data = memdup_array_user((unsigned char __user *)
...@@ -208,7 +208,7 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file, ...@@ -208,7 +208,7 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file,
break; break;
default: default:
snd_printk ("FX: ioctl %d not yet supported\n", dev_err(dev->card->dev, "FX: ioctl %d not yet supported\n",
r.request); r.request);
return -ENOTTY; return -ENOTTY;
} }
...@@ -254,8 +254,8 @@ snd_wavefront_fx_start (snd_wavefront_t *dev) ...@@ -254,8 +254,8 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
goto out; goto out;
} }
} else { } else {
snd_printk(KERN_ERR "invalid address" dev_err(dev->card->dev,
" in register data\n"); "invalid address in register data\n");
err = -1; err = -1;
goto out; goto out;
} }
......
...@@ -501,7 +501,8 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card) ...@@ -501,7 +501,8 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card)
for (i = 0; i < 30000 && !output_ready (midi); i++); for (i = 0; i < 30000 && !output_ready (midi); i++);
if (!output_ready (midi)) { if (!output_ready (midi)) {
snd_printk ("MIDI interface not ready for command\n"); dev_err(card->wavefront.card->dev,
"MIDI interface not ready for command\n");
return -1; return -1;
} }
...@@ -523,7 +524,8 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card) ...@@ -523,7 +524,8 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card)
} }
if (!ok) { if (!ok) {
snd_printk ("cannot set UART mode for MIDI interface"); dev_err(card->wavefront.card->dev,
"cannot set UART mode for MIDI interface");
dev->interrupts_are_midi = 0; dev->interrupts_are_midi = 0;
return -1; return -1;
} }
...@@ -531,7 +533,8 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card) ...@@ -531,7 +533,8 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card)
/* Route external MIDI to WaveFront synth (by default) */ /* Route external MIDI to WaveFront synth (by default) */
if (snd_wavefront_cmd (dev, WFC_MISYNTH_ON, rbuf, wbuf)) { if (snd_wavefront_cmd (dev, WFC_MISYNTH_ON, rbuf, wbuf)) {
snd_printk ("can't enable MIDI-IN-2-synth routing.\n"); dev_warn(card->wavefront.card->dev,
"can't enable MIDI-IN-2-synth routing.\n");
/* XXX error ? */ /* XXX error ? */
} }
...@@ -547,14 +550,16 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card) ...@@ -547,14 +550,16 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card)
*/ */
if (snd_wavefront_cmd (dev, WFC_VMIDI_OFF, rbuf, wbuf)) { if (snd_wavefront_cmd (dev, WFC_VMIDI_OFF, rbuf, wbuf)) {
snd_printk ("virtual MIDI mode not disabled\n"); dev_warn(card->wavefront.card->dev,
"virtual MIDI mode not disabled\n");
return 0; /* We're OK, but missing the external MIDI dev */ return 0; /* We're OK, but missing the external MIDI dev */
} }
snd_wavefront_midi_enable_virtual (card); snd_wavefront_midi_enable_virtual (card);
if (snd_wavefront_cmd (dev, WFC_VMIDI_ON, rbuf, wbuf)) { if (snd_wavefront_cmd (dev, WFC_VMIDI_ON, rbuf, wbuf)) {
snd_printk ("cannot enable virtual MIDI mode.\n"); dev_warn(card->wavefront.card->dev,
"cannot enable virtual MIDI mode.\n");
snd_wavefront_midi_disable_virtual (card); snd_wavefront_midi_disable_virtual (card);
} }
return 0; return 0;
......
This diff is collapsed.
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