1

ALSA: i2c: cs8427: 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-16-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2024-08-07 15:34:05 +02:00
parent 9cbe416b93
commit e71391ba94

View File

@ -52,8 +52,9 @@ int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
buf[1] = val;
err = snd_i2c_sendbytes(device, buf, 2);
if (err != 2) {
snd_printk(KERN_ERR "unable to send bytes 0x%02x:0x%02x "
"to CS8427 (%i)\n", buf[0], buf[1], err);
dev_err(device->bus->card->dev,
"unable to send bytes 0x%02x:0x%02x to CS8427 (%i)\n",
buf[0], buf[1], err);
return err < 0 ? err : -EIO;
}
return 0;
@ -68,14 +69,14 @@ static int snd_cs8427_reg_read(struct snd_i2c_device *device, unsigned char reg)
err = snd_i2c_sendbytes(device, &reg, 1);
if (err != 1) {
snd_printk(KERN_ERR "unable to send register 0x%x byte "
"to CS8427\n", reg);
dev_err(device->bus->card->dev,
"unable to send register 0x%x byte to CS8427\n", reg);
return err < 0 ? err : -EIO;
}
err = snd_i2c_readbytes(device, &buf, 1);
if (err != 1) {
snd_printk(KERN_ERR "unable to read register 0x%x byte "
"from CS8427\n", reg);
dev_err(device->bus->card->dev,
"unable to read register 0x%x byte from CS8427\n", reg);
return err < 0 ? err : -EIO;
}
return buf;
@ -195,16 +196,18 @@ int snd_cs8427_init(struct snd_i2c_bus *bus,
err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER);
if (err != CS8427_VER8427A) {
/* give second chance */
snd_printk(KERN_WARNING "invalid CS8427 signature 0x%x: "
"let me try again...\n", err);
dev_warn(device->bus->card->dev,
"invalid CS8427 signature 0x%x: let me try again...\n",
err);
err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER);
}
if (err != CS8427_VER8427A) {
snd_i2c_unlock(bus);
snd_printk(KERN_ERR "unable to find CS8427 signature "
"(expected 0x%x, read 0x%x),\n",
CS8427_VER8427A, err);
snd_printk(KERN_ERR " initialization is not completed\n");
dev_err(device->bus->card->dev,
"unable to find CS8427 signature (expected 0x%x, read 0x%x),\n",
CS8427_VER8427A, err);
dev_err(device->bus->card->dev,
" initialization is not completed\n");
return -EFAULT;
}
/* turn off run bit while making changes to configuration */
@ -289,7 +292,7 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
snd_i2c_sendbytes(device, buf, 1);
snd_i2c_readbytes(device, buf, 127);
for (xx = 0; xx < 127; xx++)
printk(KERN_DEBUG "reg[0x%x] = 0x%x\n", xx+1, buf[xx]);
dev_dbg(device->bus->card->dev, "reg[0x%x] = 0x%x\n", xx+1, buf[xx]);
}
#endif
@ -392,15 +395,15 @@ static int snd_cs8427_qsubcode_get(struct snd_kcontrol *kcontrol,
snd_i2c_lock(device->bus);
err = snd_i2c_sendbytes(device, &reg, 1);
if (err != 1) {
snd_printk(KERN_ERR "unable to send register 0x%x byte "
"to CS8427\n", reg);
dev_err(device->bus->card->dev,
"unable to send register 0x%x byte to CS8427\n", reg);
snd_i2c_unlock(device->bus);
return err < 0 ? err : -EIO;
}
err = snd_i2c_readbytes(device, ucontrol->value.bytes.data, 10);
if (err != 10) {
snd_printk(KERN_ERR "unable to read Q-subcode bytes "
"from CS8427\n");
dev_err(device->bus->card->dev,
"unable to read Q-subcode bytes from CS8427\n");
snd_i2c_unlock(device->bus);
return err < 0 ? err : -EIO;
}