Skip to content

Commit

Permalink
Merge branch 'topic/cvt-dev-prints' into for-next
Browse files Browse the repository at this point in the history
This merges the bunch of changes over pci and usb sound drivers to
convert to dev_err() and co.
  • Loading branch information
Takashi Iwai committed Feb 28, 2014
2 parents e8b99a1 + e3b3757 commit 2b9e4a7
Show file tree
Hide file tree
Showing 107 changed files with 2,520 additions and 2,117 deletions.
45 changes: 33 additions & 12 deletions sound/pci/ac97/ac97_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ static void update_power_regs(struct snd_ac97 *ac97);
#define ac97_is_power_save_mode(ac97) 0
#endif

#define ac97_err(ac97, fmt, args...) \
dev_err((ac97)->bus->card->dev, fmt, ##args)
#define ac97_warn(ac97, fmt, args...) \
dev_warn((ac97)->bus->card->dev, fmt, ##args)
#define ac97_dbg(ac97, fmt, args...) \
dev_dbg((ac97)->bus->card->dev, fmt, ##args)

/*
* I/O routines
Expand Down Expand Up @@ -1673,7 +1679,7 @@ static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97)
int err, idx;

/*
printk(KERN_DEBUG "AC97_GPIO_CFG = %x\n",
ac97_dbg(ac97, "AC97_GPIO_CFG = %x\n",
snd_ac97_read(ac97,AC97_GPIO_CFG));
*/
snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH));
Expand Down Expand Up @@ -1963,7 +1969,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
ac97->bus->card->number, ac97->num,
snd_ac97_get_short_name(ac97));
if ((err = device_register(&ac97->dev)) < 0) {
snd_printk(KERN_ERR "Can't register ac97 bus\n");
ac97_err(ac97, "Can't register ac97 bus\n");
ac97->dev.bus = NULL;
return err;
}
Expand Down Expand Up @@ -2089,7 +2095,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
msecs_to_jiffies(500), 1);
}
if (err < 0) {
snd_printk(KERN_WARNING "AC'97 %d does not respond - RESET\n", ac97->num);
ac97_warn(ac97, "AC'97 %d does not respond - RESET\n",
ac97->num);
/* proceed anyway - it's often non-critical */
}
}
Expand All @@ -2098,7 +2105,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
ac97->id |= snd_ac97_read(ac97, AC97_VENDOR_ID2);
if (! (ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) &&
(ac97->id == 0x00000000 || ac97->id == 0xffffffff)) {
snd_printk(KERN_ERR "AC'97 %d access is not valid [0x%x], removing mixer.\n", ac97->num, ac97->id);
ac97_err(ac97,
"AC'97 %d access is not valid [0x%x], removing mixer.\n",
ac97->num, ac97->id);
snd_ac97_free(ac97);
return -EIO;
}
Expand Down Expand Up @@ -2131,7 +2140,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,

if (!ac97_is_audio(ac97) && !ac97_is_modem(ac97)) {
if (!(ac97->scaps & (AC97_SCAP_SKIP_AUDIO|AC97_SCAP_SKIP_MODEM)))
snd_printk(KERN_ERR "AC'97 %d access error (not audio or modem codec)\n", ac97->num);
ac97_err(ac97,
"AC'97 %d access error (not audio or modem codec)\n",
ac97->num);
snd_ac97_free(ac97);
return -EACCES;
}
Expand All @@ -2156,7 +2167,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
goto __ready_ok;
schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies));
snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num);
ac97_warn(ac97,
"AC'97 %d analog subsections not ready\n", ac97->num);
}

/* FIXME: add powerdown control */
Expand Down Expand Up @@ -2188,7 +2200,10 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
goto __ready_ok;
schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies));
snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
ac97_warn(ac97,
"MC'97 %d converters and GPIO not ready (0x%x)\n",
ac97->num,
snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
}

__ready_ok:
Expand Down Expand Up @@ -2723,7 +2738,7 @@ static int tune_ad_sharing(struct snd_ac97 *ac97)
{
unsigned short scfg;
if ((ac97->id & 0xffffff00) != 0x41445300) {
snd_printk(KERN_ERR "ac97_quirk AD_SHARING is only for AD codecs\n");
ac97_err(ac97, "ac97_quirk AD_SHARING is only for AD codecs\n");
return -EINVAL;
}
/* Turn on OMS bit to route microphone to back panel */
Expand All @@ -2739,7 +2754,8 @@ AC97_SINGLE("Jack Detect", AC97_ALC650_CLOCK, 5, 1, 0);
static int tune_alc_jack(struct snd_ac97 *ac97)
{
if ((ac97->id & 0xffffff00) != 0x414c4700) {
snd_printk(KERN_ERR "ac97_quirk ALC_JACK is only for Realtek codecs\n");
ac97_err(ac97,
"ac97_quirk ALC_JACK is only for Realtek codecs\n");
return -EINVAL;
}
snd_ac97_update_bits(ac97, 0x7a, 0x20, 0x20); /* select jack detect function */
Expand Down Expand Up @@ -2899,7 +2915,8 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons
if (override && strcmp(override, "-1") && strcmp(override, "default")) {
result = apply_quirk_str(ac97, override);
if (result < 0)
snd_printk(KERN_ERR "applying quirk type %s failed (%d)\n", override, result);
ac97_err(ac97, "applying quirk type %s failed (%d)\n",
override, result);
return result;
}

Expand All @@ -2913,10 +2930,14 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons
quirk->subdevice == (quirk->mask & ac97->subsystem_device)) {
if (quirk->codec_id && quirk->codec_id != ac97->id)
continue;
snd_printdd("ac97 quirk for %s (%04x:%04x)\n", quirk->name, ac97->subsystem_vendor, ac97->subsystem_device);
ac97_dbg(ac97, "ac97 quirk for %s (%04x:%04x)\n",
quirk->name, ac97->subsystem_vendor,
ac97->subsystem_device);
result = apply_quirk(ac97, quirk->type);
if (result < 0)
snd_printk(KERN_ERR "applying quirk type %d for %s failed (%d)\n", quirk->type, quirk->name, result);
ac97_err(ac97,
"applying quirk type %d for %s failed (%d)\n",
quirk->type, quirk->name, result);
return result;
}
}
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/ac97/ac97_patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3477,7 +3477,8 @@ static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,

sctl = snd_ac97_find_mixer_ctl(ac97, *s);
if (!sctl) {
snd_printdd("Cannot find slave %s, skipped\n", *s);
dev_dbg(ac97->bus->card->dev,
"Cannot find slave %s, skipped\n", *s);
continue;
}
err = snd_ctl_add_slave(kctl, sctl);
Expand Down
15 changes: 11 additions & 4 deletions sound/pci/ac97/ac97_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,9 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
}
if (!ok_flag) {
spin_unlock_irq(&pcm->bus->bus_lock);
snd_printk(KERN_ERR "cannot find configuration for AC97 slot %i\n", i);
dev_err(bus->card->dev,
"cannot find configuration for AC97 slot %i\n",
i);
err = -EAGAIN;
goto error;
}
Expand All @@ -618,15 +620,20 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
if (pcm->r[r].rslots[cidx] & (1 << i)) {
reg = get_slot_reg(pcm, cidx, i, r);
if (reg == 0xff) {
snd_printk(KERN_ERR "invalid AC97 slot %i?\n", i);
dev_err(bus->card->dev,
"invalid AC97 slot %i?\n", i);
continue;
}
if (reg_ok[cidx] & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
continue;
//printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate);
dev_dbg(bus->card->dev,
"setting ac97 reg 0x%x to rate %d\n",
reg, rate);
err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
if (err < 0)
snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);
dev_err(bus->card->dev,
"error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n",
cidx, reg, rate, err);
else
reg_ok[cidx] |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE));
}
Expand Down
32 changes: 15 additions & 17 deletions sound/pci/ad1889.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
#define DEVNAME "ad1889"
#define PFX DEVNAME ": "

/* let's use the global sound debug interfaces */
#define ad1889_debug(fmt, arg...) snd_printd(KERN_DEBUG fmt, ## arg)

/* keep track of some hw registers */
struct ad1889_register_state {
u16 reg; /* reg setup */
Expand Down Expand Up @@ -264,11 +261,11 @@ snd_ad1889_ac97_ready(struct snd_ad1889 *chip)
&& --retry)
mdelay(1);
if (!retry) {
snd_printk(KERN_ERR PFX "[%s] Link is not ready.\n",
__func__);
dev_err(chip->card->dev, "[%s] Link is not ready.\n",
__func__);
return -EIO;
}
ad1889_debug("[%s] ready after %d ms\n", __func__, 400 - retry);
dev_dbg(chip->card->dev, "[%s] ready after %d ms\n", __func__, 400 - retry);

return 0;
}
Expand Down Expand Up @@ -405,9 +402,9 @@ snd_ad1889_playback_prepare(struct snd_pcm_substream *ss)

spin_unlock_irq(&chip->lock);

ad1889_debug("prepare playback: addr = 0x%x, count = %u, "
"size = %u, reg = 0x%x, rate = %u\n", chip->wave.addr,
count, size, reg, rt->rate);
dev_dbg(chip->card->dev,
"prepare playback: addr = 0x%x, count = %u, size = %u, reg = 0x%x, rate = %u\n",
chip->wave.addr, count, size, reg, rt->rate);
return 0;
}

Expand Down Expand Up @@ -452,9 +449,9 @@ snd_ad1889_capture_prepare(struct snd_pcm_substream *ss)

spin_unlock_irq(&chip->lock);

ad1889_debug("prepare capture: addr = 0x%x, count = %u, "
"size = %u, reg = 0x%x, rate = %u\n", chip->ramc.addr,
count, size, reg, rt->rate);
dev_dbg(chip->card->dev,
"prepare capture: addr = 0x%x, count = %u, size = %u, reg = 0x%x, rate = %u\n",
chip->ramc.addr, count, size, reg, rt->rate);
return 0;
}

Expand Down Expand Up @@ -614,7 +611,8 @@ snd_ad1889_interrupt(int irq, void *dev_id)
return IRQ_NONE;

if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI))
ad1889_debug("Unexpected master or target abort interrupt!\n");
dev_dbg(chip->card->dev,
"Unexpected master or target abort interrupt!\n");

if ((st & AD_DMA_DISR_WAVI) && chip->psubs)
snd_pcm_period_elapsed(chip->psubs);
Expand Down Expand Up @@ -656,7 +654,7 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, struct snd_pcm **rpcm)
BUFFER_BYTES_MAX);

if (err < 0) {
snd_printk(KERN_ERR PFX "buffer allocation error: %d\n", err);
dev_err(chip->card->dev, "buffer allocation error: %d\n", err);
return err;
}

Expand Down Expand Up @@ -912,7 +910,7 @@ snd_ad1889_create(struct snd_card *card,
/* check PCI availability (32bit DMA) */
if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n");
dev_err(card->dev, "error setting 32-bit DMA mask.\n");
pci_disable_device(pci);
return -ENXIO;
}
Expand All @@ -935,7 +933,7 @@ snd_ad1889_create(struct snd_card *card,
chip->bar = pci_resource_start(pci, 0);
chip->iobase = pci_ioremap_bar(pci, 0);
if (chip->iobase == NULL) {
printk(KERN_ERR PFX "unable to reserve region.\n");
dev_err(card->dev, "unable to reserve region.\n");
err = -EBUSY;
goto free_and_ret;
}
Expand All @@ -946,7 +944,7 @@ snd_ad1889_create(struct snd_card *card,

if (request_irq(pci->irq, snd_ad1889_interrupt,
IRQF_SHARED, KBUILD_MODNAME, chip)) {
printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq);
dev_err(card->dev, "cannot obtain IRQ %d\n", pci->irq);
snd_ad1889_free(chip);
return -EBUSY;
}
Expand Down
Loading

0 comments on commit 2b9e4a7

Please sign in to comment.