Commit 1fa884eb authored by Takashi Iwai's avatar Takashi Iwai

ALSA: mpu401_uart: 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 assignment of mpu->rmidi was moved to an earlier place, so that
dev_*() can access to the proper device pointer.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-5-tiwai@suse.de
parent 2bddeda8
...@@ -73,8 +73,9 @@ static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu) ...@@ -73,8 +73,9 @@ static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
mpu->read(mpu, MPU401D(mpu)); mpu->read(mpu, MPU401D(mpu));
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
if (timeout <= 0) if (timeout <= 0)
snd_printk(KERN_ERR "cmd: clear rx timeout (status = 0x%x)\n", dev_err(mpu->rmidi->dev,
mpu->read(mpu, MPU401C(mpu))); "cmd: clear rx timeout (status = 0x%x)\n",
mpu->read(mpu, MPU401C(mpu)));
#endif #endif
} }
...@@ -224,8 +225,9 @@ static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, ...@@ -224,8 +225,9 @@ static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd,
udelay(10); udelay(10);
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
if (!timeout) if (!timeout)
snd_printk(KERN_ERR "cmd: tx timeout (status = 0x%x)\n", dev_err(mpu->rmidi->dev,
mpu->read(mpu, MPU401C(mpu))); "cmd: tx timeout (status = 0x%x)\n",
mpu->read(mpu, MPU401C(mpu)));
#endif #endif
} }
mpu->write(mpu, cmd, MPU401C(mpu)); mpu->write(mpu, cmd, MPU401C(mpu));
...@@ -244,10 +246,11 @@ static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, ...@@ -244,10 +246,11 @@ static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd,
ok = 1; ok = 1;
spin_unlock_irqrestore(&mpu->input_lock, flags); spin_unlock_irqrestore(&mpu->input_lock, flags);
if (!ok) { if (!ok) {
snd_printk(KERN_ERR "cmd: 0x%x failed at 0x%lx " dev_err(mpu->rmidi->dev,
"(status = 0x%x, data = 0x%x)\n", cmd, mpu->port, "cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)\n",
mpu->read(mpu, MPU401C(mpu)), cmd, mpu->port,
mpu->read(mpu, MPU401D(mpu))); mpu->read(mpu, MPU401C(mpu)),
mpu->read(mpu, MPU401D(mpu)));
return 1; return 1;
} }
return 0; return 0;
...@@ -546,13 +549,14 @@ int snd_mpu401_uart_new(struct snd_card *card, int device, ...@@ -546,13 +549,14 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
spin_lock_init(&mpu->timer_lock); spin_lock_init(&mpu->timer_lock);
mpu->hardware = hardware; mpu->hardware = hardware;
mpu->irq = -1; mpu->irq = -1;
mpu->rmidi = rmidi;
if (! (info_flags & MPU401_INFO_INTEGRATED)) { if (! (info_flags & MPU401_INFO_INTEGRATED)) {
int res_size = hardware == MPU401_HW_PC98II ? 4 : 2; int res_size = hardware == MPU401_HW_PC98II ? 4 : 2;
mpu->res = request_region(port, res_size, "MPU401 UART"); mpu->res = request_region(port, res_size, "MPU401 UART");
if (!mpu->res) { if (!mpu->res) {
snd_printk(KERN_ERR "mpu401_uart: " dev_err(rmidi->dev,
"unable to grab port 0x%lx size %d\n", "mpu401_uart: unable to grab port 0x%lx size %d\n",
port, res_size); port, res_size);
err = -EBUSY; err = -EBUSY;
goto free_device; goto free_device;
} }
...@@ -572,8 +576,8 @@ int snd_mpu401_uart_new(struct snd_card *card, int device, ...@@ -572,8 +576,8 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
if (irq >= 0) { if (irq >= 0) {
if (request_irq(irq, snd_mpu401_uart_interrupt, 0, if (request_irq(irq, snd_mpu401_uart_interrupt, 0,
"MPU401 UART", (void *) mpu)) { "MPU401 UART", (void *) mpu)) {
snd_printk(KERN_ERR "mpu401_uart: " dev_err(rmidi->dev,
"unable to grab IRQ %d\n", irq); "mpu401_uart: unable to grab IRQ %d\n", irq);
err = -EBUSY; err = -EBUSY;
goto free_device; goto free_device;
} }
...@@ -599,7 +603,6 @@ int snd_mpu401_uart_new(struct snd_card *card, int device, ...@@ -599,7 +603,6 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
if (out_enable) if (out_enable)
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX; rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX;
} }
mpu->rmidi = rmidi;
if (rrawmidi) if (rrawmidi)
*rrawmidi = rmidi; *rrawmidi = rmidi;
return 0; return 0;
......
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