ALSA: via82xx: Use standard printk helpers

Convert with dev_err() and co from snd_printk(), etc.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2014-02-25 15:21:56 +01:00
Родитель ffa74cc781
Коммит 59d3acfa2d
1 изменённых файлов: 39 добавлений и 30 удалений

Просмотреть файл

@ -459,7 +459,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
unsigned int addr; unsigned int addr;
if (idx >= VIA_TABLE_SIZE) { if (idx >= VIA_TABLE_SIZE) {
snd_printk(KERN_ERR "via82xx: too much table size!\n"); dev_err(&pci->dev, "too much table size!\n");
return -EINVAL; return -EINVAL;
} }
addr = snd_pcm_sgbuf_get_addr(substream, ofs); addr = snd_pcm_sgbuf_get_addr(substream, ofs);
@ -474,8 +474,9 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
} else } else
flag = 0; /* period continues to the next */ flag = 0; /* period continues to the next */
/* /*
printk(KERN_DEBUG "via: tbl %d: at %d size %d " dev_dbg(&pci->dev,
"(rest %d)\n", idx, ofs, r, rest); "tbl %d: at %d size %d (rest %d)\n",
idx, ofs, r, rest);
*/ */
((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag);
dev->idx_table[idx].offset = ofs; dev->idx_table[idx].offset = ofs;
@ -528,7 +529,7 @@ static int snd_via82xx_codec_ready(struct via82xx *chip, int secondary)
if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY))
return val & 0xffff; return val & 0xffff;
} }
snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", dev_err(chip->card->dev, "codec_ready: codec %i is not ready [0x%x]\n",
secondary, snd_via82xx_codec_xread(chip)); secondary, snd_via82xx_codec_xread(chip));
return -EIO; return -EIO;
} }
@ -587,7 +588,8 @@ static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned sho
xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT;
while (1) { while (1) {
if (again++ > 3) { if (again++ > 3) {
snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", dev_err(chip->card->dev,
"codec_read: codec %i is not valid [0x%x]\n",
ac97->num, snd_via82xx_codec_xread(chip)); ac97->num, snd_via82xx_codec_xread(chip));
return 0xffff; return 0xffff;
} }
@ -777,7 +779,9 @@ static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\ ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\
viadev->lastpos < viadev->bufsize2)) viadev->lastpos < viadev->bufsize2))
static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx, static inline unsigned int calc_linear_pos(struct via82xx *chip,
struct viadev *viadev,
unsigned int idx,
unsigned int count) unsigned int count)
{ {
unsigned int size, base, res; unsigned int size, base, res;
@ -790,7 +794,8 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
/* check the validity of the calculated position */ /* check the validity of the calculated position */
if (size < count) { if (size < count) {
snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", dev_dbg(chip->card->dev,
"invalid via82xx_cur_ptr (size = %d, count = %d)\n",
(int)size, (int)count); (int)size, (int)count);
res = viadev->lastpos; res = viadev->lastpos;
} else { } else {
@ -807,9 +812,9 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
} }
if (check_invalid_pos(viadev, res)) { if (check_invalid_pos(viadev, res)) {
#ifdef POINTER_DEBUG #ifdef POINTER_DEBUG
printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, " dev_dbg(chip->card->dev,
"bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, " "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n",
"count = 0x%x\n", idx, viadev->tbl_entries, idx, viadev->tbl_entries,
viadev->lastpos, viadev->bufsize2, viadev->lastpos, viadev->bufsize2,
viadev->idx_table[idx].offset, viadev->idx_table[idx].offset,
viadev->idx_table[idx].size, count); viadev->idx_table[idx].size, count);
@ -817,8 +822,8 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
/* count register returns full size when end of buffer is reached */ /* count register returns full size when end of buffer is reached */
res = base + size; res = base + size;
if (check_invalid_pos(viadev, res)) { if (check_invalid_pos(viadev, res)) {
snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), " dev_dbg(chip->card->dev,
"using last valid pointer\n"); "invalid via82xx_cur_ptr (2), using last valid pointer\n");
res = viadev->lastpos; res = viadev->lastpos;
} }
} }
@ -850,7 +855,7 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substr
idx = 0; idx = 0;
else /* CURR_PTR holds the address + 8 */ else /* CURR_PTR holds the address + 8 */
idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries;
res = calc_linear_pos(viadev, idx, count); res = calc_linear_pos(chip, viadev, idx, count);
viadev->lastpos = res; /* remember the last position */ viadev->lastpos = res; /* remember the last position */
spin_unlock(&chip->reg_lock); spin_unlock(&chip->reg_lock);
@ -889,13 +894,14 @@ static snd_pcm_uframes_t snd_via8233_pcm_pointer(struct snd_pcm_substream *subst
idx = count >> 24; idx = count >> 24;
if (idx >= viadev->tbl_entries) { if (idx >= viadev->tbl_entries) {
#ifdef POINTER_DEBUG #ifdef POINTER_DEBUG
printk(KERN_DEBUG "fail: invalid idx = %i/%i\n", idx, dev_dbg(chip->card->dev,
"fail: invalid idx = %i/%i\n", idx,
viadev->tbl_entries); viadev->tbl_entries);
#endif #endif
res = viadev->lastpos; res = viadev->lastpos;
} else { } else {
count &= 0xffffff; count &= 0xffffff;
res = calc_linear_pos(viadev, idx, count); res = calc_linear_pos(chip, viadev, idx, count);
} }
} else { } else {
res = viadev->hwptr_done; res = viadev->hwptr_done;
@ -1940,14 +1946,15 @@ static int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legac
r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport");
if (!r) { if (!r) {
printk(KERN_WARNING "via82xx: cannot reserve joystick port %#x\n", dev_warn(chip->card->dev, "cannot reserve joystick port %#x\n",
JOYSTICK_ADDR); JOYSTICK_ADDR);
return -EBUSY; return -EBUSY;
} }
chip->gameport = gp = gameport_allocate_port(); chip->gameport = gp = gameport_allocate_port();
if (!gp) { if (!gp) {
printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n"); dev_err(chip->card->dev,
"cannot allocate memory for gameport\n");
release_and_free_resource(r); release_and_free_resource(r);
return -ENOMEM; return -ENOMEM;
} }
@ -2016,7 +2023,8 @@ static int snd_via8233_init_misc(struct via82xx *chip)
strcpy(sid.name, "PCM Playback Volume"); strcpy(sid.name, "PCM Playback Volume");
sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
if (! snd_ctl_find_id(chip->card, &sid)) { if (! snd_ctl_find_id(chip->card, &sid)) {
snd_printd(KERN_INFO "Using DXS as PCM Playback\n"); dev_info(chip->card->dev,
"Using DXS as PCM Playback\n");
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip)); err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip));
if (err < 0) if (err < 0)
return err; return err;
@ -2102,8 +2110,9 @@ static int snd_via686_init_misc(struct via82xx *chip)
mpu_port, MPU401_INFO_INTEGRATED | mpu_port, MPU401_INFO_INTEGRATED |
MPU401_INFO_IRQ_HOOK, -1, MPU401_INFO_IRQ_HOOK, -1,
&chip->rmidi) < 0) { &chip->rmidi) < 0) {
printk(KERN_WARNING "unable to initialize MPU-401" dev_warn(chip->card->dev,
" at 0x%lx, skipping\n", mpu_port); "unable to initialize MPU-401 at 0x%lx, skipping\n",
mpu_port);
legacy &= ~VIA_FUNC_ENABLE_MIDI; legacy &= ~VIA_FUNC_ENABLE_MIDI;
} else { } else {
legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */ legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */
@ -2203,7 +2212,8 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
} while (time_before(jiffies, end_time)); } while (time_before(jiffies, end_time));
if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
snd_printk(KERN_ERR "AC'97 codec is not ready [0x%x]\n", val); dev_err(chip->card->dev,
"AC'97 codec is not ready [0x%x]\n", val);
#if 0 /* FIXME: we don't support the second codec yet so skip the detection now.. */ #if 0 /* FIXME: we don't support the second codec yet so skip the detection now.. */
snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
@ -2303,8 +2313,7 @@ static int snd_via82xx_resume(struct device *dev)
pci_set_power_state(pci, PCI_D0); pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci); pci_restore_state(pci);
if (pci_enable_device(pci) < 0) { if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "via82xx: pci_enable_device failed, " dev_err(dev, "pci_enable_device failed, disabling device\n");
"disabling device\n");
snd_card_disconnect(card); snd_card_disconnect(card);
return -EIO; return -EIO;
} }
@ -2417,7 +2426,7 @@ static int snd_via82xx_create(struct snd_card *card,
snd_via8233_interrupt : snd_via686_interrupt, snd_via8233_interrupt : snd_via686_interrupt,
IRQF_SHARED, IRQF_SHARED,
KBUILD_MODNAME, chip)) { KBUILD_MODNAME, chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
snd_via82xx_free(chip); snd_via82xx_free(chip);
return -EBUSY; return -EBUSY;
} }
@ -2514,7 +2523,7 @@ static int check_dxs_list(struct pci_dev *pci, int revision)
w = snd_pci_quirk_lookup(pci, dxs_whitelist); w = snd_pci_quirk_lookup(pci, dxs_whitelist);
if (w) { if (w) {
snd_printdd(KERN_INFO "via82xx: DXS white list for %s found\n", dev_dbg(&pci->dev, "DXS white list for %s found\n",
snd_pci_quirk_name(w)); snd_pci_quirk_name(w));
return w->value; return w->value;
} }
@ -2526,10 +2535,10 @@ static int check_dxs_list(struct pci_dev *pci, int revision)
/* /*
* not detected, try 48k rate only to be sure. * not detected, try 48k rate only to be sure.
*/ */
printk(KERN_INFO "via82xx: Assuming DXS channels with 48k fixed sample rate.\n"); dev_info(&pci->dev, "Assuming DXS channels with 48k fixed sample rate.\n");
printk(KERN_INFO " Please try dxs_support=5 option\n"); dev_info(&pci->dev, " Please try dxs_support=5 option\n");
printk(KERN_INFO " and report if it works on your machine.\n"); dev_info(&pci->dev, " and report if it works on your machine.\n");
printk(KERN_INFO " For more details, read ALSA-Configuration.txt.\n"); dev_info(&pci->dev, " For more details, read ALSA-Configuration.txt.\n");
return VIA_DXS_48K; return VIA_DXS_48K;
}; };
@ -2582,7 +2591,7 @@ static int snd_via82xx_probe(struct pci_dev *pci,
strcpy(card->driver, "VIA8233"); strcpy(card->driver, "VIA8233");
break; break;
default: default:
snd_printk(KERN_ERR "invalid card type %d\n", card_type); dev_err(card->dev, "invalid card type %d\n", card_type);
err = -EINVAL; err = -EINVAL;
goto __error; goto __error;
} }