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: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-36-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2024-08-07 15:34:25 +02:00
parent 610f04ca71
commit 8b4ac54299
5 changed files with 158 additions and 154 deletions

View File

@ -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__ */

View File

@ -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
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,26 +174,27 @@ 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[dev], "CS4232: pcm port=0x%lx, fm port=0x%lx, dma1=%i, dma2=%i, irq=%i\nICS2115: port=0x%lx, irq=%i\n",
fm_port[dev], cs4232_pcm_port[dev],
dma1[dev], fm_port[dev],
dma2[dev], dma1[dev],
cs4232_pcm_irq[dev], dma2[dev],
ics2115_port[dev], cs4232_pcm_irq[dev],
ics2115_irq[dev]); ics2115_port[dev],
ics2115_irq[dev]);
return 0; return 0;
} }
@ -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,
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)
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)
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)
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)
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)
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)
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)
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)
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)
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,
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,
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;
} }
} }

View File

@ -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,
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,
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,9 +102,9 @@ 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)
*/ */
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,
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,8 +208,8 @@ 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;
} }
return err; return err;
@ -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;
} }

View File

@ -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)
} }
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)
/* 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)
*/ */
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;

View File

@ -116,7 +116,7 @@ MODULE_PARM_DESC(osrun_time, "how many seconds to wait for the ICS2115 OS");
#define DPRINT(cond, ...) \ #define DPRINT(cond, ...) \
if ((dev->debug & (cond)) == (cond)) { \ if ((dev->debug & (cond)) == (cond)) { \
snd_printk (__VA_ARGS__); \ pr_debug(__VA_ARGS__); \
} }
#else #else
#define DPRINT(cond, args...) #define DPRINT(cond, args...)
@ -341,7 +341,7 @@ snd_wavefront_cmd (snd_wavefront_t *dev,
wfcmd = wavefront_get_command(cmd); wfcmd = wavefront_get_command(cmd);
if (!wfcmd) { if (!wfcmd) {
snd_printk ("command 0x%x not supported.\n", dev_err(dev->card->dev, "command 0x%x not supported.\n",
cmd); cmd);
return 1; return 1;
} }
@ -623,7 +623,7 @@ wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom)
/* check sample status */ /* check sample status */
if (snd_wavefront_cmd (dev, WFC_GET_NSAMPLES, rbuf, wbuf)) { if (snd_wavefront_cmd (dev, WFC_GET_NSAMPLES, rbuf, wbuf)) {
snd_printk ("cannot request sample count.\n"); dev_err(dev->card->dev, "cannot request sample count.\n");
return -1; return -1;
} }
@ -635,8 +635,8 @@ wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom)
wbuf[1] = i >> 7; wbuf[1] = i >> 7;
if (snd_wavefront_cmd (dev, WFC_IDENTIFY_SAMPLE_TYPE, rbuf, wbuf)) { if (snd_wavefront_cmd (dev, WFC_IDENTIFY_SAMPLE_TYPE, rbuf, wbuf)) {
snd_printk(KERN_WARNING "cannot identify sample " dev_warn(dev->card->dev,
"type of slot %d\n", i); "cannot identify sample type of slot %d\n", i);
dev->sample_status[i] = WF_ST_EMPTY; dev->sample_status[i] = WF_ST_EMPTY;
continue; continue;
} }
@ -661,9 +661,9 @@ wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom)
break; break;
default: default:
snd_printk ("unknown sample type for " dev_err(dev->card->dev,
"slot %d (0x%x)\n", "unknown sample type for slot %d (0x%x)\n",
i, rbuf[0]); i, rbuf[0]);
} }
if (rbuf[0] != WF_ST_EMPTY) { if (rbuf[0] != WF_ST_EMPTY) {
@ -671,9 +671,10 @@ wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom)
} }
} }
snd_printk ("%d samples used (%d real, %d aliases, %d multi), " dev_info(dev->card->dev,
"%d empty\n", dev->samples_used, sc_real, sc_alias, sc_multi, "%d samples used (%d real, %d aliases, %d multi), %d empty\n",
WF_MAX_SAMPLE - dev->samples_used); dev->samples_used, sc_real, sc_alias, sc_multi,
WF_MAX_SAMPLE - dev->samples_used);
return (0); return (0);
@ -706,8 +707,8 @@ wavefront_get_patch_status (snd_wavefront_t *dev)
} else if (x == 3) { /* Bad patch number */ } else if (x == 3) { /* Bad patch number */
dev->patch_status[i] = 0; dev->patch_status[i] = 0;
} else { } else {
snd_printk ("upload patch " dev_err(dev->card->dev,
"error 0x%x\n", x); "upload patch error 0x%x\n", x);
dev->patch_status[i] = 0; dev->patch_status[i] = 0;
return 1; return 1;
} }
@ -724,7 +725,8 @@ wavefront_get_patch_status (snd_wavefront_t *dev)
} }
} }
snd_printk ("%d patch slots filled, %d in use\n", cnt, cnt2); dev_info(dev->card->dev, "%d patch slots filled, %d in use\n",
cnt, cnt2);
return (0); return (0);
} }
@ -760,8 +762,8 @@ wavefront_get_program_status (snd_wavefront_t *dev)
} else if (x == 1) { /* Bad program number */ } else if (x == 1) { /* Bad program number */
dev->prog_status[i] = 0; dev->prog_status[i] = 0;
} else { } else {
snd_printk ("upload program " dev_err(dev->card->dev,
"error 0x%x\n", x); "upload program error 0x%x\n", x);
dev->prog_status[i] = 0; dev->prog_status[i] = 0;
} }
} }
@ -772,7 +774,7 @@ wavefront_get_program_status (snd_wavefront_t *dev)
} }
} }
snd_printk ("%d programs slots in use\n", cnt); dev_info(dev->card->dev, "%d programs slots in use\n", cnt);
return (0); return (0);
} }
@ -796,7 +798,7 @@ wavefront_send_patch (snd_wavefront_t *dev, wavefront_patch_info *header)
munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES); munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES);
if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, NULL, buf)) { if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, NULL, buf)) {
snd_printk ("download patch failed\n"); dev_err(dev->card->dev, "download patch failed\n");
return -EIO; return -EIO;
} }
@ -837,7 +839,7 @@ wavefront_send_program (snd_wavefront_t *dev, wavefront_patch_info *header)
munge_buf ((unsigned char *)&header->hdr.pr, &buf[1], WF_PROGRAM_BYTES); munge_buf ((unsigned char *)&header->hdr.pr, &buf[1], WF_PROGRAM_BYTES);
if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, NULL, buf)) { if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, NULL, buf)) {
snd_printk ("download patch failed\n"); dev_err(dev->card->dev, "download patch failed\n");
return -EIO; return -EIO;
} }
@ -851,7 +853,7 @@ wavefront_freemem (snd_wavefront_t *dev)
char rbuf[8]; char rbuf[8];
if (snd_wavefront_cmd (dev, WFC_REPORT_FREE_MEMORY, rbuf, NULL)) { if (snd_wavefront_cmd (dev, WFC_REPORT_FREE_MEMORY, rbuf, NULL)) {
snd_printk ("can't get memory stats.\n"); dev_err(dev->card->dev, "can't get memory stats.\n");
return -1; return -1;
} else { } else {
return demunge_int32 (rbuf, 4); return demunge_int32 (rbuf, 4);
@ -901,7 +903,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
x = wavefront_find_free_sample(dev); x = wavefront_find_free_sample(dev);
if (x < 0) if (x < 0)
return -ENOMEM; return -ENOMEM;
snd_printk ("unspecified sample => %d\n", x); dev_info(dev->card->dev, "unspecified sample => %d\n", x);
header->number = x; header->number = x;
} }
@ -935,9 +937,9 @@ wavefront_send_sample (snd_wavefront_t *dev,
if (dev->rom_samples_rdonly) { if (dev->rom_samples_rdonly) {
if (dev->sample_status[header->number] & WF_SLOT_ROM) { if (dev->sample_status[header->number] & WF_SLOT_ROM) {
snd_printk ("sample slot %d " dev_err(dev->card->dev,
"write protected\n", "sample slot %d write protected\n",
header->number); header->number);
return -EACCES; return -EACCES;
} }
} }
@ -949,9 +951,9 @@ wavefront_send_sample (snd_wavefront_t *dev,
dev->freemem = wavefront_freemem (dev); dev->freemem = wavefront_freemem (dev);
if (dev->freemem < (int)header->size) { if (dev->freemem < (int)header->size) {
snd_printk ("insufficient memory to " dev_err(dev->card->dev,
"load %d byte sample.\n", "insufficient memory to load %d byte sample.\n",
header->size); header->size);
return -ENOMEM; return -ENOMEM;
} }
@ -960,8 +962,8 @@ wavefront_send_sample (snd_wavefront_t *dev,
skip = WF_GET_CHANNEL(&header->hdr.s); skip = WF_GET_CHANNEL(&header->hdr.s);
if (skip > 0 && header->hdr.s.SampleResolution != LINEAR_16BIT) { if (skip > 0 && header->hdr.s.SampleResolution != LINEAR_16BIT) {
snd_printk ("channel selection only " dev_err(dev->card->dev,
"possible on 16-bit samples"); "channel selection only possible on 16-bit samples");
return -EINVAL; return -EINVAL;
} }
@ -1057,8 +1059,8 @@ wavefront_send_sample (snd_wavefront_t *dev,
header->size ? header->size ?
WFC_DOWNLOAD_SAMPLE : WFC_DOWNLOAD_SAMPLE_HEADER, WFC_DOWNLOAD_SAMPLE : WFC_DOWNLOAD_SAMPLE_HEADER,
NULL, sample_hdr)) { NULL, sample_hdr)) {
snd_printk ("sample %sdownload refused.\n", dev_err(dev->card->dev, "sample %sdownload refused.\n",
header->size ? "" : "header "); header->size ? "" : "header ");
return -EIO; return -EIO;
} }
@ -1083,8 +1085,8 @@ wavefront_send_sample (snd_wavefront_t *dev,
} }
if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) { if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
snd_printk ("download block " dev_err(dev->card->dev,
"request refused.\n"); "download block request refused.\n");
return -EIO; return -EIO;
} }
@ -1145,13 +1147,13 @@ wavefront_send_sample (snd_wavefront_t *dev,
dma_ack = wavefront_read(dev); dma_ack = wavefront_read(dev);
if (dma_ack != WF_DMA_ACK) { if (dma_ack != WF_DMA_ACK) {
if (dma_ack == -1) { if (dma_ack == -1) {
snd_printk ("upload sample " dev_err(dev->card->dev,
"DMA ack timeout\n"); "upload sample DMA ack timeout\n");
return -EIO; return -EIO;
} else { } else {
snd_printk ("upload sample " dev_err(dev->card->dev,
"DMA ack error 0x%x\n", "upload sample DMA ack error 0x%x\n",
dma_ack); dma_ack);
return -EIO; return -EIO;
} }
} }
@ -1195,7 +1197,7 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)
munge_int32 (*(&header->hdr.a.FrequencyBias+1), &alias_hdr[23], 2); munge_int32 (*(&header->hdr.a.FrequencyBias+1), &alias_hdr[23], 2);
if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) { if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) {
snd_printk ("download alias failed.\n"); dev_err(dev->card->dev, "download alias failed.\n");
return -EIO; return -EIO;
} }
@ -1248,7 +1250,7 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)
if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_MULTISAMPLE, if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_MULTISAMPLE,
(unsigned char *) (long) ((num_samples*2)+3), (unsigned char *) (long) ((num_samples*2)+3),
msample_hdr)) { msample_hdr)) {
snd_printk ("download of multisample failed.\n"); dev_err(dev->card->dev, "download of multisample failed.\n");
kfree(msample_hdr); kfree(msample_hdr);
return -EIO; return -EIO;
} }
@ -1271,7 +1273,7 @@ wavefront_fetch_multisample (snd_wavefront_t *dev,
munge_int32 (header->number, number, 2); munge_int32 (header->number, number, 2);
if (snd_wavefront_cmd (dev, WFC_UPLOAD_MULTISAMPLE, log_ns, number)) { if (snd_wavefront_cmd (dev, WFC_UPLOAD_MULTISAMPLE, log_ns, number)) {
snd_printk ("upload multisample failed.\n"); dev_err(dev->card->dev, "upload multisample failed.\n");
return -EIO; return -EIO;
} }
@ -1290,16 +1292,16 @@ wavefront_fetch_multisample (snd_wavefront_t *dev,
val = wavefront_read(dev); val = wavefront_read(dev);
if (val == -1) { if (val == -1) {
snd_printk ("upload multisample failed " dev_err(dev->card->dev,
"during sample loop.\n"); "upload multisample failed during sample loop.\n");
return -EIO; return -EIO;
} }
d[0] = val; d[0] = val;
val = wavefront_read(dev); val = wavefront_read(dev);
if (val == -1) { if (val == -1) {
snd_printk ("upload multisample failed " dev_err(dev->card->dev,
"during sample loop.\n"); "upload multisample failed during sample loop.\n");
return -EIO; return -EIO;
} }
d[1] = val; d[1] = val;
@ -1334,7 +1336,7 @@ wavefront_send_drum (snd_wavefront_t *dev, wavefront_patch_info *header)
} }
if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) { if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) {
snd_printk ("download drum failed.\n"); dev_err(dev->card->dev, "download drum failed.\n");
return -EIO; return -EIO;
} }
@ -1352,7 +1354,7 @@ wavefront_find_free_sample (snd_wavefront_t *dev)
return i; return i;
} }
} }
snd_printk ("no free sample slots!\n"); dev_err(dev->card->dev, "no free sample slots!\n");
return -1; return -1;
} }
@ -1368,7 +1370,7 @@ wavefront_find_free_patch (snd_wavefront_t *dev)
return i; return i;
} }
} }
snd_printk ("no free patch slots!\n"); dev_err(dev->card->dev, "no free patch slots!\n");
return -1; return -1;
} }
#endif #endif
@ -1385,7 +1387,7 @@ wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr)
if (copy_from_user (header, addr, sizeof(wavefront_patch_info) - if (copy_from_user (header, addr, sizeof(wavefront_patch_info) -
sizeof(wavefront_any))) { sizeof(wavefront_any))) {
snd_printk ("bad address for load patch.\n"); dev_err(dev->card->dev, "bad address for load patch.\n");
err = -EFAULT; err = -EFAULT;
goto __error; goto __error;
} }
@ -1463,8 +1465,8 @@ wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr)
break; break;
default: default:
snd_printk ("unknown patch type %d.\n", dev_err(dev->card->dev, "unknown patch type %d.\n",
header->subkey); header->subkey);
err = -EINVAL; err = -EINVAL;
break; break;
} }
@ -1527,13 +1529,13 @@ wavefront_synth_control (snd_wavefront_card_t *acard,
switch (wc->cmd) { switch (wc->cmd) {
case WFC_DISABLE_INTERRUPTS: case WFC_DISABLE_INTERRUPTS:
snd_printk ("interrupts disabled.\n"); dev_dbg(dev->card->dev, "interrupts disabled.\n");
outb (0x80|0x20, dev->control_port); outb (0x80|0x20, dev->control_port);
dev->interrupts_are_midi = 1; dev->interrupts_are_midi = 1;
return 0; return 0;
case WFC_ENABLE_INTERRUPTS: case WFC_ENABLE_INTERRUPTS:
snd_printk ("interrupts enabled.\n"); dev_dbg(dev->card->dev, "interrupts enabled.\n");
outb (0x80|0x40|0x20, dev->control_port); outb (0x80|0x40|0x20, dev->control_port);
dev->interrupts_are_midi = 1; dev->interrupts_are_midi = 1;
return 0; return 0;
@ -1550,7 +1552,7 @@ wavefront_synth_control (snd_wavefront_card_t *acard,
case WFC_IDENTIFY_SLOT_TYPE: case WFC_IDENTIFY_SLOT_TYPE:
i = wc->wbuf[0] | (wc->wbuf[1] << 7); i = wc->wbuf[0] | (wc->wbuf[1] << 7);
if (i <0 || i >= WF_MAX_SAMPLE) { if (i <0 || i >= WF_MAX_SAMPLE) {
snd_printk ("invalid slot ID %d\n", dev_err(dev->card->dev, "invalid slot ID %d\n",
i); i);
wc->status = EINVAL; wc->status = EINVAL;
return -EINVAL; return -EINVAL;
@ -1561,7 +1563,7 @@ wavefront_synth_control (snd_wavefront_card_t *acard,
case WFC_DEBUG_DRIVER: case WFC_DEBUG_DRIVER:
dev->debug = wc->wbuf[0]; dev->debug = wc->wbuf[0];
snd_printk ("debug = 0x%x\n", dev->debug); dev_dbg(dev->card->dev, "debug = 0x%x\n", dev->debug);
return 0; return 0;
case WFC_UPLOAD_PATCH: case WFC_UPLOAD_PATCH:
@ -1578,8 +1580,8 @@ wavefront_synth_control (snd_wavefront_card_t *acard,
return 0; return 0;
case WFC_UPLOAD_SAMPLE_ALIAS: case WFC_UPLOAD_SAMPLE_ALIAS:
snd_printk ("support for sample alias upload " dev_err(dev->card->dev,
"being considered.\n"); "support for sample alias upload being considered.\n");
wc->status = EINVAL; wc->status = EINVAL;
return -EINVAL; return -EINVAL;
} }
@ -1620,9 +1622,8 @@ wavefront_synth_control (snd_wavefront_card_t *acard,
break; break;
case WFC_UPLOAD_SAMPLE_ALIAS: case WFC_UPLOAD_SAMPLE_ALIAS:
snd_printk ("support for " dev_err(dev->card->dev,
"sample aliases still " "support for sample aliases still being considered.\n");
"being considered.\n");
break; break;
case WFC_VMIDI_OFF: case WFC_VMIDI_OFF:
@ -1760,7 +1761,7 @@ snd_wavefront_internal_interrupt (snd_wavefront_card_t *card)
*/ */
static int static int
snd_wavefront_interrupt_bits (int irq) snd_wavefront_interrupt_bits(snd_wavefront_t *dev, int irq)
{ {
int bits; int bits;
@ -1780,7 +1781,7 @@ snd_wavefront_interrupt_bits (int irq)
break; break;
default: default:
snd_printk ("invalid IRQ %d\n", irq); dev_err(dev->card->dev, "invalid IRQ %d\n", irq);
bits = -1; bits = -1;
} }
@ -1815,7 +1816,7 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
/* IRQ already checked */ /* IRQ already checked */
bits = snd_wavefront_interrupt_bits (dev->irq); bits = snd_wavefront_interrupt_bits(dev, dev->irq);
/* try reset of port */ /* try reset of port */
@ -1885,7 +1886,7 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
*/ */
if (!dev->irq_ok) { if (!dev->irq_ok) {
snd_printk ("intr not received after h/w un-reset.\n"); dev_err(dev->card->dev, "intr not received after h/w un-reset.\n");
goto gone_bad; goto gone_bad;
} }
@ -1909,18 +1910,18 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
dev->data_port, ramcheck_time*HZ); dev->data_port, ramcheck_time*HZ);
if (!dev->irq_ok) { if (!dev->irq_ok) {
snd_printk ("post-RAM-check interrupt not received.\n"); dev_err(dev->card->dev, "post-RAM-check interrupt not received.\n");
goto gone_bad; goto gone_bad;
} }
if (!wavefront_wait (dev, STAT_CAN_READ)) { if (!wavefront_wait (dev, STAT_CAN_READ)) {
snd_printk ("no response to HW version cmd.\n"); dev_err(dev->card->dev, "no response to HW version cmd.\n");
goto gone_bad; goto gone_bad;
} }
hwv[0] = wavefront_read(dev); hwv[0] = wavefront_read(dev);
if (hwv[0] == -1) { if (hwv[0] == -1) {
snd_printk ("board not responding correctly.\n"); dev_err(dev->card->dev, "board not responding correctly.\n");
goto gone_bad; goto gone_bad;
} }
@ -1932,11 +1933,11 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
hwv[0] = wavefront_read(dev); hwv[0] = wavefront_read(dev);
if (hwv[0] == -1) { if (hwv[0] == -1) {
snd_printk ("on-board RAM test failed " dev_err(dev->card->dev,
"(bad error code).\n"); "on-board RAM test failed (bad error code).\n");
} else { } else {
snd_printk ("on-board RAM test failed " dev_err(dev->card->dev,
"(error code: 0x%x).\n", "on-board RAM test failed (error code: 0x%x).\n",
hwv[0]); hwv[0]);
} }
goto gone_bad; goto gone_bad;
@ -1946,12 +1947,12 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
hwv[1] = wavefront_read(dev); hwv[1] = wavefront_read(dev);
if (hwv[1] == -1) { if (hwv[1] == -1) {
snd_printk ("incorrect h/w response.\n"); dev_err(dev->card->dev, "incorrect h/w response.\n");
goto gone_bad; goto gone_bad;
} }
snd_printk ("hardware version %d.%d\n", dev_info(dev->card->dev, "hardware version %d.%d\n",
hwv[0], hwv[1]); hwv[0], hwv[1]);
return 0; return 0;
@ -1971,7 +1972,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
err = request_firmware(&firmware, path, dev->card->dev); err = request_firmware(&firmware, path, dev->card->dev);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "firmware (%s) download failed!!!\n", path); dev_err(dev->card->dev, "firmware (%s) download failed!!!\n", path);
return 1; return 1;
} }
@ -1982,16 +1983,16 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
if (section_length == 0) if (section_length == 0)
break; break;
if (section_length < 0 || section_length > WF_SECTION_MAX) { if (section_length < 0 || section_length > WF_SECTION_MAX) {
snd_printk(KERN_ERR dev_err(dev->card->dev,
"invalid firmware section length %d\n", "invalid firmware section length %d\n",
section_length); section_length);
goto failure; goto failure;
} }
buf++; buf++;
len++; len++;
if (firmware->size < len + section_length) { if (firmware->size < len + section_length) {
snd_printk(KERN_ERR "firmware section read error.\n"); dev_err(dev->card->dev, "firmware section read error.\n");
goto failure; goto failure;
} }
@ -2008,15 +2009,14 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
/* get ACK */ /* get ACK */
if (!wavefront_wait(dev, STAT_CAN_READ)) { if (!wavefront_wait(dev, STAT_CAN_READ)) {
snd_printk(KERN_ERR "time out for firmware ACK.\n"); dev_err(dev->card->dev, "time out for firmware ACK.\n");
goto failure; goto failure;
} }
err = inb(dev->data_port); err = inb(dev->data_port);
if (err != WF_ACK) { if (err != WF_ACK) {
snd_printk(KERN_ERR dev_err(dev->card->dev,
"download of section #%d not " "download of section #%d not acknowledged, ack = 0x%x\n",
"acknowledged, ack = 0x%x\n", section_cnt_downloaded + 1, err);
section_cnt_downloaded + 1, err);
goto failure; goto failure;
} }
@ -2028,7 +2028,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
failure: failure:
release_firmware(firmware); release_firmware(firmware);
snd_printk(KERN_ERR "firmware download failed!!!\n"); dev_err(dev->card->dev, "firmware download failed!!!\n");
return 1; return 1;
} }
@ -2040,7 +2040,7 @@ wavefront_do_reset (snd_wavefront_t *dev)
char voices[1]; char voices[1];
if (wavefront_reset_to_cleanliness (dev)) { if (wavefront_reset_to_cleanliness (dev)) {
snd_printk ("hw reset failed.\n"); dev_err(dev->card->dev, "hw reset failed.\n");
goto gone_bad; goto gone_bad;
} }
@ -2064,7 +2064,7 @@ wavefront_do_reset (snd_wavefront_t *dev)
(osrun_time*HZ)); (osrun_time*HZ));
if (!dev->irq_ok) { if (!dev->irq_ok) {
snd_printk ("no post-OS interrupt.\n"); dev_err(dev->card->dev, "no post-OS interrupt.\n");
goto gone_bad; goto gone_bad;
} }
@ -2074,7 +2074,7 @@ wavefront_do_reset (snd_wavefront_t *dev)
dev->data_port, (10*HZ)); dev->data_port, (10*HZ));
if (!dev->irq_ok) { if (!dev->irq_ok) {
snd_printk ("no post-OS interrupt(2).\n"); dev_err(dev->card->dev, "no post-OS interrupt(2).\n");
goto gone_bad; goto gone_bad;
} }
@ -2094,20 +2094,20 @@ wavefront_do_reset (snd_wavefront_t *dev)
if (dev->freemem < 0) if (dev->freemem < 0)
goto gone_bad; goto gone_bad;
snd_printk ("available DRAM %dk\n", dev->freemem / 1024); dev_info(dev->card->dev, "available DRAM %dk\n", dev->freemem / 1024);
if (wavefront_write (dev, 0xf0) || if (wavefront_write (dev, 0xf0) ||
wavefront_write (dev, 1) || wavefront_write (dev, 1) ||
(wavefront_read (dev) < 0)) { (wavefront_read (dev) < 0)) {
dev->debug = 0; dev->debug = 0;
snd_printk ("MPU emulation mode not set.\n"); dev_err(dev->card->dev, "MPU emulation mode not set.\n");
goto gone_bad; goto gone_bad;
} }
voices[0] = 32; voices[0] = 32;
if (snd_wavefront_cmd (dev, WFC_SET_NVOICES, NULL, voices)) { if (snd_wavefront_cmd (dev, WFC_SET_NVOICES, NULL, voices)) {
snd_printk ("cannot set number of voices to 32.\n"); dev_err(dev->card->dev, "cannot set number of voices to 32.\n");
goto gone_bad; goto gone_bad;
} }
@ -2187,8 +2187,8 @@ snd_wavefront_detect (snd_wavefront_card_t *card)
dev->fw_version[0] = rbuf[0]; dev->fw_version[0] = rbuf[0];
dev->fw_version[1] = rbuf[1]; dev->fw_version[1] = rbuf[1];
snd_printk ("firmware %d.%d already loaded.\n", dev_info(dev->card->dev, "firmware %d.%d already loaded.\n",
rbuf[0], rbuf[1]); rbuf[0], rbuf[1]);
/* check that a command actually works */ /* check that a command actually works */
@ -2197,22 +2197,24 @@ snd_wavefront_detect (snd_wavefront_card_t *card)
dev->hw_version[0] = rbuf[0]; dev->hw_version[0] = rbuf[0];
dev->hw_version[1] = rbuf[1]; dev->hw_version[1] = rbuf[1];
} else { } else {
snd_printk ("not raw, but no " dev_err(dev->card->dev,
"hardware version!\n"); "not raw, but no hardware version!\n");
return -1; return -1;
} }
if (!wf_raw) { if (!wf_raw) {
return 0; return 0;
} else { } else {
snd_printk ("reloading firmware as you requested.\n"); dev_info(dev->card->dev,
"reloading firmware as you requested.\n");
dev->israw = 1; dev->israw = 1;
} }
} else { } else {
dev->israw = 1; dev->israw = 1;
snd_printk ("no response to firmware probe, assume raw.\n"); dev_info(dev->card->dev,
"no response to firmware probe, assume raw.\n");
} }