aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-28 05:54:43 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-28 05:54:43 -0500
commit2b9e4a73fbd90cb8459cf84c12ae05d2eb81da41 (patch)
tree52800decb82a6f478611a41b1592a9a0c7ae75a6 /sound
parente8b99a1dcb49b0d362b19a4831a00d85c76bd4b3 (diff)
parente3b3757b92a4df4addff74e179438afbfd8bb643 (diff)
Merge branch 'topic/cvt-dev-prints' into for-next
This merges the bunch of changes over pci and usb sound drivers to convert to dev_err() and co.
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ac97/ac97_codec.c45
-rw-r--r--sound/pci/ac97/ac97_patch.c3
-rw-r--r--sound/pci/ac97/ac97_pcm.c15
-rw-r--r--sound/pci/ad1889.c32
-rw-r--r--sound/pci/ali5451/ali5451.c148
-rw-r--r--sound/pci/als300.c52
-rw-r--r--sound/pci/als4000.c15
-rw-r--r--sound/pci/atiixp.c29
-rw-r--r--sound/pci/atiixp_modem.c24
-rw-r--r--sound/pci/aw2/aw2-alsa.c42
-rw-r--r--sound/pci/aw2/aw2-saa7146.c6
-rw-r--r--sound/pci/azt3328.c346
-rw-r--r--sound/pci/bt87x.c37
-rw-r--r--sound/pci/ca0106/ca0106_main.c84
-rw-r--r--sound/pci/ca0106/ca_midi.c4
-rw-r--r--sound/pci/cmipci.c36
-rw-r--r--sound/pci/cs4281.c44
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c143
-rw-r--r--sound/pci/cs46xx/dsp_spos.c126
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c57
-rw-r--r--sound/pci/cs5530.c23
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c26
-rw-r--r--sound/pci/cs5535audio/cs5535audio_olpc.c7
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pcm.c6
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pm.c7
-rw-r--r--sound/pci/echoaudio/echoaudio.c21
-rw-r--r--sound/pci/echoaudio/echoaudio_dsp.c9
-rw-r--r--sound/pci/echoaudio/midi.c3
-rw-r--r--sound/pci/emu10k1/emu10k1.c6
-rw-r--r--sound/pci/emu10k1/emu10k1_callback.c4
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c73
-rw-r--r--sound/pci/emu10k1/emu10k1_patch.c6
-rw-r--r--sound/pci/emu10k1/emu10k1x.c27
-rw-r--r--sound/pci/emu10k1/emufx.c12
-rw-r--r--sound/pci/emu10k1/emumixer.c6
-rw-r--r--sound/pci/emu10k1/emumpu401.c7
-rw-r--r--sound/pci/emu10k1/emupcm.c22
-rw-r--r--sound/pci/emu10k1/io.c10
-rw-r--r--sound/pci/emu10k1/irq.c21
-rw-r--r--sound/pci/emu10k1/memory.c12
-rw-r--r--sound/pci/emu10k1/p16v.c45
-rw-r--r--sound/pci/emu10k1/voice.c6
-rw-r--r--sound/pci/ens1370.c39
-rw-r--r--sound/pci/es1938.c74
-rw-r--r--sound/pci/es1968.c49
-rw-r--r--sound/pci/fm801.c26
-rw-r--r--sound/pci/ice1712/aureon.c7
-rw-r--r--sound/pci/ice1712/delta.c5
-rw-r--r--sound/pci/ice1712/ews.c12
-rw-r--r--sound/pci/ice1712/ice1712.c33
-rw-r--r--sound/pci/ice1712/ice1724.c45
-rw-r--r--sound/pci/ice1712/juli.c14
-rw-r--r--sound/pci/ice1712/prodigy192.c13
-rw-r--r--sound/pci/ice1712/quartet.c6
-rw-r--r--sound/pci/intel8x0.c86
-rw-r--r--sound/pci/intel8x0m.c46
-rw-r--r--sound/pci/lola/lola.c42
-rw-r--r--sound/pci/lola/lola_clock.c14
-rw-r--r--sound/pci/lola/lola_mixer.c22
-rw-r--r--sound/pci/lola/lola_pcm.c26
-rw-r--r--sound/pci/lx6464es/lx6464es.c157
-rw-r--r--sound/pci/lx6464es/lx_core.c89
-rw-r--r--sound/pci/maestro3.c37
-rw-r--r--sound/pci/mixart/mixart.c118
-rw-r--r--sound/pci/mixart/mixart_core.c49
-rw-r--r--sound/pci/mixart/mixart_hwdep.c65
-rw-r--r--sound/pci/mixart/mixart_mixer.c16
-rw-r--r--sound/pci/nm256/nm256.c75
-rw-r--r--sound/pci/oxygen/oxygen_io.c8
-rw-r--r--sound/pci/oxygen/oxygen_lib.c10
-rw-r--r--sound/pci/oxygen/xonar_hdmi.c2
-rw-r--r--sound/pci/oxygen/xonar_lib.c4
-rw-r--r--sound/pci/pcxhr/pcxhr.c54
-rw-r--r--sound/pci/pcxhr/pcxhr_core.c108
-rw-r--r--sound/pci/pcxhr/pcxhr_hwdep.c31
-rw-r--r--sound/pci/pcxhr/pcxhr_mix22.c23
-rw-r--r--sound/pci/pcxhr/pcxhr_mixer.c13
-rw-r--r--sound/pci/rme32.c5
-rw-r--r--sound/pci/rme96.c46
-rw-r--r--sound/pci/rme9652/hdsp.c128
-rw-r--r--sound/pci/rme9652/hdspm.c125
-rw-r--r--sound/pci/rme9652/rme9652.c19
-rw-r--r--sound/pci/sonicvibes.c235
-rw-r--r--sound/pci/trident/trident_main.c89
-rw-r--r--sound/pci/via82xx.c69
-rw-r--r--sound/pci/via82xx_modem.c45
-rw-r--r--sound/pci/vx222/vx222.c7
-rw-r--r--sound/pci/vx222/vx222_ops.c19
-rw-r--r--sound/pci/ymfpci/ymfpci.c22
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c26
-rw-r--r--sound/usb/6fire/chip.c8
-rw-r--r--sound/usb/6fire/comm.c4
-rw-r--r--sound/usb/6fire/control.c18
-rw-r--r--sound/usb/6fire/firmware.c70
-rw-r--r--sound/usb/6fire/midi.c12
-rw-r--r--sound/usb/6fire/pcm.c46
-rw-r--r--sound/usb/card.c41
-rw-r--r--sound/usb/clock.c65
-rw-r--r--sound/usb/endpoint.c32
-rw-r--r--sound/usb/format.c68
-rw-r--r--sound/usb/midi.c45
-rw-r--r--sound/usb/mixer.c124
-rw-r--r--sound/usb/mixer_quirks.c10
-rw-r--r--sound/usb/pcm.c83
-rw-r--r--sound/usb/quirks.c52
-rw-r--r--sound/usb/stream.c50
-rw-r--r--sound/usb/usbaudio.h9
107 files changed, 2520 insertions, 2117 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index bf578ba2677e..14ad54b7928c 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -214,6 +214,12 @@ static void update_power_regs(struct snd_ac97 *ac97);
214#define ac97_is_power_save_mode(ac97) 0 214#define ac97_is_power_save_mode(ac97) 0
215#endif 215#endif
216 216
217#define ac97_err(ac97, fmt, args...) \
218 dev_err((ac97)->bus->card->dev, fmt, ##args)
219#define ac97_warn(ac97, fmt, args...) \
220 dev_warn((ac97)->bus->card->dev, fmt, ##args)
221#define ac97_dbg(ac97, fmt, args...) \
222 dev_dbg((ac97)->bus->card->dev, fmt, ##args)
217 223
218/* 224/*
219 * I/O routines 225 * I/O routines
@@ -1673,7 +1679,7 @@ static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97)
1673 int err, idx; 1679 int err, idx;
1674 1680
1675 /* 1681 /*
1676 printk(KERN_DEBUG "AC97_GPIO_CFG = %x\n", 1682 ac97_dbg(ac97, "AC97_GPIO_CFG = %x\n",
1677 snd_ac97_read(ac97,AC97_GPIO_CFG)); 1683 snd_ac97_read(ac97,AC97_GPIO_CFG));
1678 */ 1684 */
1679 snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); 1685 snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH));
@@ -1963,7 +1969,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
1963 ac97->bus->card->number, ac97->num, 1969 ac97->bus->card->number, ac97->num,
1964 snd_ac97_get_short_name(ac97)); 1970 snd_ac97_get_short_name(ac97));
1965 if ((err = device_register(&ac97->dev)) < 0) { 1971 if ((err = device_register(&ac97->dev)) < 0) {
1966 snd_printk(KERN_ERR "Can't register ac97 bus\n"); 1972 ac97_err(ac97, "Can't register ac97 bus\n");
1967 ac97->dev.bus = NULL; 1973 ac97->dev.bus = NULL;
1968 return err; 1974 return err;
1969 } 1975 }
@@ -2089,7 +2095,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
2089 msecs_to_jiffies(500), 1); 2095 msecs_to_jiffies(500), 1);
2090 } 2096 }
2091 if (err < 0) { 2097 if (err < 0) {
2092 snd_printk(KERN_WARNING "AC'97 %d does not respond - RESET\n", ac97->num); 2098 ac97_warn(ac97, "AC'97 %d does not respond - RESET\n",
2099 ac97->num);
2093 /* proceed anyway - it's often non-critical */ 2100 /* proceed anyway - it's often non-critical */
2094 } 2101 }
2095 } 2102 }
@@ -2098,7 +2105,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
2098 ac97->id |= snd_ac97_read(ac97, AC97_VENDOR_ID2); 2105 ac97->id |= snd_ac97_read(ac97, AC97_VENDOR_ID2);
2099 if (! (ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) && 2106 if (! (ac97->scaps & AC97_SCAP_DETECT_BY_VENDOR) &&
2100 (ac97->id == 0x00000000 || ac97->id == 0xffffffff)) { 2107 (ac97->id == 0x00000000 || ac97->id == 0xffffffff)) {
2101 snd_printk(KERN_ERR "AC'97 %d access is not valid [0x%x], removing mixer.\n", ac97->num, ac97->id); 2108 ac97_err(ac97,
2109 "AC'97 %d access is not valid [0x%x], removing mixer.\n",
2110 ac97->num, ac97->id);
2102 snd_ac97_free(ac97); 2111 snd_ac97_free(ac97);
2103 return -EIO; 2112 return -EIO;
2104 } 2113 }
@@ -2131,7 +2140,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
2131 2140
2132 if (!ac97_is_audio(ac97) && !ac97_is_modem(ac97)) { 2141 if (!ac97_is_audio(ac97) && !ac97_is_modem(ac97)) {
2133 if (!(ac97->scaps & (AC97_SCAP_SKIP_AUDIO|AC97_SCAP_SKIP_MODEM))) 2142 if (!(ac97->scaps & (AC97_SCAP_SKIP_AUDIO|AC97_SCAP_SKIP_MODEM)))
2134 snd_printk(KERN_ERR "AC'97 %d access error (not audio or modem codec)\n", ac97->num); 2143 ac97_err(ac97,
2144 "AC'97 %d access error (not audio or modem codec)\n",
2145 ac97->num);
2135 snd_ac97_free(ac97); 2146 snd_ac97_free(ac97);
2136 return -EACCES; 2147 return -EACCES;
2137 } 2148 }
@@ -2156,7 +2167,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
2156 goto __ready_ok; 2167 goto __ready_ok;
2157 schedule_timeout_uninterruptible(1); 2168 schedule_timeout_uninterruptible(1);
2158 } while (time_after_eq(end_time, jiffies)); 2169 } while (time_after_eq(end_time, jiffies));
2159 snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num); 2170 ac97_warn(ac97,
2171 "AC'97 %d analog subsections not ready\n", ac97->num);
2160 } 2172 }
2161 2173
2162 /* FIXME: add powerdown control */ 2174 /* FIXME: add powerdown control */
@@ -2188,7 +2200,10 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
2188 goto __ready_ok; 2200 goto __ready_ok;
2189 schedule_timeout_uninterruptible(1); 2201 schedule_timeout_uninterruptible(1);
2190 } while (time_after_eq(end_time, jiffies)); 2202 } while (time_after_eq(end_time, jiffies));
2191 snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); 2203 ac97_warn(ac97,
2204 "MC'97 %d converters and GPIO not ready (0x%x)\n",
2205 ac97->num,
2206 snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS));
2192 } 2207 }
2193 2208
2194 __ready_ok: 2209 __ready_ok:
@@ -2723,7 +2738,7 @@ static int tune_ad_sharing(struct snd_ac97 *ac97)
2723{ 2738{
2724 unsigned short scfg; 2739 unsigned short scfg;
2725 if ((ac97->id & 0xffffff00) != 0x41445300) { 2740 if ((ac97->id & 0xffffff00) != 0x41445300) {
2726 snd_printk(KERN_ERR "ac97_quirk AD_SHARING is only for AD codecs\n"); 2741 ac97_err(ac97, "ac97_quirk AD_SHARING is only for AD codecs\n");
2727 return -EINVAL; 2742 return -EINVAL;
2728 } 2743 }
2729 /* Turn on OMS bit to route microphone to back panel */ 2744 /* Turn on OMS bit to route microphone to back panel */
@@ -2739,7 +2754,8 @@ AC97_SINGLE("Jack Detect", AC97_ALC650_CLOCK, 5, 1, 0);
2739static int tune_alc_jack(struct snd_ac97 *ac97) 2754static int tune_alc_jack(struct snd_ac97 *ac97)
2740{ 2755{
2741 if ((ac97->id & 0xffffff00) != 0x414c4700) { 2756 if ((ac97->id & 0xffffff00) != 0x414c4700) {
2742 snd_printk(KERN_ERR "ac97_quirk ALC_JACK is only for Realtek codecs\n"); 2757 ac97_err(ac97,
2758 "ac97_quirk ALC_JACK is only for Realtek codecs\n");
2743 return -EINVAL; 2759 return -EINVAL;
2744 } 2760 }
2745 snd_ac97_update_bits(ac97, 0x7a, 0x20, 0x20); /* select jack detect function */ 2761 snd_ac97_update_bits(ac97, 0x7a, 0x20, 0x20); /* select jack detect function */
@@ -2899,7 +2915,8 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons
2899 if (override && strcmp(override, "-1") && strcmp(override, "default")) { 2915 if (override && strcmp(override, "-1") && strcmp(override, "default")) {
2900 result = apply_quirk_str(ac97, override); 2916 result = apply_quirk_str(ac97, override);
2901 if (result < 0) 2917 if (result < 0)
2902 snd_printk(KERN_ERR "applying quirk type %s failed (%d)\n", override, result); 2918 ac97_err(ac97, "applying quirk type %s failed (%d)\n",
2919 override, result);
2903 return result; 2920 return result;
2904 } 2921 }
2905 2922
@@ -2913,10 +2930,14 @@ int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, cons
2913 quirk->subdevice == (quirk->mask & ac97->subsystem_device)) { 2930 quirk->subdevice == (quirk->mask & ac97->subsystem_device)) {
2914 if (quirk->codec_id && quirk->codec_id != ac97->id) 2931 if (quirk->codec_id && quirk->codec_id != ac97->id)
2915 continue; 2932 continue;
2916 snd_printdd("ac97 quirk for %s (%04x:%04x)\n", quirk->name, ac97->subsystem_vendor, ac97->subsystem_device); 2933 ac97_dbg(ac97, "ac97 quirk for %s (%04x:%04x)\n",
2934 quirk->name, ac97->subsystem_vendor,
2935 ac97->subsystem_device);
2917 result = apply_quirk(ac97, quirk->type); 2936 result = apply_quirk(ac97, quirk->type);
2918 if (result < 0) 2937 if (result < 0)
2919 snd_printk(KERN_ERR "applying quirk type %d for %s failed (%d)\n", quirk->type, quirk->name, result); 2938 ac97_err(ac97,
2939 "applying quirk type %d for %s failed (%d)\n",
2940 quirk->type, quirk->name, result);
2920 return result; 2941 return result;
2921 } 2942 }
2922 } 2943 }
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 66a3bc95fb84..991762215417 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -3477,7 +3477,8 @@ static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,
3477 3477
3478 sctl = snd_ac97_find_mixer_ctl(ac97, *s); 3478 sctl = snd_ac97_find_mixer_ctl(ac97, *s);
3479 if (!sctl) { 3479 if (!sctl) {
3480 snd_printdd("Cannot find slave %s, skipped\n", *s); 3480 dev_dbg(ac97->bus->card->dev,
3481 "Cannot find slave %s, skipped\n", *s);
3481 continue; 3482 continue;
3482 } 3483 }
3483 err = snd_ctl_add_slave(kctl, sctl); 3484 err = snd_ctl_add_slave(kctl, sctl);
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
index eab0fc9ff2e0..d15297a68801 100644
--- a/sound/pci/ac97/ac97_pcm.c
+++ b/sound/pci/ac97/ac97_pcm.c
@@ -604,7 +604,9 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
604 } 604 }
605 if (!ok_flag) { 605 if (!ok_flag) {
606 spin_unlock_irq(&pcm->bus->bus_lock); 606 spin_unlock_irq(&pcm->bus->bus_lock);
607 snd_printk(KERN_ERR "cannot find configuration for AC97 slot %i\n", i); 607 dev_err(bus->card->dev,
608 "cannot find configuration for AC97 slot %i\n",
609 i);
608 err = -EAGAIN; 610 err = -EAGAIN;
609 goto error; 611 goto error;
610 } 612 }
@@ -618,15 +620,20 @@ int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
618 if (pcm->r[r].rslots[cidx] & (1 << i)) { 620 if (pcm->r[r].rslots[cidx] & (1 << i)) {
619 reg = get_slot_reg(pcm, cidx, i, r); 621 reg = get_slot_reg(pcm, cidx, i, r);
620 if (reg == 0xff) { 622 if (reg == 0xff) {
621 snd_printk(KERN_ERR "invalid AC97 slot %i?\n", i); 623 dev_err(bus->card->dev,
624 "invalid AC97 slot %i?\n", i);
622 continue; 625 continue;
623 } 626 }
624 if (reg_ok[cidx] & (1 << (reg - AC97_PCM_FRONT_DAC_RATE))) 627 if (reg_ok[cidx] & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
625 continue; 628 continue;
626 //printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate); 629 dev_dbg(bus->card->dev,
630 "setting ac97 reg 0x%x to rate %d\n",
631 reg, rate);
627 err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate); 632 err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
628 if (err < 0) 633 if (err < 0)
629 snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err); 634 dev_err(bus->card->dev,
635 "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n",
636 cidx, reg, rate, err);
630 else 637 else
631 reg_ok[cidx] |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE)); 638 reg_ok[cidx] |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE));
632 } 639 }
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index ba4da1ed0444..488f966adde3 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -77,9 +77,6 @@ MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
77#define DEVNAME "ad1889" 77#define DEVNAME "ad1889"
78#define PFX DEVNAME ": " 78#define PFX DEVNAME ": "
79 79
80/* let's use the global sound debug interfaces */
81#define ad1889_debug(fmt, arg...) snd_printd(KERN_DEBUG fmt, ## arg)
82
83/* keep track of some hw registers */ 80/* keep track of some hw registers */
84struct ad1889_register_state { 81struct ad1889_register_state {
85 u16 reg; /* reg setup */ 82 u16 reg; /* reg setup */
@@ -264,11 +261,11 @@ snd_ad1889_ac97_ready(struct snd_ad1889 *chip)
264 && --retry) 261 && --retry)
265 mdelay(1); 262 mdelay(1);
266 if (!retry) { 263 if (!retry) {
267 snd_printk(KERN_ERR PFX "[%s] Link is not ready.\n", 264 dev_err(chip->card->dev, "[%s] Link is not ready.\n",
268 __func__); 265 __func__);
269 return -EIO; 266 return -EIO;
270 } 267 }
271 ad1889_debug("[%s] ready after %d ms\n", __func__, 400 - retry); 268 dev_dbg(chip->card->dev, "[%s] ready after %d ms\n", __func__, 400 - retry);
272 269
273 return 0; 270 return 0;
274} 271}
@@ -405,9 +402,9 @@ snd_ad1889_playback_prepare(struct snd_pcm_substream *ss)
405 402
406 spin_unlock_irq(&chip->lock); 403 spin_unlock_irq(&chip->lock);
407 404
408 ad1889_debug("prepare playback: addr = 0x%x, count = %u, " 405 dev_dbg(chip->card->dev,
409 "size = %u, reg = 0x%x, rate = %u\n", chip->wave.addr, 406 "prepare playback: addr = 0x%x, count = %u, size = %u, reg = 0x%x, rate = %u\n",
410 count, size, reg, rt->rate); 407 chip->wave.addr, count, size, reg, rt->rate);
411 return 0; 408 return 0;
412} 409}
413 410
@@ -452,9 +449,9 @@ snd_ad1889_capture_prepare(struct snd_pcm_substream *ss)
452 449
453 spin_unlock_irq(&chip->lock); 450 spin_unlock_irq(&chip->lock);
454 451
455 ad1889_debug("prepare capture: addr = 0x%x, count = %u, " 452 dev_dbg(chip->card->dev,
456 "size = %u, reg = 0x%x, rate = %u\n", chip->ramc.addr, 453 "prepare capture: addr = 0x%x, count = %u, size = %u, reg = 0x%x, rate = %u\n",
457 count, size, reg, rt->rate); 454 chip->ramc.addr, count, size, reg, rt->rate);
458 return 0; 455 return 0;
459} 456}
460 457
@@ -614,7 +611,8 @@ snd_ad1889_interrupt(int irq, void *dev_id)
614 return IRQ_NONE; 611 return IRQ_NONE;
615 612
616 if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI)) 613 if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI))
617 ad1889_debug("Unexpected master or target abort interrupt!\n"); 614 dev_dbg(chip->card->dev,
615 "Unexpected master or target abort interrupt!\n");
618 616
619 if ((st & AD_DMA_DISR_WAVI) && chip->psubs) 617 if ((st & AD_DMA_DISR_WAVI) && chip->psubs)
620 snd_pcm_period_elapsed(chip->psubs); 618 snd_pcm_period_elapsed(chip->psubs);
@@ -656,7 +654,7 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, struct snd_pcm **rpcm)
656 BUFFER_BYTES_MAX); 654 BUFFER_BYTES_MAX);
657 655
658 if (err < 0) { 656 if (err < 0) {
659 snd_printk(KERN_ERR PFX "buffer allocation error: %d\n", err); 657 dev_err(chip->card->dev, "buffer allocation error: %d\n", err);
660 return err; 658 return err;
661 } 659 }
662 660
@@ -912,7 +910,7 @@ snd_ad1889_create(struct snd_card *card,
912 /* check PCI availability (32bit DMA) */ 910 /* check PCI availability (32bit DMA) */
913 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 911 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
914 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 912 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
915 printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n"); 913 dev_err(card->dev, "error setting 32-bit DMA mask.\n");
916 pci_disable_device(pci); 914 pci_disable_device(pci);
917 return -ENXIO; 915 return -ENXIO;
918 } 916 }
@@ -935,7 +933,7 @@ snd_ad1889_create(struct snd_card *card,
935 chip->bar = pci_resource_start(pci, 0); 933 chip->bar = pci_resource_start(pci, 0);
936 chip->iobase = pci_ioremap_bar(pci, 0); 934 chip->iobase = pci_ioremap_bar(pci, 0);
937 if (chip->iobase == NULL) { 935 if (chip->iobase == NULL) {
938 printk(KERN_ERR PFX "unable to reserve region.\n"); 936 dev_err(card->dev, "unable to reserve region.\n");
939 err = -EBUSY; 937 err = -EBUSY;
940 goto free_and_ret; 938 goto free_and_ret;
941 } 939 }
@@ -946,7 +944,7 @@ snd_ad1889_create(struct snd_card *card,
946 944
947 if (request_irq(pci->irq, snd_ad1889_interrupt, 945 if (request_irq(pci->irq, snd_ad1889_interrupt,
948 IRQF_SHARED, KBUILD_MODNAME, chip)) { 946 IRQF_SHARED, KBUILD_MODNAME, chip)) {
949 printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq); 947 dev_err(card->dev, "cannot obtain IRQ %d\n", pci->irq);
950 snd_ad1889_free(chip); 948 snd_ad1889_free(chip);
951 return -EBUSY; 949 return -EBUSY;
952 } 950 }
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 115b1120319a..feb29c24cab1 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -65,18 +65,6 @@ module_param(enable, bool, 0444);
65 65
66 66
67/* 67/*
68 * Debug part definitions
69 */
70
71/* #define ALI_DEBUG */
72
73#ifdef ALI_DEBUG
74#define snd_ali_printk(format, args...) printk(KERN_DEBUG format, ##args);
75#else
76#define snd_ali_printk(format, args...)
77#endif
78
79/*
80 * Constants definition 68 * Constants definition
81 */ 69 */
82 70
@@ -321,7 +309,7 @@ static int snd_ali_codec_ready(struct snd_ali *codec,
321 } 309 }
322 310
323 snd_ali_5451_poke(codec, port, res & ~0x8000); 311 snd_ali_5451_poke(codec, port, res & ~0x8000);
324 snd_printdd("ali_codec_ready: codec is not ready.\n "); 312 dev_dbg(codec->card->dev, "ali_codec_ready: codec is not ready.\n ");
325 return -EIO; 313 return -EIO;
326} 314}
327 315
@@ -342,7 +330,7 @@ static int snd_ali_stimer_ready(struct snd_ali *codec)
342 schedule_timeout_uninterruptible(1); 330 schedule_timeout_uninterruptible(1);
343 } 331 }
344 332
345 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); 333 dev_err(codec->card->dev, "ali_stimer_read: stimer is not ready.\n");
346 return -EIO; 334 return -EIO;
347} 335}
348 336
@@ -354,7 +342,8 @@ static void snd_ali_codec_poke(struct snd_ali *codec,int secondary,
354 unsigned int port; 342 unsigned int port;
355 343
356 if (reg >= 0x80) { 344 if (reg >= 0x80) {
357 snd_printk(KERN_ERR "ali_codec_poke: reg(%xh) invalid.\n", reg); 345 dev_err(codec->card->dev,
346 "ali_codec_poke: reg(%xh) invalid.\n", reg);
358 return; 347 return;
359 } 348 }
360 349
@@ -385,7 +374,8 @@ static unsigned short snd_ali_codec_peek(struct snd_ali *codec,
385 unsigned int port; 374 unsigned int port;
386 375
387 if (reg >= 0x80) { 376 if (reg >= 0x80) {
388 snd_printk(KERN_ERR "ali_codec_peek: reg(%xh) invalid.\n", reg); 377 dev_err(codec->card->dev,
378 "ali_codec_peek: reg(%xh) invalid.\n", reg);
389 return ~0; 379 return ~0;
390 } 380 }
391 381
@@ -417,7 +407,7 @@ static void snd_ali_codec_write(struct snd_ac97 *ac97,
417{ 407{
418 struct snd_ali *codec = ac97->private_data; 408 struct snd_ali *codec = ac97->private_data;
419 409
420 snd_ali_printk("codec_write: reg=%xh data=%xh.\n", reg, val); 410 dev_dbg(codec->card->dev, "codec_write: reg=%xh data=%xh.\n", reg, val);
421 if (reg == AC97_GPIO_STATUS) { 411 if (reg == AC97_GPIO_STATUS) {
422 outl((val << ALI_AC97_GPIO_DATA_SHIFT) | ALI_AC97_GPIO_ENABLE, 412 outl((val << ALI_AC97_GPIO_DATA_SHIFT) | ALI_AC97_GPIO_ENABLE,
423 ALI_REG(codec, ALI_AC97_GPIO)); 413 ALI_REG(codec, ALI_AC97_GPIO));
@@ -433,7 +423,7 @@ static unsigned short snd_ali_codec_read(struct snd_ac97 *ac97,
433{ 423{
434 struct snd_ali *codec = ac97->private_data; 424 struct snd_ali *codec = ac97->private_data;
435 425
436 snd_ali_printk("codec_read reg=%xh.\n", reg); 426 dev_dbg(codec->card->dev, "codec_read reg=%xh.\n", reg);
437 return snd_ali_codec_peek(codec, ac97->num, reg); 427 return snd_ali_codec_peek(codec, ac97->num, reg);
438} 428}
439 429
@@ -474,7 +464,7 @@ static int snd_ali_reset_5451(struct snd_ali *codec)
474 } 464 }
475 465
476 /* non-fatal if you have a non PM capable codec */ 466 /* non-fatal if you have a non PM capable codec */
477 /* snd_printk(KERN_WARNING "ali5451: reset time out\n"); */ 467 /* dev_warn(codec->card->dev, "ali5451: reset time out\n"); */
478 return 0; 468 return 0;
479} 469}
480 470
@@ -528,7 +518,7 @@ static void snd_ali_disable_voice_irq(struct snd_ali *codec,
528 unsigned int mask; 518 unsigned int mask;
529 struct snd_ali_channel_control *pchregs = &(codec->chregs); 519 struct snd_ali_channel_control *pchregs = &(codec->chregs);
530 520
531 snd_ali_printk("disable_voice_irq channel=%d\n",channel); 521 dev_dbg(codec->card->dev, "disable_voice_irq channel=%d\n", channel);
532 522
533 mask = 1 << (channel & 0x1f); 523 mask = 1 << (channel & 0x1f);
534 pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten)); 524 pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten));
@@ -541,7 +531,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
541 unsigned int idx = channel & 0x1f; 531 unsigned int idx = channel & 0x1f;
542 532
543 if (codec->synth.chcnt >= ALI_CHANNELS){ 533 if (codec->synth.chcnt >= ALI_CHANNELS){
544 snd_printk(KERN_ERR 534 dev_err(codec->card->dev,
545 "ali_alloc_pcm_channel: no free channels.\n"); 535 "ali_alloc_pcm_channel: no free channels.\n");
546 return -1; 536 return -1;
547 } 537 }
@@ -549,7 +539,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
549 if (!(codec->synth.chmap & (1 << idx))) { 539 if (!(codec->synth.chmap & (1 << idx))) {
550 codec->synth.chmap |= 1 << idx; 540 codec->synth.chmap |= 1 << idx;
551 codec->synth.chcnt++; 541 codec->synth.chcnt++;
552 snd_ali_printk("alloc_pcm_channel no. %d.\n",idx); 542 dev_dbg(codec->card->dev, "alloc_pcm_channel no. %d.\n", idx);
553 return idx; 543 return idx;
554 } 544 }
555 return -1; 545 return -1;
@@ -560,7 +550,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
560 int idx; 550 int idx;
561 int result = -1; 551 int result = -1;
562 552
563 snd_ali_printk("find_free_channel: for %s\n",rec ? "rec" : "pcm"); 553 dev_dbg(codec->card->dev,
554 "find_free_channel: for %s\n", rec ? "rec" : "pcm");
564 555
565 /* recording */ 556 /* recording */
566 if (rec) { 557 if (rec) {
@@ -575,8 +566,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
575 if (result >= 0) 566 if (result >= 0)
576 return result; 567 return result;
577 else { 568 else {
578 snd_printk(KERN_ERR "ali_find_free_channel: " 569 dev_err(codec->card->dev,
579 "record channel is busy now.\n"); 570 "ali_find_free_channel: record channel is busy now.\n");
580 return -1; 571 return -1;
581 } 572 }
582 } 573 }
@@ -590,8 +581,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
590 if (result >= 0) 581 if (result >= 0)
591 return result; 582 return result;
592 else 583 else
593 snd_printk(KERN_ERR "ali_find_free_channel: " 584 dev_err(codec->card->dev,
594 "S/PDIF out channel is in busy now.\n"); 585 "ali_find_free_channel: S/PDIF out channel is in busy now.\n");
595 } 586 }
596 587
597 for (idx = 0; idx < ALI_CHANNELS; idx++) { 588 for (idx = 0; idx < ALI_CHANNELS; idx++) {
@@ -599,7 +590,7 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
599 if (result >= 0) 590 if (result >= 0)
600 return result; 591 return result;
601 } 592 }
602 snd_printk(KERN_ERR "ali_find_free_channel: no free channels.\n"); 593 dev_err(codec->card->dev, "ali_find_free_channel: no free channels.\n");
603 return -1; 594 return -1;
604} 595}
605 596
@@ -607,14 +598,15 @@ static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel)
607{ 598{
608 unsigned int idx = channel & 0x0000001f; 599 unsigned int idx = channel & 0x0000001f;
609 600
610 snd_ali_printk("free_channel_pcm channel=%d\n",channel); 601 dev_dbg(codec->card->dev, "free_channel_pcm channel=%d\n", channel);
611 602
612 if (channel < 0 || channel >= ALI_CHANNELS) 603 if (channel < 0 || channel >= ALI_CHANNELS)
613 return; 604 return;
614 605
615 if (!(codec->synth.chmap & (1 << idx))) { 606 if (!(codec->synth.chmap & (1 << idx))) {
616 snd_printk(KERN_ERR "ali_free_channel_pcm: " 607 dev_err(codec->card->dev,
617 "channel %d is not in use.\n", channel); 608 "ali_free_channel_pcm: channel %d is not in use.\n",
609 channel);
618 return; 610 return;
619 } else { 611 } else {
620 codec->synth.chmap &= ~(1 << idx); 612 codec->synth.chmap &= ~(1 << idx);
@@ -626,7 +618,7 @@ static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel)
626{ 618{
627 unsigned int mask = 1 << (channel & 0x1f); 619 unsigned int mask = 1 << (channel & 0x1f);
628 620
629 snd_ali_printk("stop_voice: channel=%d\n",channel); 621 dev_dbg(codec->card->dev, "stop_voice: channel=%d\n", channel);
630 outl(mask, ALI_REG(codec, codec->chregs.regs.stop)); 622 outl(mask, ALI_REG(codec, codec->chregs.regs.stop));
631} 623}
632 624
@@ -667,7 +659,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
667 } 659 }
668 660
669 if (count > 50000) { 661 if (count > 50000) {
670 snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); 662 dev_err(codec->card->dev, "ali_detect_spdif_rate: timeout!\n");
671 return; 663 return;
672 } 664 }
673 665
@@ -682,7 +674,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
682 } 674 }
683 675
684 if (count > 50000) { 676 if (count > 50000) {
685 snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); 677 dev_err(codec->card->dev, "ali_detect_spdif_rate: timeout!\n");
686 return; 678 return;
687 } 679 }
688 680
@@ -857,9 +849,6 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
857 struct snd_ali_voice *pvoice; 849 struct snd_ali_voice *pvoice;
858 struct snd_ali_channel_control *pchregs; 850 struct snd_ali_channel_control *pchregs;
859 unsigned int old, mask; 851 unsigned int old, mask;
860#ifdef ALI_DEBUG
861 unsigned int temp, cspf;
862#endif
863 852
864 pchregs = &(codec->chregs); 853 pchregs = &(codec->chregs);
865 854
@@ -877,14 +866,11 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
877 866
878 if (pvoice->pcm && pvoice->substream) { 867 if (pvoice->pcm && pvoice->substream) {
879 /* pcm interrupt */ 868 /* pcm interrupt */
880#ifdef ALI_DEBUG
881 outb((u8)(pvoice->number), ALI_REG(codec, ALI_GC_CIR));
882 temp = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
883 cspf = (inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask;
884#endif
885 if (pvoice->running) { 869 if (pvoice->running) {
886 snd_ali_printk("update_ptr: cso=%4.4x cspf=%d.\n", 870 dev_dbg(codec->card->dev,
887 (u16)temp, cspf); 871 "update_ptr: cso=%4.4x cspf=%d.\n",
872 inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)),
873 (inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask);
888 spin_unlock(&codec->reg_lock); 874 spin_unlock(&codec->reg_lock);
889 snd_pcm_period_elapsed(pvoice->substream); 875 snd_pcm_period_elapsed(pvoice->substream);
890 spin_lock(&codec->reg_lock); 876 spin_lock(&codec->reg_lock);
@@ -940,14 +926,14 @@ static struct snd_ali_voice *snd_ali_alloc_voice(struct snd_ali * codec,
940 struct snd_ali_voice *pvoice; 926 struct snd_ali_voice *pvoice;
941 int idx; 927 int idx;
942 928
943 snd_ali_printk("alloc_voice: type=%d rec=%d\n", type, rec); 929 dev_dbg(codec->card->dev, "alloc_voice: type=%d rec=%d\n", type, rec);
944 930
945 spin_lock_irq(&codec->voice_alloc); 931 spin_lock_irq(&codec->voice_alloc);
946 if (type == SNDRV_ALI_VOICE_TYPE_PCM) { 932 if (type == SNDRV_ALI_VOICE_TYPE_PCM) {
947 idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) : 933 idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) :
948 snd_ali_find_free_channel(codec,rec); 934 snd_ali_find_free_channel(codec,rec);
949 if (idx < 0) { 935 if (idx < 0) {
950 snd_printk(KERN_ERR "ali_alloc_voice: err.\n"); 936 dev_err(codec->card->dev, "ali_alloc_voice: err.\n");
951 spin_unlock_irq(&codec->voice_alloc); 937 spin_unlock_irq(&codec->voice_alloc);
952 return NULL; 938 return NULL;
953 } 939 }
@@ -970,7 +956,7 @@ static void snd_ali_free_voice(struct snd_ali * codec,
970 void (*private_free)(void *); 956 void (*private_free)(void *);
971 void *private_data; 957 void *private_data;
972 958
973 snd_ali_printk("free_voice: channel=%d\n",pvoice->number); 959 dev_dbg(codec->card->dev, "free_voice: channel=%d\n", pvoice->number);
974 if (!pvoice->use) 960 if (!pvoice->use)
975 return; 961 return;
976 snd_ali_clear_voices(codec, pvoice->number, pvoice->number); 962 snd_ali_clear_voices(codec, pvoice->number, pvoice->number);
@@ -1153,7 +1139,7 @@ static int snd_ali_trigger(struct snd_pcm_substream *substream,
1153 outl(val, ALI_REG(codec, ALI_AINTEN)); 1139 outl(val, ALI_REG(codec, ALI_AINTEN));
1154 if (do_start) 1140 if (do_start)
1155 outl(what, ALI_REG(codec, ALI_START)); 1141 outl(what, ALI_REG(codec, ALI_START));
1156 snd_ali_printk("trigger: what=%xh whati=%xh\n", what, whati); 1142 dev_dbg(codec->card->dev, "trigger: what=%xh whati=%xh\n", what, whati);
1157 spin_unlock(&codec->reg_lock); 1143 spin_unlock(&codec->reg_lock);
1158 1144
1159 return 0; 1145 return 0;
@@ -1239,7 +1225,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1239 unsigned int VOL; 1225 unsigned int VOL;
1240 unsigned int EC; 1226 unsigned int EC;
1241 1227
1242 snd_ali_printk("playback_prepare ...\n"); 1228 dev_dbg(codec->card->dev, "playback_prepare ...\n");
1243 1229
1244 spin_lock_irq(&codec->reg_lock); 1230 spin_lock_irq(&codec->reg_lock);
1245 1231
@@ -1266,7 +1252,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1266 /* set target ESO for channel */ 1252 /* set target ESO for channel */
1267 pvoice->eso = runtime->buffer_size; 1253 pvoice->eso = runtime->buffer_size;
1268 1254
1269 snd_ali_printk("playback_prepare: eso=%xh count=%xh\n", 1255 dev_dbg(codec->card->dev, "playback_prepare: eso=%xh count=%xh\n",
1270 pvoice->eso, pvoice->count); 1256 pvoice->eso, pvoice->count);
1271 1257
1272 /* set ESO to capture first MIDLP interrupt */ 1258 /* set ESO to capture first MIDLP interrupt */
@@ -1278,8 +1264,9 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1278 PAN = 0; 1264 PAN = 0;
1279 VOL = 0; 1265 VOL = 0;
1280 EC = 0; 1266 EC = 0;
1281 snd_ali_printk("playback_prepare:\n"); 1267 dev_dbg(codec->card->dev, "playback_prepare:\n");
1282 snd_ali_printk("ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n", 1268 dev_dbg(codec->card->dev,
1269 "ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n",
1283 pvoice->number,runtime->rate,Delta,GVSEL,PAN,CTRL); 1270 pvoice->number,runtime->rate,Delta,GVSEL,PAN,CTRL);
1284 snd_ali_write_voice_regs(codec, 1271 snd_ali_write_voice_regs(codec,
1285 pvoice->number, 1272 pvoice->number,
@@ -1332,7 +1319,7 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream)
1332 1319
1333 spin_lock_irq(&codec->reg_lock); 1320 spin_lock_irq(&codec->reg_lock);
1334 1321
1335 snd_ali_printk("ali_prepare...\n"); 1322 dev_dbg(codec->card->dev, "ali_prepare...\n");
1336 1323
1337 snd_ali_enable_special_channel(codec,pvoice->number); 1324 snd_ali_enable_special_channel(codec,pvoice->number);
1338 1325
@@ -1351,15 +1338,16 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream)
1351 1338
1352 rate = snd_ali_get_spdif_in_rate(codec); 1339 rate = snd_ali_get_spdif_in_rate(codec);
1353 if (rate == 0) { 1340 if (rate == 0) {
1354 snd_printk(KERN_WARNING "ali_capture_preapre: " 1341 dev_warn(codec->card->dev,
1355 "spdif rate detect err!\n"); 1342 "ali_capture_preapre: spdif rate detect err!\n");
1356 rate = 48000; 1343 rate = 48000;
1357 } 1344 }
1358 spin_lock_irq(&codec->reg_lock); 1345 spin_lock_irq(&codec->reg_lock);
1359 bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL)); 1346 bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL));
1360 if (bValue & 0x10) { 1347 if (bValue & 0x10) {
1361 outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL)); 1348 outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL));
1362 printk(KERN_WARNING "clear SPDIF parity error flag.\n"); 1349 dev_warn(codec->card->dev,
1350 "clear SPDIF parity error flag.\n");
1363 } 1351 }
1364 1352
1365 if (rate != 48000) 1353 if (rate != 48000)
@@ -1418,7 +1406,7 @@ snd_ali_playback_pointer(struct snd_pcm_substream *substream)
1418 outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR)); 1406 outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
1419 cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)); 1407 cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
1420 spin_unlock(&codec->reg_lock); 1408 spin_unlock(&codec->reg_lock);
1421 snd_ali_printk("playback pointer returned cso=%xh.\n", cso); 1409 dev_dbg(codec->card->dev, "playback pointer returned cso=%xh.\n", cso);
1422 1410
1423 return cso; 1411 return cso;
1424} 1412}
@@ -1685,7 +1673,8 @@ static int snd_ali_pcm(struct snd_ali *codec, int device,
1685 err = snd_pcm_new(codec->card, desc->name, device, 1673 err = snd_pcm_new(codec->card, desc->name, device,
1686 desc->playback_num, desc->capture_num, &pcm); 1674 desc->playback_num, desc->capture_num, &pcm);
1687 if (err < 0) { 1675 if (err < 0) {
1688 snd_printk(KERN_ERR "snd_ali_pcm: err called snd_pcm_new.\n"); 1676 dev_err(codec->card->dev,
1677 "snd_ali_pcm: err called snd_pcm_new.\n");
1689 return err; 1678 return err;
1690 } 1679 }
1691 pcm->private_data = codec; 1680 pcm->private_data = codec;
@@ -1861,7 +1850,7 @@ static int snd_ali_mixer(struct snd_ali *codec)
1861 ac97.num = i; 1850 ac97.num = i;
1862 err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]); 1851 err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]);
1863 if (err < 0) { 1852 if (err < 0) {
1864 snd_printk(KERN_ERR 1853 dev_err(codec->card->dev,
1865 "ali mixer %d creating error.\n", i); 1854 "ali mixer %d creating error.\n", i);
1866 if (i == 0) 1855 if (i == 0)
1867 return err; 1856 return err;
@@ -1947,8 +1936,7 @@ static int ali_resume(struct device *dev)
1947 pci_set_power_state(pci, PCI_D0); 1936 pci_set_power_state(pci, PCI_D0);
1948 pci_restore_state(pci); 1937 pci_restore_state(pci);
1949 if (pci_enable_device(pci) < 0) { 1938 if (pci_enable_device(pci) < 0) {
1950 printk(KERN_ERR "ali5451: pci_enable_device failed, " 1939 dev_err(dev, "pci_enable_device failed, disabling device\n");
1951 "disabling device\n");
1952 snd_card_disconnect(card); 1940 snd_card_disconnect(card);
1953 return -EIO; 1941 return -EIO;
1954 } 1942 }
@@ -2013,10 +2001,10 @@ static int snd_ali_chip_init(struct snd_ali *codec)
2013 unsigned char temp; 2001 unsigned char temp;
2014 struct pci_dev *pci_dev; 2002 struct pci_dev *pci_dev;
2015 2003
2016 snd_ali_printk("chip initializing ... \n"); 2004 dev_dbg(codec->card->dev, "chip initializing ...\n");
2017 2005
2018 if (snd_ali_reset_5451(codec)) { 2006 if (snd_ali_reset_5451(codec)) {
2019 snd_printk(KERN_ERR "ali_chip_init: reset 5451 error.\n"); 2007 dev_err(codec->card->dev, "ali_chip_init: reset 5451 error.\n");
2020 return -1; 2008 return -1;
2021 } 2009 }
2022 2010
@@ -2062,7 +2050,7 @@ static int snd_ali_chip_init(struct snd_ali *codec)
2062 ALI_REG(codec, ALI_SCTRL)); 2050 ALI_REG(codec, ALI_SCTRL));
2063 } 2051 }
2064 2052
2065 snd_ali_printk("chip initialize succeed.\n"); 2053 dev_dbg(codec->card->dev, "chip initialize succeed.\n");
2066 return 0; 2054 return 0;
2067 2055
2068} 2056}
@@ -2088,7 +2076,7 @@ static int snd_ali_resources(struct snd_ali *codec)
2088{ 2076{
2089 int err; 2077 int err;
2090 2078
2091 snd_ali_printk("resources allocation ...\n"); 2079 dev_dbg(codec->card->dev, "resources allocation ...\n");
2092 err = pci_request_regions(codec->pci, "ALI 5451"); 2080 err = pci_request_regions(codec->pci, "ALI 5451");
2093 if (err < 0) 2081 if (err < 0)
2094 return err; 2082 return err;
@@ -2096,11 +2084,11 @@ static int snd_ali_resources(struct snd_ali *codec)
2096 2084
2097 if (request_irq(codec->pci->irq, snd_ali_card_interrupt, 2085 if (request_irq(codec->pci->irq, snd_ali_card_interrupt,
2098 IRQF_SHARED, KBUILD_MODNAME, codec)) { 2086 IRQF_SHARED, KBUILD_MODNAME, codec)) {
2099 snd_printk(KERN_ERR "Unable to request irq.\n"); 2087 dev_err(codec->card->dev, "Unable to request irq.\n");
2100 return -EBUSY; 2088 return -EBUSY;
2101 } 2089 }
2102 codec->irq = codec->pci->irq; 2090 codec->irq = codec->pci->irq;
2103 snd_ali_printk("resources allocated.\n"); 2091 dev_dbg(codec->card->dev, "resources allocated.\n");
2104 return 0; 2092 return 0;
2105} 2093}
2106static int snd_ali_dev_free(struct snd_device *device) 2094static int snd_ali_dev_free(struct snd_device *device)
@@ -2125,7 +2113,7 @@ static int snd_ali_create(struct snd_card *card,
2125 2113
2126 *r_ali = NULL; 2114 *r_ali = NULL;
2127 2115
2128 snd_ali_printk("creating ...\n"); 2116 dev_dbg(card->dev, "creating ...\n");
2129 2117
2130 /* enable PCI device */ 2118 /* enable PCI device */
2131 err = pci_enable_device(pci); 2119 err = pci_enable_device(pci);
@@ -2134,8 +2122,8 @@ static int snd_ali_create(struct snd_card *card,
2134 /* check, if we can restrict PCI DMA transfers to 31 bits */ 2122 /* check, if we can restrict PCI DMA transfers to 31 bits */
2135 if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 || 2123 if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 ||
2136 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) { 2124 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) {
2137 snd_printk(KERN_ERR "architecture does not support " 2125 dev_err(card->dev,
2138 "31bit PCI busmaster DMA\n"); 2126 "architecture does not support 31bit PCI busmaster DMA\n");
2139 pci_disable_device(pci); 2127 pci_disable_device(pci);
2140 return -ENXIO; 2128 return -ENXIO;
2141 } 2129 }
@@ -2199,19 +2187,19 @@ static int snd_ali_create(struct snd_card *card,
2199 /* M1533: southbridge */ 2187 /* M1533: southbridge */
2200 codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL); 2188 codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL);
2201 if (!codec->pci_m1533) { 2189 if (!codec->pci_m1533) {
2202 snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); 2190 dev_err(card->dev, "cannot find ALi 1533 chip.\n");
2203 snd_ali_free(codec); 2191 snd_ali_free(codec);
2204 return -ENODEV; 2192 return -ENODEV;
2205 } 2193 }
2206 /* M7101: power management */ 2194 /* M7101: power management */
2207 codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL); 2195 codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL);
2208 if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) { 2196 if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) {
2209 snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); 2197 dev_err(card->dev, "cannot find ALi 7101 chip.\n");
2210 snd_ali_free(codec); 2198 snd_ali_free(codec);
2211 return -ENODEV; 2199 return -ENODEV;
2212 } 2200 }
2213 2201
2214 snd_ali_printk("snd_device_new is called.\n"); 2202 dev_dbg(card->dev, "snd_device_new is called.\n");
2215 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops); 2203 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops);
2216 if (err < 0) { 2204 if (err < 0) {
2217 snd_ali_free(codec); 2205 snd_ali_free(codec);
@@ -2224,21 +2212,21 @@ static int snd_ali_create(struct snd_card *card,
2224 2212
2225 err = snd_ali_chip_init(codec); 2213 err = snd_ali_chip_init(codec);
2226 if (err < 0) { 2214 if (err < 0) {
2227 snd_printk(KERN_ERR "ali create: chip init error.\n"); 2215 dev_err(card->dev, "ali create: chip init error.\n");
2228 return err; 2216 return err;
2229 } 2217 }
2230 2218
2231#ifdef CONFIG_PM_SLEEP 2219#ifdef CONFIG_PM_SLEEP
2232 codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); 2220 codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL);
2233 if (!codec->image) 2221 if (!codec->image)
2234 snd_printk(KERN_WARNING "can't allocate apm buffer\n"); 2222 dev_warn(card->dev, "can't allocate apm buffer\n");
2235#endif 2223#endif
2236 2224
2237 snd_ali_enable_address_interrupt(codec); 2225 snd_ali_enable_address_interrupt(codec);
2238 codec->hw_initialized = 1; 2226 codec->hw_initialized = 1;
2239 2227
2240 *r_ali = codec; 2228 *r_ali = codec;
2241 snd_ali_printk("created.\n"); 2229 dev_dbg(card->dev, "created.\n");
2242 return 0; 2230 return 0;
2243} 2231}
2244 2232
@@ -2249,7 +2237,7 @@ static int snd_ali_probe(struct pci_dev *pci,
2249 struct snd_ali *codec; 2237 struct snd_ali *codec;
2250 int err; 2238 int err;
2251 2239
2252 snd_ali_printk("probe ...\n"); 2240 dev_dbg(&pci->dev, "probe ...\n");
2253 2241
2254 err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card); 2242 err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
2255 if (err < 0) 2243 if (err < 0)
@@ -2260,12 +2248,12 @@ static int snd_ali_probe(struct pci_dev *pci,
2260 goto error; 2248 goto error;
2261 card->private_data = codec; 2249 card->private_data = codec;
2262 2250
2263 snd_ali_printk("mixer building ...\n"); 2251 dev_dbg(&pci->dev, "mixer building ...\n");
2264 err = snd_ali_mixer(codec); 2252 err = snd_ali_mixer(codec);
2265 if (err < 0) 2253 if (err < 0)
2266 goto error; 2254 goto error;
2267 2255
2268 snd_ali_printk("pcm building ...\n"); 2256 dev_dbg(&pci->dev, "pcm building ...\n");
2269 err = snd_ali_build_pcms(codec); 2257 err = snd_ali_build_pcms(codec);
2270 if (err < 0) 2258 if (err < 0)
2271 goto error; 2259 goto error;
@@ -2278,7 +2266,7 @@ static int snd_ali_probe(struct pci_dev *pci,
2278 sprintf(card->longname, "%s at 0x%lx, irq %i", 2266 sprintf(card->longname, "%s at 0x%lx, irq %i",
2279 card->shortname, codec->port, codec->irq); 2267 card->shortname, codec->port, codec->irq);
2280 2268
2281 snd_ali_printk("register card.\n"); 2269 dev_dbg(&pci->dev, "register card.\n");
2282 err = snd_card_register(card); 2270 err = snd_card_register(card);
2283 if (err < 0) 2271 if (err < 0)
2284 goto error; 2272 goto error;
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 9acd88ab93a4..cc9a15a1304b 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -87,19 +87,8 @@
87#define PLAYBACK_BLOCK_COUNTER 0x9A 87#define PLAYBACK_BLOCK_COUNTER 0x9A
88#define RECORD_BLOCK_COUNTER 0x9B 88#define RECORD_BLOCK_COUNTER 0x9B
89 89
90#define DEBUG_CALLS 0
91#define DEBUG_PLAY_REC 0 90#define DEBUG_PLAY_REC 0
92 91
93#if DEBUG_CALLS
94#define snd_als300_dbgcalls(format, args...) printk(KERN_DEBUG format, ##args)
95#define snd_als300_dbgcallenter() printk(KERN_ERR "--> %s\n", __func__)
96#define snd_als300_dbgcallleave() printk(KERN_ERR "<-- %s\n", __func__)
97#else
98#define snd_als300_dbgcalls(format, args...)
99#define snd_als300_dbgcallenter()
100#define snd_als300_dbgcallleave()
101#endif
102
103#if DEBUG_PLAY_REC 92#if DEBUG_PLAY_REC
104#define snd_als300_dbgplay(format, args...) printk(KERN_ERR format, ##args) 93#define snd_als300_dbgplay(format, args...) printk(KERN_ERR format, ##args)
105#else 94#else
@@ -177,7 +166,6 @@ static inline void snd_als300_gcr_write(unsigned long port,
177static void snd_als300_set_irq_flag(struct snd_als300 *chip, int cmd) 166static void snd_als300_set_irq_flag(struct snd_als300 *chip, int cmd)
178{ 167{
179 u32 tmp = snd_als300_gcr_read(chip->port, MISC_CONTROL); 168 u32 tmp = snd_als300_gcr_read(chip->port, MISC_CONTROL);
180 snd_als300_dbgcallenter();
181 169
182 /* boolean XOR check, since old vs. new hardware have 170 /* boolean XOR check, since old vs. new hardware have
183 directly reversed bit setting for ENABLE and DISABLE. 171 directly reversed bit setting for ENABLE and DISABLE.
@@ -188,19 +176,16 @@ static void snd_als300_set_irq_flag(struct snd_als300 *chip, int cmd)
188 else 176 else
189 tmp &= ~IRQ_SET_BIT; 177 tmp &= ~IRQ_SET_BIT;
190 snd_als300_gcr_write(chip->port, MISC_CONTROL, tmp); 178 snd_als300_gcr_write(chip->port, MISC_CONTROL, tmp);
191 snd_als300_dbgcallleave();
192} 179}
193 180
194static int snd_als300_free(struct snd_als300 *chip) 181static int snd_als300_free(struct snd_als300 *chip)
195{ 182{
196 snd_als300_dbgcallenter();
197 snd_als300_set_irq_flag(chip, IRQ_DISABLE); 183 snd_als300_set_irq_flag(chip, IRQ_DISABLE);
198 if (chip->irq >= 0) 184 if (chip->irq >= 0)
199 free_irq(chip->irq, chip); 185 free_irq(chip->irq, chip);
200 pci_release_regions(chip->pci); 186 pci_release_regions(chip->pci);
201 pci_disable_device(chip->pci); 187 pci_disable_device(chip->pci);
202 kfree(chip); 188 kfree(chip);
203 snd_als300_dbgcallleave();
204 return 0; 189 return 0;
205} 190}
206 191
@@ -280,9 +265,7 @@ static irqreturn_t snd_als300plus_interrupt(int irq, void *dev_id)
280 265
281static void snd_als300_remove(struct pci_dev *pci) 266static void snd_als300_remove(struct pci_dev *pci)
282{ 267{
283 snd_als300_dbgcallenter();
284 snd_card_free(pci_get_drvdata(pci)); 268 snd_card_free(pci_get_drvdata(pci));
285 snd_als300_dbgcallleave();
286} 269}
287 270
288static unsigned short snd_als300_ac97_read(struct snd_ac97 *ac97, 271static unsigned short snd_als300_ac97_read(struct snd_ac97 *ac97,
@@ -330,14 +313,12 @@ static int snd_als300_ac97(struct snd_als300 *chip)
330 .read = snd_als300_ac97_read, 313 .read = snd_als300_ac97_read,
331 }; 314 };
332 315
333 snd_als300_dbgcallenter();
334 if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus)) < 0) 316 if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus)) < 0)
335 return err; 317 return err;
336 318
337 memset(&ac97, 0, sizeof(ac97)); 319 memset(&ac97, 0, sizeof(ac97));
338 ac97.private_data = chip; 320 ac97.private_data = chip;
339 321
340 snd_als300_dbgcallleave();
341 return snd_ac97_mixer(bus, &ac97, &chip->ac97); 322 return snd_ac97_mixer(bus, &ac97, &chip->ac97);
342} 323}
343 324
@@ -395,13 +376,11 @@ static int snd_als300_playback_open(struct snd_pcm_substream *substream)
395 376
396 if (!data) 377 if (!data)
397 return -ENOMEM; 378 return -ENOMEM;
398 snd_als300_dbgcallenter();
399 chip->playback_substream = substream; 379 chip->playback_substream = substream;
400 runtime->hw = snd_als300_playback_hw; 380 runtime->hw = snd_als300_playback_hw;
401 runtime->private_data = data; 381 runtime->private_data = data;
402 data->control_register = PLAYBACK_CONTROL; 382 data->control_register = PLAYBACK_CONTROL;
403 data->block_counter_register = PLAYBACK_BLOCK_COUNTER; 383 data->block_counter_register = PLAYBACK_BLOCK_COUNTER;
404 snd_als300_dbgcallleave();
405 return 0; 384 return 0;
406} 385}
407 386
@@ -411,11 +390,9 @@ static int snd_als300_playback_close(struct snd_pcm_substream *substream)
411 struct snd_als300_substream_data *data; 390 struct snd_als300_substream_data *data;
412 391
413 data = substream->runtime->private_data; 392 data = substream->runtime->private_data;
414 snd_als300_dbgcallenter();
415 kfree(data); 393 kfree(data);
416 chip->playback_substream = NULL; 394 chip->playback_substream = NULL;
417 snd_pcm_lib_free_pages(substream); 395 snd_pcm_lib_free_pages(substream);
418 snd_als300_dbgcallleave();
419 return 0; 396 return 0;
420} 397}
421 398
@@ -428,13 +405,11 @@ static int snd_als300_capture_open(struct snd_pcm_substream *substream)
428 405
429 if (!data) 406 if (!data)
430 return -ENOMEM; 407 return -ENOMEM;
431 snd_als300_dbgcallenter();
432 chip->capture_substream = substream; 408 chip->capture_substream = substream;
433 runtime->hw = snd_als300_capture_hw; 409 runtime->hw = snd_als300_capture_hw;
434 runtime->private_data = data; 410 runtime->private_data = data;
435 data->control_register = RECORD_CONTROL; 411 data->control_register = RECORD_CONTROL;
436 data->block_counter_register = RECORD_BLOCK_COUNTER; 412 data->block_counter_register = RECORD_BLOCK_COUNTER;
437 snd_als300_dbgcallleave();
438 return 0; 413 return 0;
439} 414}
440 415
@@ -444,11 +419,9 @@ static int snd_als300_capture_close(struct snd_pcm_substream *substream)
444 struct snd_als300_substream_data *data; 419 struct snd_als300_substream_data *data;
445 420
446 data = substream->runtime->private_data; 421 data = substream->runtime->private_data;
447 snd_als300_dbgcallenter();
448 kfree(data); 422 kfree(data);
449 chip->capture_substream = NULL; 423 chip->capture_substream = NULL;
450 snd_pcm_lib_free_pages(substream); 424 snd_pcm_lib_free_pages(substream);
451 snd_als300_dbgcallleave();
452 return 0; 425 return 0;
453} 426}
454 427
@@ -472,7 +445,6 @@ static int snd_als300_playback_prepare(struct snd_pcm_substream *substream)
472 unsigned short period_bytes = snd_pcm_lib_period_bytes(substream); 445 unsigned short period_bytes = snd_pcm_lib_period_bytes(substream);
473 unsigned short buffer_bytes = snd_pcm_lib_buffer_bytes(substream); 446 unsigned short buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
474 447
475 snd_als300_dbgcallenter();
476 spin_lock_irq(&chip->reg_lock); 448 spin_lock_irq(&chip->reg_lock);
477 tmp = snd_als300_gcr_read(chip->port, PLAYBACK_CONTROL); 449 tmp = snd_als300_gcr_read(chip->port, PLAYBACK_CONTROL);
478 tmp &= ~TRANSFER_START; 450 tmp &= ~TRANSFER_START;
@@ -491,7 +463,6 @@ static int snd_als300_playback_prepare(struct snd_pcm_substream *substream)
491 snd_als300_gcr_write(chip->port, PLAYBACK_END, 463 snd_als300_gcr_write(chip->port, PLAYBACK_END,
492 runtime->dma_addr + buffer_bytes - 1); 464 runtime->dma_addr + buffer_bytes - 1);
493 spin_unlock_irq(&chip->reg_lock); 465 spin_unlock_irq(&chip->reg_lock);
494 snd_als300_dbgcallleave();
495 return 0; 466 return 0;
496} 467}
497 468
@@ -503,7 +474,6 @@ static int snd_als300_capture_prepare(struct snd_pcm_substream *substream)
503 unsigned short period_bytes = snd_pcm_lib_period_bytes(substream); 474 unsigned short period_bytes = snd_pcm_lib_period_bytes(substream);
504 unsigned short buffer_bytes = snd_pcm_lib_buffer_bytes(substream); 475 unsigned short buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
505 476
506 snd_als300_dbgcallenter();
507 spin_lock_irq(&chip->reg_lock); 477 spin_lock_irq(&chip->reg_lock);
508 tmp = snd_als300_gcr_read(chip->port, RECORD_CONTROL); 478 tmp = snd_als300_gcr_read(chip->port, RECORD_CONTROL);
509 tmp &= ~TRANSFER_START; 479 tmp &= ~TRANSFER_START;
@@ -522,7 +492,6 @@ static int snd_als300_capture_prepare(struct snd_pcm_substream *substream)
522 snd_als300_gcr_write(chip->port, RECORD_END, 492 snd_als300_gcr_write(chip->port, RECORD_END,
523 runtime->dma_addr + buffer_bytes - 1); 493 runtime->dma_addr + buffer_bytes - 1);
524 spin_unlock_irq(&chip->reg_lock); 494 spin_unlock_irq(&chip->reg_lock);
525 snd_als300_dbgcallleave();
526 return 0; 495 return 0;
527} 496}
528 497
@@ -537,7 +506,6 @@ static int snd_als300_trigger(struct snd_pcm_substream *substream, int cmd)
537 data = substream->runtime->private_data; 506 data = substream->runtime->private_data;
538 reg = data->control_register; 507 reg = data->control_register;
539 508
540 snd_als300_dbgcallenter();
541 spin_lock(&chip->reg_lock); 509 spin_lock(&chip->reg_lock);
542 switch (cmd) { 510 switch (cmd) {
543 case SNDRV_PCM_TRIGGER_START: 511 case SNDRV_PCM_TRIGGER_START:
@@ -568,7 +536,6 @@ static int snd_als300_trigger(struct snd_pcm_substream *substream, int cmd)
568 ret = -EINVAL; 536 ret = -EINVAL;
569 } 537 }
570 spin_unlock(&chip->reg_lock); 538 spin_unlock(&chip->reg_lock);
571 snd_als300_dbgcallleave();
572 return ret; 539 return ret;
573} 540}
574 541
@@ -582,7 +549,6 @@ static snd_pcm_uframes_t snd_als300_pointer(struct snd_pcm_substream *substream)
582 data = substream->runtime->private_data; 549 data = substream->runtime->private_data;
583 period_bytes = snd_pcm_lib_period_bytes(substream); 550 period_bytes = snd_pcm_lib_period_bytes(substream);
584 551
585 snd_als300_dbgcallenter();
586 spin_lock(&chip->reg_lock); 552 spin_lock(&chip->reg_lock);
587 current_ptr = (u16) snd_als300_gcr_read(chip->port, 553 current_ptr = (u16) snd_als300_gcr_read(chip->port,
588 data->block_counter_register) + 4; 554 data->block_counter_register) + 4;
@@ -595,7 +561,6 @@ static snd_pcm_uframes_t snd_als300_pointer(struct snd_pcm_substream *substream)
595 if (data->period_flipflop == 0) 561 if (data->period_flipflop == 0)
596 current_ptr += period_bytes; 562 current_ptr += period_bytes;
597 snd_als300_dbgplay("Pointer (bytes): %d\n", current_ptr); 563 snd_als300_dbgplay("Pointer (bytes): %d\n", current_ptr);
598 snd_als300_dbgcallleave();
599 return bytes_to_frames(substream->runtime, current_ptr); 564 return bytes_to_frames(substream->runtime, current_ptr);
600} 565}
601 566
@@ -626,7 +591,6 @@ static int snd_als300_new_pcm(struct snd_als300 *chip)
626 struct snd_pcm *pcm; 591 struct snd_pcm *pcm;
627 int err; 592 int err;
628 593
629 snd_als300_dbgcallenter();
630 err = snd_pcm_new(chip->card, "ALS300", 0, 1, 1, &pcm); 594 err = snd_pcm_new(chip->card, "ALS300", 0, 1, 1, &pcm);
631 if (err < 0) 595 if (err < 0)
632 return err; 596 return err;
@@ -643,7 +607,6 @@ static int snd_als300_new_pcm(struct snd_als300 *chip)
643 /* pre-allocation of buffers */ 607 /* pre-allocation of buffers */
644 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 608 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
645 snd_dma_pci_data(chip->pci), 64*1024, 64*1024); 609 snd_dma_pci_data(chip->pci), 64*1024, 64*1024);
646 snd_als300_dbgcallleave();
647 return 0; 610 return 0;
648} 611}
649 612
@@ -652,7 +615,6 @@ static void snd_als300_init(struct snd_als300 *chip)
652 unsigned long flags; 615 unsigned long flags;
653 u32 tmp; 616 u32 tmp;
654 617
655 snd_als300_dbgcallenter();
656 spin_lock_irqsave(&chip->reg_lock, flags); 618 spin_lock_irqsave(&chip->reg_lock, flags);
657 chip->revision = (snd_als300_gcr_read(chip->port, MISC_CONTROL) >> 16) 619 chip->revision = (snd_als300_gcr_read(chip->port, MISC_CONTROL) >> 16)
658 & 0x0000000F; 620 & 0x0000000F;
@@ -679,7 +641,6 @@ static void snd_als300_init(struct snd_als300 *chip)
679 snd_als300_gcr_write(chip->port, PLAYBACK_CONTROL, 641 snd_als300_gcr_write(chip->port, PLAYBACK_CONTROL,
680 tmp & ~TRANSFER_START); 642 tmp & ~TRANSFER_START);
681 spin_unlock_irqrestore(&chip->reg_lock, flags); 643 spin_unlock_irqrestore(&chip->reg_lock, flags);
682 snd_als300_dbgcallleave();
683} 644}
684 645
685static int snd_als300_create(struct snd_card *card, 646static int snd_als300_create(struct snd_card *card,
@@ -695,13 +656,12 @@ static int snd_als300_create(struct snd_card *card,
695 }; 656 };
696 *rchip = NULL; 657 *rchip = NULL;
697 658
698 snd_als300_dbgcallenter();
699 if ((err = pci_enable_device(pci)) < 0) 659 if ((err = pci_enable_device(pci)) < 0)
700 return err; 660 return err;
701 661
702 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 662 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
703 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 663 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
704 printk(KERN_ERR "error setting 28bit DMA mask\n"); 664 dev_err(card->dev, "error setting 28bit DMA mask\n");
705 pci_disable_device(pci); 665 pci_disable_device(pci);
706 return -ENXIO; 666 return -ENXIO;
707 } 667 }
@@ -733,7 +693,7 @@ static int snd_als300_create(struct snd_card *card,
733 693
734 if (request_irq(pci->irq, irq_handler, IRQF_SHARED, 694 if (request_irq(pci->irq, irq_handler, IRQF_SHARED,
735 KBUILD_MODNAME, chip)) { 695 KBUILD_MODNAME, chip)) {
736 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 696 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
737 snd_als300_free(chip); 697 snd_als300_free(chip);
738 return -EBUSY; 698 return -EBUSY;
739 } 699 }
@@ -744,13 +704,13 @@ static int snd_als300_create(struct snd_card *card,
744 704
745 err = snd_als300_ac97(chip); 705 err = snd_als300_ac97(chip);
746 if (err < 0) { 706 if (err < 0) {
747 snd_printk(KERN_WARNING "Could not create ac97\n"); 707 dev_err(card->dev, "Could not create ac97\n");
748 snd_als300_free(chip); 708 snd_als300_free(chip);
749 return err; 709 return err;
750 } 710 }
751 711
752 if ((err = snd_als300_new_pcm(chip)) < 0) { 712 if ((err = snd_als300_new_pcm(chip)) < 0) {
753 snd_printk(KERN_WARNING "Could not create PCM\n"); 713 dev_err(card->dev, "Could not create PCM\n");
754 snd_als300_free(chip); 714 snd_als300_free(chip);
755 return err; 715 return err;
756 } 716 }
@@ -762,7 +722,6 @@ static int snd_als300_create(struct snd_card *card,
762 } 722 }
763 723
764 *rchip = chip; 724 *rchip = chip;
765 snd_als300_dbgcallleave();
766 return 0; 725 return 0;
767} 726}
768 727
@@ -792,8 +751,7 @@ static int snd_als300_resume(struct device *dev)
792 pci_set_power_state(pci, PCI_D0); 751 pci_set_power_state(pci, PCI_D0);
793 pci_restore_state(pci); 752 pci_restore_state(pci);
794 if (pci_enable_device(pci) < 0) { 753 if (pci_enable_device(pci) < 0) {
795 printk(KERN_ERR "als300: pci_enable_device failed, " 754 dev_err(dev, "pci_enable_device failed, disabling device\n");
796 "disabling device\n");
797 snd_card_disconnect(card); 755 snd_card_disconnect(card);
798 return -EIO; 756 return -EIO;
799 } 757 }
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 2b2bb0fa3bc7..b751c381d25e 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -578,7 +578,7 @@ static irqreturn_t snd_als4000_interrupt(int irq, void *dev_id)
578 snd_als4k_iobase_readb(chip->alt_port, 578 snd_als4k_iobase_readb(chip->alt_port,
579 ALS4K_IOB_16_ACK_FOR_CR1E); 579 ALS4K_IOB_16_ACK_FOR_CR1E);
580 580
581 /* printk(KERN_INFO "als4000: irq 0x%04x 0x%04x\n", 581 /* dev_dbg(chip->card->dev, "als4000: irq 0x%04x 0x%04x\n",
582 pci_irqstatus, sb_irqstatus); */ 582 pci_irqstatus, sb_irqstatus); */
583 583
584 /* only ack the things we actually handled above */ 584 /* only ack the things we actually handled above */
@@ -791,13 +791,13 @@ static int snd_als4000_create_gameport(struct snd_card_als4000 *acard, int dev)
791 } 791 }
792 792
793 if (!r) { 793 if (!r) {
794 printk(KERN_WARNING "als4000: cannot reserve joystick ports\n"); 794 dev_warn(&acard->pci->dev, "cannot reserve joystick ports\n");
795 return -EBUSY; 795 return -EBUSY;
796 } 796 }
797 797
798 acard->gameport = gp = gameport_allocate_port(); 798 acard->gameport = gp = gameport_allocate_port();
799 if (!gp) { 799 if (!gp) {
800 printk(KERN_ERR "als4000: cannot allocate memory for gameport\n"); 800 dev_err(&acard->pci->dev, "cannot allocate memory for gameport\n");
801 release_and_free_resource(r); 801 release_and_free_resource(r);
802 return -ENOMEM; 802 return -ENOMEM;
803 } 803 }
@@ -873,7 +873,7 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
873 /* check, if we can restrict PCI DMA transfers to 24 bits */ 873 /* check, if we can restrict PCI DMA transfers to 24 bits */
874 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 874 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
875 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 875 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
876 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 876 dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n");
877 pci_disable_device(pci); 877 pci_disable_device(pci);
878 return -ENXIO; 878 return -ENXIO;
879 } 879 }
@@ -933,7 +933,7 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
933 MPU401_INFO_INTEGRATED | 933 MPU401_INFO_INTEGRATED |
934 MPU401_INFO_IRQ_HOOK, 934 MPU401_INFO_IRQ_HOOK,
935 -1, &chip->rmidi)) < 0) { 935 -1, &chip->rmidi)) < 0) {
936 printk(KERN_ERR "als4000: no MPU-401 device at 0x%lx?\n", 936 dev_err(&pci->dev, "no MPU-401 device at 0x%lx?\n",
937 iobase + ALS4K_IOB_30_MIDI_DATA); 937 iobase + ALS4K_IOB_30_MIDI_DATA);
938 goto out_err; 938 goto out_err;
939 } 939 }
@@ -954,7 +954,7 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
954 iobase + ALS4K_IOB_10_ADLIB_ADDR0, 954 iobase + ALS4K_IOB_10_ADLIB_ADDR0,
955 iobase + ALS4K_IOB_12_ADLIB_ADDR2, 955 iobase + ALS4K_IOB_12_ADLIB_ADDR2,
956 OPL3_HW_AUTO, 1, &opl3) < 0) { 956 OPL3_HW_AUTO, 1, &opl3) < 0) {
957 printk(KERN_ERR "als4000: no OPL device at 0x%lx-0x%lx?\n", 957 dev_err(&pci->dev, "no OPL device at 0x%lx-0x%lx?\n",
958 iobase + ALS4K_IOB_10_ADLIB_ADDR0, 958 iobase + ALS4K_IOB_10_ADLIB_ADDR0,
959 iobase + ALS4K_IOB_12_ADLIB_ADDR2); 959 iobase + ALS4K_IOB_12_ADLIB_ADDR2);
960 } else { 960 } else {
@@ -1014,8 +1014,7 @@ static int snd_als4000_resume(struct device *dev)
1014 pci_set_power_state(pci, PCI_D0); 1014 pci_set_power_state(pci, PCI_D0);
1015 pci_restore_state(pci); 1015 pci_restore_state(pci);
1016 if (pci_enable_device(pci) < 0) { 1016 if (pci_enable_device(pci) < 0) {
1017 printk(KERN_ERR "als4000: pci_enable_device failed, " 1017 dev_err(dev, "pci_enable_device failed, disabling device\n");
1018 "disabling device\n");
1019 snd_card_disconnect(card); 1018 snd_card_disconnect(card);
1020 return -EIO; 1019 return -EIO;
1021 } 1020 }
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 85f893b5cc99..ae07b4926dc2 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -432,7 +432,7 @@ static int snd_atiixp_acquire_codec(struct atiixp *chip)
432 432
433 while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) { 433 while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) {
434 if (! timeout--) { 434 if (! timeout--) {
435 snd_printk(KERN_WARNING "atiixp: codec acquire timeout\n"); 435 dev_warn(chip->card->dev, "codec acquire timeout\n");
436 return -EBUSY; 436 return -EBUSY;
437 } 437 }
438 udelay(1); 438 udelay(1);
@@ -463,7 +463,7 @@ static unsigned short snd_atiixp_codec_read(struct atiixp *chip, unsigned short
463 } while (--timeout); 463 } while (--timeout);
464 /* time out may happen during reset */ 464 /* time out may happen during reset */
465 if (reg < 0x7c) 465 if (reg < 0x7c)
466 snd_printk(KERN_WARNING "atiixp: codec read timeout (reg %x)\n", reg); 466 dev_warn(chip->card->dev, "codec read timeout (reg %x)\n", reg);
467 return 0xffff; 467 return 0xffff;
468} 468}
469 469
@@ -523,7 +523,7 @@ static int snd_atiixp_aclink_reset(struct atiixp *chip)
523 mdelay(1); 523 mdelay(1);
524 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); 524 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET);
525 if (!--timeout) { 525 if (!--timeout) {
526 snd_printk(KERN_ERR "atiixp: codec reset timeout\n"); 526 dev_err(chip->card->dev, "codec reset timeout\n");
527 break; 527 break;
528 } 528 }
529 } 529 }
@@ -567,9 +567,8 @@ static int ac97_probing_bugs(struct pci_dev *pci)
567 567
568 q = snd_pci_quirk_lookup(pci, atiixp_quirks); 568 q = snd_pci_quirk_lookup(pci, atiixp_quirks);
569 if (q) { 569 if (q) {
570 snd_printdd(KERN_INFO 570 dev_dbg(&pci->dev, "atiixp quirk for %s. Forcing codec %d\n",
571 "Atiixp quirk for %s. Forcing codec %d\n", 571 snd_pci_quirk_name(q), q->value);
572 snd_pci_quirk_name(q), q->value);
573 return q->value; 572 return q->value;
574 } 573 }
575 /* this hardware doesn't need workarounds. Probe for codec */ 574 /* this hardware doesn't need workarounds. Probe for codec */
@@ -600,7 +599,7 @@ static int snd_atiixp_codec_detect(struct atiixp *chip)
600 atiixp_write(chip, IER, 0); /* disable irqs */ 599 atiixp_write(chip, IER, 0); /* disable irqs */
601 600
602 if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { 601 if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) {
603 snd_printk(KERN_ERR "atiixp: no codec detected!\n"); 602 dev_err(chip->card->dev, "no codec detected!\n");
604 return -ENXIO; 603 return -ENXIO;
605 } 604 }
606 return 0; 605 return 0;
@@ -676,7 +675,7 @@ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substr
676 continue; 675 continue;
677 return bytes_to_frames(runtime, curptr); 676 return bytes_to_frames(runtime, curptr);
678 } 677 }
679 snd_printd("atiixp: invalid DMA pointer read 0x%x (buf=%x)\n", 678 dev_dbg(chip->card->dev, "invalid DMA pointer read 0x%x (buf=%x)\n",
680 readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr); 679 readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr);
681 return 0; 680 return 0;
682} 681}
@@ -688,7 +687,7 @@ static void snd_atiixp_xrun_dma(struct atiixp *chip, struct atiixp_dma *dma)
688{ 687{
689 if (! dma->substream || ! dma->running) 688 if (! dma->substream || ! dma->running)
690 return; 689 return;
691 snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type); 690 dev_dbg(chip->card->dev, "XRUN detected (DMA %d)\n", dma->ops->type);
692 snd_pcm_stream_lock(dma->substream); 691 snd_pcm_stream_lock(dma->substream);
693 snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); 692 snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
694 snd_pcm_stream_unlock(dma->substream); 693 snd_pcm_stream_unlock(dma->substream);
@@ -1453,14 +1452,15 @@ static int snd_atiixp_mixer_new(struct atiixp *chip, int clock,
1453 ac97.scaps |= AC97_SCAP_NO_SPDIF; 1452 ac97.scaps |= AC97_SCAP_NO_SPDIF;
1454 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { 1453 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
1455 chip->ac97[i] = NULL; /* to be sure */ 1454 chip->ac97[i] = NULL; /* to be sure */
1456 snd_printdd("atiixp: codec %d not available for audio\n", i); 1455 dev_dbg(chip->card->dev,
1456 "codec %d not available for audio\n", i);
1457 continue; 1457 continue;
1458 } 1458 }
1459 codec_count++; 1459 codec_count++;
1460 } 1460 }
1461 1461
1462 if (! codec_count) { 1462 if (! codec_count) {
1463 snd_printk(KERN_ERR "atiixp: no codec available\n"); 1463 dev_err(chip->card->dev, "no codec available\n");
1464 return -ENODEV; 1464 return -ENODEV;
1465 } 1465 }
1466 1466
@@ -1511,8 +1511,7 @@ static int snd_atiixp_resume(struct device *dev)
1511 pci_set_power_state(pci, PCI_D0); 1511 pci_set_power_state(pci, PCI_D0);
1512 pci_restore_state(pci); 1512 pci_restore_state(pci);
1513 if (pci_enable_device(pci) < 0) { 1513 if (pci_enable_device(pci) < 0) {
1514 printk(KERN_ERR "atiixp: pci_enable_device failed, " 1514 dev_err(dev, "pci_enable_device failed, disabling device\n");
1515 "disabling device\n");
1516 snd_card_disconnect(card); 1515 snd_card_disconnect(card);
1517 return -EIO; 1516 return -EIO;
1518 } 1517 }
@@ -1637,14 +1636,14 @@ static int snd_atiixp_create(struct snd_card *card,
1637 chip->addr = pci_resource_start(pci, 0); 1636 chip->addr = pci_resource_start(pci, 0);
1638 chip->remap_addr = pci_ioremap_bar(pci, 0); 1637 chip->remap_addr = pci_ioremap_bar(pci, 0);
1639 if (chip->remap_addr == NULL) { 1638 if (chip->remap_addr == NULL) {
1640 snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); 1639 dev_err(card->dev, "AC'97 space ioremap problem\n");
1641 snd_atiixp_free(chip); 1640 snd_atiixp_free(chip);
1642 return -EIO; 1641 return -EIO;
1643 } 1642 }
1644 1643
1645 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, 1644 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED,
1646 KBUILD_MODNAME, chip)) { 1645 KBUILD_MODNAME, chip)) {
1647 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1646 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1648 snd_atiixp_free(chip); 1647 snd_atiixp_free(chip);
1649 return -EBUSY; 1648 return -EBUSY;
1650 } 1649 }
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 2b3244a85cf8..b9dc96c5d21e 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -400,7 +400,7 @@ static int snd_atiixp_acquire_codec(struct atiixp_modem *chip)
400 400
401 while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) { 401 while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) {
402 if (! timeout--) { 402 if (! timeout--) {
403 snd_printk(KERN_WARNING "atiixp-modem: codec acquire timeout\n"); 403 dev_warn(chip->card->dev, "codec acquire timeout\n");
404 return -EBUSY; 404 return -EBUSY;
405 } 405 }
406 udelay(1); 406 udelay(1);
@@ -433,7 +433,7 @@ static unsigned short snd_atiixp_codec_read(struct atiixp_modem *chip,
433 } while (--timeout); 433 } while (--timeout);
434 /* time out may happen during reset */ 434 /* time out may happen during reset */
435 if (reg < 0x7c) 435 if (reg < 0x7c)
436 snd_printk(KERN_WARNING "atiixp-modem: codec read timeout (reg %x)\n", reg); 436 dev_warn(chip->card->dev, "codec read timeout (reg %x)\n", reg);
437 return 0xffff; 437 return 0xffff;
438} 438}
439 439
@@ -499,7 +499,7 @@ static int snd_atiixp_aclink_reset(struct atiixp_modem *chip)
499 msleep(1); 499 msleep(1);
500 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); 500 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET);
501 if (!--timeout) { 501 if (!--timeout) {
502 snd_printk(KERN_ERR "atiixp-modem: codec reset timeout\n"); 502 dev_err(chip->card->dev, "codec reset timeout\n");
503 break; 503 break;
504 } 504 }
505 } 505 }
@@ -553,7 +553,7 @@ static int snd_atiixp_codec_detect(struct atiixp_modem *chip)
553 atiixp_write(chip, IER, 0); /* disable irqs */ 553 atiixp_write(chip, IER, 0); /* disable irqs */
554 554
555 if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { 555 if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) {
556 snd_printk(KERN_ERR "atiixp-modem: no codec detected!\n"); 556 dev_err(chip->card->dev, "no codec detected!\n");
557 return -ENXIO; 557 return -ENXIO;
558 } 558 }
559 return 0; 559 return 0;
@@ -624,7 +624,7 @@ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substr
624 continue; 624 continue;
625 return bytes_to_frames(runtime, curptr); 625 return bytes_to_frames(runtime, curptr);
626 } 626 }
627 snd_printd("atiixp-modem: invalid DMA pointer read 0x%x (buf=%x)\n", 627 dev_dbg(chip->card->dev, "invalid DMA pointer read 0x%x (buf=%x)\n",
628 readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr); 628 readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr);
629 return 0; 629 return 0;
630} 630}
@@ -637,7 +637,7 @@ static void snd_atiixp_xrun_dma(struct atiixp_modem *chip,
637{ 637{
638 if (! dma->substream || ! dma->running) 638 if (! dma->substream || ! dma->running)
639 return; 639 return;
640 snd_printdd("atiixp-modem: XRUN detected (DMA %d)\n", dma->ops->type); 640 dev_dbg(chip->card->dev, "XRUN detected (DMA %d)\n", dma->ops->type);
641 snd_pcm_stream_lock(dma->substream); 641 snd_pcm_stream_lock(dma->substream);
642 snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); 642 snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
643 snd_pcm_stream_unlock(dma->substream); 643 snd_pcm_stream_unlock(dma->substream);
@@ -1098,14 +1098,15 @@ static int snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
1098 ac97.scaps = AC97_SCAP_SKIP_AUDIO | AC97_SCAP_POWER_SAVE; 1098 ac97.scaps = AC97_SCAP_SKIP_AUDIO | AC97_SCAP_POWER_SAVE;
1099 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { 1099 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
1100 chip->ac97[i] = NULL; /* to be sure */ 1100 chip->ac97[i] = NULL; /* to be sure */
1101 snd_printdd("atiixp-modem: codec %d not available for modem\n", i); 1101 dev_dbg(chip->card->dev,
1102 "codec %d not available for modem\n", i);
1102 continue; 1103 continue;
1103 } 1104 }
1104 codec_count++; 1105 codec_count++;
1105 } 1106 }
1106 1107
1107 if (! codec_count) { 1108 if (! codec_count) {
1108 snd_printk(KERN_ERR "atiixp-modem: no codec available\n"); 1109 dev_err(chip->card->dev, "no codec available\n");
1109 return -ENODEV; 1110 return -ENODEV;
1110 } 1111 }
1111 1112
@@ -1150,8 +1151,7 @@ static int snd_atiixp_resume(struct device *dev)
1150 pci_set_power_state(pci, PCI_D0); 1151 pci_set_power_state(pci, PCI_D0);
1151 pci_restore_state(pci); 1152 pci_restore_state(pci);
1152 if (pci_enable_device(pci) < 0) { 1153 if (pci_enable_device(pci) < 0) {
1153 printk(KERN_ERR "atiixp-modem: pci_enable_device failed, " 1154 dev_err(dev, "pci_enable_device failed, disabling device\n");
1154 "disabling device\n");
1155 snd_card_disconnect(card); 1155 snd_card_disconnect(card);
1156 return -EIO; 1156 return -EIO;
1157 } 1157 }
@@ -1262,14 +1262,14 @@ static int snd_atiixp_create(struct snd_card *card,
1262 chip->addr = pci_resource_start(pci, 0); 1262 chip->addr = pci_resource_start(pci, 0);
1263 chip->remap_addr = pci_ioremap_bar(pci, 0); 1263 chip->remap_addr = pci_ioremap_bar(pci, 0);
1264 if (chip->remap_addr == NULL) { 1264 if (chip->remap_addr == NULL) {
1265 snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); 1265 dev_err(card->dev, "AC'97 space ioremap problem\n");
1266 snd_atiixp_free(chip); 1266 snd_atiixp_free(chip);
1267 return -EIO; 1267 return -EIO;
1268 } 1268 }
1269 1269
1270 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, 1270 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED,
1271 KBUILD_MODNAME, chip)) { 1271 KBUILD_MODNAME, chip)) {
1272 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1272 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1273 snd_atiixp_free(chip); 1273 snd_atiixp_free(chip);
1274 return -EBUSY; 1274 return -EBUSY;
1275 } 1275 }
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index e9dabee42805..120d0d320a60 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -262,7 +262,7 @@ static int snd_aw2_create(struct snd_card *card,
262 /* check PCI availability (32bit DMA) */ 262 /* check PCI availability (32bit DMA) */
263 if ((pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) || 263 if ((pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) ||
264 (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0)) { 264 (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0)) {
265 printk(KERN_ERR "aw2: Impossible to set 32bit mask DMA\n"); 265 dev_err(card->dev, "Impossible to set 32bit mask DMA\n");
266 pci_disable_device(pci); 266 pci_disable_device(pci);
267 return -ENXIO; 267 return -ENXIO;
268 } 268 }
@@ -290,7 +290,7 @@ static int snd_aw2_create(struct snd_card *card,
290 pci_resource_len(pci, 0)); 290 pci_resource_len(pci, 0));
291 291
292 if (chip->iobase_virt == NULL) { 292 if (chip->iobase_virt == NULL) {
293 printk(KERN_ERR "aw2: unable to remap memory region"); 293 dev_err(card->dev, "unable to remap memory region");
294 pci_release_regions(pci); 294 pci_release_regions(pci);
295 pci_disable_device(pci); 295 pci_disable_device(pci);
296 kfree(chip); 296 kfree(chip);
@@ -302,7 +302,7 @@ static int snd_aw2_create(struct snd_card *card,
302 302
303 if (request_irq(pci->irq, snd_aw2_saa7146_interrupt, 303 if (request_irq(pci->irq, snd_aw2_saa7146_interrupt,
304 IRQF_SHARED, KBUILD_MODNAME, chip)) { 304 IRQF_SHARED, KBUILD_MODNAME, chip)) {
305 printk(KERN_ERR "aw2: Cannot grab irq %d\n", pci->irq); 305 dev_err(card->dev, "Cannot grab irq %d\n", pci->irq);
306 306
307 iounmap(chip->iobase_virt); 307 iounmap(chip->iobase_virt);
308 pci_release_regions(chip->pci); 308 pci_release_regions(chip->pci);
@@ -324,9 +324,8 @@ static int snd_aw2_create(struct snd_card *card,
324 324
325 *rchip = chip; 325 *rchip = chip;
326 326
327 printk(KERN_INFO 327 dev_info(card->dev,
328 "Audiowerk 2 sound card (saa7146 chipset) detected and " 328 "Audiowerk 2 sound card (saa7146 chipset) detected and managed\n");
329 "managed\n");
330 return 0; 329 return 0;
331} 330}
332 331
@@ -399,7 +398,7 @@ static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream)
399{ 398{
400 struct snd_pcm_runtime *runtime = substream->runtime; 399 struct snd_pcm_runtime *runtime = substream->runtime;
401 400
402 snd_printdd(KERN_DEBUG "aw2: Playback_open\n"); 401 dev_dbg(substream->pcm->card->dev, "Playback_open\n");
403 runtime->hw = snd_aw2_playback_hw; 402 runtime->hw = snd_aw2_playback_hw;
404 return 0; 403 return 0;
405} 404}
@@ -415,7 +414,7 @@ static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream)
415{ 414{
416 struct snd_pcm_runtime *runtime = substream->runtime; 415 struct snd_pcm_runtime *runtime = substream->runtime;
417 416
418 snd_printdd(KERN_DEBUG "aw2: Capture_open\n"); 417 dev_dbg(substream->pcm->card->dev, "Capture_open\n");
419 runtime->hw = snd_aw2_capture_hw; 418 runtime->hw = snd_aw2_capture_hw;
420 return 0; 419 return 0;
421} 420}
@@ -603,7 +602,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
603 err = snd_pcm_new(chip->card, "Audiowerk2 analog playback", 0, 1, 0, 602 err = snd_pcm_new(chip->card, "Audiowerk2 analog playback", 0, 1, 0,
604 &pcm_playback_ana); 603 &pcm_playback_ana);
605 if (err < 0) { 604 if (err < 0) {
606 printk(KERN_ERR "aw2: snd_pcm_new error (0x%X)\n", err); 605 dev_err(chip->card->dev, "snd_pcm_new error (0x%X)\n", err);
607 return err; 606 return err;
608 } 607 }
609 608
@@ -633,14 +632,15 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
633 (chip->pci), 632 (chip->pci),
634 64 * 1024, 64 * 1024); 633 64 * 1024, 64 * 1024);
635 if (err) 634 if (err)
636 printk(KERN_ERR "aw2: snd_pcm_lib_preallocate_pages_for_all " 635 dev_err(chip->card->dev,
637 "error (0x%X)\n", err); 636 "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n",
637 err);
638 638
639 err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0, 639 err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0,
640 &pcm_playback_num); 640 &pcm_playback_num);
641 641
642 if (err < 0) { 642 if (err < 0) {
643 printk(KERN_ERR "aw2: snd_pcm_new error (0x%X)\n", err); 643 dev_err(chip->card->dev, "snd_pcm_new error (0x%X)\n", err);
644 return err; 644 return err;
645 } 645 }
646 /* Creation ok */ 646 /* Creation ok */
@@ -669,17 +669,15 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
669 (chip->pci), 669 (chip->pci),
670 64 * 1024, 64 * 1024); 670 64 * 1024, 64 * 1024);
671 if (err) 671 if (err)
672 printk(KERN_ERR 672 dev_err(chip->card->dev,
673 "aw2: snd_pcm_lib_preallocate_pages_for_all error " 673 "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n",
674 "(0x%X)\n", err); 674 err);
675
676
677 675
678 err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1, 676 err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1,
679 &pcm_capture); 677 &pcm_capture);
680 678
681 if (err < 0) { 679 if (err < 0) {
682 printk(KERN_ERR "aw2: snd_pcm_new error (0x%X)\n", err); 680 dev_err(chip->card->dev, "snd_pcm_new error (0x%X)\n", err);
683 return err; 681 return err;
684 } 682 }
685 683
@@ -709,15 +707,15 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
709 (chip->pci), 707 (chip->pci),
710 64 * 1024, 64 * 1024); 708 64 * 1024, 64 * 1024);
711 if (err) 709 if (err)
712 printk(KERN_ERR 710 dev_err(chip->card->dev,
713 "aw2: snd_pcm_lib_preallocate_pages_for_all error " 711 "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n",
714 "(0x%X)\n", err); 712 err);
715 713
716 714
717 /* Create control */ 715 /* Create control */
718 err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip)); 716 err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip));
719 if (err < 0) { 717 if (err < 0) {
720 printk(KERN_ERR "aw2: snd_ctl_add error (0x%X)\n", err); 718 dev_err(chip->card->dev, "snd_ctl_add error (0x%X)\n", err);
721 return err; 719 return err;
722 } 720 }
723 721
diff --git a/sound/pci/aw2/aw2-saa7146.c b/sound/pci/aw2/aw2-saa7146.c
index 4439636971eb..6d24e9536777 100644
--- a/sound/pci/aw2/aw2-saa7146.c
+++ b/sound/pci/aw2/aw2-saa7146.c
@@ -204,8 +204,7 @@ void snd_aw2_saa7146_pcm_init_playback(struct snd_aw2_saa7146 *chip,
204 /* Define upper limit for DMA access */ 204 /* Define upper limit for DMA access */
205 WRITEREG(dma_addr + buffer_size, ProtA1_out); 205 WRITEREG(dma_addr + buffer_size, ProtA1_out);
206 } else { 206 } else {
207 printk(KERN_ERR 207 pr_err("aw2: snd_aw2_saa7146_pcm_init_playback: "
208 "aw2: snd_aw2_saa7146_pcm_init_playback: "
209 "Substream number is not 0 or 1 -> not managed\n"); 208 "Substream number is not 0 or 1 -> not managed\n");
210 } 209 }
211} 210}
@@ -251,8 +250,7 @@ void snd_aw2_saa7146_pcm_init_capture(struct snd_aw2_saa7146 *chip,
251 /* Define upper limit for DMA access */ 250 /* Define upper limit for DMA access */
252 WRITEREG(dma_addr + buffer_size, ProtA1_in); 251 WRITEREG(dma_addr + buffer_size, ProtA1_in);
253 } else { 252 } else {
254 printk(KERN_ERR 253 pr_err("aw2: snd_aw2_saa7146_pcm_init_capture: "
255 "aw2: snd_aw2_saa7146_pcm_init_capture: "
256 "Substream number is not 0 -> not managed\n"); 254 "Substream number is not 0 -> not managed\n");
257 } 255 }
258} 256}
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 641c235ab4d8..c9216c0a9c8b 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -238,61 +238,6 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}");
238 2>/dev/null 238 2>/dev/null
239*/ 239*/
240 240
241#define DEBUG_MISC 0
242#define DEBUG_CALLS 0
243#define DEBUG_MIXER 0
244#define DEBUG_CODEC 0
245#define DEBUG_TIMER 0
246#define DEBUG_GAME 0
247#define DEBUG_PM 0
248#define MIXER_TESTING 0
249
250#if DEBUG_MISC
251#define snd_azf3328_dbgmisc(format, args...) printk(KERN_DEBUG format, ##args)
252#else
253#define snd_azf3328_dbgmisc(format, args...)
254#endif
255
256#if DEBUG_CALLS
257#define snd_azf3328_dbgcalls(format, args...) printk(format, ##args)
258#define snd_azf3328_dbgcallenter() printk(KERN_DEBUG "--> %s\n", __func__)
259#define snd_azf3328_dbgcallleave() printk(KERN_DEBUG "<-- %s\n", __func__)
260#else
261#define snd_azf3328_dbgcalls(format, args...)
262#define snd_azf3328_dbgcallenter()
263#define snd_azf3328_dbgcallleave()
264#endif
265
266#if DEBUG_MIXER
267#define snd_azf3328_dbgmixer(format, args...) printk(KERN_DEBUG format, ##args)
268#else
269#define snd_azf3328_dbgmixer(format, args...)
270#endif
271
272#if DEBUG_CODEC
273#define snd_azf3328_dbgcodec(format, args...) printk(KERN_DEBUG format, ##args)
274#else
275#define snd_azf3328_dbgcodec(format, args...)
276#endif
277
278#if DEBUG_MISC
279#define snd_azf3328_dbgtimer(format, args...) printk(KERN_DEBUG format, ##args)
280#else
281#define snd_azf3328_dbgtimer(format, args...)
282#endif
283
284#if DEBUG_GAME
285#define snd_azf3328_dbggame(format, args...) printk(KERN_DEBUG format, ##args)
286#else
287#define snd_azf3328_dbggame(format, args...)
288#endif
289
290#if DEBUG_PM
291#define snd_azf3328_dbgpm(format, args...) printk(KERN_DEBUG format, ##args)
292#else
293#define snd_azf3328_dbgpm(format, args...)
294#endif
295
296static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 241static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
297module_param_array(index, int, NULL, 0444); 242module_param_array(index, int, NULL, 0444);
298MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); 243MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard.");
@@ -475,6 +420,12 @@ snd_azf3328_ctrl_inb(const struct snd_azf3328 *chip, unsigned reg)
475 return inb(chip->ctrl_io + reg); 420 return inb(chip->ctrl_io + reg);
476} 421}
477 422
423static inline u16
424snd_azf3328_ctrl_inw(const struct snd_azf3328 *chip, unsigned reg)
425{
426 return inw(chip->ctrl_io + reg);
427}
428
478static inline void 429static inline void
479snd_azf3328_ctrl_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value) 430snd_azf3328_ctrl_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value)
480{ 431{
@@ -578,11 +529,12 @@ snd_azf3328_mixer_reset(const struct snd_azf3328 *chip)
578#ifdef AZF_USE_AC97_LAYER 529#ifdef AZF_USE_AC97_LAYER
579 530
580static inline void 531static inline void
581snd_azf3328_mixer_ac97_map_unsupported(unsigned short reg, const char *mode) 532snd_azf3328_mixer_ac97_map_unsupported(const struct snd_azf3328 *chip,
533 unsigned short reg, const char *mode)
582{ 534{
583 /* need to add some more or less clever emulation? */ 535 /* need to add some more or less clever emulation? */
584 printk(KERN_WARNING 536 dev_warn(chip->card->dev,
585 "azt3328: missing %s emulation for AC97 register 0x%02x!\n", 537 "missing %s emulation for AC97 register 0x%02x!\n",
586 mode, reg); 538 mode, reg);
587} 539}
588 540
@@ -717,10 +669,8 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97)
717 unsigned short reg_val = 0; 669 unsigned short reg_val = 0;
718 bool unsupported = false; 670 bool unsupported = false;
719 671
720 snd_azf3328_dbgmixer( 672 dev_dbg(chip->card->dev, "snd_azf3328_mixer_ac97_read reg_ac97 %u\n",
721 "snd_azf3328_mixer_ac97_read reg_ac97 %u\n", 673 reg_ac97);
722 reg_ac97
723 );
724 if (reg_azf & AZF_AC97_REG_UNSUPPORTED) 674 if (reg_azf & AZF_AC97_REG_UNSUPPORTED)
725 unsupported = true; 675 unsupported = true;
726 else { 676 else {
@@ -765,7 +715,7 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97)
765 } 715 }
766 } 716 }
767 if (unsupported) 717 if (unsupported)
768 snd_azf3328_mixer_ac97_map_unsupported(reg_ac97, "read"); 718 snd_azf3328_mixer_ac97_map_unsupported(chip, reg_ac97, "read");
769 719
770 return reg_val; 720 return reg_val;
771} 721}
@@ -778,10 +728,9 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97,
778 unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97); 728 unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97);
779 bool unsupported = false; 729 bool unsupported = false;
780 730
781 snd_azf3328_dbgmixer( 731 dev_dbg(chip->card->dev,
782 "snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n", 732 "snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n",
783 reg_ac97, val 733 reg_ac97, val);
784 );
785 if (reg_azf & AZF_AC97_REG_UNSUPPORTED) 734 if (reg_azf & AZF_AC97_REG_UNSUPPORTED)
786 unsupported = true; 735 unsupported = true;
787 else { 736 else {
@@ -814,7 +763,7 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97,
814 } 763 }
815 } 764 }
816 if (unsupported) 765 if (unsupported)
817 snd_azf3328_mixer_ac97_map_unsupported(reg_ac97, "write"); 766 snd_azf3328_mixer_ac97_map_unsupported(chip, reg_ac97, "write");
818} 767}
819 768
820static int 769static int
@@ -850,7 +799,7 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip)
850 * due to this card being a very quirky AC97 "lookalike". 799 * due to this card being a very quirky AC97 "lookalike".
851 */ 800 */
852 if (rc) 801 if (rc)
853 printk(KERN_ERR "azt3328: AC97 init failed, err %d!\n", rc); 802 dev_err(chip->card->dev, "AC97 init failed, err %d!\n", rc);
854 803
855 /* If we return an error here, then snd_card_free() should 804 /* If we return an error here, then snd_card_free() should
856 * free up any ac97 codecs that got created, as well as the bus. 805 * free up any ac97 codecs that got created, as well as the bus.
@@ -870,8 +819,6 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip,
870 unsigned char curr_vol_left = 0, curr_vol_right = 0; 819 unsigned char curr_vol_left = 0, curr_vol_right = 0;
871 int left_change = 0, right_change = 0; 820 int left_change = 0, right_change = 0;
872 821
873 snd_azf3328_dbgcallenter();
874
875 if (chan_sel & SET_CHAN_LEFT) { 822 if (chan_sel & SET_CHAN_LEFT) {
876 curr_vol_left = inb(portbase + 1); 823 curr_vol_left = inb(portbase + 1);
877 824
@@ -912,7 +859,6 @@ snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip,
912 if (delay) 859 if (delay)
913 mdelay(delay); 860 mdelay(delay);
914 } while ((left_change) || (right_change)); 861 } while ((left_change) || (right_change));
915 snd_azf3328_dbgcallleave();
916} 862}
917 863
918/* 864/*
@@ -990,14 +936,12 @@ snd_azf3328_info_mixer(struct snd_kcontrol *kcontrol,
990{ 936{
991 struct azf3328_mixer_reg reg; 937 struct azf3328_mixer_reg reg;
992 938
993 snd_azf3328_dbgcallenter();
994 snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value); 939 snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value);
995 uinfo->type = reg.mask == 1 ? 940 uinfo->type = reg.mask == 1 ?
996 SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; 941 SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;
997 uinfo->count = reg.stereo + 1; 942 uinfo->count = reg.stereo + 1;
998 uinfo->value.integer.min = 0; 943 uinfo->value.integer.min = 0;
999 uinfo->value.integer.max = reg.mask; 944 uinfo->value.integer.max = reg.mask;
1000 snd_azf3328_dbgcallleave();
1001 return 0; 945 return 0;
1002} 946}
1003 947
@@ -1009,7 +953,6 @@ snd_azf3328_get_mixer(struct snd_kcontrol *kcontrol,
1009 struct azf3328_mixer_reg reg; 953 struct azf3328_mixer_reg reg;
1010 u16 oreg, val; 954 u16 oreg, val;
1011 955
1012 snd_azf3328_dbgcallenter();
1013 snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value); 956 snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value);
1014 957
1015 oreg = snd_azf3328_mixer_inw(chip, reg.reg); 958 oreg = snd_azf3328_mixer_inw(chip, reg.reg);
@@ -1023,12 +966,11 @@ snd_azf3328_get_mixer(struct snd_kcontrol *kcontrol,
1023 val = reg.mask - val; 966 val = reg.mask - val;
1024 ucontrol->value.integer.value[1] = val; 967 ucontrol->value.integer.value[1] = val;
1025 } 968 }
1026 snd_azf3328_dbgmixer("get: %02x is %04x -> vol %02lx|%02lx " 969 dev_dbg(chip->card->dev,
1027 "(shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n", 970 "get: %02x is %04x -> vol %02lx|%02lx (shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n",
1028 reg.reg, oreg, 971 reg.reg, oreg,
1029 ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], 972 ucontrol->value.integer.value[0], ucontrol->value.integer.value[1],
1030 reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo); 973 reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo);
1031 snd_azf3328_dbgcallleave();
1032 return 0; 974 return 0;
1033} 975}
1034 976
@@ -1040,7 +982,6 @@ snd_azf3328_put_mixer(struct snd_kcontrol *kcontrol,
1040 struct azf3328_mixer_reg reg; 982 struct azf3328_mixer_reg reg;
1041 u16 oreg, nreg, val; 983 u16 oreg, nreg, val;
1042 984
1043 snd_azf3328_dbgcallenter();
1044 snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value); 985 snd_azf3328_mixer_reg_decode(&reg, kcontrol->private_value);
1045 oreg = snd_azf3328_mixer_inw(chip, reg.reg); 986 oreg = snd_azf3328_mixer_inw(chip, reg.reg);
1046 val = ucontrol->value.integer.value[0] & reg.mask; 987 val = ucontrol->value.integer.value[0] & reg.mask;
@@ -1064,12 +1005,11 @@ snd_azf3328_put_mixer(struct snd_kcontrol *kcontrol,
1064 else 1005 else
1065 snd_azf3328_mixer_outw(chip, reg.reg, nreg); 1006 snd_azf3328_mixer_outw(chip, reg.reg, nreg);
1066 1007
1067 snd_azf3328_dbgmixer("put: %02x to %02lx|%02lx, " 1008 dev_dbg(chip->card->dev,
1068 "oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n", 1009 "put: %02x to %02lx|%02lx, oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n",
1069 reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], 1010 reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1],
1070 oreg, reg.lchan_shift, reg.rchan_shift, 1011 oreg, reg.lchan_shift, reg.rchan_shift,
1071 nreg, snd_azf3328_mixer_inw(chip, reg.reg)); 1012 nreg, snd_azf3328_mixer_inw(chip, reg.reg));
1072 snd_azf3328_dbgcallleave();
1073 return (nreg != oreg); 1013 return (nreg != oreg);
1074} 1014}
1075 1015
@@ -1135,7 +1075,8 @@ snd_azf3328_get_mixer_enum(struct snd_kcontrol *kcontrol,
1135 } else 1075 } else
1136 ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1); 1076 ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1);
1137 1077
1138 snd_azf3328_dbgmixer("get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n", 1078 dev_dbg(chip->card->dev,
1079 "get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n",
1139 reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1], 1080 reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1],
1140 reg.lchan_shift, reg.enum_c); 1081 reg.lchan_shift, reg.enum_c);
1141 return 0; 1082 return 0;
@@ -1167,7 +1108,8 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol,
1167 snd_azf3328_mixer_outw(chip, reg.reg, val); 1108 snd_azf3328_mixer_outw(chip, reg.reg, val);
1168 nreg = val; 1109 nreg = val;
1169 1110
1170 snd_azf3328_dbgmixer("put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg); 1111 dev_dbg(chip->card->dev,
1112 "put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg);
1171 return (nreg != oreg); 1113 return (nreg != oreg);
1172} 1114}
1173 1115
@@ -1253,7 +1195,6 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip)
1253 unsigned int idx; 1195 unsigned int idx;
1254 int err; 1196 int err;
1255 1197
1256 snd_azf3328_dbgcallenter();
1257 if (snd_BUG_ON(!chip || !chip->card)) 1198 if (snd_BUG_ON(!chip || !chip->card))
1258 return -EINVAL; 1199 return -EINVAL;
1259 1200
@@ -1279,7 +1220,6 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip)
1279 snd_component_add(card, "AZF3328 mixer"); 1220 snd_component_add(card, "AZF3328 mixer");
1280 strcpy(card->mixername, "AZF3328 mixer"); 1221 strcpy(card->mixername, "AZF3328 mixer");
1281 1222
1282 snd_azf3328_dbgcallleave();
1283 return 0; 1223 return 0;
1284} 1224}
1285#endif /* AZF_USE_AC97_LAYER */ 1225#endif /* AZF_USE_AC97_LAYER */
@@ -1288,19 +1228,13 @@ static int
1288snd_azf3328_hw_params(struct snd_pcm_substream *substream, 1228snd_azf3328_hw_params(struct snd_pcm_substream *substream,
1289 struct snd_pcm_hw_params *hw_params) 1229 struct snd_pcm_hw_params *hw_params)
1290{ 1230{
1291 int res; 1231 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
1292 snd_azf3328_dbgcallenter();
1293 res = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
1294 snd_azf3328_dbgcallleave();
1295 return res;
1296} 1232}
1297 1233
1298static int 1234static int
1299snd_azf3328_hw_free(struct snd_pcm_substream *substream) 1235snd_azf3328_hw_free(struct snd_pcm_substream *substream)
1300{ 1236{
1301 snd_azf3328_dbgcallenter();
1302 snd_pcm_lib_free_pages(substream); 1237 snd_pcm_lib_free_pages(substream);
1303 snd_azf3328_dbgcallleave();
1304 return 0; 1238 return 0;
1305} 1239}
1306 1240
@@ -1315,7 +1249,6 @@ snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
1315 u16 val = 0xff00; 1249 u16 val = 0xff00;
1316 u8 freq = 0; 1250 u8 freq = 0;
1317 1251
1318 snd_azf3328_dbgcallenter();
1319 switch (bitrate) { 1252 switch (bitrate) {
1320 case AZF_FREQ_4000: freq = SOUNDFORMAT_FREQ_SUSPECTED_4000; break; 1253 case AZF_FREQ_4000: freq = SOUNDFORMAT_FREQ_SUSPECTED_4000; break;
1321 case AZF_FREQ_4800: freq = SOUNDFORMAT_FREQ_SUSPECTED_4800; break; 1254 case AZF_FREQ_4800: freq = SOUNDFORMAT_FREQ_SUSPECTED_4800; break;
@@ -1379,7 +1312,6 @@ snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
1379 ); 1312 );
1380 1313
1381 spin_unlock_irqrestore(codec->lock, flags); 1314 spin_unlock_irqrestore(codec->lock, flags);
1382 snd_azf3328_dbgcallleave();
1383} 1315}
1384 1316
1385static inline void 1317static inline void
@@ -1404,15 +1336,16 @@ snd_azf3328_ctrl_reg_6AH_update(struct snd_azf3328 *chip,
1404 chip->shadow_reg_ctrl_6AH |= bitmask; 1336 chip->shadow_reg_ctrl_6AH |= bitmask;
1405 else 1337 else
1406 chip->shadow_reg_ctrl_6AH &= ~bitmask; 1338 chip->shadow_reg_ctrl_6AH &= ~bitmask;
1407 snd_azf3328_dbgcodec("6AH_update mask 0x%04x do_mask %d: val 0x%04x\n", 1339 dev_dbg(chip->card->dev,
1408 bitmask, do_mask, chip->shadow_reg_ctrl_6AH); 1340 "6AH_update mask 0x%04x do_mask %d: val 0x%04x\n",
1341 bitmask, do_mask, chip->shadow_reg_ctrl_6AH);
1409 snd_azf3328_ctrl_outw(chip, IDX_IO_6AH, chip->shadow_reg_ctrl_6AH); 1342 snd_azf3328_ctrl_outw(chip, IDX_IO_6AH, chip->shadow_reg_ctrl_6AH);
1410} 1343}
1411 1344
1412static inline void 1345static inline void
1413snd_azf3328_ctrl_enable_codecs(struct snd_azf3328 *chip, bool enable) 1346snd_azf3328_ctrl_enable_codecs(struct snd_azf3328 *chip, bool enable)
1414{ 1347{
1415 snd_azf3328_dbgcodec("codec_enable %d\n", enable); 1348 dev_dbg(chip->card->dev, "codec_enable %d\n", enable);
1416 /* no idea what exactly is being done here, but I strongly assume it's 1349 /* no idea what exactly is being done here, but I strongly assume it's
1417 * PM related */ 1350 * PM related */
1418 snd_azf3328_ctrl_reg_6AH_update( 1351 snd_azf3328_ctrl_reg_6AH_update(
@@ -1429,7 +1362,7 @@ snd_azf3328_ctrl_codec_activity(struct snd_azf3328 *chip,
1429 struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; 1362 struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];
1430 bool need_change = (codec->running != enable); 1363 bool need_change = (codec->running != enable);
1431 1364
1432 snd_azf3328_dbgcodec( 1365 dev_dbg(chip->card->dev,
1433 "codec_activity: %s codec, enable %d, need_change %d\n", 1366 "codec_activity: %s codec, enable %d, need_change %d\n",
1434 codec->name, enable, need_change 1367 codec->name, enable, need_change
1435 ); 1368 );
@@ -1470,13 +1403,13 @@ snd_azf3328_ctrl_codec_activity(struct snd_azf3328 *chip,
1470} 1403}
1471 1404
1472static void 1405static void
1473snd_azf3328_codec_setdmaa(struct snd_azf3328_codec_data *codec, 1406snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip,
1474 unsigned long addr, 1407 struct snd_azf3328_codec_data *codec,
1475 unsigned int period_bytes, 1408 unsigned long addr,
1476 unsigned int buffer_bytes 1409 unsigned int period_bytes,
1410 unsigned int buffer_bytes
1477) 1411)
1478{ 1412{
1479 snd_azf3328_dbgcallenter();
1480 WARN_ONCE(period_bytes & 1, "odd period length!?\n"); 1413 WARN_ONCE(period_bytes & 1, "odd period length!?\n");
1481 WARN_ONCE(buffer_bytes != 2 * period_bytes, 1414 WARN_ONCE(buffer_bytes != 2 * period_bytes,
1482 "missed our input expectations! %u vs. %u\n", 1415 "missed our input expectations! %u vs. %u\n",
@@ -1499,7 +1432,7 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328_codec_data *codec,
1499 setup_io.dma_start_1 = addr; 1432 setup_io.dma_start_1 = addr;
1500 setup_io.dma_start_2 = addr+area_length; 1433 setup_io.dma_start_2 = addr+area_length;
1501 1434
1502 snd_azf3328_dbgcodec( 1435 dev_dbg(chip->card->dev,
1503 "setdma: buffers %08x[%u] / %08x[%u], %u, %u\n", 1436 "setdma: buffers %08x[%u] / %08x[%u], %u, %u\n",
1504 setup_io.dma_start_1, area_length, 1437 setup_io.dma_start_1, area_length,
1505 setup_io.dma_start_2, area_length, 1438 setup_io.dma_start_2, area_length,
@@ -1522,7 +1455,6 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328_codec_data *codec,
1522 ); 1455 );
1523 spin_unlock_irqrestore(codec->lock, flags); 1456 spin_unlock_irqrestore(codec->lock, flags);
1524 } 1457 }
1525 snd_azf3328_dbgcallleave();
1526} 1458}
1527 1459
1528static int 1460static int
@@ -1535,8 +1467,6 @@ snd_azf3328_pcm_prepare(struct snd_pcm_substream *substream)
1535 unsigned int count = snd_pcm_lib_period_bytes(substream); 1467 unsigned int count = snd_pcm_lib_period_bytes(substream);
1536#endif 1468#endif
1537 1469
1538 snd_azf3328_dbgcallenter();
1539
1540 codec->dma_base = runtime->dma_addr; 1470 codec->dma_base = runtime->dma_addr;
1541 1471
1542#if 0 1472#if 0
@@ -1544,10 +1474,9 @@ snd_azf3328_pcm_prepare(struct snd_pcm_substream *substream)
1544 runtime->rate, 1474 runtime->rate,
1545 snd_pcm_format_width(runtime->format), 1475 snd_pcm_format_width(runtime->format),
1546 runtime->channels); 1476 runtime->channels);
1547 snd_azf3328_codec_setdmaa(codec, 1477 snd_azf3328_codec_setdmaa(chip, codec,
1548 runtime->dma_addr, count, size); 1478 runtime->dma_addr, count, size);
1549#endif 1479#endif
1550 snd_azf3328_dbgcallleave();
1551 return 0; 1480 return 0;
1552} 1481}
1553 1482
@@ -1562,11 +1491,9 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1562 bool previously_muted = false; 1491 bool previously_muted = false;
1563 bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type); 1492 bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type);
1564 1493
1565 snd_azf3328_dbgcalls("snd_azf3328_pcm_trigger cmd %d\n", cmd);
1566
1567 switch (cmd) { 1494 switch (cmd) {
1568 case SNDRV_PCM_TRIGGER_START: 1495 case SNDRV_PCM_TRIGGER_START:
1569 snd_azf3328_dbgcodec("START %s\n", codec->name); 1496 dev_dbg(chip->card->dev, "START PCM %s\n", codec->name);
1570 1497
1571 if (is_main_mixer_playback_codec) { 1498 if (is_main_mixer_playback_codec) {
1572 /* mute WaveOut (avoid clicking during setup) */ 1499 /* mute WaveOut (avoid clicking during setup) */
@@ -1593,7 +1520,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1593 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff); 1520 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff);
1594 spin_unlock(codec->lock); 1521 spin_unlock(codec->lock);
1595 1522
1596 snd_azf3328_codec_setdmaa(codec, runtime->dma_addr, 1523 snd_azf3328_codec_setdmaa(chip, codec, runtime->dma_addr,
1597 snd_pcm_lib_period_bytes(substream), 1524 snd_pcm_lib_period_bytes(substream),
1598 snd_pcm_lib_buffer_bytes(substream) 1525 snd_pcm_lib_buffer_bytes(substream)
1599 ); 1526 );
@@ -1633,10 +1560,10 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1633 ); 1560 );
1634 } 1561 }
1635 1562
1636 snd_azf3328_dbgcodec("STARTED %s\n", codec->name); 1563 dev_dbg(chip->card->dev, "PCM STARTED %s\n", codec->name);
1637 break; 1564 break;
1638 case SNDRV_PCM_TRIGGER_RESUME: 1565 case SNDRV_PCM_TRIGGER_RESUME:
1639 snd_azf3328_dbgcodec("RESUME %s\n", codec->name); 1566 dev_dbg(chip->card->dev, "PCM RESUME %s\n", codec->name);
1640 /* resume codec if we were active */ 1567 /* resume codec if we were active */
1641 spin_lock(codec->lock); 1568 spin_lock(codec->lock);
1642 if (codec->running) 1569 if (codec->running)
@@ -1648,7 +1575,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1648 spin_unlock(codec->lock); 1575 spin_unlock(codec->lock);
1649 break; 1576 break;
1650 case SNDRV_PCM_TRIGGER_STOP: 1577 case SNDRV_PCM_TRIGGER_STOP:
1651 snd_azf3328_dbgcodec("STOP %s\n", codec->name); 1578 dev_dbg(chip->card->dev, "PCM STOP %s\n", codec->name);
1652 1579
1653 if (is_main_mixer_playback_codec) { 1580 if (is_main_mixer_playback_codec) {
1654 /* mute WaveOut (avoid clicking during setup) */ 1581 /* mute WaveOut (avoid clicking during setup) */
@@ -1684,10 +1611,10 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1684 ); 1611 );
1685 } 1612 }
1686 1613
1687 snd_azf3328_dbgcodec("STOPPED %s\n", codec->name); 1614 dev_dbg(chip->card->dev, "PCM STOPPED %s\n", codec->name);
1688 break; 1615 break;
1689 case SNDRV_PCM_TRIGGER_SUSPEND: 1616 case SNDRV_PCM_TRIGGER_SUSPEND:
1690 snd_azf3328_dbgcodec("SUSPEND %s\n", codec->name); 1617 dev_dbg(chip->card->dev, "PCM SUSPEND %s\n", codec->name);
1691 /* make sure codec is stopped */ 1618 /* make sure codec is stopped */
1692 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, 1619 snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
1693 snd_azf3328_codec_inw( 1620 snd_azf3328_codec_inw(
@@ -1696,17 +1623,16 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1696 ); 1623 );
1697 break; 1624 break;
1698 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1625 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1699 snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); 1626 WARN(1, "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n");
1700 break; 1627 break;
1701 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 1628 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1702 snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); 1629 WARN(1, "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n");
1703 break; 1630 break;
1704 default: 1631 default:
1705 snd_printk(KERN_ERR "FIXME: unknown trigger mode!\n"); 1632 WARN(1, "FIXME: unknown trigger mode!\n");
1706 return -EINVAL; 1633 return -EINVAL;
1707 } 1634 }
1708 1635
1709 snd_azf3328_dbgcallleave();
1710 return result; 1636 return result;
1711} 1637}
1712 1638
@@ -1728,8 +1654,8 @@ snd_azf3328_pcm_pointer(struct snd_pcm_substream *substream
1728 result -= codec->dma_base; 1654 result -= codec->dma_base;
1729#endif 1655#endif
1730 frmres = bytes_to_frames( substream->runtime, result); 1656 frmres = bytes_to_frames( substream->runtime, result);
1731 snd_azf3328_dbgcodec("%08li %s @ 0x%8lx, frames %8ld\n", 1657 dev_dbg(substream->pcm->card->dev, "%08li %s @ 0x%8lx, frames %8ld\n",
1732 jiffies, codec->name, result, frmres); 1658 jiffies, codec->name, result, frmres);
1733 return frmres; 1659 return frmres;
1734} 1660}
1735 1661
@@ -1792,7 +1718,7 @@ snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip)
1792 * skeleton handler only 1718 * skeleton handler only
1793 * (we do not want axis reading in interrupt handler - too much load!) 1719 * (we do not want axis reading in interrupt handler - too much load!)
1794 */ 1720 */
1795 snd_azf3328_dbggame("gameport irq\n"); 1721 dev_dbg(chip->card->dev, "gameport irq\n");
1796 1722
1797 /* this should ACK the gameport IRQ properly, hopefully. */ 1723 /* this should ACK the gameport IRQ properly, hopefully. */
1798 snd_azf3328_game_inw(chip, IDX_GAME_AXIS_VALUE); 1724 snd_azf3328_game_inw(chip, IDX_GAME_AXIS_VALUE);
@@ -1804,7 +1730,7 @@ snd_azf3328_gameport_open(struct gameport *gameport, int mode)
1804 struct snd_azf3328 *chip = gameport_get_port_data(gameport); 1730 struct snd_azf3328 *chip = gameport_get_port_data(gameport);
1805 int res; 1731 int res;
1806 1732
1807 snd_azf3328_dbggame("gameport_open, mode %d\n", mode); 1733 dev_dbg(chip->card->dev, "gameport_open, mode %d\n", mode);
1808 switch (mode) { 1734 switch (mode) {
1809 case GAMEPORT_MODE_COOKED: 1735 case GAMEPORT_MODE_COOKED:
1810 case GAMEPORT_MODE_RAW: 1736 case GAMEPORT_MODE_RAW:
@@ -1827,7 +1753,7 @@ snd_azf3328_gameport_close(struct gameport *gameport)
1827{ 1753{
1828 struct snd_azf3328 *chip = gameport_get_port_data(gameport); 1754 struct snd_azf3328 *chip = gameport_get_port_data(gameport);
1829 1755
1830 snd_azf3328_dbggame("gameport_close\n"); 1756 dev_dbg(chip->card->dev, "gameport_close\n");
1831 snd_azf3328_gameport_set_counter_frequency(chip, 1757 snd_azf3328_gameport_set_counter_frequency(chip,
1832 GAME_HWCFG_ADC_COUNTER_FREQ_1_200); 1758 GAME_HWCFG_ADC_COUNTER_FREQ_1_200);
1833 snd_azf3328_gameport_axis_circuit_enable(chip, 0); 1759 snd_azf3328_gameport_axis_circuit_enable(chip, 0);
@@ -1892,9 +1818,8 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport,
1892 axes[i] = -1; 1818 axes[i] = -1;
1893 } 1819 }
1894 1820
1895 snd_azf3328_dbggame("cooked_read: axes %d %d %d %d buttons %d\n", 1821 dev_dbg(chip->card->dev, "cooked_read: axes %d %d %d %d buttons %d\n",
1896 axes[0], axes[1], axes[2], axes[3], *buttons 1822 axes[0], axes[1], axes[2], axes[3], *buttons);
1897 );
1898 1823
1899 return 0; 1824 return 0;
1900} 1825}
@@ -1906,7 +1831,7 @@ snd_azf3328_gameport(struct snd_azf3328 *chip, int dev)
1906 1831
1907 chip->gameport = gp = gameport_allocate_port(); 1832 chip->gameport = gp = gameport_allocate_port();
1908 if (!gp) { 1833 if (!gp) {
1909 printk(KERN_ERR "azt3328: cannot alloc memory for gameport\n"); 1834 dev_err(chip->card->dev, "cannot alloc memory for gameport\n");
1910 return -ENOMEM; 1835 return -ENOMEM;
1911 } 1836 }
1912 1837
@@ -1950,23 +1875,23 @@ snd_azf3328_gameport_free(struct snd_azf3328 *chip) { }
1950static inline void 1875static inline void
1951snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip) 1876snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip)
1952{ 1877{
1953 printk(KERN_WARNING "huh, game port IRQ occurred!?\n"); 1878 dev_warn(chip->card->dev, "huh, game port IRQ occurred!?\n");
1954} 1879}
1955#endif /* SUPPORT_GAMEPORT */ 1880#endif /* SUPPORT_GAMEPORT */
1956 1881
1957/******************************************************************/ 1882/******************************************************************/
1958 1883
1959static inline void 1884static inline void
1960snd_azf3328_irq_log_unknown_type(u8 which) 1885snd_azf3328_irq_log_unknown_type(struct snd_azf3328 *chip, u8 which)
1961{ 1886{
1962 snd_azf3328_dbgcodec( 1887 dev_dbg(chip->card->dev,
1963 "azt3328: unknown IRQ type (%x) occurred, please report!\n", 1888 "unknown IRQ type (%x) occurred, please report!\n",
1964 which 1889 which);
1965 );
1966} 1890}
1967 1891
1968static inline void 1892static inline void
1969snd_azf3328_pcm_interrupt(const struct snd_azf3328_codec_data *first_codec, 1893snd_azf3328_pcm_interrupt(struct snd_azf3328 *chip,
1894 const struct snd_azf3328_codec_data *first_codec,
1970 u8 status 1895 u8 status
1971) 1896)
1972{ 1897{
@@ -1990,17 +1915,15 @@ snd_azf3328_pcm_interrupt(const struct snd_azf3328_codec_data *first_codec,
1990 1915
1991 if (codec->substream) { 1916 if (codec->substream) {
1992 snd_pcm_period_elapsed(codec->substream); 1917 snd_pcm_period_elapsed(codec->substream);
1993 snd_azf3328_dbgcodec("%s period done (#%x), @ %x\n", 1918 dev_dbg(chip->card->dev, "%s period done (#%x), @ %x\n",
1994 codec->name, 1919 codec->name,
1995 which, 1920 which,
1996 snd_azf3328_codec_inl( 1921 snd_azf3328_codec_inl(
1997 codec, IDX_IO_CODEC_DMA_CURRPOS 1922 codec, IDX_IO_CODEC_DMA_CURRPOS));
1998 )
1999 );
2000 } else 1923 } else
2001 printk(KERN_WARNING "azt3328: irq handler problem!\n"); 1924 dev_warn(chip->card->dev, "irq handler problem!\n");
2002 if (which & IRQ_SOMETHING) 1925 if (which & IRQ_SOMETHING)
2003 snd_azf3328_irq_log_unknown_type(which); 1926 snd_azf3328_irq_log_unknown_type(chip, which);
2004 } 1927 }
2005} 1928}
2006 1929
@@ -2009,9 +1932,7 @@ snd_azf3328_interrupt(int irq, void *dev_id)
2009{ 1932{
2010 struct snd_azf3328 *chip = dev_id; 1933 struct snd_azf3328 *chip = dev_id;
2011 u8 status; 1934 u8 status;
2012#if DEBUG_CODEC
2013 static unsigned long irq_count; 1935 static unsigned long irq_count;
2014#endif
2015 1936
2016 status = snd_azf3328_ctrl_inb(chip, IDX_IO_IRQSTATUS); 1937 status = snd_azf3328_ctrl_inb(chip, IDX_IO_IRQSTATUS);
2017 1938
@@ -2022,14 +1943,13 @@ snd_azf3328_interrupt(int irq, void *dev_id)
2022 )) 1943 ))
2023 return IRQ_NONE; /* must be interrupt for another device */ 1944 return IRQ_NONE; /* must be interrupt for another device */
2024 1945
2025 snd_azf3328_dbgcodec( 1946 dev_dbg(chip->card->dev,
2026 "irq_count %ld! IDX_IO_IRQSTATUS %04x\n", 1947 "irq_count %ld! IDX_IO_IRQSTATUS %04x\n",
2027 irq_count++ /* debug-only */, 1948 irq_count++ /* debug-only */,
2028 status 1949 status);
2029 );
2030 1950
2031 if (status & IRQ_TIMER) { 1951 if (status & IRQ_TIMER) {
2032 /* snd_azf3328_dbgcodec("timer %ld\n", 1952 /* dev_dbg(chip->card->dev, "timer %ld\n",
2033 snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE) 1953 snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE)
2034 & TIMER_VALUE_MASK 1954 & TIMER_VALUE_MASK
2035 ); */ 1955 ); */
@@ -2039,11 +1959,11 @@ snd_azf3328_interrupt(int irq, void *dev_id)
2039 spin_lock(&chip->reg_lock); 1959 spin_lock(&chip->reg_lock);
2040 snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07); 1960 snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07);
2041 spin_unlock(&chip->reg_lock); 1961 spin_unlock(&chip->reg_lock);
2042 snd_azf3328_dbgcodec("azt3328: timer IRQ\n"); 1962 dev_dbg(chip->card->dev, "timer IRQ\n");
2043 } 1963 }
2044 1964
2045 if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT)) 1965 if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT))
2046 snd_azf3328_pcm_interrupt(chip->codecs, status); 1966 snd_azf3328_pcm_interrupt(chip, chip->codecs, status);
2047 1967
2048 if (status & IRQ_GAMEPORT) 1968 if (status & IRQ_GAMEPORT)
2049 snd_azf3328_gameport_interrupt(chip); 1969 snd_azf3328_gameport_interrupt(chip);
@@ -2055,7 +1975,7 @@ snd_azf3328_interrupt(int irq, void *dev_id)
2055 1975
2056 /* hmm, do we have to ack the IRQ here somehow? 1976 /* hmm, do we have to ack the IRQ here somehow?
2057 * If so, then I don't know how yet... */ 1977 * If so, then I don't know how yet... */
2058 snd_azf3328_dbgcodec("azt3328: MPU401 IRQ\n"); 1978 dev_dbg(chip->card->dev, "MPU401 IRQ\n");
2059 } 1979 }
2060 return IRQ_HANDLED; 1980 return IRQ_HANDLED;
2061} 1981}
@@ -2133,7 +2053,6 @@ snd_azf3328_pcm_open(struct snd_pcm_substream *substream,
2133 struct snd_pcm_runtime *runtime = substream->runtime; 2053 struct snd_pcm_runtime *runtime = substream->runtime;
2134 struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; 2054 struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];
2135 2055
2136 snd_azf3328_dbgcallenter();
2137 codec->substream = substream; 2056 codec->substream = substream;
2138 2057
2139 /* same parameters for all our codecs - at least we think so... */ 2058 /* same parameters for all our codecs - at least we think so... */
@@ -2142,7 +2061,6 @@ snd_azf3328_pcm_open(struct snd_pcm_substream *substream,
2142 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 2061 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
2143 &snd_azf3328_hw_constraints_rates); 2062 &snd_azf3328_hw_constraints_rates);
2144 runtime->private_data = codec; 2063 runtime->private_data = codec;
2145 snd_azf3328_dbgcallleave();
2146 return 0; 2064 return 0;
2147} 2065}
2148 2066
@@ -2171,9 +2089,7 @@ snd_azf3328_pcm_close(struct snd_pcm_substream *substream
2171 struct snd_azf3328_codec_data *codec = 2089 struct snd_azf3328_codec_data *codec =
2172 substream->runtime->private_data; 2090 substream->runtime->private_data;
2173 2091
2174 snd_azf3328_dbgcallenter();
2175 codec->substream = NULL; 2092 codec->substream = NULL;
2176 snd_azf3328_dbgcallleave();
2177 return 0; 2093 return 0;
2178} 2094}
2179 2095
@@ -2220,8 +2136,6 @@ enum { AZF_PCMDEV_STD, AZF_PCMDEV_I2S_OUT, NUM_AZF_PCMDEVS }; /* pcm devices */
2220 struct snd_pcm *pcm; 2136 struct snd_pcm *pcm;
2221 int err; 2137 int err;
2222 2138
2223 snd_azf3328_dbgcallenter();
2224
2225 err = snd_pcm_new(chip->card, "AZF3328 DSP", AZF_PCMDEV_STD, 2139 err = snd_pcm_new(chip->card, "AZF3328 DSP", AZF_PCMDEV_STD,
2226 1, 1, &pcm); 2140 1, 1, &pcm);
2227 if (err < 0) 2141 if (err < 0)
@@ -2258,7 +2172,6 @@ enum { AZF_PCMDEV_STD, AZF_PCMDEV_I2S_OUT, NUM_AZF_PCMDEVS }; /* pcm devices */
2258 snd_dma_pci_data(chip->pci), 2172 snd_dma_pci_data(chip->pci),
2259 64*1024, 64*1024); 2173 64*1024, 64*1024);
2260 2174
2261 snd_azf3328_dbgcallleave();
2262 return 0; 2175 return 0;
2263} 2176}
2264 2177
@@ -2281,7 +2194,6 @@ snd_azf3328_timer_start(struct snd_timer *timer)
2281 unsigned long flags; 2194 unsigned long flags;
2282 unsigned int delay; 2195 unsigned int delay;
2283 2196
2284 snd_azf3328_dbgcallenter();
2285 chip = snd_timer_chip(timer); 2197 chip = snd_timer_chip(timer);
2286 delay = ((timer->sticks * seqtimer_scaling) - 1) & TIMER_VALUE_MASK; 2198 delay = ((timer->sticks * seqtimer_scaling) - 1) & TIMER_VALUE_MASK;
2287 if (delay < 49) { 2199 if (delay < 49) {
@@ -2289,15 +2201,14 @@ snd_azf3328_timer_start(struct snd_timer *timer)
2289 * this timing tweak 2201 * this timing tweak
2290 * (we need to do it to avoid a lockup, though) */ 2202 * (we need to do it to avoid a lockup, though) */
2291 2203
2292 snd_azf3328_dbgtimer("delay was too low (%d)!\n", delay); 2204 dev_dbg(chip->card->dev, "delay was too low (%d)!\n", delay);
2293 delay = 49; /* minimum time is 49 ticks */ 2205 delay = 49; /* minimum time is 49 ticks */
2294 } 2206 }
2295 snd_azf3328_dbgtimer("setting timer countdown value %d\n", delay); 2207 dev_dbg(chip->card->dev, "setting timer countdown value %d\n", delay);
2296 delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; 2208 delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE;
2297 spin_lock_irqsave(&chip->reg_lock, flags); 2209 spin_lock_irqsave(&chip->reg_lock, flags);
2298 snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay); 2210 snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay);
2299 spin_unlock_irqrestore(&chip->reg_lock, flags); 2211 spin_unlock_irqrestore(&chip->reg_lock, flags);
2300 snd_azf3328_dbgcallleave();
2301 return 0; 2212 return 0;
2302} 2213}
2303 2214
@@ -2307,7 +2218,6 @@ snd_azf3328_timer_stop(struct snd_timer *timer)
2307 struct snd_azf3328 *chip; 2218 struct snd_azf3328 *chip;
2308 unsigned long flags; 2219 unsigned long flags;
2309 2220
2310 snd_azf3328_dbgcallenter();
2311 chip = snd_timer_chip(timer); 2221 chip = snd_timer_chip(timer);
2312 spin_lock_irqsave(&chip->reg_lock, flags); 2222 spin_lock_irqsave(&chip->reg_lock, flags);
2313 /* disable timer countdown and interrupt */ 2223 /* disable timer countdown and interrupt */
@@ -2319,7 +2229,6 @@ snd_azf3328_timer_stop(struct snd_timer *timer)
2319 the hardware/ALSA interrupt activity. */ 2229 the hardware/ALSA interrupt activity. */
2320 snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x04); 2230 snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x04);
2321 spin_unlock_irqrestore(&chip->reg_lock, flags); 2231 spin_unlock_irqrestore(&chip->reg_lock, flags);
2322 snd_azf3328_dbgcallleave();
2323 return 0; 2232 return 0;
2324} 2233}
2325 2234
@@ -2328,10 +2237,8 @@ static int
2328snd_azf3328_timer_precise_resolution(struct snd_timer *timer, 2237snd_azf3328_timer_precise_resolution(struct snd_timer *timer,
2329 unsigned long *num, unsigned long *den) 2238 unsigned long *num, unsigned long *den)
2330{ 2239{
2331 snd_azf3328_dbgcallenter();
2332 *num = 1; 2240 *num = 1;
2333 *den = 1024000 / seqtimer_scaling; 2241 *den = 1024000 / seqtimer_scaling;
2334 snd_azf3328_dbgcallleave();
2335 return 0; 2242 return 0;
2336} 2243}
2337 2244
@@ -2351,7 +2258,6 @@ snd_azf3328_timer(struct snd_azf3328 *chip, int device)
2351 struct snd_timer_id tid; 2258 struct snd_timer_id tid;
2352 int err; 2259 int err;
2353 2260
2354 snd_azf3328_dbgcallenter();
2355 tid.dev_class = SNDRV_TIMER_CLASS_CARD; 2261 tid.dev_class = SNDRV_TIMER_CLASS_CARD;
2356 tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; 2262 tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
2357 tid.card = chip->card->number; 2263 tid.card = chip->card->number;
@@ -2376,7 +2282,6 @@ snd_azf3328_timer(struct snd_azf3328 *chip, int device)
2376 err = 0; 2282 err = 0;
2377 2283
2378out: 2284out:
2379 snd_azf3328_dbgcallleave();
2380 return err; 2285 return err;
2381} 2286}
2382 2287
@@ -2438,34 +2343,34 @@ snd_azf3328_test_bit(unsigned unsigned reg, int bit)
2438static inline void 2343static inline void
2439snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip) 2344snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip)
2440{ 2345{
2441#if DEBUG_MISC
2442 u16 tmp; 2346 u16 tmp;
2443 2347
2444 snd_azf3328_dbgmisc( 2348 dev_dbg(chip->card->dev,
2445 "ctrl_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, " 2349 "ctrl_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, "
2446 "opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n", 2350 "opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n",
2447 chip->ctrl_io, chip->game_io, chip->mpu_io, 2351 chip->ctrl_io, chip->game_io, chip->mpu_io,
2448 chip->opl3_io, chip->mixer_io, chip->irq 2352 chip->opl3_io, chip->mixer_io, chip->irq);
2449 );
2450 2353
2451 snd_azf3328_dbgmisc("game %02x %02x %02x %02x %02x %02x\n", 2354 dev_dbg(chip->card->dev,
2355 "game %02x %02x %02x %02x %02x %02x\n",
2452 snd_azf3328_game_inb(chip, 0), 2356 snd_azf3328_game_inb(chip, 0),
2453 snd_azf3328_game_inb(chip, 1), 2357 snd_azf3328_game_inb(chip, 1),
2454 snd_azf3328_game_inb(chip, 2), 2358 snd_azf3328_game_inb(chip, 2),
2455 snd_azf3328_game_inb(chip, 3), 2359 snd_azf3328_game_inb(chip, 3),
2456 snd_azf3328_game_inb(chip, 4), 2360 snd_azf3328_game_inb(chip, 4),
2457 snd_azf3328_game_inb(chip, 5) 2361 snd_azf3328_game_inb(chip, 5));
2458 );
2459 2362
2460 for (tmp = 0; tmp < 0x07; tmp += 1) 2363 for (tmp = 0; tmp < 0x07; tmp += 1)
2461 snd_azf3328_dbgmisc("mpu_io 0x%04x\n", inb(chip->mpu_io + tmp)); 2364 dev_dbg(chip->card->dev,
2365 "mpu_io 0x%04x\n", inb(chip->mpu_io + tmp));
2462 2366
2463 for (tmp = 0; tmp <= 0x07; tmp += 1) 2367 for (tmp = 0; tmp <= 0x07; tmp += 1)
2464 snd_azf3328_dbgmisc("0x%02x: game200 0x%04x, game208 0x%04x\n", 2368 dev_dbg(chip->card->dev,
2369 "0x%02x: game200 0x%04x, game208 0x%04x\n",
2465 tmp, inb(0x200 + tmp), inb(0x208 + tmp)); 2370 tmp, inb(0x200 + tmp), inb(0x208 + tmp));
2466 2371
2467 for (tmp = 0; tmp <= 0x01; tmp += 1) 2372 for (tmp = 0; tmp <= 0x01; tmp += 1)
2468 snd_azf3328_dbgmisc( 2373 dev_dbg(chip->card->dev,
2469 "0x%02x: mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, " 2374 "0x%02x: mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, "
2470 "mpu330 0x%04x opl388 0x%04x opl38c 0x%04x\n", 2375 "mpu330 0x%04x opl388 0x%04x opl38c 0x%04x\n",
2471 tmp, 2376 tmp,
@@ -2474,19 +2379,17 @@ snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip)
2474 inb(0x320 + tmp), 2379 inb(0x320 + tmp),
2475 inb(0x330 + tmp), 2380 inb(0x330 + tmp),
2476 inb(0x388 + tmp), 2381 inb(0x388 + tmp),
2477 inb(0x38c + tmp) 2382 inb(0x38c + tmp));
2478 );
2479 2383
2480 for (tmp = 0; tmp < AZF_IO_SIZE_CTRL; tmp += 2) 2384 for (tmp = 0; tmp < AZF_IO_SIZE_CTRL; tmp += 2)
2481 snd_azf3328_dbgmisc("ctrl 0x%02x: 0x%04x\n", 2385 dev_dbg(chip->card->dev,
2482 tmp, snd_azf3328_ctrl_inw(chip, tmp) 2386 "ctrl 0x%02x: 0x%04x\n",
2483 ); 2387 tmp, snd_azf3328_ctrl_inw(chip, tmp));
2484 2388
2485 for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2) 2389 for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2)
2486 snd_azf3328_dbgmisc("mixer 0x%02x: 0x%04x\n", 2390 dev_dbg(chip->card->dev,
2487 tmp, snd_azf3328_mixer_inw(chip, tmp) 2391 "mixer 0x%02x: 0x%04x\n",
2488 ); 2392 tmp, snd_azf3328_mixer_inw(chip, tmp));
2489#endif /* DEBUG_MISC */
2490} 2393}
2491 2394
2492static int 2395static int
@@ -2523,8 +2426,8 @@ snd_azf3328_create(struct snd_card *card,
2523 /* check if we can restrict PCI DMA transfers to 24 bits */ 2426 /* check if we can restrict PCI DMA transfers to 24 bits */
2524 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 2427 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
2525 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 2428 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
2526 snd_printk(KERN_ERR "architecture does not support " 2429 dev_err(card->dev,
2527 "24bit PCI busmaster DMA\n" 2430 "architecture does not support 24bit PCI busmaster DMA\n"
2528 ); 2431 );
2529 err = -ENXIO; 2432 err = -ENXIO;
2530 goto out_err; 2433 goto out_err;
@@ -2560,7 +2463,7 @@ snd_azf3328_create(struct snd_card *card,
2560 2463
2561 if (request_irq(pci->irq, snd_azf3328_interrupt, 2464 if (request_irq(pci->irq, snd_azf3328_interrupt,
2562 IRQF_SHARED, KBUILD_MODNAME, chip)) { 2465 IRQF_SHARED, KBUILD_MODNAME, chip)) {
2563 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2466 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2564 err = -EBUSY; 2467 err = -EBUSY;
2565 goto out_err; 2468 goto out_err;
2566 } 2469 }
@@ -2622,7 +2525,6 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2622 struct snd_opl3 *opl3; 2525 struct snd_opl3 *opl3;
2623 int err; 2526 int err;
2624 2527
2625 snd_azf3328_dbgcallenter();
2626 if (dev >= SNDRV_CARDS) { 2528 if (dev >= SNDRV_CARDS) {
2627 err = -ENODEV; 2529 err = -ENODEV;
2628 goto out; 2530 goto out;
@@ -2656,7 +2558,7 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2656 -1, &chip->rmidi 2558 -1, &chip->rmidi
2657 ); 2559 );
2658 if (err < 0) { 2560 if (err < 0) {
2659 snd_printk(KERN_ERR "azf3328: no MPU-401 device at 0x%lx?\n", 2561 dev_err(card->dev, "no MPU-401 device at 0x%lx?\n",
2660 chip->mpu_io 2562 chip->mpu_io
2661 ); 2563 );
2662 goto out_err; 2564 goto out_err;
@@ -2672,7 +2574,7 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2672 2574
2673 if (snd_opl3_create(card, chip->opl3_io, chip->opl3_io+2, 2575 if (snd_opl3_create(card, chip->opl3_io, chip->opl3_io+2,
2674 OPL3_HW_AUTO, 1, &opl3) < 0) { 2576 OPL3_HW_AUTO, 1, &opl3) < 0) {
2675 snd_printk(KERN_ERR "azf3328: no OPL3 device at 0x%lx-0x%lx?\n", 2577 dev_err(card->dev, "no OPL3 device at 0x%lx-0x%lx?\n",
2676 chip->opl3_io, chip->opl3_io+2 2578 chip->opl3_io, chip->opl3_io+2
2677 ); 2579 );
2678 } else { 2580 } else {
@@ -2694,12 +2596,15 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2694 goto out_err; 2596 goto out_err;
2695 2597
2696#ifdef MODULE 2598#ifdef MODULE
2697 printk(KERN_INFO 2599 dev_info(card->dev,
2698"azt3328: Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n" 2600 "Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n");
2699"azt3328: Hardware was completely undocumented, unfortunately.\n" 2601 dev_info(card->dev,
2700"azt3328: Feel free to contact andi AT lisas.de for bug reports etc.!\n" 2602 "Hardware was completely undocumented, unfortunately.\n");
2701"azt3328: User-scalable sequencer timer set to %dHz (1024000Hz / %d).\n", 2603 dev_info(card->dev,
2702 1024000 / seqtimer_scaling, seqtimer_scaling); 2604 "Feel free to contact andi AT lisas.de for bug reports etc.!\n");
2605 dev_info(card->dev,
2606 "User-scalable sequencer timer set to %dHz (1024000Hz / %d).\n",
2607 1024000 / seqtimer_scaling, seqtimer_scaling);
2703#endif 2608#endif
2704 2609
2705 snd_azf3328_gameport(chip, dev); 2610 snd_azf3328_gameport(chip, dev);
@@ -2711,31 +2616,29 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2711 goto out; 2616 goto out;
2712 2617
2713out_err: 2618out_err:
2714 snd_printk(KERN_ERR "azf3328: something failed, exiting\n"); 2619 dev_err(card->dev, "something failed, exiting\n");
2715 snd_card_free(card); 2620 snd_card_free(card);
2716 2621
2717out: 2622out:
2718 snd_azf3328_dbgcallleave();
2719 return err; 2623 return err;
2720} 2624}
2721 2625
2722static void 2626static void
2723snd_azf3328_remove(struct pci_dev *pci) 2627snd_azf3328_remove(struct pci_dev *pci)
2724{ 2628{
2725 snd_azf3328_dbgcallenter();
2726 snd_card_free(pci_get_drvdata(pci)); 2629 snd_card_free(pci_get_drvdata(pci));
2727 snd_azf3328_dbgcallleave();
2728} 2630}
2729 2631
2730#ifdef CONFIG_PM_SLEEP 2632#ifdef CONFIG_PM_SLEEP
2731static inline void 2633static inline void
2732snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) 2634snd_azf3328_suspend_regs(const struct snd_azf3328 *chip,
2635 unsigned long io_addr, unsigned count, u32 *saved_regs)
2733{ 2636{
2734 unsigned reg; 2637 unsigned reg;
2735 2638
2736 for (reg = 0; reg < count; ++reg) { 2639 for (reg = 0; reg < count; ++reg) {
2737 *saved_regs = inl(io_addr); 2640 *saved_regs = inl(io_addr);
2738 snd_azf3328_dbgpm("suspend: io 0x%04lx: 0x%08x\n", 2641 dev_dbg(chip->card->dev, "suspend: io 0x%04lx: 0x%08x\n",
2739 io_addr, *saved_regs); 2642 io_addr, *saved_regs);
2740 ++saved_regs; 2643 ++saved_regs;
2741 io_addr += sizeof(*saved_regs); 2644 io_addr += sizeof(*saved_regs);
@@ -2743,7 +2646,8 @@ snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs)
2743} 2646}
2744 2647
2745static inline void 2648static inline void
2746snd_azf3328_resume_regs(const u32 *saved_regs, 2649snd_azf3328_resume_regs(const struct snd_azf3328 *chip,
2650 const u32 *saved_regs,
2747 unsigned long io_addr, 2651 unsigned long io_addr,
2748 unsigned count 2652 unsigned count
2749) 2653)
@@ -2752,7 +2656,8 @@ snd_azf3328_resume_regs(const u32 *saved_regs,
2752 2656
2753 for (reg = 0; reg < count; ++reg) { 2657 for (reg = 0; reg < count; ++reg) {
2754 outl(*saved_regs, io_addr); 2658 outl(*saved_regs, io_addr);
2755 snd_azf3328_dbgpm("resume: io 0x%04lx: 0x%08x --> 0x%08x\n", 2659 dev_dbg(chip->card->dev,
2660 "resume: io 0x%04lx: 0x%08x --> 0x%08x\n",
2756 io_addr, *saved_regs, inl(io_addr)); 2661 io_addr, *saved_regs, inl(io_addr));
2757 ++saved_regs; 2662 ++saved_regs;
2758 io_addr += sizeof(*saved_regs); 2663 io_addr += sizeof(*saved_regs);
@@ -2765,7 +2670,7 @@ snd_azf3328_suspend_ac97(struct snd_azf3328 *chip)
2765#ifdef AZF_USE_AC97_LAYER 2670#ifdef AZF_USE_AC97_LAYER
2766 snd_ac97_suspend(chip->ac97); 2671 snd_ac97_suspend(chip->ac97);
2767#else 2672#else
2768 snd_azf3328_suspend_regs(chip->mixer_io, 2673 snd_azf3328_suspend_regs(chip, chip->mixer_io,
2769 ARRAY_SIZE(chip->saved_regs_mixer), chip->saved_regs_mixer); 2674 ARRAY_SIZE(chip->saved_regs_mixer), chip->saved_regs_mixer);
2770 2675
2771 /* make sure to disable master volume etc. to prevent looping sound */ 2676 /* make sure to disable master volume etc. to prevent looping sound */
@@ -2780,7 +2685,7 @@ snd_azf3328_resume_ac97(const struct snd_azf3328 *chip)
2780#ifdef AZF_USE_AC97_LAYER 2685#ifdef AZF_USE_AC97_LAYER
2781 snd_ac97_resume(chip->ac97); 2686 snd_ac97_resume(chip->ac97);
2782#else 2687#else
2783 snd_azf3328_resume_regs(chip->saved_regs_mixer, chip->mixer_io, 2688 snd_azf3328_resume_regs(chip, chip->saved_regs_mixer, chip->mixer_io,
2784 ARRAY_SIZE(chip->saved_regs_mixer)); 2689 ARRAY_SIZE(chip->saved_regs_mixer));
2785 2690
2786 /* unfortunately with 32bit transfers, IDX_MIXER_PLAY_MASTER (0x02) 2691 /* unfortunately with 32bit transfers, IDX_MIXER_PLAY_MASTER (0x02)
@@ -2807,18 +2712,18 @@ snd_azf3328_suspend(struct device *dev)
2807 2712
2808 snd_azf3328_suspend_ac97(chip); 2713 snd_azf3328_suspend_ac97(chip);
2809 2714
2810 snd_azf3328_suspend_regs(chip->ctrl_io, 2715 snd_azf3328_suspend_regs(chip, chip->ctrl_io,
2811 ARRAY_SIZE(chip->saved_regs_ctrl), chip->saved_regs_ctrl); 2716 ARRAY_SIZE(chip->saved_regs_ctrl), chip->saved_regs_ctrl);
2812 2717
2813 /* manually store the one currently relevant write-only reg, too */ 2718 /* manually store the one currently relevant write-only reg, too */
2814 saved_regs_ctrl_u16 = (u16 *)chip->saved_regs_ctrl; 2719 saved_regs_ctrl_u16 = (u16 *)chip->saved_regs_ctrl;
2815 saved_regs_ctrl_u16[IDX_IO_6AH / 2] = chip->shadow_reg_ctrl_6AH; 2720 saved_regs_ctrl_u16[IDX_IO_6AH / 2] = chip->shadow_reg_ctrl_6AH;
2816 2721
2817 snd_azf3328_suspend_regs(chip->game_io, 2722 snd_azf3328_suspend_regs(chip, chip->game_io,
2818 ARRAY_SIZE(chip->saved_regs_game), chip->saved_regs_game); 2723 ARRAY_SIZE(chip->saved_regs_game), chip->saved_regs_game);
2819 snd_azf3328_suspend_regs(chip->mpu_io, 2724 snd_azf3328_suspend_regs(chip, chip->mpu_io,
2820 ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu); 2725 ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu);
2821 snd_azf3328_suspend_regs(chip->opl3_io, 2726 snd_azf3328_suspend_regs(chip, chip->opl3_io,
2822 ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3); 2727 ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3);
2823 2728
2824 pci_disable_device(pci); 2729 pci_disable_device(pci);
@@ -2837,23 +2742,22 @@ snd_azf3328_resume(struct device *dev)
2837 pci_set_power_state(pci, PCI_D0); 2742 pci_set_power_state(pci, PCI_D0);
2838 pci_restore_state(pci); 2743 pci_restore_state(pci);
2839 if (pci_enable_device(pci) < 0) { 2744 if (pci_enable_device(pci) < 0) {
2840 printk(KERN_ERR "azt3328: pci_enable_device failed, " 2745 dev_err(dev, "pci_enable_device failed, disabling device\n");
2841 "disabling device\n");
2842 snd_card_disconnect(card); 2746 snd_card_disconnect(card);
2843 return -EIO; 2747 return -EIO;
2844 } 2748 }
2845 pci_set_master(pci); 2749 pci_set_master(pci);
2846 2750
2847 snd_azf3328_resume_regs(chip->saved_regs_game, chip->game_io, 2751 snd_azf3328_resume_regs(chip, chip->saved_regs_game, chip->game_io,
2848 ARRAY_SIZE(chip->saved_regs_game)); 2752 ARRAY_SIZE(chip->saved_regs_game));
2849 snd_azf3328_resume_regs(chip->saved_regs_mpu, chip->mpu_io, 2753 snd_azf3328_resume_regs(chip, chip->saved_regs_mpu, chip->mpu_io,
2850 ARRAY_SIZE(chip->saved_regs_mpu)); 2754 ARRAY_SIZE(chip->saved_regs_mpu));
2851 snd_azf3328_resume_regs(chip->saved_regs_opl3, chip->opl3_io, 2755 snd_azf3328_resume_regs(chip, chip->saved_regs_opl3, chip->opl3_io,
2852 ARRAY_SIZE(chip->saved_regs_opl3)); 2756 ARRAY_SIZE(chip->saved_regs_opl3));
2853 2757
2854 snd_azf3328_resume_ac97(chip); 2758 snd_azf3328_resume_ac97(chip);
2855 2759
2856 snd_azf3328_resume_regs(chip->saved_regs_ctrl, chip->ctrl_io, 2760 snd_azf3328_resume_regs(chip, chip->saved_regs_ctrl, chip->ctrl_io,
2857 ARRAY_SIZE(chip->saved_regs_ctrl)); 2761 ARRAY_SIZE(chip->saved_regs_ctrl));
2858 2762
2859 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2763 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 06dc7d97cc0c..8546711d12f9 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -293,17 +293,23 @@ static void snd_bt87x_pci_error(struct snd_bt87x *chip, unsigned int status)
293 PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY; 293 PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY;
294 pci_write_config_word(chip->pci, PCI_STATUS, pci_status); 294 pci_write_config_word(chip->pci, PCI_STATUS, pci_status);
295 if (pci_status != PCI_STATUS_DETECTED_PARITY) 295 if (pci_status != PCI_STATUS_DETECTED_PARITY)
296 snd_printk(KERN_ERR "Aieee - PCI error! status %#08x, PCI status %#04x\n", 296 dev_err(chip->card->dev,
297 "Aieee - PCI error! status %#08x, PCI status %#04x\n",
297 status & ERROR_INTERRUPTS, pci_status); 298 status & ERROR_INTERRUPTS, pci_status);
298 else { 299 else {
299 snd_printk(KERN_ERR "Aieee - PCI parity error detected!\n"); 300 dev_err(chip->card->dev,
301 "Aieee - PCI parity error detected!\n");
300 /* error 'handling' similar to aic7xxx_pci.c: */ 302 /* error 'handling' similar to aic7xxx_pci.c: */
301 chip->pci_parity_errors++; 303 chip->pci_parity_errors++;
302 if (chip->pci_parity_errors > 20) { 304 if (chip->pci_parity_errors > 20) {
303 snd_printk(KERN_ERR "Too many PCI parity errors observed.\n"); 305 dev_err(chip->card->dev,
304 snd_printk(KERN_ERR "Some device on this bus is generating bad parity.\n"); 306 "Too many PCI parity errors observed.\n");
305 snd_printk(KERN_ERR "This is an error *observed by*, not *generated by*, this card.\n"); 307 dev_err(chip->card->dev,
306 snd_printk(KERN_ERR "PCI parity error checking has been disabled.\n"); 308 "Some device on this bus is generating bad parity.\n");
309 dev_err(chip->card->dev,
310 "This is an error *observed by*, not *generated by*, this card.\n");
311 dev_err(chip->card->dev,
312 "PCI parity error checking has been disabled.\n");
307 chip->interrupt_mask &= ~(INT_PPERR | INT_RIPERR); 313 chip->interrupt_mask &= ~(INT_PPERR | INT_RIPERR);
308 snd_bt87x_writel(chip, REG_INT_MASK, chip->interrupt_mask); 314 snd_bt87x_writel(chip, REG_INT_MASK, chip->interrupt_mask);
309 } 315 }
@@ -323,9 +329,11 @@ static irqreturn_t snd_bt87x_interrupt(int irq, void *dev_id)
323 329
324 if (irq_status & ERROR_INTERRUPTS) { 330 if (irq_status & ERROR_INTERRUPTS) {
325 if (irq_status & (INT_FBUS | INT_FTRGT)) 331 if (irq_status & (INT_FBUS | INT_FTRGT))
326 snd_printk(KERN_WARNING "FIFO overrun, status %#08x\n", status); 332 dev_warn(chip->card->dev,
333 "FIFO overrun, status %#08x\n", status);
327 if (irq_status & INT_OCERR) 334 if (irq_status & INT_OCERR)
328 snd_printk(KERN_ERR "internal RISC error, status %#08x\n", status); 335 dev_err(chip->card->dev,
336 "internal RISC error, status %#08x\n", status);
329 if (irq_status & (INT_PPERR | INT_RIPERR | INT_PABORT)) 337 if (irq_status & (INT_PPERR | INT_RIPERR | INT_PABORT))
330 snd_bt87x_pci_error(chip, irq_status); 338 snd_bt87x_pci_error(chip, irq_status);
331 } 339 }
@@ -747,7 +755,7 @@ static int snd_bt87x_create(struct snd_card *card,
747 } 755 }
748 chip->mmio = pci_ioremap_bar(pci, 0); 756 chip->mmio = pci_ioremap_bar(pci, 0);
749 if (!chip->mmio) { 757 if (!chip->mmio) {
750 snd_printk(KERN_ERR "cannot remap io memory\n"); 758 dev_err(card->dev, "cannot remap io memory\n");
751 err = -ENOMEM; 759 err = -ENOMEM;
752 goto fail; 760 goto fail;
753 } 761 }
@@ -762,7 +770,7 @@ static int snd_bt87x_create(struct snd_card *card,
762 err = request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED, 770 err = request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED,
763 KBUILD_MODNAME, chip); 771 KBUILD_MODNAME, chip);
764 if (err < 0) { 772 if (err < 0) {
765 snd_printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 773 dev_err(card->dev, "cannot grab irq %d\n", pci->irq);
766 goto fail; 774 goto fail;
767 } 775 }
768 chip->irq = pci->irq; 776 chip->irq = pci->irq;
@@ -850,14 +858,15 @@ static int snd_bt87x_detect_card(struct pci_dev *pci)
850 for (i = 0; i < ARRAY_SIZE(blacklist); ++i) 858 for (i = 0; i < ARRAY_SIZE(blacklist); ++i)
851 if (blacklist[i].subvendor == pci->subsystem_vendor && 859 if (blacklist[i].subvendor == pci->subsystem_vendor &&
852 blacklist[i].subdevice == pci->subsystem_device) { 860 blacklist[i].subdevice == pci->subsystem_device) {
853 snd_printdd(KERN_INFO "card %#04x-%#04x:%#04x has no audio\n", 861 dev_dbg(&pci->dev,
862 "card %#04x-%#04x:%#04x has no audio\n",
854 pci->device, pci->subsystem_vendor, pci->subsystem_device); 863 pci->device, pci->subsystem_vendor, pci->subsystem_device);
855 return -EBUSY; 864 return -EBUSY;
856 } 865 }
857 866
858 snd_printk(KERN_INFO "unknown card %#04x-%#04x:%#04x\n", 867 dev_info(&pci->dev, "unknown card %#04x-%#04x:%#04x\n",
859 pci->device, pci->subsystem_vendor, pci->subsystem_device); 868 pci->device, pci->subsystem_vendor, pci->subsystem_device);
860 snd_printk(KERN_DEBUG "please mail id, board name, and, " 869 dev_info(&pci->dev, "please mail id, board name, and, "
861 "if it works, the correct digital_rate option to " 870 "if it works, the correct digital_rate option to "
862 "<alsa-devel@alsa-project.org>\n"); 871 "<alsa-devel@alsa-project.org>\n");
863 return SND_BT87X_BOARD_UNKNOWN; 872 return SND_BT87X_BOARD_UNKNOWN;
@@ -925,7 +934,7 @@ static int snd_bt87x_probe(struct pci_dev *pci,
925 if (err < 0) 934 if (err < 0)
926 goto _error; 935 goto _error;
927 } 936 }
928 snd_printk(KERN_INFO "bt87x%d: Using board %d, %sanalog, %sdigital " 937 dev_info(card->dev, "bt87x%d: Using board %d, %sanalog, %sdigital "
929 "(rate %d Hz)\n", dev, boardid, 938 "(rate %d Hz)\n", dev, boardid,
930 chip->board.no_analog ? "no " : "", 939 chip->board.no_analog ? "no " : "",
931 chip->board.no_digital ? "no " : "", chip->board.dig_rate); 940 chip->board.no_digital ? "no " : "", chip->board.dig_rate);
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index f659c7a89c0c..f94cc6e97d4a 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -417,13 +417,13 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
417 int status; 417 int status;
418 int retry; 418 int retry;
419 if ((reg > 0x7f) || (value > 0x1ff)) { 419 if ((reg > 0x7f) || (value > 0x1ff)) {
420 snd_printk(KERN_ERR "i2c_write: invalid values.\n"); 420 dev_err(emu->card->dev, "i2c_write: invalid values.\n");
421 return -EINVAL; 421 return -EINVAL;
422 } 422 }
423 423
424 tmp = reg << 25 | value << 16; 424 tmp = reg << 25 | value << 16;
425 /* 425 /*
426 snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value); 426 dev_dbg(emu->card->dev, "I2C-write:reg=0x%x, value=0x%x\n", reg, value);
427 */ 427 */
428 /* Not sure what this I2C channel controls. */ 428 /* Not sure what this I2C channel controls. */
429 /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ 429 /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */
@@ -442,7 +442,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
442 /* Wait till the transaction ends */ 442 /* Wait till the transaction ends */
443 while (1) { 443 while (1) {
444 status = snd_ca0106_ptr_read(emu, I2C_A, 0); 444 status = snd_ca0106_ptr_read(emu, I2C_A, 0);
445 /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/ 445 /*dev_dbg(emu->card->dev, "I2C:status=0x%x\n", status);*/
446 timeout++; 446 timeout++;
447 if ((status & I2C_A_ADC_START) == 0) 447 if ((status & I2C_A_ADC_START) == 0)
448 break; 448 break;
@@ -456,7 +456,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
456 } 456 }
457 457
458 if (retry == 10) { 458 if (retry == 10) {
459 snd_printk(KERN_ERR "Writing to ADC failed!\n"); 459 dev_err(emu->card->dev, "Writing to ADC failed!\n");
460 return -EINVAL; 460 return -EINVAL;
461 } 461 }
462 462
@@ -516,7 +516,8 @@ static void restore_spdif_bits(struct snd_ca0106 *chip, int idx)
516 } 516 }
517} 517}
518 518
519static int snd_ca0106_channel_dac(struct snd_ca0106_details *details, 519static int snd_ca0106_channel_dac(struct snd_ca0106 *chip,
520 struct snd_ca0106_details *details,
520 int channel_id) 521 int channel_id)
521{ 522{
522 switch (channel_id) { 523 switch (channel_id) {
@@ -529,7 +530,7 @@ static int snd_ca0106_channel_dac(struct snd_ca0106_details *details,
529 case PCM_UNKNOWN_CHANNEL: 530 case PCM_UNKNOWN_CHANNEL:
530 return (details->spi_dac & 0x000f) >> (4 * 0); 531 return (details->spi_dac & 0x000f) >> (4 * 0);
531 default: 532 default:
532 snd_printk(KERN_DEBUG "ca0106: unknown channel_id %d\n", 533 dev_dbg(chip->card->dev, "ca0106: unknown channel_id %d\n",
533 channel_id); 534 channel_id);
534 } 535 }
535 return 0; 536 return 0;
@@ -539,7 +540,7 @@ static int snd_ca0106_pcm_power_dac(struct snd_ca0106 *chip, int channel_id,
539 int power) 540 int power)
540{ 541{
541 if (chip->details->spi_dac) { 542 if (chip->details->spi_dac) {
542 const int dac = snd_ca0106_channel_dac(chip->details, 543 const int dac = snd_ca0106_channel_dac(chip, chip->details,
543 channel_id); 544 channel_id);
544 const int reg = spi_dacd_reg[dac]; 545 const int reg = spi_dacd_reg[dac];
545 const int bit = spi_dacd_bit[dac]; 546 const int bit = spi_dacd_bit[dac];
@@ -583,7 +584,7 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
583 584
584 channel->use = 1; 585 channel->use = 1;
585 /* 586 /*
586 printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", 587 dev_dbg(chip->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
587 channel_id, chip, channel); 588 channel_id, chip, channel);
588 */ 589 */
589 //channel->interrupt = snd_ca0106_pcm_channel_interrupt; 590 //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
@@ -660,7 +661,8 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre
660 661
661 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); 662 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
662 if (epcm == NULL) { 663 if (epcm == NULL) {
663 snd_printk(KERN_ERR "open_capture_channel: failed epcm alloc\n"); 664 dev_err(chip->card->dev,
665 "open_capture_channel: failed epcm alloc\n");
664 return -ENOMEM; 666 return -ENOMEM;
665 } 667 }
666 epcm->emu = chip; 668 epcm->emu = chip;
@@ -677,7 +679,7 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre
677 679
678 channel->use = 1; 680 channel->use = 1;
679 /* 681 /*
680 printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", 682 dev_dbg(chip->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
681 channel_id, chip, channel); 683 channel_id, chip, channel);
682 */ 684 */
683 //channel->interrupt = snd_ca0106_pcm_channel_interrupt; 685 //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
@@ -771,7 +773,7 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream)
771 int i; 773 int i;
772 774
773#if 0 /* debug */ 775#if 0 /* debug */
774 snd_printk(KERN_DEBUG 776 dev_dbg(emu->card->dev,
775 "prepare:channel_number=%d, rate=%d, format=0x%x, " 777 "prepare:channel_number=%d, rate=%d, format=0x%x, "
776 "channels=%d, buffer_size=%ld, period_size=%ld, " 778 "channels=%d, buffer_size=%ld, period_size=%ld, "
777 "periods=%u, frames_to_bytes=%d\n", 779 "periods=%u, frames_to_bytes=%d\n",
@@ -779,9 +781,11 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream)
779 runtime->channels, runtime->buffer_size, 781 runtime->channels, runtime->buffer_size,
780 runtime->period_size, runtime->periods, 782 runtime->period_size, runtime->periods,
781 frames_to_bytes(runtime, 1)); 783 frames_to_bytes(runtime, 1));
782 snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", 784 dev_dbg(emu->card->dev,
785 "dma_addr=%x, dma_area=%p, table_base=%p\n",
783 runtime->dma_addr, runtime->dma_area, table_base); 786 runtime->dma_addr, runtime->dma_area, table_base);
784 snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", 787 dev_dbg(emu->card->dev,
788 "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
785 emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); 789 emu->buffer.addr, emu->buffer.area, emu->buffer.bytes);
786#endif /* debug */ 790#endif /* debug */
787 /* Rate can be set per channel. */ 791 /* Rate can be set per channel. */
@@ -876,7 +880,7 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream)
876 u32 reg71; 880 u32 reg71;
877 881
878#if 0 /* debug */ 882#if 0 /* debug */
879 snd_printk(KERN_DEBUG 883 dev_dbg(emu->card->dev,
880 "prepare:channel_number=%d, rate=%d, format=0x%x, " 884 "prepare:channel_number=%d, rate=%d, format=0x%x, "
881 "channels=%d, buffer_size=%ld, period_size=%ld, " 885 "channels=%d, buffer_size=%ld, period_size=%ld, "
882 "periods=%u, frames_to_bytes=%d\n", 886 "periods=%u, frames_to_bytes=%d\n",
@@ -884,9 +888,11 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream)
884 runtime->channels, runtime->buffer_size, 888 runtime->channels, runtime->buffer_size,
885 runtime->period_size, runtime->periods, 889 runtime->period_size, runtime->periods,
886 frames_to_bytes(runtime, 1)); 890 frames_to_bytes(runtime, 1));
887 snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", 891 dev_dbg(emu->card->dev,
892 "dma_addr=%x, dma_area=%p, table_base=%p\n",
888 runtime->dma_addr, runtime->dma_area, table_base); 893 runtime->dma_addr, runtime->dma_area, table_base);
889 snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", 894 dev_dbg(emu->card->dev,
895 "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
890 emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); 896 emu->buffer.addr, emu->buffer.area, emu->buffer.bytes);
891#endif /* debug */ 897#endif /* debug */
892 /* reg71 controls ADC rate. */ 898 /* reg71 controls ADC rate. */
@@ -934,7 +940,7 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream)
934 940
935 941
936 /* 942 /*
937 printk(KERN_DEBUG 943 dev_dbg(emu->card->dev,
938 "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, " 944 "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, "
939 "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n", 945 "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",
940 channel, runtime->rate, runtime->format, runtime->channels, 946 channel, runtime->rate, runtime->format, runtime->channels,
@@ -982,13 +988,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
982 runtime = s->runtime; 988 runtime = s->runtime;
983 epcm = runtime->private_data; 989 epcm = runtime->private_data;
984 channel = epcm->channel_id; 990 channel = epcm->channel_id;
985 /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ 991 /* dev_dbg(emu->card->dev, "channel=%d\n", channel); */
986 epcm->running = running; 992 epcm->running = running;
987 basic |= (0x1 << channel); 993 basic |= (0x1 << channel);
988 extended |= (0x10 << channel); 994 extended |= (0x10 << channel);
989 snd_pcm_trigger_done(s, substream); 995 snd_pcm_trigger_done(s, substream);
990 } 996 }
991 /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */ 997 /* dev_dbg(emu->card->dev, "basic=0x%x, extended=0x%x\n",basic, extended); */
992 998
993 switch (cmd) { 999 switch (cmd) {
994 case SNDRV_PCM_TRIGGER_START: 1000 case SNDRV_PCM_TRIGGER_START:
@@ -1070,7 +1076,7 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream)
1070 return ptr; 1076 return ptr;
1071 prev_ptr = ptr; 1077 prev_ptr = ptr;
1072 } while (--timeout); 1078 } while (--timeout);
1073 snd_printk(KERN_WARNING "ca0106: unstable DMA pointer!\n"); 1079 dev_warn(emu->card->dev, "ca0106: unstable DMA pointer!\n");
1074 return 0; 1080 return 0;
1075} 1081}
1076 1082
@@ -1093,7 +1099,7 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream)
1093 if (ptr >= runtime->buffer_size) 1099 if (ptr >= runtime->buffer_size)
1094 ptr -= runtime->buffer_size; 1100 ptr -= runtime->buffer_size;
1095 /* 1101 /*
1096 printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " 1102 dev_dbg(emu->card->dev, "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, "
1097 "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", 1103 "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n",
1098 ptr1, ptr2, ptr, (int)runtime->buffer_size, 1104 ptr1, ptr2, ptr, (int)runtime->buffer_size,
1099 (int)runtime->period_size, (int)runtime->frame_bits, 1105 (int)runtime->period_size, (int)runtime->frame_bits,
@@ -1284,9 +1290,9 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id)
1284 1290
1285 stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); 1291 stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0);
1286 /* 1292 /*
1287 snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n", 1293 dev_dbg(emu->card->dev, "interrupt status = 0x%08x, stat76=0x%08x\n",
1288 status, stat76); 1294 status, stat76);
1289 snd_printk(KERN_DEBUG "ptr=0x%08x\n", 1295 dev_dbg(emu->card->dev, "ptr=0x%08x\n",
1290 snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); 1296 snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0));
1291 */ 1297 */
1292 mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ 1298 mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */
@@ -1296,11 +1302,13 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id)
1296/* FIXME: Select the correct substream for period elapsed */ 1302/* FIXME: Select the correct substream for period elapsed */
1297 if(pchannel->use) { 1303 if(pchannel->use) {
1298 snd_pcm_period_elapsed(pchannel->epcm->substream); 1304 snd_pcm_period_elapsed(pchannel->epcm->substream);
1299 //printk(KERN_INFO "interrupt [%d] used\n", i); 1305 /* dev_dbg(emu->card->dev, "interrupt [%d] used\n", i); */
1300 } 1306 }
1301 } 1307 }
1302 //printk(KERN_INFO "channel=%p\n",pchannel); 1308 /*
1303 //printk(KERN_INFO "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number); 1309 dev_dbg(emu->card->dev, "channel=%p\n", pchannel);
1310 dev_dbg(emu->card->dev, "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number);
1311 */
1304 mask <<= 1; 1312 mask <<= 1;
1305 } 1313 }
1306 mask = 0x110000; /* 0x1 for one half, 0x10 for the other half period. */ 1314 mask = 0x110000; /* 0x1 for one half, 0x10 for the other half period. */
@@ -1310,11 +1318,13 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id)
1310/* FIXME: Select the correct substream for period elapsed */ 1318/* FIXME: Select the correct substream for period elapsed */
1311 if(pchannel->use) { 1319 if(pchannel->use) {
1312 snd_pcm_period_elapsed(pchannel->epcm->substream); 1320 snd_pcm_period_elapsed(pchannel->epcm->substream);
1313 //printk(KERN_INFO "interrupt [%d] used\n", i); 1321 /* dev_dbg(emu->card->dev, "interrupt [%d] used\n", i); */
1314 } 1322 }
1315 } 1323 }
1316 //printk(KERN_INFO "channel=%p\n",pchannel); 1324 /*
1317 //printk(KERN_INFO "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number); 1325 dev_dbg(emu->card->dev, "channel=%p\n", pchannel);
1326 dev_dbg(emu->card->dev, "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number);
1327 */
1318 mask <<= 1; 1328 mask <<= 1;
1319 } 1329 }
1320 1330
@@ -1603,7 +1613,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume)
1603 int size, n; 1613 int size, n;
1604 1614
1605 size = ARRAY_SIZE(i2c_adc_init); 1615 size = ARRAY_SIZE(i2c_adc_init);
1606 /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */ 1616 /* dev_dbg(emu->card->dev, "I2C:array size=0x%x\n", size); */
1607 for (n = 0; n < size; n++) 1617 for (n = 0; n < size; n++)
1608 snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], 1618 snd_ca0106_i2c_write(chip, i2c_adc_init[n][0],
1609 i2c_adc_init[n][1]); 1619 i2c_adc_init[n][1]);
@@ -1668,7 +1678,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
1668 return err; 1678 return err;
1669 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 1679 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
1670 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1680 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
1671 printk(KERN_ERR "error to set 32bit mask DMA\n"); 1681 dev_err(card->dev, "error to set 32bit mask DMA\n");
1672 pci_disable_device(pci); 1682 pci_disable_device(pci);
1673 return -ENXIO; 1683 return -ENXIO;
1674 } 1684 }
@@ -1689,14 +1699,14 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
1689 chip->res_port = request_region(chip->port, 0x20, "snd_ca0106"); 1699 chip->res_port = request_region(chip->port, 0x20, "snd_ca0106");
1690 if (!chip->res_port) { 1700 if (!chip->res_port) {
1691 snd_ca0106_free(chip); 1701 snd_ca0106_free(chip);
1692 printk(KERN_ERR "cannot allocate the port\n"); 1702 dev_err(card->dev, "cannot allocate the port\n");
1693 return -EBUSY; 1703 return -EBUSY;
1694 } 1704 }
1695 1705
1696 if (request_irq(pci->irq, snd_ca0106_interrupt, 1706 if (request_irq(pci->irq, snd_ca0106_interrupt,
1697 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1707 IRQF_SHARED, KBUILD_MODNAME, chip)) {
1698 snd_ca0106_free(chip); 1708 snd_ca0106_free(chip);
1699 printk(KERN_ERR "cannot grab irq\n"); 1709 dev_err(card->dev, "cannot grab irq\n");
1700 return -EBUSY; 1710 return -EBUSY;
1701 } 1711 }
1702 chip->irq = pci->irq; 1712 chip->irq = pci->irq;
@@ -1712,7 +1722,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
1712 /* read serial */ 1722 /* read serial */
1713 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 1723 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
1714 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 1724 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
1715 printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", 1725 dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n",
1716 chip->model, pci->revision, chip->serial); 1726 chip->model, pci->revision, chip->serial);
1717 strcpy(card->driver, "CA0106"); 1727 strcpy(card->driver, "CA0106");
1718 strcpy(card->shortname, "CA0106"); 1728 strcpy(card->shortname, "CA0106");
@@ -1726,7 +1736,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
1726 } 1736 }
1727 chip->details = c; 1737 chip->details = c;
1728 if (subsystem[dev]) { 1738 if (subsystem[dev]) {
1729 printk(KERN_INFO "snd-ca0106: Sound card name=%s, " 1739 dev_info(card->dev, "Sound card name=%s, "
1730 "subsystem=0x%x. Forced to subsystem=0x%x\n", 1740 "subsystem=0x%x. Forced to subsystem=0x%x\n",
1731 c->name, chip->serial, subsystem[dev]); 1741 c->name, chip->serial, subsystem[dev]);
1732 } 1742 }
@@ -1869,11 +1879,11 @@ static int snd_ca0106_probe(struct pci_dev *pci,
1869 if (err < 0) 1879 if (err < 0)
1870 goto error; 1880 goto error;
1871 1881
1872 snd_printdd("ca0106: probe for MIDI channel A ..."); 1882 dev_dbg(card->dev, "probe for MIDI channel A ...");
1873 err = snd_ca0106_midi(chip, CA0106_MIDI_CHAN_A); 1883 err = snd_ca0106_midi(chip, CA0106_MIDI_CHAN_A);
1874 if (err < 0) 1884 if (err < 0)
1875 goto error; 1885 goto error;
1876 snd_printdd(" done.\n"); 1886 dev_dbg(card->dev, " done.\n");
1877 1887
1878#ifdef CONFIG_PROC_FS 1888#ifdef CONFIG_PROC_FS
1879 snd_ca0106_proc_init(chip); 1889 snd_ca0106_proc_init(chip);
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c
index 8bbdf265d11d..b91c7f6d19f9 100644
--- a/sound/pci/ca0106/ca_midi.c
+++ b/sound/pci/ca0106/ca_midi.c
@@ -46,7 +46,7 @@ static void ca_midi_clear_rx(struct snd_ca_midi *midi)
46 ca_midi_read_data(midi); 46 ca_midi_read_data(midi);
47#ifdef CONFIG_SND_DEBUG 47#ifdef CONFIG_SND_DEBUG
48 if (timeout <= 0) 48 if (timeout <= 0)
49 snd_printk(KERN_ERR "ca_midi_clear_rx: timeout (status = 0x%x)\n", 49 pr_err("ca_midi_clear_rx: timeout (status = 0x%x)\n",
50 ca_midi_read_stat(midi)); 50 ca_midi_read_stat(midi));
51#endif 51#endif
52} 52}
@@ -113,7 +113,7 @@ static void ca_midi_cmd(struct snd_ca_midi *midi, unsigned char cmd, int ack)
113 } 113 }
114 spin_unlock_irqrestore(&midi->input_lock, flags); 114 spin_unlock_irqrestore(&midi->input_lock, flags);
115 if (!ok) 115 if (!ok)
116 snd_printk(KERN_ERR "ca_midi_cmd: 0x%x failed at 0x%x (status = 0x%x, data = 0x%x)!!!\n", 116 pr_err("ca_midi_cmd: 0x%x failed at 0x%x (status = 0x%x, data = 0x%x)!!!\n",
117 cmd, 117 cmd,
118 midi->get_dev_id_port(midi->dev_id), 118 midi->get_dev_id_port(midi->dev_id),
119 ca_midi_read_stat(midi), 119 ca_midi_read_stat(midi),
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 66c0558ce449..12c318e175f4 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -796,7 +796,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
796 if (runtime->channels > 1) 796 if (runtime->channels > 1)
797 rec->fmt |= 0x01; 797 rec->fmt |= 0x01;
798 if (rec->is_dac && set_dac_channels(cm, rec, runtime->channels) < 0) { 798 if (rec->is_dac && set_dac_channels(cm, rec, runtime->channels) < 0) {
799 snd_printd("cannot set dac channels\n"); 799 dev_dbg(cm->card->dev, "cannot set dac channels\n");
800 return -EINVAL; 800 return -EINVAL;
801 } 801 }
802 802
@@ -827,7 +827,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
827 else 827 else
828 cm->ctrl |= val; 828 cm->ctrl |= val;
829 snd_cmipci_write(cm, CM_REG_FUNCTRL0, cm->ctrl); 829 snd_cmipci_write(cm, CM_REG_FUNCTRL0, cm->ctrl);
830 //snd_printd("cmipci: functrl0 = %08x\n", cm->ctrl); 830 /* dev_dbg(cm->card->dev, "functrl0 = %08x\n", cm->ctrl); */
831 831
832 /* set sample rate */ 832 /* set sample rate */
833 freq = 0; 833 freq = 0;
@@ -850,7 +850,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
850 val |= (freq << CM_ASFC_SHIFT) & CM_ASFC_MASK; 850 val |= (freq << CM_ASFC_SHIFT) & CM_ASFC_MASK;
851 } 851 }
852 snd_cmipci_write(cm, CM_REG_FUNCTRL1, val); 852 snd_cmipci_write(cm, CM_REG_FUNCTRL1, val);
853 //snd_printd("cmipci: functrl1 = %08x\n", val); 853 dev_dbg(cm->card->dev, "functrl1 = %08x\n", val);
854 854
855 /* set format */ 855 /* set format */
856 val = snd_cmipci_read(cm, CM_REG_CHFORMAT); 856 val = snd_cmipci_read(cm, CM_REG_CHFORMAT);
@@ -866,7 +866,7 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
866 val |= freq_ext << (rec->ch * 2); 866 val |= freq_ext << (rec->ch * 2);
867 } 867 }
868 snd_cmipci_write(cm, CM_REG_CHFORMAT, val); 868 snd_cmipci_write(cm, CM_REG_CHFORMAT, val);
869 //snd_printd("cmipci: chformat = %08x\n", val); 869 dev_dbg(cm->card->dev, "chformat = %08x\n", val);
870 870
871 if (!rec->is_dac && cm->chip_version) { 871 if (!rec->is_dac && cm->chip_version) {
872 if (runtime->rate > 44100) 872 if (runtime->rate > 44100)
@@ -904,7 +904,7 @@ static int snd_cmipci_pcm_trigger(struct cmipci *cm, struct cmipci_pcm *rec,
904 cm->ctrl |= chen; 904 cm->ctrl |= chen;
905 /* enable channel */ 905 /* enable channel */
906 snd_cmipci_write(cm, CM_REG_FUNCTRL0, cm->ctrl); 906 snd_cmipci_write(cm, CM_REG_FUNCTRL0, cm->ctrl);
907 //snd_printd("cmipci: functrl0 = %08x\n", cm->ctrl); 907 dev_dbg(cm->card->dev, "functrl0 = %08x\n", cm->ctrl);
908 break; 908 break;
909 case SNDRV_PCM_TRIGGER_STOP: 909 case SNDRV_PCM_TRIGGER_STOP:
910 rec->running = 0; 910 rec->running = 0;
@@ -952,7 +952,7 @@ static snd_pcm_uframes_t snd_cmipci_pcm_pointer(struct cmipci *cm, struct cmipci
952 if (rem < rec->dma_size) 952 if (rem < rec->dma_size)
953 goto ok; 953 goto ok;
954 } 954 }
955 printk(KERN_ERR "cmipci: invalid PCM pointer: %#x\n", rem); 955 dev_err(cm->card->dev, "invalid PCM pointer: %#x\n", rem);
956 return SNDRV_PCM_POS_XRUN; 956 return SNDRV_PCM_POS_XRUN;
957ok: 957ok:
958 ptr = (rec->dma_size - (rem + 1)) >> rec->shift; 958 ptr = (rec->dma_size - (rem + 1)) >> rec->shift;
@@ -2889,13 +2889,13 @@ static int snd_cmipci_create_gameport(struct cmipci *cm, int dev)
2889 } 2889 }
2890 2890
2891 if (!r) { 2891 if (!r) {
2892 printk(KERN_WARNING "cmipci: cannot reserve joystick ports\n"); 2892 dev_warn(cm->card->dev, "cannot reserve joystick ports\n");
2893 return -EBUSY; 2893 return -EBUSY;
2894 } 2894 }
2895 2895
2896 cm->gameport = gp = gameport_allocate_port(); 2896 cm->gameport = gp = gameport_allocate_port();
2897 if (!gp) { 2897 if (!gp) {
2898 printk(KERN_ERR "cmipci: cannot allocate memory for gameport\n"); 2898 dev_err(cm->card->dev, "cannot allocate memory for gameport\n");
2899 release_and_free_resource(r); 2899 release_and_free_resource(r);
2900 return -ENOMEM; 2900 return -ENOMEM;
2901 } 2901 }
@@ -2995,13 +2995,14 @@ static int snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2995 2995
2996 if (snd_opl3_create(cm->card, iosynth, iosynth + 2, 2996 if (snd_opl3_create(cm->card, iosynth, iosynth + 2,
2997 OPL3_HW_OPL3, 0, &opl3) < 0) { 2997 OPL3_HW_OPL3, 0, &opl3) < 0) {
2998 printk(KERN_ERR "cmipci: no OPL device at %#lx, " 2998 dev_err(cm->card->dev,
2999 "skipping...\n", iosynth); 2999 "no OPL device at %#lx, skipping...\n",
3000 iosynth);
3000 goto disable_fm; 3001 goto disable_fm;
3001 } 3002 }
3002 } 3003 }
3003 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 3004 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
3004 printk(KERN_ERR "cmipci: cannot create OPL3 hwdep\n"); 3005 dev_err(cm->card->dev, "cannot create OPL3 hwdep\n");
3005 return err; 3006 return err;
3006 } 3007 }
3007 return 0; 3008 return 0;
@@ -3060,7 +3061,7 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
3060 3061
3061 if (request_irq(pci->irq, snd_cmipci_interrupt, 3062 if (request_irq(pci->irq, snd_cmipci_interrupt,
3062 IRQF_SHARED, KBUILD_MODNAME, cm)) { 3063 IRQF_SHARED, KBUILD_MODNAME, cm)) {
3063 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3064 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
3064 snd_cmipci_free(cm); 3065 snd_cmipci_free(cm);
3065 return -EBUSY; 3066 return -EBUSY;
3066 } 3067 }
@@ -3192,8 +3193,9 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
3192 /* enable UART */ 3193 /* enable UART */
3193 snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN); 3194 snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN);
3194 if (inb(iomidi + 1) == 0xff) { 3195 if (inb(iomidi + 1) == 0xff) {
3195 snd_printk(KERN_ERR "cannot enable MPU-401 port" 3196 dev_err(cm->card->dev,
3196 " at %#lx\n", iomidi); 3197 "cannot enable MPU-401 port at %#lx\n",
3198 iomidi);
3197 snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, 3199 snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1,
3198 CM_UART_EN); 3200 CM_UART_EN);
3199 iomidi = 0; 3201 iomidi = 0;
@@ -3237,7 +3239,8 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
3237 MPU401_INFO_INTEGRATED : 0) | 3239 MPU401_INFO_INTEGRATED : 0) |
3238 MPU401_INFO_IRQ_HOOK, 3240 MPU401_INFO_IRQ_HOOK,
3239 -1, &cm->rmidi)) < 0) { 3241 -1, &cm->rmidi)) < 0) {
3240 printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi); 3242 dev_err(cm->card->dev,
3243 "no UART401 device at 0x%lx\n", iomidi);
3241 } 3244 }
3242 } 3245 }
3243 3246
@@ -3380,8 +3383,7 @@ static int snd_cmipci_resume(struct device *dev)
3380 pci_set_power_state(pci, PCI_D0); 3383 pci_set_power_state(pci, PCI_D0);
3381 pci_restore_state(pci); 3384 pci_restore_state(pci);
3382 if (pci_enable_device(pci) < 0) { 3385 if (pci_enable_device(pci) < 0) {
3383 printk(KERN_ERR "cmipci: pci_enable_device failed, " 3386 dev_err(dev, "pci_enable_device failed, disabling device\n");
3384 "disabling device\n");
3385 snd_card_disconnect(card); 3387 snd_card_disconnect(card);
3386 return -EIO; 3388 return -EIO;
3387 } 3389 }
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 2bd55177b1ae..43d1f912c641 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -564,7 +564,8 @@ static void snd_cs4281_ac97_write(struct snd_ac97 *ac97,
564 return; 564 return;
565 } 565 }
566 } 566 }
567 snd_printk(KERN_ERR "AC'97 write problem, reg = 0x%x, val = 0x%x\n", reg, val); 567 dev_err(chip->card->dev,
568 "AC'97 write problem, reg = 0x%x, val = 0x%x\n", reg, val);
568} 569}
569 570
570static unsigned short snd_cs4281_ac97_read(struct snd_ac97 *ac97, 571static unsigned short snd_cs4281_ac97_read(struct snd_ac97 *ac97,
@@ -624,7 +625,8 @@ static unsigned short snd_cs4281_ac97_read(struct snd_ac97 *ac97,
624 goto __ok1; 625 goto __ok1;
625 } 626 }
626 627
627 snd_printk(KERN_ERR "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); 628 dev_err(chip->card->dev,
629 "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg);
628 result = 0xffff; 630 result = 0xffff;
629 goto __end; 631 goto __end;
630 632
@@ -643,7 +645,8 @@ static unsigned short snd_cs4281_ac97_read(struct snd_ac97 *ac97,
643 udelay(10); 645 udelay(10);
644 } 646 }
645 647
646 snd_printk(KERN_ERR "AC'97 read problem (ACSTS_VSTS), reg = 0x%x\n", reg); 648 dev_err(chip->card->dev,
649 "AC'97 read problem (ACSTS_VSTS), reg = 0x%x\n", reg);
647 result = 0xffff; 650 result = 0xffff;
648 goto __end; 651 goto __end;
649 652
@@ -835,8 +838,9 @@ static snd_pcm_uframes_t snd_cs4281_pointer(struct snd_pcm_substream *substream)
835 struct cs4281 *chip = snd_pcm_substream_chip(substream); 838 struct cs4281 *chip = snd_pcm_substream_chip(substream);
836 839
837 /* 840 /*
838 printk(KERN_DEBUG "DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", 841 dev_dbg(chip->card->dev,
839 snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, 842 "DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n",
843 snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size,
840 jiffies); 844 jiffies);
841 */ 845 */
842 return runtime->buffer_size - 846 return runtime->buffer_size -
@@ -1265,7 +1269,8 @@ static int snd_cs4281_create_gameport(struct cs4281 *chip)
1265 1269
1266 chip->gameport = gp = gameport_allocate_port(); 1270 chip->gameport = gp = gameport_allocate_port();
1267 if (!gp) { 1271 if (!gp) {
1268 printk(KERN_ERR "cs4281: cannot allocate memory for gameport\n"); 1272 dev_err(chip->card->dev,
1273 "cannot allocate memory for gameport\n");
1269 return -ENOMEM; 1274 return -ENOMEM;
1270 } 1275 }
1271 1276
@@ -1361,7 +1366,7 @@ static int snd_cs4281_create(struct snd_card *card,
1361 chip->irq = -1; 1366 chip->irq = -1;
1362 pci_set_master(pci); 1367 pci_set_master(pci);
1363 if (dual_codec < 0 || dual_codec > 3) { 1368 if (dual_codec < 0 || dual_codec > 3) {
1364 snd_printk(KERN_ERR "invalid dual_codec option %d\n", dual_codec); 1369 dev_err(card->dev, "invalid dual_codec option %d\n", dual_codec);
1365 dual_codec = 0; 1370 dual_codec = 0;
1366 } 1371 }
1367 chip->dual_codec = dual_codec; 1372 chip->dual_codec = dual_codec;
@@ -1383,7 +1388,7 @@ static int snd_cs4281_create(struct snd_card *card,
1383 1388
1384 if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_SHARED, 1389 if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_SHARED,
1385 KBUILD_MODNAME, chip)) { 1390 KBUILD_MODNAME, chip)) {
1386 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1391 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1387 snd_cs4281_free(chip); 1392 snd_cs4281_free(chip);
1388 return -ENOMEM; 1393 return -ENOMEM;
1389 } 1394 }
@@ -1423,7 +1428,8 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
1423 snd_cs4281_pokeBA0(chip, BA0_CFLR, BA0_CFLR_DEFAULT); 1428 snd_cs4281_pokeBA0(chip, BA0_CFLR, BA0_CFLR_DEFAULT);
1424 tmp = snd_cs4281_peekBA0(chip, BA0_CFLR); 1429 tmp = snd_cs4281_peekBA0(chip, BA0_CFLR);
1425 if (tmp != BA0_CFLR_DEFAULT) { 1430 if (tmp != BA0_CFLR_DEFAULT) {
1426 snd_printk(KERN_ERR "CFLR setup failed (0x%x)\n", tmp); 1431 dev_err(chip->card->dev,
1432 "CFLR setup failed (0x%x)\n", tmp);
1427 return -EIO; 1433 return -EIO;
1428 } 1434 }
1429 } 1435 }
@@ -1434,11 +1440,13 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
1434 snd_cs4281_pokeBA0(chip, BA0_CWPR, 0x4281); 1440 snd_cs4281_pokeBA0(chip, BA0_CWPR, 0x4281);
1435 1441
1436 if ((tmp = snd_cs4281_peekBA0(chip, BA0_SERC1)) != (BA0_SERC1_SO1EN | BA0_SERC1_AC97)) { 1442 if ((tmp = snd_cs4281_peekBA0(chip, BA0_SERC1)) != (BA0_SERC1_SO1EN | BA0_SERC1_AC97)) {
1437 snd_printk(KERN_ERR "SERC1 AC'97 check failed (0x%x)\n", tmp); 1443 dev_err(chip->card->dev,
1444 "SERC1 AC'97 check failed (0x%x)\n", tmp);
1438 return -EIO; 1445 return -EIO;
1439 } 1446 }
1440 if ((tmp = snd_cs4281_peekBA0(chip, BA0_SERC2)) != (BA0_SERC2_SI1EN | BA0_SERC2_AC97)) { 1447 if ((tmp = snd_cs4281_peekBA0(chip, BA0_SERC2)) != (BA0_SERC2_SI1EN | BA0_SERC2_AC97)) {
1441 snd_printk(KERN_ERR "SERC2 AC'97 check failed (0x%x)\n", tmp); 1448 dev_err(chip->card->dev,
1449 "SERC2 AC'97 check failed (0x%x)\n", tmp);
1442 return -EIO; 1450 return -EIO;
1443 } 1451 }
1444 1452
@@ -1500,7 +1508,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
1500 schedule_timeout_uninterruptible(1); 1508 schedule_timeout_uninterruptible(1);
1501 } while (time_after_eq(end_time, jiffies)); 1509 } while (time_after_eq(end_time, jiffies));
1502 1510
1503 snd_printk(KERN_ERR "DLLRDY not seen\n"); 1511 dev_err(chip->card->dev, "DLLRDY not seen\n");
1504 return -EIO; 1512 return -EIO;
1505 1513
1506 __ok0: 1514 __ok0:
@@ -1526,7 +1534,9 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
1526 schedule_timeout_uninterruptible(1); 1534 schedule_timeout_uninterruptible(1);
1527 } while (time_after_eq(end_time, jiffies)); 1535 } while (time_after_eq(end_time, jiffies));
1528 1536
1529 snd_printk(KERN_ERR "never read codec ready from AC'97 (0x%x)\n", snd_cs4281_peekBA0(chip, BA0_ACSTS)); 1537 dev_err(chip->card->dev,
1538 "never read codec ready from AC'97 (0x%x)\n",
1539 snd_cs4281_peekBA0(chip, BA0_ACSTS));
1530 return -EIO; 1540 return -EIO;
1531 1541
1532 __ok1: 1542 __ok1:
@@ -1537,7 +1547,8 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
1537 goto __codec2_ok; 1547 goto __codec2_ok;
1538 schedule_timeout_uninterruptible(1); 1548 schedule_timeout_uninterruptible(1);
1539 } while (time_after_eq(end_time, jiffies)); 1549 } while (time_after_eq(end_time, jiffies));
1540 snd_printk(KERN_INFO "secondary codec doesn't respond. disable it...\n"); 1550 dev_info(chip->card->dev,
1551 "secondary codec doesn't respond. disable it...\n");
1541 chip->dual_codec = 0; 1552 chip->dual_codec = 0;
1542 __codec2_ok: ; 1553 __codec2_ok: ;
1543 } 1554 }
@@ -1567,7 +1578,7 @@ static int snd_cs4281_chip_init(struct cs4281 *chip)
1567 1578
1568 if (--retry_count > 0) 1579 if (--retry_count > 0)
1569 goto __retry; 1580 goto __retry;
1570 snd_printk(KERN_ERR "never read ISV3 and ISV4 from AC'97\n"); 1581 dev_err(chip->card->dev, "never read ISV3 and ISV4 from AC'97\n");
1571 return -EIO; 1582 return -EIO;
1572 1583
1573 __ok2: 1584 __ok2:
@@ -2054,8 +2065,7 @@ static int cs4281_resume(struct device *dev)
2054 pci_set_power_state(pci, PCI_D0); 2065 pci_set_power_state(pci, PCI_D0);
2055 pci_restore_state(pci); 2066 pci_restore_state(pci);
2056 if (pci_enable_device(pci) < 0) { 2067 if (pci_enable_device(pci) < 0) {
2057 printk(KERN_ERR "cs4281: pci_enable_device failed, " 2068 dev_err(dev, "pci_enable_device failed, disabling device\n");
2058 "disabling device\n");
2059 snd_card_disconnect(card); 2069 snd_card_disconnect(card);
2060 return -EIO; 2070 return -EIO;
2061 } 2071 }
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 28766478f81c..32b44f25b5c8 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -116,7 +116,7 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
116 116
117 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL); 117 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL);
118 if ((tmp & ACCTL_VFRM) == 0) { 118 if ((tmp & ACCTL_VFRM) == 0) {
119 snd_printk(KERN_WARNING "cs46xx: ACCTL_VFRM not set 0x%x\n",tmp); 119 dev_warn(chip->card->dev, "ACCTL_VFRM not set 0x%x\n", tmp);
120 snd_cs46xx_pokeBA0(chip, BA0_ACCTL, (tmp & (~ACCTL_ESYN)) | ACCTL_VFRM ); 120 snd_cs46xx_pokeBA0(chip, BA0_ACCTL, (tmp & (~ACCTL_ESYN)) | ACCTL_VFRM );
121 msleep(50); 121 msleep(50);
122 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL + offset); 122 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL + offset);
@@ -168,7 +168,8 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
168 goto ok1; 168 goto ok1;
169 } 169 }
170 170
171 snd_printk(KERN_ERR "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); 171 dev_err(chip->card->dev,
172 "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg);
172 result = 0xffff; 173 result = 0xffff;
173 goto end; 174 goto end;
174 175
@@ -187,7 +188,9 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
187 udelay(10); 188 udelay(10);
188 } 189 }
189 190
190 snd_printk(KERN_ERR "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n", codec_index, reg); 191 dev_err(chip->card->dev,
192 "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n",
193 codec_index, reg);
191 result = 0xffff; 194 result = 0xffff;
192 goto end; 195 goto end;
193 196
@@ -197,7 +200,8 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
197 * ACSDA = Status Data Register = 474h 200 * ACSDA = Status Data Register = 474h
198 */ 201 */
199#if 0 202#if 0
200 printk(KERN_DEBUG "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, 203 dev_dbg(chip->card->dev,
204 "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg,
201 snd_cs46xx_peekBA0(chip, BA0_ACSDA), 205 snd_cs46xx_peekBA0(chip, BA0_ACSDA),
202 snd_cs46xx_peekBA0(chip, BA0_ACCAD)); 206 snd_cs46xx_peekBA0(chip, BA0_ACCAD));
203#endif 207#endif
@@ -286,7 +290,9 @@ static void snd_cs46xx_codec_write(struct snd_cs46xx *chip,
286 goto end; 290 goto end;
287 } 291 }
288 } 292 }
289 snd_printk(KERN_ERR "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n", codec_index, reg, val); 293 dev_err(chip->card->dev,
294 "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n",
295 codec_index, reg, val);
290 end: 296 end:
291 chip->active_ctrl(chip, -1); 297 chip->active_ctrl(chip, -1);
292} 298}
@@ -608,8 +614,8 @@ static int cs46xx_wait_for_fifo(struct snd_cs46xx * chip,int retry_timeout)
608 } 614 }
609 615
610 if(status & SERBST_WBSY) { 616 if(status & SERBST_WBSY) {
611 snd_printk(KERN_ERR "cs46xx: failure waiting for " 617 dev_err(chip->card->dev,
612 "FIFO command to complete\n"); 618 "failure waiting for FIFO command to complete\n");
613 return -EINVAL; 619 return -EINVAL;
614 } 620 }
615 621
@@ -646,7 +652,9 @@ static void snd_cs46xx_clear_serial_FIFOs(struct snd_cs46xx *chip)
646 * Make sure the previous FIFO write operation has completed. 652 * Make sure the previous FIFO write operation has completed.
647 */ 653 */
648 if (cs46xx_wait_for_fifo(chip,1)) { 654 if (cs46xx_wait_for_fifo(chip,1)) {
649 snd_printdd ("failed waiting for FIFO at addr (%02X)\n",idx); 655 dev_dbg(chip->card->dev,
656 "failed waiting for FIFO at addr (%02X)\n",
657 idx);
650 658
651 if (powerdown) 659 if (powerdown)
652 snd_cs46xx_pokeBA0(chip, BA0_CLKCR1, tmp); 660 snd_cs46xx_pokeBA0(chip, BA0_CLKCR1, tmp);
@@ -694,7 +702,7 @@ static void snd_cs46xx_proc_start(struct snd_cs46xx *chip)
694 } 702 }
695 703
696 if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR) 704 if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR)
697 snd_printk(KERN_ERR "SPCR_RUNFR never reset\n"); 705 dev_err(chip->card->dev, "SPCR_RUNFR never reset\n");
698} 706}
699 707
700static void snd_cs46xx_proc_stop(struct snd_cs46xx *chip) 708static void snd_cs46xx_proc_stop(struct snd_cs46xx *chip)
@@ -1054,7 +1062,8 @@ static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x
1054 cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, 1062 cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate,
1055 cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id); 1063 cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id);
1056 if (cpcm->pcm_channel == NULL) { 1064 if (cpcm->pcm_channel == NULL) {
1057 snd_printk(KERN_ERR "cs46xx: failed to create virtual PCM channel\n"); 1065 dev_err(chip->card->dev,
1066 "failed to create virtual PCM channel\n");
1058 return -ENOMEM; 1067 return -ENOMEM;
1059 } 1068 }
1060 cpcm->pcm_channel->sample_rate = sample_rate; 1069 cpcm->pcm_channel->sample_rate = sample_rate;
@@ -1067,7 +1076,8 @@ static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x
1067 if ( (cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm, 1076 if ( (cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm,
1068 cpcm->hw_buf.addr, 1077 cpcm->hw_buf.addr,
1069 cpcm->pcm_channel_id)) == NULL) { 1078 cpcm->pcm_channel_id)) == NULL) {
1070 snd_printk(KERN_ERR "cs46xx: failed to re-create virtual PCM channel\n"); 1079 dev_err(chip->card->dev,
1080 "failed to re-create virtual PCM channel\n");
1071 return -ENOMEM; 1081 return -ENOMEM;
1072 } 1082 }
1073 1083
@@ -1116,7 +1126,8 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
1116 return -EINVAL; 1126 return -EINVAL;
1117 } 1127 }
1118 1128
1119 snd_printdd ("period_size (%d), periods (%d) buffer_size(%d)\n", 1129 dev_dbg(chip->card->dev,
1130 "period_size (%d), periods (%d) buffer_size(%d)\n",
1120 period_size, params_periods(hw_params), 1131 period_size, params_periods(hw_params),
1121 params_buffer_bytes(hw_params)); 1132 params_buffer_bytes(hw_params));
1122#endif 1133#endif
@@ -1531,22 +1542,20 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
1531 1542
1532static int snd_cs46xx_playback_open(struct snd_pcm_substream *substream) 1543static int snd_cs46xx_playback_open(struct snd_pcm_substream *substream)
1533{ 1544{
1534 snd_printdd("open front channel\n"); 1545 dev_dbg(substream->pcm->card->dev, "open front channel\n");
1535 return _cs46xx_playback_open_channel(substream,DSP_PCM_MAIN_CHANNEL); 1546 return _cs46xx_playback_open_channel(substream,DSP_PCM_MAIN_CHANNEL);
1536} 1547}
1537 1548
1538#ifdef CONFIG_SND_CS46XX_NEW_DSP 1549#ifdef CONFIG_SND_CS46XX_NEW_DSP
1539static int snd_cs46xx_playback_open_rear(struct snd_pcm_substream *substream) 1550static int snd_cs46xx_playback_open_rear(struct snd_pcm_substream *substream)
1540{ 1551{
1541 snd_printdd("open rear channel\n"); 1552 dev_dbg(substream->pcm->card->dev, "open rear channel\n");
1542
1543 return _cs46xx_playback_open_channel(substream,DSP_PCM_REAR_CHANNEL); 1553 return _cs46xx_playback_open_channel(substream,DSP_PCM_REAR_CHANNEL);
1544} 1554}
1545 1555
1546static int snd_cs46xx_playback_open_clfe(struct snd_pcm_substream *substream) 1556static int snd_cs46xx_playback_open_clfe(struct snd_pcm_substream *substream)
1547{ 1557{
1548 snd_printdd("open center - LFE channel\n"); 1558 dev_dbg(substream->pcm->card->dev, "open center - LFE channel\n");
1549
1550 return _cs46xx_playback_open_channel(substream,DSP_PCM_CENTER_LFE_CHANNEL); 1559 return _cs46xx_playback_open_channel(substream,DSP_PCM_CENTER_LFE_CHANNEL);
1551} 1560}
1552 1561
@@ -1554,7 +1563,7 @@ static int snd_cs46xx_playback_open_iec958(struct snd_pcm_substream *substream)
1554{ 1563{
1555 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1564 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);
1556 1565
1557 snd_printdd("open raw iec958 channel\n"); 1566 dev_dbg(chip->card->dev, "open raw iec958 channel\n");
1558 1567
1559 mutex_lock(&chip->spos_mutex); 1568 mutex_lock(&chip->spos_mutex);
1560 cs46xx_iec958_pre_open (chip); 1569 cs46xx_iec958_pre_open (chip);
@@ -1570,7 +1579,7 @@ static int snd_cs46xx_playback_close_iec958(struct snd_pcm_substream *substream)
1570 int err; 1579 int err;
1571 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1580 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);
1572 1581
1573 snd_printdd("close raw iec958 channel\n"); 1582 dev_dbg(chip->card->dev, "close raw iec958 channel\n");
1574 1583
1575 err = snd_cs46xx_playback_close(substream); 1584 err = snd_cs46xx_playback_close(substream);
1576 1585
@@ -2421,10 +2430,10 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
2421 2430
2422 /* set the desired CODEC mode */ 2431 /* set the desired CODEC mode */
2423 if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) { 2432 if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) {
2424 snd_printdd("cs46xx: CODEC1 mode %04x\n", 0x0); 2433 dev_dbg(ac97->bus->card->dev, "CODEC1 mode %04x\n", 0x0);
2425 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x0); 2434 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x0);
2426 } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) { 2435 } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) {
2427 snd_printdd("cs46xx: CODEC2 mode %04x\n", 0x3); 2436 dev_dbg(ac97->bus->card->dev, "CODEC2 mode %04x\n", 0x3);
2428 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x3); 2437 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x3);
2429 } else { 2438 } else {
2430 snd_BUG(); /* should never happen ... */ 2439 snd_BUG(); /* should never happen ... */
@@ -2456,7 +2465,8 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
2456 msleep(10); 2465 msleep(10);
2457 } while (time_after_eq(end_time, jiffies)); 2466 } while (time_after_eq(end_time, jiffies));
2458 2467
2459 snd_printk(KERN_ERR "CS46xx secondary codec doesn't respond!\n"); 2468 dev_err(ac97->bus->card->dev,
2469 "CS46xx secondary codec doesn't respond!\n");
2460} 2470}
2461#endif 2471#endif
2462 2472
@@ -2476,7 +2486,8 @@ static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
2476 snd_cs46xx_codec_write(chip, AC97_RESET, 0, codec); 2486 snd_cs46xx_codec_write(chip, AC97_RESET, 0, codec);
2477 udelay(10); 2487 udelay(10);
2478 if (snd_cs46xx_codec_read(chip, AC97_RESET, codec) & 0x8000) { 2488 if (snd_cs46xx_codec_read(chip, AC97_RESET, codec) & 0x8000) {
2479 snd_printdd("snd_cs46xx: seconadry codec not present\n"); 2489 dev_dbg(chip->card->dev,
2490 "seconadry codec not present\n");
2480 return -ENXIO; 2491 return -ENXIO;
2481 } 2492 }
2482 } 2493 }
@@ -2489,7 +2500,7 @@ static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
2489 } 2500 }
2490 msleep(10); 2501 msleep(10);
2491 } 2502 }
2492 snd_printdd("snd_cs46xx: codec %d detection timeout\n", codec); 2503 dev_dbg(chip->card->dev, "codec %d detection timeout\n", codec);
2493 return -ENXIO; 2504 return -ENXIO;
2494} 2505}
2495 2506
@@ -2509,7 +2520,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2509 2520
2510 /* detect primary codec */ 2521 /* detect primary codec */
2511 chip->nr_ac97_codecs = 0; 2522 chip->nr_ac97_codecs = 0;
2512 snd_printdd("snd_cs46xx: detecting primary codec\n"); 2523 dev_dbg(chip->card->dev, "detecting primary codec\n");
2513 if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0) 2524 if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0)
2514 return err; 2525 return err;
2515 chip->ac97_bus->private_free = snd_cs46xx_mixer_free_ac97_bus; 2526 chip->ac97_bus->private_free = snd_cs46xx_mixer_free_ac97_bus;
@@ -2519,7 +2530,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2519 chip->nr_ac97_codecs = 1; 2530 chip->nr_ac97_codecs = 1;
2520 2531
2521#ifdef CONFIG_SND_CS46XX_NEW_DSP 2532#ifdef CONFIG_SND_CS46XX_NEW_DSP
2522 snd_printdd("snd_cs46xx: detecting seconadry codec\n"); 2533 dev_dbg(chip->card->dev, "detecting seconadry codec\n");
2523 /* try detect a secondary codec */ 2534 /* try detect a secondary codec */
2524 if (! cs46xx_detect_codec(chip, CS46XX_SECONDARY_CODEC_INDEX)) 2535 if (! cs46xx_detect_codec(chip, CS46XX_SECONDARY_CODEC_INDEX))
2525 chip->nr_ac97_codecs = 2; 2536 chip->nr_ac97_codecs = 2;
@@ -2554,7 +2565,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2554 } 2565 }
2555 /* do soundcard specific mixer setup */ 2566 /* do soundcard specific mixer setup */
2556 if (chip->mixer_init) { 2567 if (chip->mixer_init) {
2557 snd_printdd ("calling chip->mixer_init(chip);\n"); 2568 dev_dbg(chip->card->dev, "calling chip->mixer_init(chip);\n");
2558 chip->mixer_init(chip); 2569 chip->mixer_init(chip);
2559 } 2570 }
2560#endif 2571#endif
@@ -2801,7 +2812,8 @@ int snd_cs46xx_gameport(struct snd_cs46xx *chip)
2801 2812
2802 chip->gameport = gp = gameport_allocate_port(); 2813 chip->gameport = gp = gameport_allocate_port();
2803 if (!gp) { 2814 if (!gp) {
2804 printk(KERN_ERR "cs46xx: cannot allocate memory for gameport\n"); 2815 dev_err(chip->card->dev,
2816 "cannot allocate memory for gameport\n");
2805 return -ENOMEM; 2817 return -ENOMEM;
2806 } 2818 }
2807 2819
@@ -3138,8 +3150,10 @@ static int snd_cs46xx_chip_init(struct snd_cs46xx *chip)
3138 } 3150 }
3139 3151
3140 3152
3141 snd_printk(KERN_ERR "create - never read codec ready from AC'97\n"); 3153 dev_err(chip->card->dev,
3142 snd_printk(KERN_ERR "it is not probably bug, try to use CS4236 driver\n"); 3154 "create - never read codec ready from AC'97\n");
3155 dev_err(chip->card->dev,
3156 "it is not probably bug, try to use CS4236 driver\n");
3143 return -EIO; 3157 return -EIO;
3144 ok1: 3158 ok1:
3145#ifdef CONFIG_SND_CS46XX_NEW_DSP 3159#ifdef CONFIG_SND_CS46XX_NEW_DSP
@@ -3157,7 +3171,8 @@ static int snd_cs46xx_chip_init(struct snd_cs46xx *chip)
3157 * Make sure CODEC is READY. 3171 * Make sure CODEC is READY.
3158 */ 3172 */
3159 if (!(snd_cs46xx_peekBA0(chip, BA0_ACSTS2) & ACSTS_CRDY)) 3173 if (!(snd_cs46xx_peekBA0(chip, BA0_ACSTS2) & ACSTS_CRDY))
3160 snd_printdd("cs46xx: never read card ready from secondary AC'97\n"); 3174 dev_dbg(chip->card->dev,
3175 "never read card ready from secondary AC'97\n");
3161 } 3176 }
3162#endif 3177#endif
3163 3178
@@ -3187,17 +3202,21 @@ static int snd_cs46xx_chip_init(struct snd_cs46xx *chip)
3187 } 3202 }
3188 3203
3189#ifndef CONFIG_SND_CS46XX_NEW_DSP 3204#ifndef CONFIG_SND_CS46XX_NEW_DSP
3190 snd_printk(KERN_ERR "create - never read ISV3 & ISV4 from AC'97\n"); 3205 dev_err(chip->card->dev,
3206 "create - never read ISV3 & ISV4 from AC'97\n");
3191 return -EIO; 3207 return -EIO;
3192#else 3208#else
3193 /* This may happen on a cold boot with a Terratec SiXPack 5.1. 3209 /* This may happen on a cold boot with a Terratec SiXPack 5.1.
3194 Reloading the driver may help, if there's other soundcards 3210 Reloading the driver may help, if there's other soundcards
3195 with the same problem I would like to know. (Benny) */ 3211 with the same problem I would like to know. (Benny) */
3196 3212
3197 snd_printk(KERN_ERR "ERROR: snd-cs46xx: never read ISV3 & ISV4 from AC'97\n"); 3213 dev_err(chip->card->dev, "never read ISV3 & ISV4 from AC'97\n");
3198 snd_printk(KERN_ERR " Try reloading the ALSA driver, if you find something\n"); 3214 dev_err(chip->card->dev,
3199 snd_printk(KERN_ERR " broken or not working on your soundcard upon\n"); 3215 "Try reloading the ALSA driver, if you find something\n");
3200 snd_printk(KERN_ERR " this message please report to alsa-devel@alsa-project.org\n"); 3216 dev_err(chip->card->dev,
3217 "broken or not working on your soundcard upon\n");
3218 dev_err(chip->card->dev,
3219 "this message please report to alsa-devel@alsa-project.org\n");
3201 3220
3202 return -EIO; 3221 return -EIO;
3203#endif 3222#endif
@@ -3266,13 +3285,13 @@ int snd_cs46xx_start_dsp(struct snd_cs46xx *chip)
3266 for (i = 0; i < CS46XX_DSP_MODULES; i++) { 3285 for (i = 0; i < CS46XX_DSP_MODULES; i++) {
3267 err = load_firmware(chip, &chip->modules[i], module_names[i]); 3286 err = load_firmware(chip, &chip->modules[i], module_names[i]);
3268 if (err < 0) { 3287 if (err < 0) {
3269 snd_printk(KERN_ERR "firmware load error [%s]\n", 3288 dev_err(chip->card->dev, "firmware load error [%s]\n",
3270 module_names[i]); 3289 module_names[i]);
3271 return err; 3290 return err;
3272 } 3291 }
3273 err = cs46xx_dsp_load_module(chip, chip->modules[i]); 3292 err = cs46xx_dsp_load_module(chip, chip->modules[i]);
3274 if (err < 0) { 3293 if (err < 0) {
3275 snd_printk(KERN_ERR "image download error [%s]\n", 3294 dev_err(chip->card->dev, "image download error [%s]\n",
3276 module_names[i]); 3295 module_names[i]);
3277 return err; 3296 return err;
3278 } 3297 }
@@ -3288,7 +3307,7 @@ int snd_cs46xx_start_dsp(struct snd_cs46xx *chip)
3288 /* old image */ 3307 /* old image */
3289 err = snd_cs46xx_download_image(chip); 3308 err = snd_cs46xx_download_image(chip);
3290 if (err < 0) { 3309 if (err < 0) {
3291 snd_printk(KERN_ERR "image download error\n"); 3310 dev_err(chip->card->dev, "image download error\n");
3292 return err; 3311 return err;
3293 } 3312 }
3294 3313
@@ -3341,7 +3360,7 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3341 u32 idx, valid_slots,tmp,powerdown = 0; 3360 u32 idx, valid_slots,tmp,powerdown = 0;
3342 u16 modem_power,pin_config,logic_type; 3361 u16 modem_power,pin_config,logic_type;
3343 3362
3344 snd_printdd ("cs46xx: cs46xx_setup_eapd_slot()+\n"); 3363 dev_dbg(chip->card->dev, "cs46xx_setup_eapd_slot()+\n");
3345 3364
3346 /* 3365 /*
3347 * See if the devices are powered down. If so, we must power them up first 3366 * See if the devices are powered down. If so, we must power them up first
@@ -3359,7 +3378,8 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3359 * stuff. 3378 * stuff.
3360 */ 3379 */
3361 if(chip->nr_ac97_codecs != 2) { 3380 if(chip->nr_ac97_codecs != 2) {
3362 snd_printk (KERN_ERR "cs46xx: cs46xx_setup_eapd_slot() - no secondary codec configured\n"); 3381 dev_err(chip->card->dev,
3382 "cs46xx_setup_eapd_slot() - no secondary codec configured\n");
3363 return -EINVAL; 3383 return -EINVAL;
3364 } 3384 }
3365 3385
@@ -3400,7 +3420,7 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3400 snd_cs46xx_pokeBA0(chip, BA0_ACOSV, valid_slots); 3420 snd_cs46xx_pokeBA0(chip, BA0_ACOSV, valid_slots);
3401 3421
3402 if ( cs46xx_wait_for_fifo(chip,1) ) { 3422 if ( cs46xx_wait_for_fifo(chip,1) ) {
3403 snd_printdd("FIFO is busy\n"); 3423 dev_dbg(chip->card->dev, "FIFO is busy\n");
3404 3424
3405 return -EINVAL; 3425 return -EINVAL;
3406 } 3426 }
@@ -3421,7 +3441,9 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3421 * Wait for command to complete 3441 * Wait for command to complete
3422 */ 3442 */
3423 if ( cs46xx_wait_for_fifo(chip,200) ) { 3443 if ( cs46xx_wait_for_fifo(chip,200) ) {
3424 snd_printdd("failed waiting for FIFO at addr (%02X)\n",idx); 3444 dev_dbg(chip->card->dev,
3445 "failed waiting for FIFO at addr (%02X)\n",
3446 idx);
3425 3447
3426 return -EINVAL; 3448 return -EINVAL;
3427 } 3449 }
@@ -3510,14 +3532,14 @@ static void amp_hercules(struct snd_cs46xx *chip, int change)
3510 3532
3511 chip->amplifier += change; 3533 chip->amplifier += change;
3512 if (chip->amplifier && !old) { 3534 if (chip->amplifier && !old) {
3513 snd_printdd ("Hercules amplifier ON\n"); 3535 dev_dbg(chip->card->dev, "Hercules amplifier ON\n");
3514 3536
3515 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, 3537 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR,
3516 EGPIODR_GPOE2 | val1); /* enable EGPIO2 output */ 3538 EGPIODR_GPOE2 | val1); /* enable EGPIO2 output */
3517 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, 3539 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR,
3518 EGPIOPTR_GPPT2 | val2); /* open-drain on output */ 3540 EGPIOPTR_GPPT2 | val2); /* open-drain on output */
3519 } else if (old && !chip->amplifier) { 3541 } else if (old && !chip->amplifier) {
3520 snd_printdd ("Hercules amplifier OFF\n"); 3542 dev_dbg(chip->card->dev, "Hercules amplifier OFF\n");
3521 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, val1 & ~EGPIODR_GPOE2); /* disable */ 3543 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, val1 & ~EGPIODR_GPOE2); /* disable */
3522 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, val2 & ~EGPIOPTR_GPPT2); /* disable */ 3544 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, val2 & ~EGPIOPTR_GPPT2); /* disable */
3523 } 3545 }
@@ -3525,7 +3547,7 @@ static void amp_hercules(struct snd_cs46xx *chip, int change)
3525 3547
3526static void voyetra_mixer_init (struct snd_cs46xx *chip) 3548static void voyetra_mixer_init (struct snd_cs46xx *chip)
3527{ 3549{
3528 snd_printdd ("initializing Voyetra mixer\n"); 3550 dev_dbg(chip->card->dev, "initializing Voyetra mixer\n");
3529 3551
3530 /* Enable SPDIF out */ 3552 /* Enable SPDIF out */
3531 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, EGPIODR_GPOE0); 3553 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, EGPIODR_GPOE0);
@@ -3543,7 +3565,7 @@ static void hercules_mixer_init (struct snd_cs46xx *chip)
3543 /* set EGPIO to default */ 3565 /* set EGPIO to default */
3544 hercules_init(chip); 3566 hercules_init(chip);
3545 3567
3546 snd_printdd ("initializing Hercules mixer\n"); 3568 dev_dbg(chip->card->dev, "initializing Hercules mixer\n");
3547 3569
3548#ifdef CONFIG_SND_CS46XX_NEW_DSP 3570#ifdef CONFIG_SND_CS46XX_NEW_DSP
3549 if (chip->in_suspend) 3571 if (chip->in_suspend)
@@ -3554,7 +3576,9 @@ static void hercules_mixer_init (struct snd_cs46xx *chip)
3554 3576
3555 kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip); 3577 kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip);
3556 if ((err = snd_ctl_add(card, kctl)) < 0) { 3578 if ((err = snd_ctl_add(card, kctl)) < 0) {
3557 printk (KERN_ERR "cs46xx: failed to initialize Hercules mixer (%d)\n",err); 3579 dev_err(card->dev,
3580 "failed to initialize Hercules mixer (%d)\n",
3581 err);
3558 break; 3582 break;
3559 } 3583 }
3560 } 3584 }
@@ -3826,8 +3850,7 @@ static int snd_cs46xx_resume(struct device *dev)
3826 pci_set_power_state(pci, PCI_D0); 3850 pci_set_power_state(pci, PCI_D0);
3827 pci_restore_state(pci); 3851 pci_restore_state(pci);
3828 if (pci_enable_device(pci) < 0) { 3852 if (pci_enable_device(pci) < 0) {
3829 printk(KERN_ERR "cs46xx: pci_enable_device failed, " 3853 dev_err(dev, "pci_enable_device failed, disabling device\n");
3830 "disabling device\n");
3831 snd_card_disconnect(card); 3854 snd_card_disconnect(card);
3832 return -EIO; 3855 return -EIO;
3833 } 3856 }
@@ -3932,7 +3955,8 @@ int snd_cs46xx_create(struct snd_card *card,
3932 chip->ba1_addr = pci_resource_start(pci, 1); 3955 chip->ba1_addr = pci_resource_start(pci, 1);
3933 if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 || 3956 if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 ||
3934 chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) { 3957 chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) {
3935 snd_printk(KERN_ERR "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", 3958 dev_err(chip->card->dev,
3959 "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n",
3936 chip->ba0_addr, chip->ba1_addr); 3960 chip->ba0_addr, chip->ba1_addr);
3937 snd_cs46xx_free(chip); 3961 snd_cs46xx_free(chip);
3938 return -ENOMEM; 3962 return -ENOMEM;
@@ -3969,7 +3993,8 @@ int snd_cs46xx_create(struct snd_card *card,
3969 3993
3970 for (cp = &cards[0]; cp->name; cp++) { 3994 for (cp = &cards[0]; cp->name; cp++) {
3971 if (cp->vendor == ss_vendor && cp->id == ss_card) { 3995 if (cp->vendor == ss_vendor && cp->id == ss_card) {
3972 snd_printdd ("hack for %s enabled\n", cp->name); 3996 dev_dbg(chip->card->dev, "hack for %s enabled\n",
3997 cp->name);
3973 3998
3974 chip->amplifier_ctrl = cp->amp; 3999 chip->amplifier_ctrl = cp->amp;
3975 chip->active_ctrl = cp->active; 4000 chip->active_ctrl = cp->active;
@@ -3982,12 +4007,14 @@ int snd_cs46xx_create(struct snd_card *card,
3982 } 4007 }
3983 4008
3984 if (external_amp) { 4009 if (external_amp) {
3985 snd_printk(KERN_INFO "Crystal EAPD support forced on.\n"); 4010 dev_info(chip->card->dev,
4011 "Crystal EAPD support forced on.\n");
3986 chip->amplifier_ctrl = amp_voyetra; 4012 chip->amplifier_ctrl = amp_voyetra;
3987 } 4013 }
3988 4014
3989 if (thinkpad) { 4015 if (thinkpad) {
3990 snd_printk(KERN_INFO "Activating CLKRUN hack for Thinkpad.\n"); 4016 dev_info(chip->card->dev,
4017 "Activating CLKRUN hack for Thinkpad.\n");
3991 chip->active_ctrl = clkrun_hack; 4018 chip->active_ctrl = clkrun_hack;
3992 clkrun_init(chip); 4019 clkrun_init(chip);
3993 } 4020 }
@@ -4005,14 +4032,16 @@ int snd_cs46xx_create(struct snd_card *card,
4005 region = &chip->region.idx[idx]; 4032 region = &chip->region.idx[idx];
4006 if ((region->resource = request_mem_region(region->base, region->size, 4033 if ((region->resource = request_mem_region(region->base, region->size,
4007 region->name)) == NULL) { 4034 region->name)) == NULL) {
4008 snd_printk(KERN_ERR "unable to request memory region 0x%lx-0x%lx\n", 4035 dev_err(chip->card->dev,
4036 "unable to request memory region 0x%lx-0x%lx\n",
4009 region->base, region->base + region->size - 1); 4037 region->base, region->base + region->size - 1);
4010 snd_cs46xx_free(chip); 4038 snd_cs46xx_free(chip);
4011 return -EBUSY; 4039 return -EBUSY;
4012 } 4040 }
4013 region->remap_addr = ioremap_nocache(region->base, region->size); 4041 region->remap_addr = ioremap_nocache(region->base, region->size);
4014 if (region->remap_addr == NULL) { 4042 if (region->remap_addr == NULL) {
4015 snd_printk(KERN_ERR "%s ioremap problem\n", region->name); 4043 dev_err(chip->card->dev,
4044 "%s ioremap problem\n", region->name);
4016 snd_cs46xx_free(chip); 4045 snd_cs46xx_free(chip);
4017 return -ENOMEM; 4046 return -ENOMEM;
4018 } 4047 }
@@ -4020,7 +4049,7 @@ int snd_cs46xx_create(struct snd_card *card,
4020 4049
4021 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED, 4050 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED,
4022 KBUILD_MODNAME, chip)) { 4051 KBUILD_MODNAME, chip)) {
4023 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 4052 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
4024 snd_cs46xx_free(chip); 4053 snd_cs46xx_free(chip);
4025 return -EBUSY; 4054 return -EBUSY;
4026 } 4055 }
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 1686b4f4c44f..1c4a0fb3ffef 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -85,12 +85,15 @@ static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32
85 address = (hival & 0x00FFF) << 5; 85 address = (hival & 0x00FFF) << 5;
86 address |= loval >> 15; 86 address |= loval >> 15;
87 87
88 snd_printdd("handle_wideop[1]: %05x:%05x addr %04x\n",hival,loval,address); 88 dev_dbg(chip->card->dev,
89 "handle_wideop[1]: %05x:%05x addr %04x\n",
90 hival, loval, address);
89 91
90 if ( !(address & 0x8000) ) { 92 if ( !(address & 0x8000) ) {
91 address += (ins->code.offset / 2) - overlay_begin_address; 93 address += (ins->code.offset / 2) - overlay_begin_address;
92 } else { 94 } else {
93 snd_printdd("handle_wideop[1]: ROM symbol not reallocated\n"); 95 dev_dbg(chip->card->dev,
96 "handle_wideop[1]: ROM symbol not reallocated\n");
94 } 97 }
95 98
96 hival &= 0xFF000; 99 hival &= 0xFF000;
@@ -102,8 +105,9 @@ static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32
102 address = (hival & 0x00FFF) << 5; 105 address = (hival & 0x00FFF) << 5;
103 address |= loval >> 15; 106 address |= loval >> 15;
104 107
105 snd_printdd("handle_wideop:[2] %05x:%05x addr %04x\n",hival,loval,address); 108 dev_dbg(chip->card->dev,
106 nreallocated ++; 109 "handle_wideop:[2] %05x:%05x addr %04x\n",
110 hival, loval, address); nreallocated++;
107 } /* wide_opcodes[j] == wide_op */ 111 } /* wide_opcodes[j] == wide_op */
108 } /* for */ 112 } /* for */
109 } /* mod_type == 0 ... */ 113 } /* mod_type == 0 ... */
@@ -113,7 +117,8 @@ static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32
113 ins->code.data[ins->code.size++] = hival; 117 ins->code.data[ins->code.size++] = hival;
114 } 118 }
115 119
116 snd_printdd("dsp_spos: %d instructions reallocated\n",nreallocated); 120 dev_dbg(chip->card->dev,
121 "dsp_spos: %d instructions reallocated\n", nreallocated);
117 return nreallocated; 122 return nreallocated;
118} 123}
119 124
@@ -157,7 +162,8 @@ static int add_symbols (struct snd_cs46xx * chip, struct dsp_module_desc * modul
157 162
158 for (i = 0;i < module->symbol_table.nsymbols; ++i) { 163 for (i = 0;i < module->symbol_table.nsymbols; ++i) {
159 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) { 164 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) {
160 snd_printk(KERN_ERR "dsp_spos: symbol table is full\n"); 165 dev_err(chip->card->dev,
166 "dsp_spos: symbol table is full\n");
161 return -ENOMEM; 167 return -ENOMEM;
162 } 168 }
163 169
@@ -176,8 +182,11 @@ static int add_symbols (struct snd_cs46xx * chip, struct dsp_module_desc * modul
176 182
177 ins->symbol_table.nsymbols++; 183 ins->symbol_table.nsymbols++;
178 } else { 184 } else {
179 /* if (0) printk ("dsp_spos: symbol <%s> duplicated, probably nothing wrong with that (Cirrus?)\n", 185#if 0
180 module->symbol_table.symbols[i].symbol_name); */ 186 dev_dbg(chip->card->dev,
187 "dsp_spos: symbol <%s> duplicated, probably nothing wrong with that (Cirrus?)\n",
188 module->symbol_table.symbols[i].symbol_name); */
189#endif
181 } 190 }
182 } 191 }
183 192
@@ -192,14 +201,15 @@ add_symbol (struct snd_cs46xx * chip, char * symbol_name, u32 address, int type)
192 int index; 201 int index;
193 202
194 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) { 203 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) {
195 snd_printk(KERN_ERR "dsp_spos: symbol table is full\n"); 204 dev_err(chip->card->dev, "dsp_spos: symbol table is full\n");
196 return NULL; 205 return NULL;
197 } 206 }
198 207
199 if (cs46xx_dsp_lookup_symbol(chip, 208 if (cs46xx_dsp_lookup_symbol(chip,
200 symbol_name, 209 symbol_name,
201 type) != NULL) { 210 type) != NULL) {
202 snd_printk(KERN_ERR "dsp_spos: symbol <%s> duplicated\n", symbol_name); 211 dev_err(chip->card->dev,
212 "dsp_spos: symbol <%s> duplicated\n", symbol_name);
203 return NULL; 213 return NULL;
204 } 214 }
205 215
@@ -305,19 +315,20 @@ static int dsp_load_parameter(struct snd_cs46xx *chip,
305 u32 doffset, dsize; 315 u32 doffset, dsize;
306 316
307 if (!parameter) { 317 if (!parameter) {
308 snd_printdd("dsp_spos: module got no parameter segment\n"); 318 dev_dbg(chip->card->dev,
319 "dsp_spos: module got no parameter segment\n");
309 return 0; 320 return 0;
310 } 321 }
311 322
312 doffset = (parameter->offset * 4 + DSP_PARAMETER_BYTE_OFFSET); 323 doffset = (parameter->offset * 4 + DSP_PARAMETER_BYTE_OFFSET);
313 dsize = parameter->size * 4; 324 dsize = parameter->size * 4;
314 325
315 snd_printdd("dsp_spos: " 326 dev_dbg(chip->card->dev,
316 "downloading parameter data to chip (%08x-%08x)\n", 327 "dsp_spos: downloading parameter data to chip (%08x-%08x)\n",
317 doffset,doffset + dsize); 328 doffset,doffset + dsize);
318 if (snd_cs46xx_download (chip, parameter->data, doffset, dsize)) { 329 if (snd_cs46xx_download (chip, parameter->data, doffset, dsize)) {
319 snd_printk(KERN_ERR "dsp_spos: " 330 dev_err(chip->card->dev,
320 "failed to download parameter data to DSP\n"); 331 "dsp_spos: failed to download parameter data to DSP\n");
321 return -EINVAL; 332 return -EINVAL;
322 } 333 }
323 return 0; 334 return 0;
@@ -329,18 +340,21 @@ static int dsp_load_sample(struct snd_cs46xx *chip,
329 u32 doffset, dsize; 340 u32 doffset, dsize;
330 341
331 if (!sample) { 342 if (!sample) {
332 snd_printdd("dsp_spos: module got no sample segment\n"); 343 dev_dbg(chip->card->dev,
344 "dsp_spos: module got no sample segment\n");
333 return 0; 345 return 0;
334 } 346 }
335 347
336 doffset = (sample->offset * 4 + DSP_SAMPLE_BYTE_OFFSET); 348 doffset = (sample->offset * 4 + DSP_SAMPLE_BYTE_OFFSET);
337 dsize = sample->size * 4; 349 dsize = sample->size * 4;
338 350
339 snd_printdd("dsp_spos: downloading sample data to chip (%08x-%08x)\n", 351 dev_dbg(chip->card->dev,
352 "dsp_spos: downloading sample data to chip (%08x-%08x)\n",
340 doffset,doffset + dsize); 353 doffset,doffset + dsize);
341 354
342 if (snd_cs46xx_download (chip,sample->data,doffset,dsize)) { 355 if (snd_cs46xx_download (chip,sample->data,doffset,dsize)) {
343 snd_printk(KERN_ERR "dsp_spos: failed to sample data to DSP\n"); 356 dev_err(chip->card->dev,
357 "dsp_spos: failed to sample data to DSP\n");
344 return -EINVAL; 358 return -EINVAL;
345 } 359 }
346 return 0; 360 return 0;
@@ -354,14 +368,16 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * m
354 int err; 368 int err;
355 369
356 if (ins->nmodules == DSP_MAX_MODULES - 1) { 370 if (ins->nmodules == DSP_MAX_MODULES - 1) {
357 snd_printk(KERN_ERR "dsp_spos: to many modules loaded into DSP\n"); 371 dev_err(chip->card->dev,
372 "dsp_spos: to many modules loaded into DSP\n");
358 return -ENOMEM; 373 return -ENOMEM;
359 } 374 }
360 375
361 snd_printdd("dsp_spos: loading module %s into DSP\n", module->module_name); 376 dev_dbg(chip->card->dev,
377 "dsp_spos: loading module %s into DSP\n", module->module_name);
362 378
363 if (ins->nmodules == 0) { 379 if (ins->nmodules == 0) {
364 snd_printdd("dsp_spos: clearing parameter area\n"); 380 dev_dbg(chip->card->dev, "dsp_spos: clearing parameter area\n");
365 snd_cs46xx_clear_BA1(chip, DSP_PARAMETER_BYTE_OFFSET, DSP_PARAMETER_BYTE_SIZE); 381 snd_cs46xx_clear_BA1(chip, DSP_PARAMETER_BYTE_OFFSET, DSP_PARAMETER_BYTE_SIZE);
366 } 382 }
367 383
@@ -371,7 +387,7 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * m
371 return err; 387 return err;
372 388
373 if (ins->nmodules == 0) { 389 if (ins->nmodules == 0) {
374 snd_printdd("dsp_spos: clearing sample area\n"); 390 dev_dbg(chip->card->dev, "dsp_spos: clearing sample area\n");
375 snd_cs46xx_clear_BA1(chip, DSP_SAMPLE_BYTE_OFFSET, DSP_SAMPLE_BYTE_SIZE); 391 snd_cs46xx_clear_BA1(chip, DSP_SAMPLE_BYTE_OFFSET, DSP_SAMPLE_BYTE_SIZE);
376 } 392 }
377 393
@@ -381,15 +397,17 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * m
381 return err; 397 return err;
382 398
383 if (ins->nmodules == 0) { 399 if (ins->nmodules == 0) {
384 snd_printdd("dsp_spos: clearing code area\n"); 400 dev_dbg(chip->card->dev, "dsp_spos: clearing code area\n");
385 snd_cs46xx_clear_BA1(chip, DSP_CODE_BYTE_OFFSET, DSP_CODE_BYTE_SIZE); 401 snd_cs46xx_clear_BA1(chip, DSP_CODE_BYTE_OFFSET, DSP_CODE_BYTE_SIZE);
386 } 402 }
387 403
388 if (code == NULL) { 404 if (code == NULL) {
389 snd_printdd("dsp_spos: module got no code segment\n"); 405 dev_dbg(chip->card->dev,
406 "dsp_spos: module got no code segment\n");
390 } else { 407 } else {
391 if (ins->code.offset + code->size > DSP_CODE_BYTE_SIZE) { 408 if (ins->code.offset + code->size > DSP_CODE_BYTE_SIZE) {
392 snd_printk(KERN_ERR "dsp_spos: no space available in DSP\n"); 409 dev_err(chip->card->dev,
410 "dsp_spos: no space available in DSP\n");
393 return -ENOMEM; 411 return -ENOMEM;
394 } 412 }
395 413
@@ -401,19 +419,22 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * m
401 if (snd_BUG_ON(!module->symbol_table.symbols)) 419 if (snd_BUG_ON(!module->symbol_table.symbols))
402 return -ENOMEM; 420 return -ENOMEM;
403 if (add_symbols(chip,module)) { 421 if (add_symbols(chip,module)) {
404 snd_printk(KERN_ERR "dsp_spos: failed to load symbol table\n"); 422 dev_err(chip->card->dev,
423 "dsp_spos: failed to load symbol table\n");
405 return -ENOMEM; 424 return -ENOMEM;
406 } 425 }
407 426
408 doffset = (code->offset * 4 + ins->code.offset * 4 + DSP_CODE_BYTE_OFFSET); 427 doffset = (code->offset * 4 + ins->code.offset * 4 + DSP_CODE_BYTE_OFFSET);
409 dsize = code->size * 4; 428 dsize = code->size * 4;
410 snd_printdd("dsp_spos: downloading code to chip (%08x-%08x)\n", 429 dev_dbg(chip->card->dev,
430 "dsp_spos: downloading code to chip (%08x-%08x)\n",
411 doffset,doffset + dsize); 431 doffset,doffset + dsize);
412 432
413 module->nfixups = shadow_and_reallocate_code(chip,code->data,code->size,module->overlay_begin_address); 433 module->nfixups = shadow_and_reallocate_code(chip,code->data,code->size,module->overlay_begin_address);
414 434
415 if (snd_cs46xx_download (chip,(ins->code.data + ins->code.offset),doffset,dsize)) { 435 if (snd_cs46xx_download (chip,(ins->code.data + ins->code.offset),doffset,dsize)) {
416 snd_printk(KERN_ERR "dsp_spos: failed to download code to DSP\n"); 436 dev_err(chip->card->dev,
437 "dsp_spos: failed to download code to DSP\n");
417 return -EINVAL; 438 return -EINVAL;
418 } 439 }
419 440
@@ -447,7 +468,7 @@ cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, int symb
447 } 468 }
448 469
449#if 0 470#if 0
450 printk ("dsp_spos: symbol <%s> type %02x not found\n", 471 dev_err(chip->card->dev, "dsp_spos: symbol <%s> type %02x not found\n",
451 symbol_name,symbol_type); 472 symbol_name,symbol_type);
452#endif 473#endif
453 474
@@ -910,7 +931,6 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
910} 931}
911#endif /* CONFIG_PROC_FS */ 932#endif /* CONFIG_PROC_FS */
912 933
913static int debug_tree;
914static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data, 934static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data,
915 u32 dest, int size) 935 u32 dest, int size)
916{ 936{
@@ -919,13 +939,13 @@ static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data,
919 int i; 939 int i;
920 940
921 for (i = 0; i < size; ++i) { 941 for (i = 0; i < size; ++i) {
922 if (debug_tree) printk ("addr %p, val %08x\n",spdst,task_data[i]); 942 dev_dbg(chip->card->dev, "addr %p, val %08x\n",
943 spdst, task_data[i]);
923 writel(task_data[i],spdst); 944 writel(task_data[i],spdst);
924 spdst += sizeof(u32); 945 spdst += sizeof(u32);
925 } 946 }
926} 947}
927 948
928static int debug_scb;
929static void _dsp_create_scb (struct snd_cs46xx *chip, u32 * scb_data, u32 dest) 949static void _dsp_create_scb (struct snd_cs46xx *chip, u32 * scb_data, u32 dest)
930{ 950{
931 void __iomem *spdst = chip->region.idx[1].remap_addr + 951 void __iomem *spdst = chip->region.idx[1].remap_addr +
@@ -933,7 +953,8 @@ static void _dsp_create_scb (struct snd_cs46xx *chip, u32 * scb_data, u32 dest)
933 int i; 953 int i;
934 954
935 for (i = 0; i < 0x10; ++i) { 955 for (i = 0; i < 0x10; ++i) {
936 if (debug_scb) printk ("addr %p, val %08x\n",spdst,scb_data[i]); 956 dev_dbg(chip->card->dev, "addr %p, val %08x\n",
957 spdst, scb_data[i]);
937 writel(scb_data[i],spdst); 958 writel(scb_data[i],spdst);
938 spdst += sizeof(u32); 959 spdst += sizeof(u32);
939 } 960 }
@@ -960,7 +981,8 @@ static struct dsp_scb_descriptor * _map_scb (struct snd_cs46xx *chip, char * nam
960 int index; 981 int index;
961 982
962 if (ins->nscb == DSP_MAX_SCB_DESC - 1) { 983 if (ins->nscb == DSP_MAX_SCB_DESC - 1) {
963 snd_printk(KERN_ERR "dsp_spos: got no place for other SCB\n"); 984 dev_err(chip->card->dev,
985 "dsp_spos: got no place for other SCB\n");
964 return NULL; 986 return NULL;
965 } 987 }
966 988
@@ -991,7 +1013,8 @@ _map_task_tree (struct snd_cs46xx *chip, char * name, u32 dest, u32 size)
991 struct dsp_task_descriptor * desc = NULL; 1013 struct dsp_task_descriptor * desc = NULL;
992 1014
993 if (ins->ntask == DSP_MAX_TASK_DESC - 1) { 1015 if (ins->ntask == DSP_MAX_TASK_DESC - 1) {
994 snd_printk(KERN_ERR "dsp_spos: got no place for other TASK\n"); 1016 dev_err(chip->card->dev,
1017 "dsp_spos: got no place for other TASK\n");
995 return NULL; 1018 return NULL;
996 } 1019 }
997 1020
@@ -1031,7 +1054,7 @@ cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32
1031 desc->data = scb_data; 1054 desc->data = scb_data;
1032 _dsp_create_scb(chip,scb_data,dest); 1055 _dsp_create_scb(chip,scb_data,dest);
1033 } else { 1056 } else {
1034 snd_printk(KERN_ERR "dsp_spos: failed to map SCB\n"); 1057 dev_err(chip->card->dev, "dsp_spos: failed to map SCB\n");
1035#ifdef CONFIG_PM_SLEEP 1058#ifdef CONFIG_PM_SLEEP
1036 kfree(scb_data); 1059 kfree(scb_data);
1037#endif 1060#endif
@@ -1052,7 +1075,7 @@ cs46xx_dsp_create_task_tree (struct snd_cs46xx *chip, char * name, u32 * task_da
1052 desc->data = task_data; 1075 desc->data = task_data;
1053 _dsp_create_task_tree(chip,task_data,dest,size); 1076 _dsp_create_task_tree(chip,task_data,dest,size);
1054 } else { 1077 } else {
1055 snd_printk(KERN_ERR "dsp_spos: failed to map TASK\n"); 1078 dev_err(chip->card->dev, "dsp_spos: failed to map TASK\n");
1056 } 1079 }
1057 1080
1058 return desc; 1081 return desc;
@@ -1105,31 +1128,36 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
1105 1128
1106 null_algorithm = cs46xx_dsp_lookup_symbol(chip, "NULLALGORITHM", SYMBOL_CODE); 1129 null_algorithm = cs46xx_dsp_lookup_symbol(chip, "NULLALGORITHM", SYMBOL_CODE);
1107 if (null_algorithm == NULL) { 1130 if (null_algorithm == NULL) {
1108 snd_printk(KERN_ERR "dsp_spos: symbol NULLALGORITHM not found\n"); 1131 dev_err(chip->card->dev,
1132 "dsp_spos: symbol NULLALGORITHM not found\n");
1109 return -EIO; 1133 return -EIO;
1110 } 1134 }
1111 1135
1112 fg_task_tree_header_code = cs46xx_dsp_lookup_symbol(chip, "FGTASKTREEHEADERCODE", SYMBOL_CODE); 1136 fg_task_tree_header_code = cs46xx_dsp_lookup_symbol(chip, "FGTASKTREEHEADERCODE", SYMBOL_CODE);
1113 if (fg_task_tree_header_code == NULL) { 1137 if (fg_task_tree_header_code == NULL) {
1114 snd_printk(KERN_ERR "dsp_spos: symbol FGTASKTREEHEADERCODE not found\n"); 1138 dev_err(chip->card->dev,
1139 "dsp_spos: symbol FGTASKTREEHEADERCODE not found\n");
1115 return -EIO; 1140 return -EIO;
1116 } 1141 }
1117 1142
1118 task_tree_header_code = cs46xx_dsp_lookup_symbol(chip, "TASKTREEHEADERCODE", SYMBOL_CODE); 1143 task_tree_header_code = cs46xx_dsp_lookup_symbol(chip, "TASKTREEHEADERCODE", SYMBOL_CODE);
1119 if (task_tree_header_code == NULL) { 1144 if (task_tree_header_code == NULL) {
1120 snd_printk(KERN_ERR "dsp_spos: symbol TASKTREEHEADERCODE not found\n"); 1145 dev_err(chip->card->dev,
1146 "dsp_spos: symbol TASKTREEHEADERCODE not found\n");
1121 return -EIO; 1147 return -EIO;
1122 } 1148 }
1123 1149
1124 task_tree_thread = cs46xx_dsp_lookup_symbol(chip, "TASKTREETHREAD", SYMBOL_CODE); 1150 task_tree_thread = cs46xx_dsp_lookup_symbol(chip, "TASKTREETHREAD", SYMBOL_CODE);
1125 if (task_tree_thread == NULL) { 1151 if (task_tree_thread == NULL) {
1126 snd_printk(KERN_ERR "dsp_spos: symbol TASKTREETHREAD not found\n"); 1152 dev_err(chip->card->dev,
1153 "dsp_spos: symbol TASKTREETHREAD not found\n");
1127 return -EIO; 1154 return -EIO;
1128 } 1155 }
1129 1156
1130 magic_snoop_task = cs46xx_dsp_lookup_symbol(chip, "MAGICSNOOPTASK", SYMBOL_CODE); 1157 magic_snoop_task = cs46xx_dsp_lookup_symbol(chip, "MAGICSNOOPTASK", SYMBOL_CODE);
1131 if (magic_snoop_task == NULL) { 1158 if (magic_snoop_task == NULL) {
1132 snd_printk(KERN_ERR "dsp_spos: symbol MAGICSNOOPTASK not found\n"); 1159 dev_err(chip->card->dev,
1160 "dsp_spos: symbol MAGICSNOOPTASK not found\n");
1133 return -EIO; 1161 return -EIO;
1134 } 1162 }
1135 1163
@@ -1476,7 +1504,7 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
1476 return 0; 1504 return 0;
1477 1505
1478 _fail_end: 1506 _fail_end:
1479 snd_printk(KERN_ERR "dsp_spos: failed to setup SCB's in DSP\n"); 1507 dev_err(chip->card->dev, "dsp_spos: failed to setup SCB's in DSP\n");
1480 return -EINVAL; 1508 return -EINVAL;
1481} 1509}
1482 1510
@@ -1491,18 +1519,21 @@ static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,
1491 1519
1492 s16_async_codec_input_task = cs46xx_dsp_lookup_symbol(chip, "S16_ASYNCCODECINPUTTASK", SYMBOL_CODE); 1520 s16_async_codec_input_task = cs46xx_dsp_lookup_symbol(chip, "S16_ASYNCCODECINPUTTASK", SYMBOL_CODE);
1493 if (s16_async_codec_input_task == NULL) { 1521 if (s16_async_codec_input_task == NULL) {
1494 snd_printk(KERN_ERR "dsp_spos: symbol S16_ASYNCCODECINPUTTASK not found\n"); 1522 dev_err(chip->card->dev,
1523 "dsp_spos: symbol S16_ASYNCCODECINPUTTASK not found\n");
1495 return -EIO; 1524 return -EIO;
1496 } 1525 }
1497 spdifo_task = cs46xx_dsp_lookup_symbol(chip, "SPDIFOTASK", SYMBOL_CODE); 1526 spdifo_task = cs46xx_dsp_lookup_symbol(chip, "SPDIFOTASK", SYMBOL_CODE);
1498 if (spdifo_task == NULL) { 1527 if (spdifo_task == NULL) {
1499 snd_printk(KERN_ERR "dsp_spos: symbol SPDIFOTASK not found\n"); 1528 dev_err(chip->card->dev,
1529 "dsp_spos: symbol SPDIFOTASK not found\n");
1500 return -EIO; 1530 return -EIO;
1501 } 1531 }
1502 1532
1503 spdifi_task = cs46xx_dsp_lookup_symbol(chip, "SPDIFITASK", SYMBOL_CODE); 1533 spdifi_task = cs46xx_dsp_lookup_symbol(chip, "SPDIFITASK", SYMBOL_CODE);
1504 if (spdifi_task == NULL) { 1534 if (spdifi_task == NULL) {
1505 snd_printk(KERN_ERR "dsp_spos: symbol SPDIFITASK not found\n"); 1535 dev_err(chip->card->dev,
1536 "dsp_spos: symbol SPDIFITASK not found\n");
1506 return -EIO; 1537 return -EIO;
1507 } 1538 }
1508 1539
@@ -1883,7 +1914,8 @@ int cs46xx_poke_via_dsp (struct snd_cs46xx *chip, u32 address, u32 data)
1883 } 1914 }
1884 1915
1885 if (i == 25) { 1916 if (i == 25) {
1886 snd_printk(KERN_ERR "dsp_spos: SPIOWriteTask not responding\n"); 1917 dev_err(chip->card->dev,
1918 "dsp_spos: SPIOWriteTask not responding\n");
1887 return -EBUSY; 1919 return -EBUSY;
1888 } 1920 }
1889 1921
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index 409e8764fbeb..8284bc9b5858 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -233,8 +233,11 @@ void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb)
233{ 233{
234 if (scb->proc_info) { 234 if (scb->proc_info) {
235 struct proc_scb_info * scb_info = scb->proc_info->private_data; 235 struct proc_scb_info * scb_info = scb->proc_info->private_data;
236 struct snd_cs46xx *chip = scb_info->chip;
236 237
237 snd_printdd("cs46xx_dsp_proc_free_scb_desc: freeing %s\n",scb->scb_name); 238 dev_dbg(chip->card->dev,
239 "cs46xx_dsp_proc_free_scb_desc: freeing %s\n",
240 scb->scb_name);
238 241
239 snd_info_free_entry(scb->proc_info); 242 snd_info_free_entry(scb->proc_info);
240 scb->proc_info = NULL; 243 scb->proc_info = NULL;
@@ -305,7 +308,7 @@ _dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u
305 scb_data[SCBfuncEntryPtr] &= 0xFFFF0000; 308 scb_data[SCBfuncEntryPtr] &= 0xFFFF0000;
306 scb_data[SCBfuncEntryPtr] |= task_entry->address; 309 scb_data[SCBfuncEntryPtr] |= task_entry->address;
307 310
308 snd_printdd("dsp_spos: creating SCB <%s>\n",name); 311 dev_dbg(chip->card->dev, "dsp_spos: creating SCB <%s>\n", name);
309 312
310 scb = cs46xx_dsp_create_scb(chip,name,scb_data,dest); 313 scb = cs46xx_dsp_create_scb(chip,name,scb_data,dest);
311 314
@@ -320,9 +323,15 @@ _dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u
320 /* update parent SCB */ 323 /* update parent SCB */
321 if (scb->parent_scb_ptr) { 324 if (scb->parent_scb_ptr) {
322#if 0 325#if 0
323 printk ("scb->parent_scb_ptr = %s\n",scb->parent_scb_ptr->scb_name); 326 dev_dbg(chip->card->dev,
324 printk ("scb->parent_scb_ptr->next_scb_ptr = %s\n",scb->parent_scb_ptr->next_scb_ptr->scb_name); 327 "scb->parent_scb_ptr = %s\n",
325 printk ("scb->parent_scb_ptr->sub_list_ptr = %s\n",scb->parent_scb_ptr->sub_list_ptr->scb_name); 328 scb->parent_scb_ptr->scb_name);
329 dev_dbg(chip->card->dev,
330 "scb->parent_scb_ptr->next_scb_ptr = %s\n",
331 scb->parent_scb_ptr->next_scb_ptr->scb_name);
332 dev_dbg(chip->card->dev,
333 "scb->parent_scb_ptr->sub_list_ptr = %s\n",
334 scb->parent_scb_ptr->sub_list_ptr->scb_name);
326#endif 335#endif
327 /* link to parent SCB */ 336 /* link to parent SCB */
328 if (scb_child_type == SCB_ON_PARENT_NEXT_SCB) { 337 if (scb_child_type == SCB_ON_PARENT_NEXT_SCB) {
@@ -368,7 +377,8 @@ cs46xx_dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_d
368 SYMBOL_CODE); 377 SYMBOL_CODE);
369 378
370 if (task_entry == NULL) { 379 if (task_entry == NULL) {
371 snd_printk (KERN_ERR "dsp_spos: symbol %s not found\n",task_entry_name); 380 dev_err(chip->card->dev,
381 "dsp_spos: symbol %s not found\n", task_entry_name);
372 return NULL; 382 return NULL;
373 } 383 }
374 384
@@ -582,7 +592,8 @@ cs46xx_dsp_create_pcm_reader_scb(struct snd_cs46xx * chip, char * scb_name,
582 SYMBOL_CODE); 592 SYMBOL_CODE);
583 593
584 if (ins->null_algorithm == NULL) { 594 if (ins->null_algorithm == NULL) {
585 snd_printk (KERN_ERR "dsp_spos: symbol NULLALGORITHM not found\n"); 595 dev_err(chip->card->dev,
596 "dsp_spos: symbol NULLALGORITHM not found\n");
586 return NULL; 597 return NULL;
587 } 598 }
588 } 599 }
@@ -612,7 +623,8 @@ cs46xx_dsp_create_src_task_scb(struct snd_cs46xx * chip, char * scb_name,
612 unsigned int phiIncr; 623 unsigned int phiIncr;
613 unsigned int correctionPerGOF, correctionPerSec; 624 unsigned int correctionPerGOF, correctionPerSec;
614 625
615 snd_printdd( "dsp_spos: setting %s rate to %u\n",scb_name,rate); 626 dev_dbg(chip->card->dev, "dsp_spos: setting %s rate to %u\n",
627 scb_name, rate);
616 628
617 /* 629 /*
618 * Compute the values used to drive the actual sample rate conversion. 630 * Compute the values used to drive the actual sample rate conversion.
@@ -670,7 +682,8 @@ cs46xx_dsp_create_src_task_scb(struct snd_cs46xx * chip, char * scb_name,
670 SYMBOL_CODE); 682 SYMBOL_CODE);
671 683
672 if (ins->s16_up == NULL) { 684 if (ins->s16_up == NULL) {
673 snd_printk (KERN_ERR "dsp_spos: symbol S16_UPSRC not found\n"); 685 dev_err(chip->card->dev,
686 "dsp_spos: symbol S16_UPSRC not found\n");
674 return NULL; 687 return NULL;
675 } 688 }
676 } 689 }
@@ -1265,7 +1278,7 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
1265 the Sample Rate Converted (which could 1278 the Sample Rate Converted (which could
1266 alter the raw data stream ...) */ 1279 alter the raw data stream ...) */
1267 if (sample_rate == 48000) { 1280 if (sample_rate == 48000) {
1268 snd_printdd ("IEC958 pass through\n"); 1281 dev_dbg(chip->card->dev, "IEC958 pass through\n");
1269 /* Hack to bypass creating a new SRC */ 1282 /* Hack to bypass creating a new SRC */
1270 pass_through = 1; 1283 pass_through = 1;
1271 } 1284 }
@@ -1299,13 +1312,14 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
1299 } 1312 }
1300 1313
1301 if (pcm_index == -1) { 1314 if (pcm_index == -1) {
1302 snd_printk (KERN_ERR "dsp_spos: no free PCM channel\n"); 1315 dev_err(chip->card->dev, "dsp_spos: no free PCM channel\n");
1303 return NULL; 1316 return NULL;
1304 } 1317 }
1305 1318
1306 if (src_scb == NULL) { 1319 if (src_scb == NULL) {
1307 if (ins->nsrc_scb >= DSP_MAX_SRC_NR) { 1320 if (ins->nsrc_scb >= DSP_MAX_SRC_NR) {
1308 snd_printk(KERN_ERR "dsp_spos: to many SRC instances\n!"); 1321 dev_err(chip->card->dev,
1322 "dsp_spos: to many SRC instances\n!");
1309 return NULL; 1323 return NULL;
1310 } 1324 }
1311 1325
@@ -1331,7 +1345,8 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
1331 1345
1332 snprintf (scb_name,DSP_MAX_SCB_NAME,"SrcTask_SCB%d",src_index); 1346 snprintf (scb_name,DSP_MAX_SCB_NAME,"SrcTask_SCB%d",src_index);
1333 1347
1334 snd_printdd( "dsp_spos: creating SRC \"%s\"\n",scb_name); 1348 dev_dbg(chip->card->dev,
1349 "dsp_spos: creating SRC \"%s\"\n", scb_name);
1335 src_scb = cs46xx_dsp_create_src_task_scb(chip,scb_name, 1350 src_scb = cs46xx_dsp_create_src_task_scb(chip,scb_name,
1336 sample_rate, 1351 sample_rate,
1337 src_output_buffer_addr[src_index], 1352 src_output_buffer_addr[src_index],
@@ -1343,7 +1358,8 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
1343 pass_through); 1358 pass_through);
1344 1359
1345 if (!src_scb) { 1360 if (!src_scb) {
1346 snd_printk (KERN_ERR "dsp_spos: failed to create SRCtaskSCB\n"); 1361 dev_err(chip->card->dev,
1362 "dsp_spos: failed to create SRCtaskSCB\n");
1347 return NULL; 1363 return NULL;
1348 } 1364 }
1349 1365
@@ -1355,8 +1371,8 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
1355 1371
1356 snprintf (scb_name,DSP_MAX_SCB_NAME,"PCMReader_SCB%d",pcm_index); 1372 snprintf (scb_name,DSP_MAX_SCB_NAME,"PCMReader_SCB%d",pcm_index);
1357 1373
1358 snd_printdd( "dsp_spos: creating PCM \"%s\" (%d)\n",scb_name, 1374 dev_dbg(chip->card->dev, "dsp_spos: creating PCM \"%s\" (%d)\n",
1359 pcm_channel_id); 1375 scb_name, pcm_channel_id);
1360 1376
1361 pcm_scb = cs46xx_dsp_create_pcm_reader_scb(chip,scb_name, 1377 pcm_scb = cs46xx_dsp_create_pcm_reader_scb(chip,scb_name,
1362 pcm_reader_buffer_addr[pcm_index], 1378 pcm_reader_buffer_addr[pcm_index],
@@ -1369,7 +1385,8 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
1369 ); 1385 );
1370 1386
1371 if (!pcm_scb) { 1387 if (!pcm_scb) {
1372 snd_printk (KERN_ERR "dsp_spos: failed to create PCMreaderSCB\n"); 1388 dev_err(chip->card->dev,
1389 "dsp_spos: failed to create PCMreaderSCB\n");
1373 return NULL; 1390 return NULL;
1374 } 1391 }
1375 1392
@@ -1419,7 +1436,8 @@ int cs46xx_dsp_pcm_channel_set_period (struct snd_cs46xx * chip,
1419 temp |= DMA_RQ_C1_SOURCE_MOD16; 1436 temp |= DMA_RQ_C1_SOURCE_MOD16;
1420 break; 1437 break;
1421 default: 1438 default:
1422 snd_printdd ("period size (%d) not supported by HW\n", period_size); 1439 dev_dbg(chip->card->dev,
1440 "period size (%d) not supported by HW\n", period_size);
1423 return -EINVAL; 1441 return -EINVAL;
1424 } 1442 }
1425 1443
@@ -1457,7 +1475,8 @@ int cs46xx_dsp_pcm_ostream_set_period (struct snd_cs46xx * chip,
1457 temp |= DMA_RQ_C1_DEST_MOD16; 1475 temp |= DMA_RQ_C1_DEST_MOD16;
1458 break; 1476 break;
1459 default: 1477 default:
1460 snd_printdd ("period size (%d) not supported by HW\n", period_size); 1478 dev_dbg(chip->card->dev,
1479 "period size (%d) not supported by HW\n", period_size);
1461 return -EINVAL; 1480 return -EINVAL;
1462 } 1481 }
1463 1482
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index 8037e8600a72..b4e0ff6a99a3 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -160,17 +160,17 @@ static int snd_cs5530_create(struct snd_card *card,
160 sb_base = 0x220 + 0x20 * (map & 3); 160 sb_base = 0x220 + 0x20 * (map & 3);
161 161
162 if (map & (1<<2)) 162 if (map & (1<<2))
163 printk(KERN_INFO "CS5530: XpressAudio at 0x%lx\n", sb_base); 163 dev_info(card->dev, "XpressAudio at 0x%lx\n", sb_base);
164 else { 164 else {
165 printk(KERN_ERR "Could not find XpressAudio!\n"); 165 dev_err(card->dev, "Could not find XpressAudio!\n");
166 snd_cs5530_free(chip); 166 snd_cs5530_free(chip);
167 return -ENODEV; 167 return -ENODEV;
168 } 168 }
169 169
170 if (map & (1<<5)) 170 if (map & (1<<5))
171 printk(KERN_INFO "CS5530: MPU at 0x300\n"); 171 dev_info(card->dev, "MPU at 0x300\n");
172 else if (map & (1<<6)) 172 else if (map & (1<<6))
173 printk(KERN_INFO "CS5530: MPU at 0x330\n"); 173 dev_info(card->dev, "MPU at 0x330\n");
174 174
175 irq = snd_cs5530_mixer_read(sb_base, 0x80) & 0x0F; 175 irq = snd_cs5530_mixer_read(sb_base, 0x80) & 0x0F;
176 dma8 = snd_cs5530_mixer_read(sb_base, 0x81); 176 dma8 = snd_cs5530_mixer_read(sb_base, 0x81);
@@ -182,7 +182,7 @@ static int snd_cs5530_create(struct snd_card *card,
182 else if (dma8 & 0x80) 182 else if (dma8 & 0x80)
183 dma16 = 7; 183 dma16 = 7;
184 else { 184 else {
185 printk(KERN_ERR "CS5530: No 16bit DMA enabled\n"); 185 dev_err(card->dev, "No 16bit DMA enabled\n");
186 snd_cs5530_free(chip); 186 snd_cs5530_free(chip);
187 return -ENODEV; 187 return -ENODEV;
188 } 188 }
@@ -194,7 +194,7 @@ static int snd_cs5530_create(struct snd_card *card,
194 else if (dma8 & 0x08) 194 else if (dma8 & 0x08)
195 dma8 = 3; 195 dma8 = 3;
196 else { 196 else {
197 printk(KERN_ERR "CS5530: No 8bit DMA enabled\n"); 197 dev_err(card->dev, "No 8bit DMA enabled\n");
198 snd_cs5530_free(chip); 198 snd_cs5530_free(chip);
199 return -ENODEV; 199 return -ENODEV;
200 } 200 }
@@ -208,32 +208,31 @@ static int snd_cs5530_create(struct snd_card *card,
208 else if (irq & 8) 208 else if (irq & 8)
209 irq = 10; 209 irq = 10;
210 else { 210 else {
211 printk(KERN_ERR "CS5530: SoundBlaster IRQ not set\n"); 211 dev_err(card->dev, "SoundBlaster IRQ not set\n");
212 snd_cs5530_free(chip); 212 snd_cs5530_free(chip);
213 return -ENODEV; 213 return -ENODEV;
214 } 214 }
215 215
216 printk(KERN_INFO "CS5530: IRQ: %d DMA8: %d DMA16: %d\n", irq, dma8, 216 dev_info(card->dev, "IRQ: %d DMA8: %d DMA16: %d\n", irq, dma8, dma16);
217 dma16);
218 217
219 err = snd_sbdsp_create(card, sb_base, irq, snd_sb16dsp_interrupt, dma8, 218 err = snd_sbdsp_create(card, sb_base, irq, snd_sb16dsp_interrupt, dma8,
220 dma16, SB_HW_CS5530, &chip->sb); 219 dma16, SB_HW_CS5530, &chip->sb);
221 if (err < 0) { 220 if (err < 0) {
222 printk(KERN_ERR "CS5530: Could not create SoundBlaster\n"); 221 dev_err(card->dev, "Could not create SoundBlaster\n");
223 snd_cs5530_free(chip); 222 snd_cs5530_free(chip);
224 return err; 223 return err;
225 } 224 }
226 225
227 err = snd_sb16dsp_pcm(chip->sb, 0, &chip->sb->pcm); 226 err = snd_sb16dsp_pcm(chip->sb, 0, &chip->sb->pcm);
228 if (err < 0) { 227 if (err < 0) {
229 printk(KERN_ERR "CS5530: Could not create PCM\n"); 228 dev_err(card->dev, "Could not create PCM\n");
230 snd_cs5530_free(chip); 229 snd_cs5530_free(chip);
231 return err; 230 return err;
232 } 231 }
233 232
234 err = snd_sbmixer_new(chip->sb); 233 err = snd_sbmixer_new(chip->sb);
235 if (err < 0) { 234 if (err < 0) {
236 printk(KERN_ERR "CS5530: Could not create Mixer\n"); 235 dev_err(card->dev, "Could not create Mixer\n");
237 snd_cs5530_free(chip); 236 snd_cs5530_free(chip);
238 return err; 237 return err;
239 } 238 }
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 051b3e28e341..edcbbda5c488 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -84,7 +84,8 @@ static void wait_till_cmd_acked(struct cs5535audio *cs5535au, unsigned long time
84 udelay(1); 84 udelay(1);
85 } while (--timeout); 85 } while (--timeout);
86 if (!timeout) 86 if (!timeout)
87 snd_printk(KERN_ERR "Failure writing to cs5535 codec\n"); 87 dev_err(cs5535au->card->dev,
88 "Failure writing to cs5535 codec\n");
88} 89}
89 90
90static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au, 91static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
@@ -109,8 +110,9 @@ static unsigned short snd_cs5535audio_codec_read(struct cs5535audio *cs5535au,
109 udelay(1); 110 udelay(1);
110 } while (--timeout); 111 } while (--timeout);
111 if (!timeout) 112 if (!timeout)
112 snd_printk(KERN_ERR "Failure reading codec reg 0x%x," 113 dev_err(cs5535au->card->dev,
113 "Last value=0x%x\n", reg, val); 114 "Failure reading codec reg 0x%x, Last value=0x%x\n",
115 reg, val);
114 116
115 return (unsigned short) val; 117 return (unsigned short) val;
116} 118}
@@ -168,7 +170,7 @@ static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
168 olpc_prequirks(card, &ac97); 170 olpc_prequirks(card, &ac97);
169 171
170 if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) { 172 if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
171 snd_printk(KERN_ERR "mixer failed\n"); 173 dev_err(card->dev, "mixer failed\n");
172 return err; 174 return err;
173 } 175 }
174 176
@@ -176,7 +178,7 @@ static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
176 178
177 err = olpc_quirks(card, cs5535au->ac97); 179 err = olpc_quirks(card, cs5535au->ac97);
178 if (err < 0) { 180 if (err < 0) {
179 snd_printk(KERN_ERR "olpc quirks failed\n"); 181 dev_err(card->dev, "olpc quirks failed\n");
180 return err; 182 return err;
181 } 183 }
182 184
@@ -194,8 +196,9 @@ static void process_bm0_irq(struct cs5535audio *cs5535au)
194 dma = cs5535au->playback_substream->runtime->private_data; 196 dma = cs5535au->playback_substream->runtime->private_data;
195 snd_pcm_period_elapsed(cs5535au->playback_substream); 197 snd_pcm_period_elapsed(cs5535au->playback_substream);
196 } else { 198 } else {
197 snd_printk(KERN_ERR "unexpected bm0 irq src, bm_stat=%x\n", 199 dev_err(cs5535au->card->dev,
198 bm_stat); 200 "unexpected bm0 irq src, bm_stat=%x\n",
201 bm_stat);
199 } 202 }
200} 203}
201 204
@@ -241,8 +244,9 @@ static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id)
241 process_bm1_irq(cs5535au); 244 process_bm1_irq(cs5535au);
242 break; 245 break;
243 default: 246 default:
244 snd_printk(KERN_ERR "Unexpected irq src: " 247 dev_err(cs5535au->card->dev,
245 "0x%x\n", acc_irq_stat); 248 "Unexpected irq src: 0x%x\n",
249 acc_irq_stat);
246 break; 250 break;
247 } 251 }
248 } 252 }
@@ -287,7 +291,7 @@ static int snd_cs5535audio_create(struct snd_card *card,
287 291
288 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 292 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
289 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 293 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
290 printk(KERN_WARNING "unable to get 32bit dma\n"); 294 dev_warn(card->dev, "unable to get 32bit dma\n");
291 err = -ENXIO; 295 err = -ENXIO;
292 goto pcifail; 296 goto pcifail;
293 } 297 }
@@ -312,7 +316,7 @@ static int snd_cs5535audio_create(struct snd_card *card,
312 316
313 if (request_irq(pci->irq, snd_cs5535audio_interrupt, 317 if (request_irq(pci->irq, snd_cs5535audio_interrupt,
314 IRQF_SHARED, KBUILD_MODNAME, cs5535au)) { 318 IRQF_SHARED, KBUILD_MODNAME, cs5535au)) {
315 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 319 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
316 err = -EBUSY; 320 err = -EBUSY;
317 goto sndfail; 321 goto sndfail;
318 } 322 }
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
index e6a44507d557..3b0fdaca8dc7 100644
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c
@@ -36,7 +36,8 @@ void olpc_analog_input(struct snd_ac97 *ac97, int on)
36 err = snd_ac97_update_bits(ac97, AC97_AD_TEST2, 36 err = snd_ac97_update_bits(ac97, AC97_AD_TEST2,
37 1 << AC97_AD_HPFD_SHIFT, on << AC97_AD_HPFD_SHIFT); 37 1 << AC97_AD_HPFD_SHIFT, on << AC97_AD_HPFD_SHIFT);
38 if (err < 0) { 38 if (err < 0) {
39 snd_printk(KERN_ERR "setting High Pass Filter - %d\n", err); 39 dev_err(ac97->bus->card->dev,
40 "setting High Pass Filter - %d\n", err);
40 return; 41 return;
41 } 42 }
42 43
@@ -58,7 +59,7 @@ void olpc_mic_bias(struct snd_ac97 *ac97, int on)
58 err = snd_ac97_update_bits(ac97, AC97_AD_MISC, 59 err = snd_ac97_update_bits(ac97, AC97_AD_MISC,
59 1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT); 60 1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT);
60 if (err < 0) 61 if (err < 0)
61 snd_printk(KERN_ERR "setting MIC Bias - %d\n", err); 62 dev_err(ac97->bus->card->dev, "setting MIC Bias - %d\n", err);
62} 63}
63 64
64static int olpc_dc_info(struct snd_kcontrol *kctl, 65static int olpc_dc_info(struct snd_kcontrol *kctl,
@@ -153,7 +154,7 @@ int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
153 return 0; 154 return 0;
154 155
155 if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) { 156 if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) {
156 printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n"); 157 dev_err(card->dev, "unable to allocate MIC GPIO\n");
157 return -EIO; 158 return -EIO;
158 } 159 }
159 gpio_direction_output(OLPC_GPIO_MIC_AC, 0); 160 gpio_direction_output(OLPC_GPIO_MIC_AC, 0);
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index 9ab01a7047cf..9c2dc911d8d7 100644
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -317,7 +317,7 @@ static int snd_cs5535audio_trigger(struct snd_pcm_substream *substream, int cmd)
317 dma->ops->disable_dma(cs5535au); 317 dma->ops->disable_dma(cs5535au);
318 break; 318 break;
319 default: 319 default:
320 snd_printk(KERN_ERR "unhandled trigger\n"); 320 dev_err(cs5535au->card->dev, "unhandled trigger\n");
321 err = -EINVAL; 321 err = -EINVAL;
322 break; 322 break;
323 } 323 }
@@ -335,13 +335,13 @@ static snd_pcm_uframes_t snd_cs5535audio_pcm_pointer(struct snd_pcm_substream
335 dma = substream->runtime->private_data; 335 dma = substream->runtime->private_data;
336 curdma = dma->ops->read_dma_pntr(cs5535au); 336 curdma = dma->ops->read_dma_pntr(cs5535au);
337 if (curdma < dma->buf_addr) { 337 if (curdma < dma->buf_addr) {
338 snd_printk(KERN_ERR "curdma=%x < %x bufaddr.\n", 338 dev_err(cs5535au->card->dev, "curdma=%x < %x bufaddr.\n",
339 curdma, dma->buf_addr); 339 curdma, dma->buf_addr);
340 return 0; 340 return 0;
341 } 341 }
342 curdma -= dma->buf_addr; 342 curdma -= dma->buf_addr;
343 if (curdma >= dma->buf_bytes) { 343 if (curdma >= dma->buf_bytes) {
344 snd_printk(KERN_ERR "diff=%x >= %x buf_bytes.\n", 344 dev_err(cs5535au->card->dev, "diff=%x >= %x buf_bytes.\n",
345 curdma, dma->buf_bytes); 345 curdma, dma->buf_bytes);
346 return 0; 346 return 0;
347 } 347 }
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c
index 6c34def5986d..34cc60057d0c 100644
--- a/sound/pci/cs5535audio/cs5535audio_pm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pm.c
@@ -74,7 +74,7 @@ static int snd_cs5535audio_suspend(struct device *dev)
74 snd_cs5535audio_stop_hardware(cs5535au); 74 snd_cs5535audio_stop_hardware(cs5535au);
75 75
76 if (pci_save_state(pci)) { 76 if (pci_save_state(pci)) {
77 printk(KERN_ERR "cs5535audio: pci_save_state failed!\n"); 77 dev_err(dev, "pci_save_state failed!\n");
78 return -EIO; 78 return -EIO;
79 } 79 }
80 pci_disable_device(pci); 80 pci_disable_device(pci);
@@ -94,8 +94,7 @@ static int snd_cs5535audio_resume(struct device *dev)
94 pci_set_power_state(pci, PCI_D0); 94 pci_set_power_state(pci, PCI_D0);
95 pci_restore_state(pci); 95 pci_restore_state(pci);
96 if (pci_enable_device(pci) < 0) { 96 if (pci_enable_device(pci) < 0) {
97 printk(KERN_ERR "cs5535audio: pci_enable_device failed, " 97 dev_err(dev, "pci_enable_device failed, disabling device\n");
98 "disabling device\n");
99 snd_card_disconnect(card); 98 snd_card_disconnect(card);
100 return -EIO; 99 return -EIO;
101 } 100 }
@@ -113,7 +112,7 @@ static int snd_cs5535audio_resume(struct device *dev)
113 } while (--timeout); 112 } while (--timeout);
114 113
115 if (!timeout) 114 if (!timeout)
116 snd_printk(KERN_ERR "Failure getting AC Link ready\n"); 115 dev_err(cs5535au->card->dev, "Failure getting AC Link ready\n");
117 116
118 /* set up rate regs, dma. actual initiation is done in trig */ 117 /* set up rate regs, dma. actual initiation is done in trig */
119 for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) { 118 for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) {
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 1ef77c0d39ec..166ec0c120d4 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -58,7 +58,8 @@ static int get_firmware(const struct firmware **fw_entry,
58 snprintf(name, sizeof(name), "ea/%s", card_fw[fw_index].data); 58 snprintf(name, sizeof(name), "ea/%s", card_fw[fw_index].data);
59 err = request_firmware(fw_entry, name, pci_device(chip)); 59 err = request_firmware(fw_entry, name, pci_device(chip));
60 if (err < 0) 60 if (err < 0)
61 snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); 61 dev_err(chip->card->dev,
62 "get_firmware(): Firmware not available (%d)\n", err);
62#ifdef CONFIG_PM_SLEEP 63#ifdef CONFIG_PM_SLEEP
63 else 64 else
64 chip->fw_cache[fw_index] = *fw_entry; 65 chip->fw_cache[fw_index] = *fw_entry;
@@ -563,7 +564,7 @@ static int init_engine(struct snd_pcm_substream *substream,
563 err = snd_pcm_lib_malloc_pages(substream, 564 err = snd_pcm_lib_malloc_pages(substream,
564 params_buffer_bytes(hw_params)); 565 params_buffer_bytes(hw_params));
565 if (err < 0) { 566 if (err < 0) {
566 snd_printk(KERN_ERR "malloc_pages err=%d\n", err); 567 dev_err(chip->card->dev, "malloc_pages err=%d\n", err);
567 spin_lock_irq(&chip->lock); 568 spin_lock_irq(&chip->lock);
568 free_pipes(chip, pipe); 569 free_pipes(chip, pipe);
569 spin_unlock_irq(&chip->lock); 570 spin_unlock_irq(&chip->lock);
@@ -1990,7 +1991,7 @@ static int snd_echo_create(struct snd_card *card,
1990 if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz, 1991 if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz,
1991 ECHOCARD_NAME)) == NULL) { 1992 ECHOCARD_NAME)) == NULL) {
1992 snd_echo_free(chip); 1993 snd_echo_free(chip);
1993 snd_printk(KERN_ERR "cannot get memory region\n"); 1994 dev_err(chip->card->dev, "cannot get memory region\n");
1994 return -EBUSY; 1995 return -EBUSY;
1995 } 1996 }
1996 chip->dsp_registers = (volatile u32 __iomem *) 1997 chip->dsp_registers = (volatile u32 __iomem *)
@@ -1999,7 +2000,7 @@ static int snd_echo_create(struct snd_card *card,
1999 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, 2000 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
2000 KBUILD_MODNAME, chip)) { 2001 KBUILD_MODNAME, chip)) {
2001 snd_echo_free(chip); 2002 snd_echo_free(chip);
2002 snd_printk(KERN_ERR "cannot grab irq\n"); 2003 dev_err(chip->card->dev, "cannot grab irq\n");
2003 return -EBUSY; 2004 return -EBUSY;
2004 } 2005 }
2005 chip->irq = pci->irq; 2006 chip->irq = pci->irq;
@@ -2012,7 +2013,7 @@ static int snd_echo_create(struct snd_card *card,
2012 sizeof(struct comm_page), 2013 sizeof(struct comm_page),
2013 &chip->commpage_dma_buf) < 0) { 2014 &chip->commpage_dma_buf) < 0) {
2014 snd_echo_free(chip); 2015 snd_echo_free(chip);
2015 snd_printk(KERN_ERR "cannot allocate the comm page\n"); 2016 dev_err(chip->card->dev, "cannot allocate the comm page\n");
2016 return -ENOMEM; 2017 return -ENOMEM;
2017 } 2018 }
2018 chip->comm_page_phys = chip->commpage_dma_buf.addr; 2019 chip->comm_page_phys = chip->commpage_dma_buf.addr;
@@ -2081,7 +2082,7 @@ static int snd_echo_probe(struct pci_dev *pci,
2081 chip->dsp_registers_phys, chip->irq); 2082 chip->dsp_registers_phys, chip->irq);
2082 2083
2083 if ((err = snd_echo_new_pcm(chip)) < 0) { 2084 if ((err = snd_echo_new_pcm(chip)) < 0) {
2084 snd_printk(KERN_ERR "new pcm error %d\n", err); 2085 dev_err(chip->card->dev, "new pcm error %d\n", err);
2085 snd_card_free(card); 2086 snd_card_free(card);
2086 return err; 2087 return err;
2087 } 2088 }
@@ -2089,7 +2090,7 @@ static int snd_echo_probe(struct pci_dev *pci,
2089#ifdef ECHOCARD_HAS_MIDI 2090#ifdef ECHOCARD_HAS_MIDI
2090 if (chip->has_midi) { /* Some Mia's do not have midi */ 2091 if (chip->has_midi) { /* Some Mia's do not have midi */
2091 if ((err = snd_echo_midi_create(card, chip)) < 0) { 2092 if ((err = snd_echo_midi_create(card, chip)) < 0) {
2092 snd_printk(KERN_ERR "new midi error %d\n", err); 2093 dev_err(chip->card->dev, "new midi error %d\n", err);
2093 snd_card_free(card); 2094 snd_card_free(card);
2094 return err; 2095 return err;
2095 } 2096 }
@@ -2188,14 +2189,14 @@ static int snd_echo_probe(struct pci_dev *pci,
2188 err = snd_card_register(card); 2189 err = snd_card_register(card);
2189 if (err < 0) 2190 if (err < 0)
2190 goto ctl_error; 2191 goto ctl_error;
2191 snd_printk(KERN_INFO "Card registered: %s\n", card->longname); 2192 dev_info(card->dev, "Card registered: %s\n", card->longname);
2192 2193
2193 pci_set_drvdata(pci, chip); 2194 pci_set_drvdata(pci, chip);
2194 dev++; 2195 dev++;
2195 return 0; 2196 return 0;
2196 2197
2197ctl_error: 2198ctl_error:
2198 snd_printk(KERN_ERR "new control error %d\n", err); 2199 dev_err(card->dev, "new control error %d\n", err);
2199 snd_card_free(card); 2200 snd_card_free(card);
2200 return err; 2201 return err;
2201} 2202}
@@ -2291,7 +2292,7 @@ static int snd_echo_resume(struct device *dev)
2291 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, 2292 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
2292 KBUILD_MODNAME, chip)) { 2293 KBUILD_MODNAME, chip)) {
2293 snd_echo_free(chip); 2294 snd_echo_free(chip);
2294 snd_printk(KERN_ERR "cannot grab irq\n"); 2295 dev_err(chip->card->dev, "cannot grab irq\n");
2295 return -EBUSY; 2296 return -EBUSY;
2296 } 2297 }
2297 chip->irq = pci->irq; 2298 chip->irq = pci->irq;
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c
index d8c670c9d62c..5a6a217b82e0 100644
--- a/sound/pci/echoaudio/echoaudio_dsp.c
+++ b/sound/pci/echoaudio/echoaudio_dsp.c
@@ -53,7 +53,7 @@ static int wait_handshake(struct echoaudio *chip)
53 udelay(1); 53 udelay(1);
54 } 54 }
55 55
56 snd_printk(KERN_ERR "wait_handshake(): Timeout waiting for DSP\n"); 56 dev_err(chip->card->dev, "wait_handshake(): Timeout waiting for DSP\n");
57 return -EBUSY; 57 return -EBUSY;
58} 58}
59 59
@@ -149,7 +149,8 @@ static int read_sn(struct echoaudio *chip)
149 149
150 for (i = 0; i < 5; i++) { 150 for (i = 0; i < 5; i++) {
151 if (read_dsp(chip, &sn[i])) { 151 if (read_dsp(chip, &sn[i])) {
152 snd_printk(KERN_ERR "Failed to read serial number\n"); 152 dev_err(chip->card->dev,
153 "Failed to read serial number\n");
153 return -EIO; 154 return -EIO;
154 } 155 }
155 } 156 }
@@ -184,7 +185,7 @@ static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic)
184 185
185 err = get_firmware(&fw, chip, asic); 186 err = get_firmware(&fw, chip, asic);
186 if (err < 0) { 187 if (err < 0) {
187 snd_printk(KERN_WARNING "Firmware not found !\n"); 188 dev_warn(chip->card->dev, "Firmware not found !\n");
188 return err; 189 return err;
189 } 190 }
190 191
@@ -247,7 +248,7 @@ static int install_resident_loader(struct echoaudio *chip)
247 248
248 i = get_firmware(&fw, chip, FW_361_LOADER); 249 i = get_firmware(&fw, chip, FW_361_LOADER);
249 if (i < 0) { 250 if (i < 0) {
250 snd_printk(KERN_WARNING "Firmware not found !\n"); 251 dev_warn(chip->card->dev, "Firmware not found !\n");
251 return i; 252 return i;
252 } 253 }
253 254
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c
index abfd51c2530e..7f4dfae0323a 100644
--- a/sound/pci/echoaudio/midi.c
+++ b/sound/pci/echoaudio/midi.c
@@ -221,7 +221,8 @@ static void snd_echo_midi_output_write(unsigned long data)
221 DE_MID(("Try to send %d bytes...\n", bytes)); 221 DE_MID(("Try to send %d bytes...\n", bytes));
222 sent = write_midi(chip, buf, bytes); 222 sent = write_midi(chip, buf, bytes);
223 if (sent < 0) { 223 if (sent < 0) {
224 snd_printk(KERN_ERR "write_midi() error %d\n", sent); 224 dev_err(chip->card->dev,
225 "write_midi() error %d\n", sent);
225 /* retry later */ 226 /* retry later */
226 sent = 9000; 227 sent = 9000;
227 chip->midi_full = 1; 228 chip->midi_full = 1;
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 5c0413b40dc3..ad9d9f8b48ed 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -170,7 +170,8 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
170 if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH, 170 if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH,
171 sizeof(struct snd_emu10k1_synth_arg), &wave) < 0 || 171 sizeof(struct snd_emu10k1_synth_arg), &wave) < 0 ||
172 wave == NULL) { 172 wave == NULL) {
173 snd_printk(KERN_WARNING "can't initialize Emu10k1 wavetable synth\n"); 173 dev_warn(emu->card->dev,
174 "can't initialize Emu10k1 wavetable synth\n");
174 } else { 175 } else {
175 struct snd_emu10k1_synth_arg *arg; 176 struct snd_emu10k1_synth_arg *arg;
176 arg = SNDRV_SEQ_DEVICE_ARGPTR(wave); 177 arg = SNDRV_SEQ_DEVICE_ARGPTR(wave);
@@ -247,8 +248,7 @@ static int snd_emu10k1_resume(struct device *dev)
247 pci_set_power_state(pci, PCI_D0); 248 pci_set_power_state(pci, PCI_D0);
248 pci_restore_state(pci); 249 pci_restore_state(pci);
249 if (pci_enable_device(pci) < 0) { 250 if (pci_enable_device(pci) < 0) {
250 printk(KERN_ERR "emu10k1: pci_enable_device failed, " 251 dev_err(dev, "pci_enable_device failed, disabling device\n");
251 "disabling device\n");
252 snd_card_disconnect(card); 252 snd_card_disconnect(card);
253 return -EIO; 253 return -EIO;
254 } 254 }
diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c
index cae36597aa71..3f3ef38d9b6e 100644
--- a/sound/pci/emu10k1/emu10k1_callback.c
+++ b/sound/pci/emu10k1/emu10k1_callback.c
@@ -105,7 +105,7 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw)
105 vp = &emu->voices[best[i].voice]; 105 vp = &emu->voices[best[i].voice];
106 if ((ch = vp->ch) < 0) { 106 if ((ch = vp->ch) < 0) {
107 /* 107 /*
108 printk(KERN_WARNING 108 dev_warn(emu->card->dev,
109 "synth_get_voice: ch < 0 (%d) ??", i); 109 "synth_get_voice: ch < 0 (%d) ??", i);
110 */ 110 */
111 continue; 111 continue;
@@ -339,7 +339,7 @@ start_voice(struct snd_emux_voice *vp)
339 return -EINVAL; 339 return -EINVAL;
340 emem->map_locked++; 340 emem->map_locked++;
341 if (snd_emu10k1_memblk_map(hw, emem) < 0) { 341 if (snd_emu10k1_memblk_map(hw, emem) < 0) {
342 /* printk(KERN_ERR "emu: cannot map!\n"); */ 342 /* dev_err(hw->card->devK, "emu: cannot map!\n"); */
343 return -ENOMEM; 343 return -ENOMEM;
344 } 344 }
345 mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1; 345 mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1;
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 75504da63613..229269788023 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
217 } 217 }
218 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ 218 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
219 /* Hacks for Alice3 to work independent of haP16V driver */ 219 /* Hacks for Alice3 to work independent of haP16V driver */
220 snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); 220 dev_info(emu->card->dev, "Audigy2 value: Special config.\n");
221 /* Setup SRCMulti_I2S SamplingRate */ 221 /* Setup SRCMulti_I2S SamplingRate */
222 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 222 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
223 tmp &= 0xfffff1ff; 223 tmp &= 0xfffff1ff;
@@ -723,7 +723,8 @@ static int emu1010_firmware_thread(void *data)
723 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { 723 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
724 /* Audio Dock attached */ 724 /* Audio Dock attached */
725 /* Return to Audio Dock programming mode */ 725 /* Return to Audio Dock programming mode */
726 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); 726 dev_info(emu->card->dev,
727 "emu1010: Loading Audio Dock Firmware\n");
727 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK); 728 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
728 729
729 if (!emu->dock_fw) { 730 if (!emu->dock_fw) {
@@ -756,19 +757,25 @@ static int emu1010_firmware_thread(void *data)
756 757
757 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); 758 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
758 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg); 759 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
759 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", reg); 760 dev_info(emu->card->dev,
761 "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n",
762 reg);
760 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ 763 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
761 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 764 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
762 snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg); 765 dev_info(emu->card->dev,
766 "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg);
763 if ((reg & 0x1f) != 0x15) { 767 if ((reg & 0x1f) != 0x15) {
764 /* FPGA failed to be programmed */ 768 /* FPGA failed to be programmed */
765 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", reg); 769 dev_info(emu->card->dev,
770 "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n",
771 reg);
766 continue; 772 continue;
767 } 773 }
768 snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); 774 dev_info(emu->card->dev,
775 "emu1010: Audio Dock Firmware loaded\n");
769 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); 776 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
770 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); 777 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
771 snd_printk(KERN_INFO "Audio Dock ver: %u.%u\n", 778 dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n",
772 tmp, tmp2); 779 tmp, tmp2);
773 /* Sync clocking between 1010 and Dock */ 780 /* Sync clocking between 1010 and Dock */
774 /* Allow DLL to settle */ 781 /* Allow DLL to settle */
@@ -777,7 +784,7 @@ static int emu1010_firmware_thread(void *data)
777 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 784 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
778 } 785 }
779 } 786 }
780 snd_printk(KERN_INFO "emu1010: firmware thread stopping\n"); 787 dev_info(emu->card->dev, "emu1010: firmware thread stopping\n");
781 return 0; 788 return 0;
782} 789}
783 790
@@ -818,7 +825,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
818 u32 tmp, tmp2, reg; 825 u32 tmp, tmp2, reg;
819 int err; 826 int err;
820 827
821 snd_printk(KERN_INFO "emu1010: Special config.\n"); 828 dev_info(emu->card->dev, "emu1010: Special config.\n");
822 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, 829 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
823 * Lock Sound Memory Cache, Lock Tank Memory Cache, 830 * Lock Sound Memory Cache, Lock Tank Memory Cache,
824 * Mute all codecs. 831 * Mute all codecs.
@@ -843,7 +850,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
843 850
844 /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ 851 /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
845 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 852 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
846 snd_printdd("reg1 = 0x%x\n", reg); 853 dev_dbg(emu->card->dev, "reg1 = 0x%x\n", reg);
847 if ((reg & 0x3f) == 0x15) { 854 if ((reg & 0x3f) == 0x15) {
848 /* FPGA netlist already present so clear it */ 855 /* FPGA netlist already present so clear it */
849 /* Return to programming mode */ 856 /* Return to programming mode */
@@ -851,13 +858,14 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
851 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02); 858 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
852 } 859 }
853 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 860 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
854 snd_printdd("reg2 = 0x%x\n", reg); 861 dev_dbg(emu->card->dev, "reg2 = 0x%x\n", reg);
855 if ((reg & 0x3f) == 0x15) { 862 if ((reg & 0x3f) == 0x15) {
856 /* FPGA failed to return to programming mode */ 863 /* FPGA failed to return to programming mode */
857 snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n"); 864 dev_info(emu->card->dev,
865 "emu1010: FPGA failed to return to programming mode\n");
858 return -ENODEV; 866 return -ENODEV;
859 } 867 }
860 snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg); 868 dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg);
861 869
862 if (!emu->firmware) { 870 if (!emu->firmware) {
863 const char *filename; 871 const char *filename;
@@ -880,16 +888,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
880 888
881 err = request_firmware(&emu->firmware, filename, &emu->pci->dev); 889 err = request_firmware(&emu->firmware, filename, &emu->pci->dev);
882 if (err != 0) { 890 if (err != 0) {
883 snd_printk(KERN_ERR "emu1010: firmware: %s not found. Err = %d\n", filename, err); 891 dev_info(emu->card->dev,
892 "emu1010: firmware: %s not found. Err = %d\n",
893 filename, err);
884 return err; 894 return err;
885 } 895 }
886 snd_printk(KERN_INFO "emu1010: firmware file = %s, size = 0x%zx\n", 896 dev_info(emu->card->dev,
897 "emu1010: firmware file = %s, size = 0x%zx\n",
887 filename, emu->firmware->size); 898 filename, emu->firmware->size);
888 } 899 }
889 900
890 err = snd_emu1010_load_firmware(emu, emu->firmware); 901 err = snd_emu1010_load_firmware(emu, emu->firmware);
891 if (err != 0) { 902 if (err != 0) {
892 snd_printk(KERN_INFO "emu1010: Loading Firmware failed\n"); 903 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n");
893 return err; 904 return err;
894 } 905 }
895 906
@@ -897,21 +908,23 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
897 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg); 908 snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
898 if ((reg & 0x3f) != 0x15) { 909 if ((reg & 0x3f) != 0x15) {
899 /* FPGA failed to be programmed */ 910 /* FPGA failed to be programmed */
900 snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg); 911 dev_info(emu->card->dev,
912 "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n",
913 reg);
901 return -ENODEV; 914 return -ENODEV;
902 } 915 }
903 916
904 snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); 917 dev_info(emu->card->dev, "emu1010: Hana Firmware loaded\n");
905 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); 918 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
906 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); 919 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
907 snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2); 920 dev_info(emu->card->dev, "emu1010: Hana version: %u.%u\n", tmp, tmp2);
908 /* Enable 48Volt power to Audio Dock */ 921 /* Enable 48Volt power to Audio Dock */
909 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); 922 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
910 923
911 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 924 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
912 snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg); 925 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg);
913 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 926 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
914 snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg); 927 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg);
915 snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp); 928 snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp);
916 /* Optical -> ADAT I/O */ 929 /* Optical -> ADAT I/O */
917 /* 0 : SPDIF 930 /* 0 : SPDIF
@@ -950,7 +963,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
950 snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00); 963 snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00);
951 964
952 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 965 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
953 snd_printk(KERN_INFO "emu1010: Card options3 = 0x%x\n", reg); 966 dev_info(emu->card->dev, "emu1010: Card options3 = 0x%x\n", reg);
954 /* Default WCLK set to 48kHz. */ 967 /* Default WCLK set to 48kHz. */
955 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00); 968 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00);
956 /* Word Clock source, Internal 48kHz x1 */ 969 /* Word Clock source, Internal 48kHz x1 */
@@ -1808,7 +1821,9 @@ int snd_emu10k1_create(struct snd_card *card,
1808 emu->revision = pci->revision; 1821 emu->revision = pci->revision;
1809 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); 1822 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
1810 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); 1823 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
1811 snd_printdd("vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n", pci->vendor, pci->device, emu->serial, emu->model); 1824 dev_dbg(card->dev,
1825 "vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n",
1826 pci->vendor, pci->device, emu->serial, emu->model);
1812 1827
1813 for (c = emu_chip_details; c->vendor; c++) { 1828 for (c = emu_chip_details; c->vendor; c++) {
1814 if (c->vendor == pci->vendor && c->device == pci->device) { 1829 if (c->vendor == pci->vendor && c->device == pci->device) {
@@ -1827,21 +1842,21 @@ int snd_emu10k1_create(struct snd_card *card,
1827 } 1842 }
1828 } 1843 }
1829 if (c->vendor == 0) { 1844 if (c->vendor == 0) {
1830 snd_printk(KERN_ERR "emu10k1: Card not recognised\n"); 1845 dev_err(card->dev, "emu10k1: Card not recognised\n");
1831 kfree(emu); 1846 kfree(emu);
1832 pci_disable_device(pci); 1847 pci_disable_device(pci);
1833 return -ENOENT; 1848 return -ENOENT;
1834 } 1849 }
1835 emu->card_capabilities = c; 1850 emu->card_capabilities = c;
1836 if (c->subsystem && !subsystem) 1851 if (c->subsystem && !subsystem)
1837 snd_printdd("Sound card name = %s\n", c->name); 1852 dev_dbg(card->dev, "Sound card name = %s\n", c->name);
1838 else if (subsystem) 1853 else if (subsystem)
1839 snd_printdd("Sound card name = %s, " 1854 dev_dbg(card->dev, "Sound card name = %s, "
1840 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. " 1855 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. "
1841 "Forced to subsystem = 0x%x\n", c->name, 1856 "Forced to subsystem = 0x%x\n", c->name,
1842 pci->vendor, pci->device, emu->serial, c->subsystem); 1857 pci->vendor, pci->device, emu->serial, c->subsystem);
1843 else 1858 else
1844 snd_printdd("Sound card name = %s, " 1859 dev_dbg(card->dev, "Sound card name = %s, "
1845 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n", 1860 "vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n",
1846 c->name, pci->vendor, pci->device, 1861 c->name, pci->vendor, pci->device,
1847 emu->serial); 1862 emu->serial);
@@ -1869,7 +1884,9 @@ int snd_emu10k1_create(struct snd_card *card,
1869 emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK; 1884 emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK;
1870 if (pci_set_dma_mask(pci, emu->dma_mask) < 0 || 1885 if (pci_set_dma_mask(pci, emu->dma_mask) < 0 ||
1871 pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) { 1886 pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) {
1872 snd_printk(KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n", emu->dma_mask); 1887 dev_err(card->dev,
1888 "architecture does not support PCI busmaster DMA with mask 0x%lx\n",
1889 emu->dma_mask);
1873 kfree(emu); 1890 kfree(emu);
1874 pci_disable_device(pci); 1891 pci_disable_device(pci);
1875 return -ENXIO; 1892 return -ENXIO;
diff --git a/sound/pci/emu10k1/emu10k1_patch.c b/sound/pci/emu10k1/emu10k1_patch.c
index 662a45876a8b..0e069aeab86d 100644
--- a/sound/pci/emu10k1/emu10k1_patch.c
+++ b/sound/pci/emu10k1/emu10k1_patch.c
@@ -50,7 +50,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
50 return -EINVAL; 50 return -EINVAL;
51 51
52 if (sp->v.size == 0) { 52 if (sp->v.size == 0) {
53 snd_printd("emu: rom font for sample %d\n", sp->v.sample); 53 dev_dbg(emu->card->dev,
54 "emu: rom font for sample %d\n", sp->v.sample);
54 return 0; 55 return 0;
55 } 56 }
56 57
@@ -92,7 +93,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
92 blocksize *= 2; 93 blocksize *= 2;
93 sp->block = snd_emu10k1_synth_alloc(emu, blocksize); 94 sp->block = snd_emu10k1_synth_alloc(emu, blocksize);
94 if (sp->block == NULL) { 95 if (sp->block == NULL) {
95 snd_printd("emu10k1: synth malloc failed (size=%d)\n", blocksize); 96 dev_dbg(emu->card->dev,
97 "synth malloc failed (size=%d)\n", blocksize);
96 /* not ENOMEM (for compatibility with OSS) */ 98 /* not ENOMEM (for compatibility with OSS) */
97 return -ENOSPC; 99 return -ENOSPC;
98 } 100 }
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 3988eaa778cf..efe017526977 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -369,7 +369,8 @@ static void snd_emu10k1x_pcm_interrupt(struct emu10k1x *emu, struct emu10k1x_voi
369 if (epcm->substream == NULL) 369 if (epcm->substream == NULL)
370 return; 370 return;
371#if 0 371#if 0
372 snd_printk(KERN_INFO "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", 372 dev_info(emu->card->dev,
373 "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
373 epcm->substream->ops->pointer(epcm->substream), 374 epcm->substream->ops->pointer(epcm->substream),
374 snd_pcm_lib_period_bytes(epcm->substream), 375 snd_pcm_lib_period_bytes(epcm->substream),
375 snd_pcm_lib_buffer_bytes(epcm->substream)); 376 snd_pcm_lib_buffer_bytes(epcm->substream));
@@ -487,7 +488,11 @@ static int snd_emu10k1x_pcm_trigger(struct snd_pcm_substream *substream,
487 int channel = epcm->voice->number; 488 int channel = epcm->voice->number;
488 int result = 0; 489 int result = 0;
489 490
490// snd_printk(KERN_INFO "trigger - emu10k1x = 0x%x, cmd = %i, pointer = %d\n", (int)emu, cmd, (int)substream->ops->pointer(substream)); 491 /*
492 dev_dbg(emu->card->dev,
493 "trigger - emu10k1x = 0x%x, cmd = %i, pointer = %d\n",
494 (int)emu, cmd, (int)substream->ops->pointer(substream));
495 */
491 496
492 switch (cmd) { 497 switch (cmd) {
493 case SNDRV_PCM_TRIGGER_START: 498 case SNDRV_PCM_TRIGGER_START:
@@ -826,7 +831,7 @@ static irqreturn_t snd_emu10k1x_interrupt(int irq, void *dev_id)
826 // acknowledge the interrupt if necessary 831 // acknowledge the interrupt if necessary
827 outl(status, chip->port + IPR); 832 outl(status, chip->port + IPR);
828 833
829 // snd_printk(KERN_INFO "interrupt %08x\n", status); 834 /* dev_dbg(chip->card->dev, "interrupt %08x\n", status); */
830 return IRQ_HANDLED; 835 return IRQ_HANDLED;
831} 836}
832 837
@@ -919,7 +924,7 @@ static int snd_emu10k1x_create(struct snd_card *card,
919 return err; 924 return err;
920 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 925 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
921 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 926 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
922 snd_printk(KERN_ERR "error to set 28bit mask DMA\n"); 927 dev_err(card->dev, "error to set 28bit mask DMA\n");
923 pci_disable_device(pci); 928 pci_disable_device(pci);
924 return -ENXIO; 929 return -ENXIO;
925 } 930 }
@@ -940,14 +945,15 @@ static int snd_emu10k1x_create(struct snd_card *card,
940 chip->port = pci_resource_start(pci, 0); 945 chip->port = pci_resource_start(pci, 0);
941 if ((chip->res_port = request_region(chip->port, 8, 946 if ((chip->res_port = request_region(chip->port, 8,
942 "EMU10K1X")) == NULL) { 947 "EMU10K1X")) == NULL) {
943 snd_printk(KERN_ERR "emu10k1x: cannot allocate the port 0x%lx\n", chip->port); 948 dev_err(card->dev, "cannot allocate the port 0x%lx\n",
949 chip->port);
944 snd_emu10k1x_free(chip); 950 snd_emu10k1x_free(chip);
945 return -EBUSY; 951 return -EBUSY;
946 } 952 }
947 953
948 if (request_irq(pci->irq, snd_emu10k1x_interrupt, 954 if (request_irq(pci->irq, snd_emu10k1x_interrupt,
949 IRQF_SHARED, KBUILD_MODNAME, chip)) { 955 IRQF_SHARED, KBUILD_MODNAME, chip)) {
950 snd_printk(KERN_ERR "emu10k1x: cannot grab irq %d\n", pci->irq); 956 dev_err(card->dev, "cannot grab irq %d\n", pci->irq);
951 snd_emu10k1x_free(chip); 957 snd_emu10k1x_free(chip);
952 return -EBUSY; 958 return -EBUSY;
953 } 959 }
@@ -964,7 +970,7 @@ static int snd_emu10k1x_create(struct snd_card *card,
964 chip->revision = pci->revision; 970 chip->revision = pci->revision;
965 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 971 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
966 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 972 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
967 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, 973 dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n", chip->model,
968 chip->revision, chip->serial); 974 chip->revision, chip->serial);
969 975
970 outl(0, chip->port + INTE); 976 outl(0, chip->port + INTE);
@@ -1248,7 +1254,9 @@ static void mpu401_clear_rx(struct emu10k1x *emu, struct emu10k1x_midi *mpu)
1248 mpu401_read_data(emu, mpu); 1254 mpu401_read_data(emu, mpu);
1249#ifdef CONFIG_SND_DEBUG 1255#ifdef CONFIG_SND_DEBUG
1250 if (timeout <= 0) 1256 if (timeout <= 0)
1251 snd_printk(KERN_ERR "cmd: clear rx timeout (status = 0x%x)\n", mpu401_read_stat(emu, mpu)); 1257 dev_err(emu->card->dev,
1258 "cmd: clear rx timeout (status = 0x%x)\n",
1259 mpu401_read_stat(emu, mpu));
1252#endif 1260#endif
1253} 1261}
1254 1262
@@ -1322,7 +1330,8 @@ static int snd_emu10k1x_midi_cmd(struct emu10k1x * emu,
1322 } 1330 }
1323 spin_unlock_irqrestore(&midi->input_lock, flags); 1331 spin_unlock_irqrestore(&midi->input_lock, flags);
1324 if (!ok) { 1332 if (!ok) {
1325 snd_printk(KERN_ERR "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n", 1333 dev_err(emu->card->dev,
1334 "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n",
1326 cmd, emu->port, 1335 cmd, emu->port,
1327 mpu401_read_stat(emu, midi), 1336 mpu401_read_stat(emu, midi),
1328 mpu401_read_data(emu, midi)); 1337 mpu401_read_data(emu, midi));
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 1f9c7c4bbcd8..745f0627c634 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -1547,7 +1547,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1547 /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */ 1547 /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */
1548 if (emu->card_capabilities->emu_model) { 1548 if (emu->card_capabilities->emu_model) {
1549 /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */ 1549 /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */
1550 snd_printk(KERN_INFO "EMU outputs on\n"); 1550 dev_info(emu->card->dev, "EMU outputs on\n");
1551 for (z = 0; z < 8; z++) { 1551 for (z = 0; z < 8; z++) {
1552 if (emu->card_capabilities->ca0108_chip) { 1552 if (emu->card_capabilities->ca0108_chip) {
1553 A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000); 1553 A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000);
@@ -1571,7 +1571,9 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1571 A_SWITCH(icode, &ptr, tmp + 1, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, tmp + 1); 1571 A_SWITCH(icode, &ptr, tmp + 1, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, tmp + 1);
1572 if ((z==1) && (emu->card_capabilities->spdif_bug)) { 1572 if ((z==1) && (emu->card_capabilities->spdif_bug)) {
1573 /* Due to a SPDIF output bug on some Audigy cards, this code delays the Right channel by 1 sample */ 1573 /* Due to a SPDIF output bug on some Audigy cards, this code delays the Right channel by 1 sample */
1574 snd_printk(KERN_INFO "Installing spdif_bug patch: %s\n", emu->card_capabilities->name); 1574 dev_info(emu->card->dev,
1575 "Installing spdif_bug patch: %s\n",
1576 emu->card_capabilities->name);
1575 A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(gpr - 3), A_C_00000000, A_C_00000000); 1577 A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(gpr - 3), A_C_00000000, A_C_00000000);
1576 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 3), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); 1578 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 3), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000);
1577 } else { 1579 } else {
@@ -1595,7 +1597,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1595 1597
1596 if (emu->card_capabilities->emu_model) { 1598 if (emu->card_capabilities->emu_model) {
1597 if (emu->card_capabilities->ca0108_chip) { 1599 if (emu->card_capabilities->ca0108_chip) {
1598 snd_printk(KERN_INFO "EMU2 inputs on\n"); 1600 dev_info(emu->card->dev, "EMU2 inputs on\n");
1599 for (z = 0; z < 0x10; z++) { 1601 for (z = 0; z < 0x10; z++) {
1600 snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, 1602 snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp,
1601 bit_shifter16, 1603 bit_shifter16,
@@ -1603,11 +1605,11 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1603 A_FXBUS2(z*2) ); 1605 A_FXBUS2(z*2) );
1604 } 1606 }
1605 } else { 1607 } else {
1606 snd_printk(KERN_INFO "EMU inputs on\n"); 1608 dev_info(emu->card->dev, "EMU inputs on\n");
1607 /* Capture 16 (originally 8) channels of S32_LE sound */ 1609 /* Capture 16 (originally 8) channels of S32_LE sound */
1608 1610
1609 /* 1611 /*
1610 printk(KERN_DEBUG "emufx.c: gpr=0x%x, tmp=0x%x\n", 1612 dev_dbg(emu->card->dev, "emufx.c: gpr=0x%x, tmp=0x%x\n",
1611 gpr, tmp); 1613 gpr, tmp);
1612 */ 1614 */
1613 /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */ 1615 /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index f6c3da0d377d..c5ae2a24d8a5 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -1853,8 +1853,10 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
1853 if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) { 1853 if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) {
1854 if (emu->card_capabilities->ac97_chip == 1) 1854 if (emu->card_capabilities->ac97_chip == 1)
1855 return err; 1855 return err;
1856 snd_printd(KERN_INFO "emu10k1: AC97 is optional on this board\n"); 1856 dev_info(emu->card->dev,
1857 snd_printd(KERN_INFO" Proceeding without ac97 mixers...\n"); 1857 "AC97 is optional on this board\n");
1858 dev_info(emu->card->dev,
1859 "Proceeding without ac97 mixers...\n");
1858 snd_device_free(emu->card, pbus); 1860 snd_device_free(emu->card, pbus);
1859 goto no_ac97; /* FIXME: get rid of ugly gotos.. */ 1861 goto no_ac97; /* FIXME: get rid of ugly gotos.. */
1860 } 1862 }
diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c
index 1ec91246dfee..fdf2b0ada489 100644
--- a/sound/pci/emu10k1/emumpu401.c
+++ b/sound/pci/emu10k1/emumpu401.c
@@ -64,7 +64,9 @@ static void mpu401_clear_rx(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *mp
64 mpu401_read_data(emu, mpu); 64 mpu401_read_data(emu, mpu);
65#ifdef CONFIG_SND_DEBUG 65#ifdef CONFIG_SND_DEBUG
66 if (timeout <= 0) 66 if (timeout <= 0)
67 snd_printk(KERN_ERR "cmd: clear rx timeout (status = 0x%x)\n", mpu401_read_stat(emu, mpu)); 67 dev_err(emu->card->dev,
68 "cmd: clear rx timeout (status = 0x%x)\n",
69 mpu401_read_stat(emu, mpu));
68#endif 70#endif
69} 71}
70 72
@@ -141,7 +143,8 @@ static int snd_emu10k1_midi_cmd(struct snd_emu10k1 * emu, struct snd_emu10k1_mid
141 } 143 }
142 spin_unlock_irqrestore(&midi->input_lock, flags); 144 spin_unlock_irqrestore(&midi->input_lock, flags);
143 if (!ok) { 145 if (!ok) {
144 snd_printk(KERN_ERR "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n", 146 dev_err(emu->card->dev,
147 "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n",
145 cmd, emu->port, 148 cmd, emu->port,
146 mpu401_read_stat(emu, midi), 149 mpu401_read_stat(emu, midi),
147 mpu401_read_data(emu, midi)); 150 mpu401_read_data(emu, midi));
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 5ae1d045bdcb..f82481bd2542 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -44,7 +44,8 @@ static void snd_emu10k1_pcm_interrupt(struct snd_emu10k1 *emu,
44 if (epcm->substream == NULL) 44 if (epcm->substream == NULL)
45 return; 45 return;
46#if 0 46#if 0
47 printk(KERN_DEBUG "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", 47 dev_dbg(emu->card->dev,
48 "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
48 epcm->substream->runtime->hw->pointer(emu, epcm->substream), 49 epcm->substream->runtime->hw->pointer(emu, epcm->substream),
49 snd_pcm_lib_period_bytes(epcm->substream), 50 snd_pcm_lib_period_bytes(epcm->substream),
50 snd_pcm_lib_buffer_bytes(epcm->substream)); 51 snd_pcm_lib_buffer_bytes(epcm->substream));
@@ -147,7 +148,7 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic
147 &epcm->extra); 148 &epcm->extra);
148 if (err < 0) { 149 if (err < 0) {
149 /* 150 /*
150 printk(KERN_DEBUG "pcm_channel_alloc: " 151 dev_dbg(emu->card->dev, "pcm_channel_alloc: "
151 "failed extra: voices=%d, frame=%d\n", 152 "failed extra: voices=%d, frame=%d\n",
152 voices, frame); 153 voices, frame);
153 */ 154 */
@@ -761,7 +762,8 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
761 int result = 0; 762 int result = 0;
762 763
763 /* 764 /*
764 printk(KERN_DEBUG "trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", 765 dev_dbg(emu->card->dev,
766 "trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n",
765 (int)emu, cmd, substream->ops->pointer(substream)) 767 (int)emu, cmd, substream->ops->pointer(substream))
766 */ 768 */
767 spin_lock(&emu->reg_lock); 769 spin_lock(&emu->reg_lock);
@@ -815,7 +817,7 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream,
815 outl(epcm->capture_ipr, emu->port + IPR); 817 outl(epcm->capture_ipr, emu->port + IPR);
816 snd_emu10k1_intr_enable(emu, epcm->capture_inte); 818 snd_emu10k1_intr_enable(emu, epcm->capture_inte);
817 /* 819 /*
818 printk(KERN_DEBUG "adccr = 0x%x, adcbs = 0x%x\n", 820 dev_dbg(emu->card->dev, "adccr = 0x%x, adcbs = 0x%x\n",
819 epcm->adccr, epcm->adcbs); 821 epcm->adccr, epcm->adcbs);
820 */ 822 */
821 switch (epcm->type) { 823 switch (epcm->type) {
@@ -826,7 +828,10 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream,
826 if (emu->audigy) { 828 if (emu->audigy) {
827 snd_emu10k1_ptr_write(emu, A_FXWC1, 0, epcm->capture_cr_val); 829 snd_emu10k1_ptr_write(emu, A_FXWC1, 0, epcm->capture_cr_val);
828 snd_emu10k1_ptr_write(emu, A_FXWC2, 0, epcm->capture_cr_val2); 830 snd_emu10k1_ptr_write(emu, A_FXWC2, 0, epcm->capture_cr_val2);
829 snd_printdd("cr_val=0x%x, cr_val2=0x%x\n", epcm->capture_cr_val, epcm->capture_cr_val2); 831 dev_dbg(emu->card->dev,
832 "cr_val=0x%x, cr_val2=0x%x\n",
833 epcm->capture_cr_val,
834 epcm->capture_cr_val2);
830 } else 835 } else
831 snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val); 836 snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val);
832 break; 837 break;
@@ -889,7 +894,7 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream *
889 } 894 }
890#endif 895#endif
891 /* 896 /*
892 printk(KERN_DEBUG 897 dev_dbg(emu->card->dev,
893 "ptr = 0x%lx, buffer_size = 0x%lx, period_size = 0x%lx\n", 898 "ptr = 0x%lx, buffer_size = 0x%lx, period_size = 0x%lx\n",
894 (long)ptr, (long)runtime->buffer_size, 899 (long)ptr, (long)runtime->buffer_size,
895 (long)runtime->period_size); 900 (long)runtime->period_size);
@@ -1594,7 +1599,8 @@ static void snd_emu10k1_fx8010_playback_tram_poke1(unsigned short *dst_left,
1594 unsigned int tram_shift) 1599 unsigned int tram_shift)
1595{ 1600{
1596 /* 1601 /*
1597 printk(KERN_DEBUG "tram_poke1: dst_left = 0x%p, dst_right = 0x%p, " 1602 dev_dbg(emu->card->dev,
1603 "tram_poke1: dst_left = 0x%p, dst_right = 0x%p, "
1598 "src = 0x%p, count = 0x%x\n", 1604 "src = 0x%p, count = 0x%x\n",
1599 dst_left, dst_right, src, count); 1605 dst_left, dst_right, src, count);
1600 */ 1606 */
@@ -1675,7 +1681,7 @@ static int snd_emu10k1_fx8010_playback_prepare(struct snd_pcm_substream *substre
1675 unsigned int i; 1681 unsigned int i;
1676 1682
1677 /* 1683 /*
1678 printk(KERN_DEBUG "prepare: etram_pages = 0x%p, dma_area = 0x%x, " 1684 dev_dbg(emu->card->dev, "prepare: etram_pages = 0x%p, dma_area = 0x%x, "
1679 "buffer_size = 0x%x (0x%x)\n", 1685 "buffer_size = 0x%x (0x%x)\n",
1680 emu->fx8010.etram_pages, runtime->dma_area, 1686 emu->fx8010.etram_pages, runtime->dma_area,
1681 runtime->buffer_size, runtime->buffer_size << 2); 1687 runtime->buffer_size, runtime->buffer_size << 2);
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c
index e4fba49fee4a..81c75b4528d9 100644
--- a/sound/pci/emu10k1/io.c
+++ b/sound/pci/emu10k1/io.c
@@ -72,7 +72,7 @@ void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned i
72 unsigned int mask; 72 unsigned int mask;
73 73
74 if (!emu) { 74 if (!emu) {
75 snd_printk(KERN_ERR "ptr_write: emu is null!\n"); 75 dev_err(emu->card->dev, "ptr_write: emu is null!\n");
76 dump_stack(); 76 dump_stack();
77 return; 77 return;
78 } 78 }
@@ -199,7 +199,7 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu,
199 int err = 0; 199 int err = 0;
200 200
201 if ((reg > 0x7f) || (value > 0x1ff)) { 201 if ((reg > 0x7f) || (value > 0x1ff)) {
202 snd_printk(KERN_ERR "i2c_write: invalid values.\n"); 202 dev_err(emu->card->dev, "i2c_write: invalid values.\n");
203 return -EINVAL; 203 return -EINVAL;
204 } 204 }
205 205
@@ -227,7 +227,7 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu,
227 break; 227 break;
228 228
229 if (timeout > 1000) { 229 if (timeout > 1000) {
230 snd_printk(KERN_WARNING 230 dev_warn(emu->card->dev,
231 "emu10k1:I2C:timeout status=0x%x\n", 231 "emu10k1:I2C:timeout status=0x%x\n",
232 status); 232 status);
233 break; 233 break;
@@ -239,8 +239,8 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu,
239 } 239 }
240 240
241 if (retry == 10) { 241 if (retry == 10) {
242 snd_printk(KERN_ERR "Writing to ADC failed!\n"); 242 dev_err(emu->card->dev, "Writing to ADC failed!\n");
243 snd_printk(KERN_ERR "status=0x%x, reg=%d, value=%d\n", 243 dev_err(emu->card->dev, "status=0x%x, reg=%d, value=%d\n",
244 status, reg, value); 244 status, reg, value);
245 /* dump_stack(); */ 245 /* dump_stack(); */
246 err = -EINVAL; 246 err = -EINVAL;
diff --git a/sound/pci/emu10k1/irq.c b/sound/pci/emu10k1/irq.c
index 30bfed6f8339..3c5c5e3dc2d9 100644
--- a/sound/pci/emu10k1/irq.c
+++ b/sound/pci/emu10k1/irq.c
@@ -41,11 +41,12 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id)
41 orig_status = status; 41 orig_status = status;
42 handled = 1; 42 handled = 1;
43 if ((status & 0xffffffff) == 0xffffffff) { 43 if ((status & 0xffffffff) == 0xffffffff) {
44 snd_printk(KERN_INFO "snd-emu10k1: Suspected sound card removal\n"); 44 dev_info(emu->card->dev,
45 "Suspected sound card removal\n");
45 break; 46 break;
46 } 47 }
47 if (status & IPR_PCIERROR) { 48 if (status & IPR_PCIERROR) {
48 snd_printk(KERN_ERR "interrupt: PCI error\n"); 49 dev_err(emu->card->dev, "interrupt: PCI error\n");
49 snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE); 50 snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE);
50 status &= ~IPR_PCIERROR; 51 status &= ~IPR_PCIERROR;
51 } 52 }
@@ -157,19 +158,22 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id)
157 struct snd_emu10k1_voice *pvoice = &(emu->p16v_voices[0]); 158 struct snd_emu10k1_voice *pvoice = &(emu->p16v_voices[0]);
158 struct snd_emu10k1_voice *cvoice = &(emu->p16v_capture_voice); 159 struct snd_emu10k1_voice *cvoice = &(emu->p16v_capture_voice);
159 160
160 //printk(KERN_INFO "status2=0x%x\n", status2); 161 /* dev_dbg(emu->card->dev, "status2=0x%x\n", status2); */
161 orig_status2 = status2; 162 orig_status2 = status2;
162 if(status2 & mask) { 163 if(status2 & mask) {
163 if(pvoice->use) { 164 if(pvoice->use) {
164 snd_pcm_period_elapsed(pvoice->epcm->substream); 165 snd_pcm_period_elapsed(pvoice->epcm->substream);
165 } else { 166 } else {
166 snd_printk(KERN_ERR "p16v: status: 0x%08x, mask=0x%08x, pvoice=%p, use=%d\n", status2, mask, pvoice, pvoice->use); 167 dev_err(emu->card->dev,
168 "p16v: status: 0x%08x, mask=0x%08x, pvoice=%p, use=%d\n",
169 status2, mask, pvoice,
170 pvoice->use);
167 } 171 }
168 } 172 }
169 if(status2 & 0x110000) { 173 if(status2 & 0x110000) {
170 //printk(KERN_INFO "capture int found\n"); 174 /* dev_info(emu->card->dev, "capture int found\n"); */
171 if(cvoice->use) { 175 if(cvoice->use) {
172 //printk(KERN_INFO "capture period_elapsed\n"); 176 /* dev_info(emu->card->dev, "capture period_elapsed\n"); */
173 snd_pcm_period_elapsed(cvoice->epcm->substream); 177 snd_pcm_period_elapsed(cvoice->epcm->substream);
174 } 178 }
175 } 179 }
@@ -180,7 +184,8 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id)
180 184
181 if (status) { 185 if (status) {
182 unsigned int bits; 186 unsigned int bits;
183 snd_printk(KERN_ERR "emu10k1: unhandled interrupt: 0x%08x\n", status); 187 dev_err(emu->card->dev,
188 "unhandled interrupt: 0x%08x\n", status);
184 //make sure any interrupts we don't handle are disabled: 189 //make sure any interrupts we don't handle are disabled:
185 bits = INTE_FXDSPENABLE | 190 bits = INTE_FXDSPENABLE |
186 INTE_PCIERRORENABLE | 191 INTE_PCIERRORENABLE |
@@ -202,7 +207,7 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id)
202 outl(orig_status, emu->port + IPR); /* ack all */ 207 outl(orig_status, emu->port + IPR); /* ack all */
203 } 208 }
204 if (timeout == 1000) 209 if (timeout == 1000)
205 snd_printk(KERN_INFO "emu10k1 irq routine failure\n"); 210 dev_info(emu->card->dev, "emu10k1 irq routine failure\n");
206 211
207 return IRQ_RETVAL(handled); 212 return IRQ_RETVAL(handled);
208} 213}
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
index ae709c1ab3a8..c68e6dd2fa67 100644
--- a/sound/pci/emu10k1/memory.c
+++ b/sound/pci/emu10k1/memory.c
@@ -236,11 +236,13 @@ __found_pages:
236static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr) 236static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr)
237{ 237{
238 if (addr & ~emu->dma_mask) { 238 if (addr & ~emu->dma_mask) {
239 snd_printk(KERN_ERR "max memory size is 0x%lx (addr = 0x%lx)!!\n", emu->dma_mask, (unsigned long)addr); 239 dev_err(emu->card->dev,
240 "max memory size is 0x%lx (addr = 0x%lx)!!\n",
241 emu->dma_mask, (unsigned long)addr);
240 return 0; 242 return 0;
241 } 243 }
242 if (addr & (EMUPAGESIZE-1)) { 244 if (addr & (EMUPAGESIZE-1)) {
243 snd_printk(KERN_ERR "page is not aligned\n"); 245 dev_err(emu->card->dev, "page is not aligned\n");
244 return 0; 246 return 0;
245 } 247 }
246 return 1; 248 return 1;
@@ -331,7 +333,8 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
331 else 333 else
332 addr = snd_pcm_sgbuf_get_addr(substream, ofs); 334 addr = snd_pcm_sgbuf_get_addr(substream, ofs);
333 if (! is_valid_page(emu, addr)) { 335 if (! is_valid_page(emu, addr)) {
334 printk(KERN_ERR "emu: failure page = %d\n", idx); 336 dev_err(emu->card->dev,
337 "emu: failure page = %d\n", idx);
335 mutex_unlock(&hdr->block_mutex); 338 mutex_unlock(&hdr->block_mutex);
336 return NULL; 339 return NULL;
337 } 340 }
@@ -507,7 +510,8 @@ static inline void *offset_ptr(struct snd_emu10k1 *emu, int page, int offset)
507 return NULL; 510 return NULL;
508 ptr = emu->page_ptr_table[page]; 511 ptr = emu->page_ptr_table[page];
509 if (! ptr) { 512 if (! ptr) {
510 printk(KERN_ERR "emu10k1: access to NULL ptr: page = %d\n", page); 513 dev_err(emu->card->dev,
514 "access to NULL ptr: page = %d\n", page);
511 return NULL; 515 return NULL;
512 } 516 }
513 ptr += offset & (PAGE_SIZE - 1); 517 ptr += offset & (PAGE_SIZE - 1);
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 7e2025cd6d9c..a4fe7f0c9458 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -168,7 +168,7 @@ static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime)
168 struct snd_emu10k1_pcm *epcm = runtime->private_data; 168 struct snd_emu10k1_pcm *epcm = runtime->private_data;
169 169
170 if (epcm) { 170 if (epcm) {
171 /* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */ 171 /* dev_dbg(emu->card->dev, "epcm free: %p\n", epcm); */
172 kfree(epcm); 172 kfree(epcm);
173 } 173 }
174} 174}
@@ -183,14 +183,14 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea
183 int err; 183 int err;
184 184
185 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); 185 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
186 /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ 186 /* dev_dbg(emu->card->dev, "epcm kcalloc: %p\n", epcm); */
187 187
188 if (epcm == NULL) 188 if (epcm == NULL)
189 return -ENOMEM; 189 return -ENOMEM;
190 epcm->emu = emu; 190 epcm->emu = emu;
191 epcm->substream = substream; 191 epcm->substream = substream;
192 /* 192 /*
193 snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", 193 dev_dbg(emu->card->dev, "epcm device=%d, channel_id=%d\n",
194 substream->pcm->device, channel_id); 194 substream->pcm->device, channel_id);
195 */ 195 */
196 runtime->private_data = epcm; 196 runtime->private_data = epcm;
@@ -203,10 +203,10 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea
203 203
204 channel->use=1; 204 channel->use=1;
205#if 0 /* debug */ 205#if 0 /* debug */
206 snd_printk(KERN_DEBUG 206 dev_dbg(emu->card->dev,
207 "p16v: open channel_id=%d, channel=%p, use=0x%x\n", 207 "p16v: open channel_id=%d, channel=%p, use=0x%x\n",
208 channel_id, channel, channel->use); 208 channel_id, channel, channel->use);
209 printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", 209 dev_dbg(emu->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
210 channel_id, chip, channel); 210 channel_id, chip, channel);
211#endif /* debug */ 211#endif /* debug */
212 /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ 212 /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
@@ -231,14 +231,14 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream
231 int err; 231 int err;
232 232
233 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); 233 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
234 /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ 234 /* dev_dbg(emu->card->dev, "epcm kcalloc: %p\n", epcm); */
235 235
236 if (epcm == NULL) 236 if (epcm == NULL)
237 return -ENOMEM; 237 return -ENOMEM;
238 epcm->emu = emu; 238 epcm->emu = emu;
239 epcm->substream = substream; 239 epcm->substream = substream;
240 /* 240 /*
241 snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", 241 dev_dbg(emu->card->dev, "epcm device=%d, channel_id=%d\n",
242 substream->pcm->device, channel_id); 242 substream->pcm->device, channel_id);
243 */ 243 */
244 runtime->private_data = epcm; 244 runtime->private_data = epcm;
@@ -251,10 +251,10 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream
251 251
252 channel->use=1; 252 channel->use=1;
253#if 0 /* debug */ 253#if 0 /* debug */
254 snd_printk(KERN_DEBUG 254 dev_dbg(emu->card->dev,
255 "p16v: open channel_id=%d, channel=%p, use=0x%x\n", 255 "p16v: open channel_id=%d, channel=%p, use=0x%x\n",
256 channel_id, channel, channel->use); 256 channel_id, channel, channel->use);
257 printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", 257 dev_dbg(emu->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
258 channel_id, chip, channel); 258 channel_id, chip, channel);
259#endif /* debug */ 259#endif /* debug */
260 /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ 260 /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
@@ -349,15 +349,18 @@ static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream)
349 u32 tmp; 349 u32 tmp;
350 350
351#if 0 /* debug */ 351#if 0 /* debug */
352 snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, " 352 dev_dbg(emu->card->dev,
353 "prepare:channel_number=%d, rate=%d, "
353 "format=0x%x, channels=%d, buffer_size=%ld, " 354 "format=0x%x, channels=%d, buffer_size=%ld, "
354 "period_size=%ld, periods=%u, frames_to_bytes=%d\n", 355 "period_size=%ld, periods=%u, frames_to_bytes=%d\n",
355 channel, runtime->rate, runtime->format, runtime->channels, 356 channel, runtime->rate, runtime->format, runtime->channels,
356 runtime->buffer_size, runtime->period_size, 357 runtime->buffer_size, runtime->period_size,
357 runtime->periods, frames_to_bytes(runtime, 1)); 358 runtime->periods, frames_to_bytes(runtime, 1));
358 snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", 359 dev_dbg(emu->card->dev,
360 "dma_addr=%x, dma_area=%p, table_base=%p\n",
359 runtime->dma_addr, runtime->dma_area, table_base); 361 runtime->dma_addr, runtime->dma_area, table_base);
360 snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", 362 dev_dbg(emu->card->dev,
363 "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
361 emu->p16v_buffer.addr, emu->p16v_buffer.area, 364 emu->p16v_buffer.addr, emu->p16v_buffer.area,
362 emu->p16v_buffer.bytes); 365 emu->p16v_buffer.bytes);
363#endif /* debug */ 366#endif /* debug */
@@ -405,7 +408,7 @@ static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream)
405 u32 tmp; 408 u32 tmp;
406 409
407 /* 410 /*
408 printk(KERN_DEBUG "prepare capture:channel_number=%d, rate=%d, " 411 dev_dbg(emu->card->dev, "prepare capture:channel_number=%d, rate=%d, "
409 "format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, " 412 "format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, "
410 "frames_to_bytes=%d\n", 413 "frames_to_bytes=%d\n",
411 channel, runtime->rate, runtime->format, runtime->channels, 414 channel, runtime->rate, runtime->format, runtime->channels,
@@ -491,13 +494,13 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
491 runtime = s->runtime; 494 runtime = s->runtime;
492 epcm = runtime->private_data; 495 epcm = runtime->private_data;
493 channel = substream->pcm->device-emu->p16v_device_offset; 496 channel = substream->pcm->device-emu->p16v_device_offset;
494 /* snd_printk(KERN_DEBUG "p16v channel=%d\n", channel); */ 497 /* dev_dbg(emu->card->dev, "p16v channel=%d\n", channel); */
495 epcm->running = running; 498 epcm->running = running;
496 basic |= (0x1<<channel); 499 basic |= (0x1<<channel);
497 inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel); 500 inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel);
498 snd_pcm_trigger_done(s, substream); 501 snd_pcm_trigger_done(s, substream);
499 } 502 }
500 /* snd_printk(KERN_DEBUG "basic=0x%x, inte=0x%x\n", basic, inte); */ 503 /* dev_dbg(emu->card->dev, "basic=0x%x, inte=0x%x\n", basic, inte); */
501 504
502 switch (cmd) { 505 switch (cmd) {
503 case SNDRV_PCM_TRIGGER_START: 506 case SNDRV_PCM_TRIGGER_START:
@@ -588,10 +591,10 @@ snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
588 ptr=ptr2; 591 ptr=ptr2;
589 if (ptr >= runtime->buffer_size) { 592 if (ptr >= runtime->buffer_size) {
590 ptr -= runtime->buffer_size; 593 ptr -= runtime->buffer_size;
591 printk(KERN_WARNING "buffer capture limited!\n"); 594 dev_warn(emu->card->dev, "buffer capture limited!\n");
592 } 595 }
593 /* 596 /*
594 printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " 597 dev_dbg(emu->card->dev, "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, "
595 "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", 598 "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n",
596 ptr1, ptr2, ptr, (int)runtime->buffer_size, 599 ptr1, ptr2, ptr, (int)runtime->buffer_size,
597 (int)runtime->period_size, (int)runtime->frame_bits, 600 (int)runtime->period_size, (int)runtime->frame_bits,
@@ -630,7 +633,7 @@ int snd_p16v_free(struct snd_emu10k1 *chip)
630 if (chip->p16v_buffer.area) { 633 if (chip->p16v_buffer.area) {
631 snd_dma_free_pages(&chip->p16v_buffer); 634 snd_dma_free_pages(&chip->p16v_buffer);
632 /* 635 /*
633 snd_printk(KERN_DEBUG "period lables free: %p\n", 636 dev_dbg(chip->card->dev, "period lables free: %p\n",
634 &chip->p16v_buffer); 637 &chip->p16v_buffer);
635 */ 638 */
636 } 639 }
@@ -644,7 +647,7 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
644 int err; 647 int err;
645 int capture=1; 648 int capture=1;
646 649
647 /* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d\n", device); */ 650 /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */
648 emu->p16v_device_offset = device; 651 emu->p16v_device_offset = device;
649 if (rpcm) 652 if (rpcm)
650 *rpcm = NULL; 653 *rpcm = NULL;
@@ -672,7 +675,7 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
672 ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) 675 ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0)
673 return err; 676 return err;
674 /* 677 /*
675 snd_printk(KERN_DEBUG 678 dev_dbg(emu->card->dev,
676 "preallocate playback substream: err=%d\n", err); 679 "preallocate playback substream: err=%d\n", err);
677 */ 680 */
678 } 681 }
@@ -686,7 +689,7 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
686 65536 - 64, 65536 - 64)) < 0) 689 65536 - 64, 65536 - 64)) < 0)
687 return err; 690 return err;
688 /* 691 /*
689 snd_printk(KERN_DEBUG 692 dev_dbg(emu->card->dev,
690 "preallocate capture substream: err=%d\n", err); 693 "preallocate capture substream: err=%d\n", err);
691 */ 694 */
692 } 695 }
diff --git a/sound/pci/emu10k1/voice.c b/sound/pci/emu10k1/voice.c
index 101e7cb79cb2..f16fd5cfb7cd 100644
--- a/sound/pci/emu10k1/voice.c
+++ b/sound/pci/emu10k1/voice.c
@@ -55,7 +55,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
55 first_voice = last_voice = 0; 55 first_voice = last_voice = 0;
56 for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) { 56 for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) {
57 /* 57 /*
58 printk(KERN_DEBUG "i %d j %d next free %d!\n", 58 dev_dbg(emu->card->dev, "i %d j %d next free %d!\n",
59 i, j, emu->next_free_voice); 59 i, j, emu->next_free_voice);
60 */ 60 */
61 i %= NUM_G; 61 i %= NUM_G;
@@ -75,7 +75,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
75 } 75 }
76 } 76 }
77 if (!skip) { 77 if (!skip) {
78 /* printk(KERN_DEBUG "allocated voice %d\n", i); */ 78 /* dev_dbg(emu->card->dev, "allocated voice %d\n", i); */
79 first_voice = i; 79 first_voice = i;
80 last_voice = (i + number) % NUM_G; 80 last_voice = (i + number) % NUM_G;
81 emu->next_free_voice = last_voice; 81 emu->next_free_voice = last_voice;
@@ -89,7 +89,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
89 for (i = 0; i < number; i++) { 89 for (i = 0; i < number; i++) {
90 voice = &emu->voices[(first_voice + i) % NUM_G]; 90 voice = &emu->voices[(first_voice + i) % NUM_G];
91 /* 91 /*
92 printk(kERN_DEBUG "voice alloc - %i, %i of %i\n", 92 dev_dbg(emu->card->dev, "voice alloc - %i, %i of %i\n",
93 voice->number, idx-first_voice+1, number); 93 voice->number, idx-first_voice+1, number);
94 */ 94 */
95 voice->use = 1; 95 voice->use = 1;
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 0f89d2a2090e..29cd339ffc37 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -525,7 +525,7 @@ static unsigned int snd_es1371_wait_src_ready(struct ensoniq * ensoniq)
525 return r; 525 return r;
526 cond_resched(); 526 cond_resched();
527 } 527 }
528 snd_printk(KERN_ERR "wait src ready timeout 0x%lx [0x%x]\n", 528 dev_err(ensoniq->card->dev, "wait src ready timeout 0x%lx [0x%x]\n",
529 ES_REG(ensoniq, 1371_SMPRATE), r); 529 ES_REG(ensoniq, 1371_SMPRATE), r);
530 return 0; 530 return 0;
531} 531}
@@ -587,7 +587,7 @@ static void snd_es1370_codec_write(struct snd_ak4531 *ak4531,
587 unsigned long end_time = jiffies + HZ / 10; 587 unsigned long end_time = jiffies + HZ / 10;
588 588
589#if 0 589#if 0
590 printk(KERN_DEBUG 590 dev_dbg(ensoniq->card->dev,
591 "CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", 591 "CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n",
592 reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); 592 reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC));
593#endif 593#endif
@@ -598,7 +598,7 @@ static void snd_es1370_codec_write(struct snd_ak4531 *ak4531,
598 } 598 }
599 schedule_timeout_uninterruptible(1); 599 schedule_timeout_uninterruptible(1);
600 } while (time_after(end_time, jiffies)); 600 } while (time_after(end_time, jiffies));
601 snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", 601 dev_err(ensoniq->card->dev, "codec write timeout, status = 0x%x\n",
602 inl(ES_REG(ensoniq, STATUS))); 602 inl(ES_REG(ensoniq, STATUS)));
603} 603}
604 604
@@ -649,7 +649,7 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
649 } 649 }
650 } 650 }
651 mutex_unlock(&ensoniq->src_mutex); 651 mutex_unlock(&ensoniq->src_mutex);
652 snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", 652 dev_err(ensoniq->card->dev, "codec write timeout at 0x%lx [0x%x]\n",
653 ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); 653 ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
654} 654}
655 655
@@ -706,8 +706,8 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
706 } 706 }
707 mutex_unlock(&ensoniq->src_mutex); 707 mutex_unlock(&ensoniq->src_mutex);
708 if (++fail > 10) { 708 if (++fail > 10) {
709 snd_printk(KERN_ERR "codec read timeout (final) " 709 dev_err(ensoniq->card->dev,
710 "at 0x%lx, reg = 0x%x [0x%x]\n", 710 "codec read timeout (final) at 0x%lx, reg = 0x%x [0x%x]\n",
711 ES_REG(ensoniq, 1371_CODEC), reg, 711 ES_REG(ensoniq, 1371_CODEC), reg,
712 inl(ES_REG(ensoniq, 1371_CODEC))); 712 inl(ES_REG(ensoniq, 1371_CODEC)));
713 return 0; 713 return 0;
@@ -716,7 +716,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
716 } 716 }
717 } 717 }
718 mutex_unlock(&ensoniq->src_mutex); 718 mutex_unlock(&ensoniq->src_mutex);
719 snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", 719 dev_err(ensoniq->card->dev, "codec read timeout at 0x%lx [0x%x]\n",
720 ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); 720 ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC)));
721 return 0; 721 return 0;
722} 722}
@@ -1796,7 +1796,7 @@ static int snd_ensoniq_1370_mixer(struct ensoniq *ensoniq)
1796#ifdef SUPPORT_JOYSTICK 1796#ifdef SUPPORT_JOYSTICK
1797 1797
1798#ifdef CHIP1371 1798#ifdef CHIP1371
1799static int snd_ensoniq_get_joystick_port(int dev) 1799static int snd_ensoniq_get_joystick_port(struct ensoniq *ensoniq, int dev)
1800{ 1800{
1801 switch (joystick_port[dev]) { 1801 switch (joystick_port[dev]) {
1802 case 0: /* disabled */ 1802 case 0: /* disabled */
@@ -1808,12 +1808,13 @@ static int snd_ensoniq_get_joystick_port(int dev)
1808 return joystick_port[dev]; 1808 return joystick_port[dev];
1809 1809
1810 default: 1810 default:
1811 printk(KERN_ERR "ens1371: invalid joystick port %#x", joystick_port[dev]); 1811 dev_err(ensoniq->card->dev,
1812 "invalid joystick port %#x", joystick_port[dev]);
1812 return 0; 1813 return 0;
1813 } 1814 }
1814} 1815}
1815#else 1816#else
1816static inline int snd_ensoniq_get_joystick_port(int dev) 1817static int snd_ensoniq_get_joystick_port(struct ensoniq *ensoniq, int dev)
1817{ 1818{
1818 return joystick[dev] ? 0x200 : 0; 1819 return joystick[dev] ? 0x200 : 0;
1819} 1820}
@@ -1824,7 +1825,7 @@ static int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev)
1824 struct gameport *gp; 1825 struct gameport *gp;
1825 int io_port; 1826 int io_port;
1826 1827
1827 io_port = snd_ensoniq_get_joystick_port(dev); 1828 io_port = snd_ensoniq_get_joystick_port(ensoniq, dev);
1828 1829
1829 switch (io_port) { 1830 switch (io_port) {
1830 case 0: 1831 case 0:
@@ -1835,14 +1836,16 @@ static int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev)
1835 if (request_region(io_port, 8, "ens137x: gameport")) 1836 if (request_region(io_port, 8, "ens137x: gameport"))
1836 break; 1837 break;
1837 if (io_port > 0x218) { 1838 if (io_port > 0x218) {
1838 printk(KERN_WARNING "ens137x: no gameport ports available\n"); 1839 dev_warn(ensoniq->card->dev,
1840 "no gameport ports available\n");
1839 return -EBUSY; 1841 return -EBUSY;
1840 } 1842 }
1841 break; 1843 break;
1842 1844
1843 default: 1845 default:
1844 if (!request_region(io_port, 8, "ens137x: gameport")) { 1846 if (!request_region(io_port, 8, "ens137x: gameport")) {
1845 printk(KERN_WARNING "ens137x: gameport io port %#x in use\n", 1847 dev_warn(ensoniq->card->dev,
1848 "gameport io port %#x in use\n",
1846 io_port); 1849 io_port);
1847 return -EBUSY; 1850 return -EBUSY;
1848 } 1851 }
@@ -1851,7 +1854,8 @@ static int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev)
1851 1854
1852 ensoniq->gameport = gp = gameport_allocate_port(); 1855 ensoniq->gameport = gp = gameport_allocate_port();
1853 if (!gp) { 1856 if (!gp) {
1854 printk(KERN_ERR "ens137x: cannot allocate memory for gameport\n"); 1857 dev_err(ensoniq->card->dev,
1858 "cannot allocate memory for gameport\n");
1855 release_region(io_port, 8); 1859 release_region(io_port, 8);
1856 return -ENOMEM; 1860 return -ENOMEM;
1857 } 1861 }
@@ -2082,8 +2086,7 @@ static int snd_ensoniq_resume(struct device *dev)
2082 pci_set_power_state(pci, PCI_D0); 2086 pci_set_power_state(pci, PCI_D0);
2083 pci_restore_state(pci); 2087 pci_restore_state(pci);
2084 if (pci_enable_device(pci) < 0) { 2088 if (pci_enable_device(pci) < 0) {
2085 printk(KERN_ERR DRIVER_NAME ": pci_enable_device failed, " 2089 dev_err(dev, "pci_enable_device failed, disabling device\n");
2086 "disabling device\n");
2087 snd_card_disconnect(card); 2090 snd_card_disconnect(card);
2088 return -EIO; 2091 return -EIO;
2089 } 2092 }
@@ -2137,7 +2140,7 @@ static int snd_ensoniq_create(struct snd_card *card,
2137 ensoniq->port = pci_resource_start(pci, 0); 2140 ensoniq->port = pci_resource_start(pci, 0);
2138 if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED, 2141 if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED,
2139 KBUILD_MODNAME, ensoniq)) { 2142 KBUILD_MODNAME, ensoniq)) {
2140 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2143 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2141 snd_ensoniq_free(ensoniq); 2144 snd_ensoniq_free(ensoniq);
2142 return -EBUSY; 2145 return -EBUSY;
2143 } 2146 }
@@ -2145,7 +2148,7 @@ static int snd_ensoniq_create(struct snd_card *card,
2145#ifdef CHIP1370 2148#ifdef CHIP1370
2146 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 2149 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2147 16, &ensoniq->dma_bug) < 0) { 2150 16, &ensoniq->dma_bug) < 0) {
2148 snd_printk(KERN_ERR "unable to allocate space for phantom area - dma_bug\n"); 2151 dev_err(card->dev, "unable to allocate space for phantom area - dma_bug\n");
2149 snd_ensoniq_free(ensoniq); 2152 snd_ensoniq_free(ensoniq);
2150 return -EBUSY; 2153 return -EBUSY;
2151 } 2154 }
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 33489bcc0aff..34d95bf916b5 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -254,7 +254,6 @@ MODULE_DEVICE_TABLE(pci, snd_es1938_ids);
254#define WRITE_LOOP_TIMEOUT 0x10000 254#define WRITE_LOOP_TIMEOUT 0x10000
255#define GET_LOOP_TIMEOUT 0x01000 255#define GET_LOOP_TIMEOUT 0x01000
256 256
257#undef REG_DEBUG
258/* ----------------------------------------------------------------- 257/* -----------------------------------------------------------------
259 * Write to a mixer register 258 * Write to a mixer register
260 * -----------------------------------------------------------------*/ 259 * -----------------------------------------------------------------*/
@@ -265,9 +264,7 @@ static void snd_es1938_mixer_write(struct es1938 *chip, unsigned char reg, unsig
265 outb(reg, SLSB_REG(chip, MIXERADDR)); 264 outb(reg, SLSB_REG(chip, MIXERADDR));
266 outb(val, SLSB_REG(chip, MIXERDATA)); 265 outb(val, SLSB_REG(chip, MIXERDATA));
267 spin_unlock_irqrestore(&chip->mixer_lock, flags); 266 spin_unlock_irqrestore(&chip->mixer_lock, flags);
268#ifdef REG_DEBUG 267 dev_dbg(chip->card->dev, "Mixer reg %02x set to %02x\n", reg, val);
269 snd_printk(KERN_DEBUG "Mixer reg %02x set to %02x\n", reg, val);
270#endif
271} 268}
272 269
273/* ----------------------------------------------------------------- 270/* -----------------------------------------------------------------
@@ -281,9 +278,7 @@ static int snd_es1938_mixer_read(struct es1938 *chip, unsigned char reg)
281 outb(reg, SLSB_REG(chip, MIXERADDR)); 278 outb(reg, SLSB_REG(chip, MIXERADDR));
282 data = inb(SLSB_REG(chip, MIXERDATA)); 279 data = inb(SLSB_REG(chip, MIXERDATA));
283 spin_unlock_irqrestore(&chip->mixer_lock, flags); 280 spin_unlock_irqrestore(&chip->mixer_lock, flags);
284#ifdef REG_DEBUG 281 dev_dbg(chip->card->dev, "Mixer reg %02x now is %02x\n", reg, data);
285 snd_printk(KERN_DEBUG "Mixer reg %02x now is %02x\n", reg, data);
286#endif
287 return data; 282 return data;
288} 283}
289 284
@@ -302,10 +297,9 @@ static int snd_es1938_mixer_bits(struct es1938 *chip, unsigned char reg,
302 if (val != oval) { 297 if (val != oval) {
303 new = (old & ~mask) | (val & mask); 298 new = (old & ~mask) | (val & mask);
304 outb(new, SLSB_REG(chip, MIXERDATA)); 299 outb(new, SLSB_REG(chip, MIXERDATA));
305#ifdef REG_DEBUG 300 dev_dbg(chip->card->dev,
306 snd_printk(KERN_DEBUG "Mixer reg %02x was %02x, set to %02x\n", 301 "Mixer reg %02x was %02x, set to %02x\n",
307 reg, old, new); 302 reg, old, new);
308#endif
309 } 303 }
310 spin_unlock_irqrestore(&chip->mixer_lock, flags); 304 spin_unlock_irqrestore(&chip->mixer_lock, flags);
311 return oval; 305 return oval;
@@ -324,7 +318,8 @@ static void snd_es1938_write_cmd(struct es1938 *chip, unsigned char cmd)
324 return; 318 return;
325 } 319 }
326 } 320 }
327 printk(KERN_ERR "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); 321 dev_err(chip->card->dev,
322 "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v);
328} 323}
329 324
330/* ----------------------------------------------------------------- 325/* -----------------------------------------------------------------
@@ -337,7 +332,7 @@ static int snd_es1938_get_byte(struct es1938 *chip)
337 for (i = GET_LOOP_TIMEOUT; i; i--) 332 for (i = GET_LOOP_TIMEOUT; i; i--)
338 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80) 333 if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80)
339 return inb(SLSB_REG(chip, READDATA)); 334 return inb(SLSB_REG(chip, READDATA));
340 snd_printk(KERN_ERR "get_byte timeout: status 0x02%x\n", v); 335 dev_err(chip->card->dev, "get_byte timeout: status 0x02%x\n", v);
341 return -ENODEV; 336 return -ENODEV;
342} 337}
343 338
@@ -351,9 +346,7 @@ static void snd_es1938_write(struct es1938 *chip, unsigned char reg, unsigned ch
351 snd_es1938_write_cmd(chip, reg); 346 snd_es1938_write_cmd(chip, reg);
352 snd_es1938_write_cmd(chip, val); 347 snd_es1938_write_cmd(chip, val);
353 spin_unlock_irqrestore(&chip->reg_lock, flags); 348 spin_unlock_irqrestore(&chip->reg_lock, flags);
354#ifdef REG_DEBUG 349 dev_dbg(chip->card->dev, "Reg %02x set to %02x\n", reg, val);
355 snd_printk(KERN_DEBUG "Reg %02x set to %02x\n", reg, val);
356#endif
357} 350}
358 351
359/* ----------------------------------------------------------------- 352/* -----------------------------------------------------------------
@@ -368,9 +361,7 @@ static unsigned char snd_es1938_read(struct es1938 *chip, unsigned char reg)
368 snd_es1938_write_cmd(chip, reg); 361 snd_es1938_write_cmd(chip, reg);
369 val = snd_es1938_get_byte(chip); 362 val = snd_es1938_get_byte(chip);
370 spin_unlock_irqrestore(&chip->reg_lock, flags); 363 spin_unlock_irqrestore(&chip->reg_lock, flags);
371#ifdef REG_DEBUG 364 dev_dbg(chip->card->dev, "Reg %02x now is %02x\n", reg, val);
372 snd_printk(KERN_DEBUG "Reg %02x now is %02x\n", reg, val);
373#endif
374 return val; 365 return val;
375} 366}
376 367
@@ -391,10 +382,8 @@ static int snd_es1938_bits(struct es1938 *chip, unsigned char reg, unsigned char
391 snd_es1938_write_cmd(chip, reg); 382 snd_es1938_write_cmd(chip, reg);
392 new = (old & ~mask) | (val & mask); 383 new = (old & ~mask) | (val & mask);
393 snd_es1938_write_cmd(chip, new); 384 snd_es1938_write_cmd(chip, new);
394#ifdef REG_DEBUG 385 dev_dbg(chip->card->dev, "Reg %02x was %02x, set to %02x\n",
395 snd_printk(KERN_DEBUG "Reg %02x was %02x, set to %02x\n",
396 reg, old, new); 386 reg, old, new);
397#endif
398 } 387 }
399 spin_unlock_irqrestore(&chip->reg_lock, flags); 388 spin_unlock_irqrestore(&chip->reg_lock, flags);
400 return oval; 389 return oval;
@@ -416,7 +405,7 @@ static void snd_es1938_reset(struct es1938 *chip)
416 goto __next; 405 goto __next;
417 } 406 }
418 } 407 }
419 snd_printk(KERN_ERR "ESS Solo-1 reset failed\n"); 408 dev_err(chip->card->dev, "ESS Solo-1 reset failed\n");
420 409
421 __next: 410 __next:
422 snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT); 411 snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT);
@@ -1504,16 +1493,15 @@ static int es1938_resume(struct device *dev)
1504 pci_set_power_state(pci, PCI_D0); 1493 pci_set_power_state(pci, PCI_D0);
1505 pci_restore_state(pci); 1494 pci_restore_state(pci);
1506 if (pci_enable_device(pci) < 0) { 1495 if (pci_enable_device(pci) < 0) {
1507 printk(KERN_ERR "es1938: pci_enable_device failed, " 1496 dev_err(dev, "pci_enable_device failed, disabling device\n");
1508 "disabling device\n");
1509 snd_card_disconnect(card); 1497 snd_card_disconnect(card);
1510 return -EIO; 1498 return -EIO;
1511 } 1499 }
1512 1500
1513 if (request_irq(pci->irq, snd_es1938_interrupt, 1501 if (request_irq(pci->irq, snd_es1938_interrupt,
1514 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1502 IRQF_SHARED, KBUILD_MODNAME, chip)) {
1515 printk(KERN_ERR "es1938: unable to grab IRQ %d, " 1503 dev_err(dev, "unable to grab IRQ %d, disabling device\n",
1516 "disabling device\n", pci->irq); 1504 pci->irq);
1517 snd_card_disconnect(card); 1505 snd_card_disconnect(card);
1518 return -EIO; 1506 return -EIO;
1519 } 1507 }
@@ -1545,7 +1533,8 @@ static int snd_es1938_create_gameport(struct es1938 *chip)
1545 1533
1546 chip->gameport = gp = gameport_allocate_port(); 1534 chip->gameport = gp = gameport_allocate_port();
1547 if (!gp) { 1535 if (!gp) {
1548 printk(KERN_ERR "es1938: cannot allocate memory for gameport\n"); 1536 dev_err(chip->card->dev,
1537 "cannot allocate memory for gameport\n");
1549 return -ENOMEM; 1538 return -ENOMEM;
1550 } 1539 }
1551 1540
@@ -1612,7 +1601,8 @@ static int snd_es1938_create(struct snd_card *card,
1612 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1601 /* check, if we can restrict PCI DMA transfers to 24 bits */
1613 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1602 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
1614 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1603 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
1615 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1604 dev_err(card->dev,
1605 "architecture does not support 24bit PCI busmaster DMA\n");
1616 pci_disable_device(pci); 1606 pci_disable_device(pci);
1617 return -ENXIO; 1607 return -ENXIO;
1618 } 1608 }
@@ -1639,15 +1629,14 @@ static int snd_es1938_create(struct snd_card *card,
1639 chip->game_port = pci_resource_start(pci, 4); 1629 chip->game_port = pci_resource_start(pci, 4);
1640 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED, 1630 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED,
1641 KBUILD_MODNAME, chip)) { 1631 KBUILD_MODNAME, chip)) {
1642 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1632 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1643 snd_es1938_free(chip); 1633 snd_es1938_free(chip);
1644 return -EBUSY; 1634 return -EBUSY;
1645 } 1635 }
1646 chip->irq = pci->irq; 1636 chip->irq = pci->irq;
1647#ifdef ES1938_DDEBUG 1637 dev_dbg(card->dev,
1648 snd_printk(KERN_DEBUG "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", 1638 "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n",
1649 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port); 1639 chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port);
1650#endif
1651 1640
1652 chip->ddma_port = chip->vc_port + 0x00; /* fix from Thomas Sailer */ 1641 chip->ddma_port = chip->vc_port + 0x00; /* fix from Thomas Sailer */
1653 1642
@@ -1673,21 +1662,22 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id)
1673 1662
1674 status = inb(SLIO_REG(chip, IRQCONTROL)); 1663 status = inb(SLIO_REG(chip, IRQCONTROL));
1675#if 0 1664#if 0
1676 printk(KERN_DEBUG "Es1938debug - interrupt status: =0x%x\n", status); 1665 dev_dbg(chip->card->dev,
1666 "Es1938debug - interrupt status: =0x%x\n", status);
1677#endif 1667#endif
1678 1668
1679 /* AUDIO 1 */ 1669 /* AUDIO 1 */
1680 if (status & 0x10) { 1670 if (status & 0x10) {
1681#if 0 1671#if 0
1682 printk(KERN_DEBUG 1672 dev_dbg(chip->card->dev,
1683 "Es1938debug - AUDIO channel 1 interrupt\n"); 1673 "Es1938debug - AUDIO channel 1 interrupt\n");
1684 printk(KERN_DEBUG 1674 dev_dbg(chip->card->dev,
1685 "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", 1675 "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n",
1686 inw(SLDM_REG(chip, DMACOUNT))); 1676 inw(SLDM_REG(chip, DMACOUNT)));
1687 printk(KERN_DEBUG 1677 dev_dbg(chip->card->dev,
1688 "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", 1678 "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n",
1689 inl(SLDM_REG(chip, DMAADDR))); 1679 inl(SLDM_REG(chip, DMAADDR)));
1690 printk(KERN_DEBUG 1680 dev_dbg(chip->card->dev,
1691 "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", 1681 "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n",
1692 inl(SLDM_REG(chip, DMASTATUS))); 1682 inl(SLDM_REG(chip, DMASTATUS)));
1693#endif 1683#endif
@@ -1703,12 +1693,12 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id)
1703 /* AUDIO 2 */ 1693 /* AUDIO 2 */
1704 if (status & 0x20) { 1694 if (status & 0x20) {
1705#if 0 1695#if 0
1706 printk(KERN_DEBUG 1696 dev_dbg(chip->card->dev,
1707 "Es1938debug - AUDIO channel 2 interrupt\n"); 1697 "Es1938debug - AUDIO channel 2 interrupt\n");
1708 printk(KERN_DEBUG 1698 dev_dbg(chip->card->dev,
1709 "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", 1699 "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n",
1710 inw(SLIO_REG(chip, AUDIO2DMACOUNT))); 1700 inw(SLIO_REG(chip, AUDIO2DMACOUNT)));
1711 printk(KERN_DEBUG 1701 dev_dbg(chip->card->dev,
1712 "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", 1702 "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n",
1713 inl(SLIO_REG(chip, AUDIO2DMAADDR))); 1703 inl(SLIO_REG(chip, AUDIO2DMAADDR)));
1714 1704
@@ -1842,7 +1832,7 @@ static int snd_es1938_probe(struct pci_dev *pci,
1842 SLSB_REG(chip, FMLOWADDR), 1832 SLSB_REG(chip, FMLOWADDR),
1843 SLSB_REG(chip, FMHIGHADDR), 1833 SLSB_REG(chip, FMHIGHADDR),
1844 OPL3_HW_OPL3, 1, &opl3) < 0) { 1834 OPL3_HW_OPL3, 1, &opl3) < 0) {
1845 printk(KERN_ERR "es1938: OPL3 not detected at 0x%lx\n", 1835 dev_err(card->dev, "OPL3 not detected at 0x%lx\n",
1846 SLSB_REG(chip, FMLOWADDR)); 1836 SLSB_REG(chip, FMLOWADDR));
1847 } else { 1837 } else {
1848 if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) { 1838 if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) {
@@ -1858,7 +1848,7 @@ static int snd_es1938_probe(struct pci_dev *pci,
1858 chip->mpu_port, 1848 chip->mpu_port,
1859 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK, 1849 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
1860 -1, &chip->rmidi) < 0) { 1850 -1, &chip->rmidi) < 0) {
1861 printk(KERN_ERR "es1938: unable to initialize MPU-401\n"); 1851 dev_err(card->dev, "unable to initialize MPU-401\n");
1862 } else { 1852 } else {
1863 // this line is vital for MIDI interrupt handling on ess-solo1 1853 // this line is vital for MIDI interrupt handling on ess-solo1
1864 // andreas@flying-snail.de 1854 // andreas@flying-snail.de
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 87e9cd5d3ceb..5bb1cf603301 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -632,7 +632,7 @@ static int snd_es1968_ac97_wait(struct es1968 *chip)
632 return 0; 632 return 0;
633 cond_resched(); 633 cond_resched();
634 } 634 }
635 snd_printd("es1968: ac97 timeout\n"); 635 dev_dbg(chip->card->dev, "ac97 timeout\n");
636 return 1; /* timeout */ 636 return 1; /* timeout */
637} 637}
638 638
@@ -644,7 +644,7 @@ static int snd_es1968_ac97_wait_poll(struct es1968 *chip)
644 if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1)) 644 if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1))
645 return 0; 645 return 0;
646 } 646 }
647 snd_printd("es1968: ac97 timeout\n"); 647 dev_dbg(chip->card->dev, "ac97 timeout\n");
648 return 1; /* timeout */ 648 return 1; /* timeout */
649} 649}
650 650
@@ -687,7 +687,7 @@ static void apu_index_set(struct es1968 *chip, u16 index)
687 for (i = 0; i < 1000; i++) 687 for (i = 0; i < 1000; i++)
688 if (__maestro_read(chip, IDR1_CRAM_POINTER) == index) 688 if (__maestro_read(chip, IDR1_CRAM_POINTER) == index)
689 return; 689 return;
690 snd_printd("es1968: APU register select failed. (Timeout)\n"); 690 dev_dbg(chip->card->dev, "APU register select failed. (Timeout)\n");
691} 691}
692 692
693/* no spinlock */ 693/* no spinlock */
@@ -699,7 +699,7 @@ static void apu_data_set(struct es1968 *chip, u16 data)
699 return; 699 return;
700 __maestro_write(chip, IDR0_DATA_PORT, data); 700 __maestro_write(chip, IDR0_DATA_PORT, data);
701 } 701 }
702 snd_printd("es1968: APU register set probably failed (Timeout)!\n"); 702 dev_dbg(chip->card->dev, "APU register set probably failed (Timeout)!\n");
703} 703}
704 704
705/* no spinlock */ 705/* no spinlock */
@@ -1442,13 +1442,14 @@ snd_es1968_init_dmabuf(struct es1968 *chip)
1442 snd_dma_pci_data(chip->pci), 1442 snd_dma_pci_data(chip->pci),
1443 chip->total_bufsize, &chip->dma); 1443 chip->total_bufsize, &chip->dma);
1444 if (err < 0 || ! chip->dma.area) { 1444 if (err < 0 || ! chip->dma.area) {
1445 snd_printk(KERN_ERR "es1968: can't allocate dma pages for size %d\n", 1445 dev_err(chip->card->dev,
1446 "can't allocate dma pages for size %d\n",
1446 chip->total_bufsize); 1447 chip->total_bufsize);
1447 return -ENOMEM; 1448 return -ENOMEM;
1448 } 1449 }
1449 if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) { 1450 if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) {
1450 snd_dma_free_pages(&chip->dma); 1451 snd_dma_free_pages(&chip->dma);
1451 snd_printk(KERN_ERR "es1968: DMA buffer beyond 256MB.\n"); 1452 dev_err(chip->card->dev, "DMA buffer beyond 256MB.\n");
1452 return -ENOMEM; 1453 return -ENOMEM;
1453 } 1454 }
1454 1455
@@ -1489,7 +1490,8 @@ static int snd_es1968_hw_params(struct snd_pcm_substream *substream,
1489 } 1490 }
1490 chan->memory = snd_es1968_new_memory(chip, size); 1491 chan->memory = snd_es1968_new_memory(chip, size);
1491 if (chan->memory == NULL) { 1492 if (chan->memory == NULL) {
1492 // snd_printd("cannot allocate dma buffer: size = %d\n", size); 1493 dev_dbg(chip->card->dev,
1494 "cannot allocate dma buffer: size = %d\n", size);
1493 return -ENOMEM; 1495 return -ENOMEM;
1494 } 1496 }
1495 snd_pcm_set_runtime_buffer(substream, &chan->memory->buf); 1497 snd_pcm_set_runtime_buffer(substream, &chan->memory->buf);
@@ -1715,11 +1717,13 @@ static void es1968_measure_clock(struct es1968 *chip)
1715 1717
1716 /* search 2 APUs (although one apu is enough) */ 1718 /* search 2 APUs (although one apu is enough) */
1717 if ((apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY)) < 0) { 1719 if ((apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY)) < 0) {
1718 snd_printk(KERN_ERR "Hmm, cannot find empty APU pair!?\n"); 1720 dev_err(chip->card->dev, "Hmm, cannot find empty APU pair!?\n");
1719 return; 1721 return;
1720 } 1722 }
1721 if ((memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE)) == NULL) { 1723 if ((memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE)) == NULL) {
1722 snd_printk(KERN_ERR "cannot allocate dma buffer - using default clock %d\n", chip->clock); 1724 dev_warn(chip->card->dev,
1725 "cannot allocate dma buffer - using default clock %d\n",
1726 chip->clock);
1723 snd_es1968_free_apu_pair(chip, apu); 1727 snd_es1968_free_apu_pair(chip, apu);
1724 return; 1728 return;
1725 } 1729 }
@@ -1780,7 +1784,7 @@ static void es1968_measure_clock(struct es1968 *chip)
1780 else 1784 else
1781 t += stop_time.tv_usec - start_time.tv_usec; 1785 t += stop_time.tv_usec - start_time.tv_usec;
1782 if (t == 0) { 1786 if (t == 0) {
1783 snd_printk(KERN_ERR "?? calculation error..\n"); 1787 dev_err(chip->card->dev, "?? calculation error..\n");
1784 } else { 1788 } else {
1785 offset *= 1000; 1789 offset *= 1000;
1786 offset = (offset / t) * 1000 + ((offset % t) * 1000) / t; 1790 offset = (offset / t) * 1000 + ((offset % t) * 1000) / t;
@@ -1788,7 +1792,7 @@ static void es1968_measure_clock(struct es1968 *chip)
1788 if (offset >= 40000 && offset <= 50000) 1792 if (offset >= 40000 && offset <= 50000)
1789 chip->clock = (chip->clock * offset) / 48000; 1793 chip->clock = (chip->clock * offset) / 48000;
1790 } 1794 }
1791 printk(KERN_INFO "es1968: clocking to %d\n", chip->clock); 1795 dev_info(chip->card->dev, "clocking to %d\n", chip->clock);
1792 } 1796 }
1793 snd_es1968_free_memory(chip, memory); 1797 snd_es1968_free_memory(chip, memory);
1794 snd_es1968_free_apu_pair(chip, apu); 1798 snd_es1968_free_apu_pair(chip, apu);
@@ -2108,7 +2112,7 @@ static void snd_es1968_ac97_reset(struct es1968 *chip)
2108 outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); 2112 outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c);
2109 2113
2110#if 0 /* the loop here needs to be much better if we want it.. */ 2114#if 0 /* the loop here needs to be much better if we want it.. */
2111 snd_printk(KERN_INFO "trying software reset\n"); 2115 dev_info(chip->card->dev, "trying software reset\n");
2112 /* try and do a software reset */ 2116 /* try and do a software reset */
2113 outb(0x80 | 0x7c, ioaddr + 0x30); 2117 outb(0x80 | 0x7c, ioaddr + 0x30);
2114 for (w = 0;; w++) { 2118 for (w = 0;; w++) {
@@ -2416,8 +2420,7 @@ static int es1968_resume(struct device *dev)
2416 pci_set_power_state(pci, PCI_D0); 2420 pci_set_power_state(pci, PCI_D0);
2417 pci_restore_state(pci); 2421 pci_restore_state(pci);
2418 if (pci_enable_device(pci) < 0) { 2422 if (pci_enable_device(pci) < 0) {
2419 printk(KERN_ERR "es1968: pci_enable_device failed, " 2423 dev_err(dev, "pci_enable_device failed, disabling device\n");
2420 "disabling device\n");
2421 snd_card_disconnect(card); 2424 snd_card_disconnect(card);
2422 return -EIO; 2425 return -EIO;
2423 } 2426 }
@@ -2479,7 +2482,8 @@ static int snd_es1968_create_gameport(struct es1968 *chip, int dev)
2479 2482
2480 chip->gameport = gp = gameport_allocate_port(); 2483 chip->gameport = gp = gameport_allocate_port();
2481 if (!gp) { 2484 if (!gp) {
2482 printk(KERN_ERR "es1968: cannot allocate memory for gameport\n"); 2485 dev_err(chip->card->dev,
2486 "cannot allocate memory for gameport\n");
2483 release_and_free_resource(r); 2487 release_and_free_resource(r);
2484 return -ENOMEM; 2488 return -ENOMEM;
2485 } 2489 }
@@ -2706,7 +2710,8 @@ static int snd_es1968_create(struct snd_card *card,
2706 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2710 /* check, if we can restrict PCI DMA transfers to 28 bits */
2707 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2711 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
2708 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2712 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
2709 snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); 2713 dev_err(card->dev,
2714 "architecture does not support 28bit PCI busmaster DMA\n");
2710 pci_disable_device(pci); 2715 pci_disable_device(pci);
2711 return -ENXIO; 2716 return -ENXIO;
2712 } 2717 }
@@ -2740,7 +2745,7 @@ static int snd_es1968_create(struct snd_card *card,
2740 chip->io_port = pci_resource_start(pci, 0); 2745 chip->io_port = pci_resource_start(pci, 0);
2741 if (request_irq(pci->irq, snd_es1968_interrupt, IRQF_SHARED, 2746 if (request_irq(pci->irq, snd_es1968_interrupt, IRQF_SHARED,
2742 KBUILD_MODNAME, chip)) { 2747 KBUILD_MODNAME, chip)) {
2743 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2748 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2744 snd_es1968_free(chip); 2749 snd_es1968_free(chip);
2745 return -EBUSY; 2750 return -EBUSY;
2746 } 2751 }
@@ -2770,7 +2775,7 @@ static int snd_es1968_create(struct snd_card *card,
2770 } 2775 }
2771 if (do_pm > 1) { 2776 if (do_pm > 1) {
2772 /* not matched; disabling pm */ 2777 /* not matched; disabling pm */
2773 printk(KERN_INFO "es1968: not attempting power management.\n"); 2778 dev_info(card->dev, "not attempting power management.\n");
2774 do_pm = 0; 2779 do_pm = 0;
2775 } 2780 }
2776 } 2781 }
@@ -2800,7 +2805,7 @@ static int snd_es1968_create(struct snd_card *card,
2800 for (i = 0; i < ARRAY_SIZE(snd_es1968_tea575x_gpios); i++) { 2805 for (i = 0; i < ARRAY_SIZE(snd_es1968_tea575x_gpios); i++) {
2801 chip->tea575x_tuner = i; 2806 chip->tea575x_tuner = i;
2802 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) { 2807 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) {
2803 snd_printk(KERN_INFO "es1968: detected TEA575x radio type %s\n", 2808 dev_info(card->dev, "detected TEA575x radio type %s\n",
2804 get_tea575x_gpio(chip)->name); 2809 get_tea575x_gpio(chip)->name);
2805 strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name, 2810 strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name,
2806 sizeof(chip->tea.card)); 2811 sizeof(chip->tea.card));
@@ -2899,7 +2904,7 @@ static int snd_es1968_probe(struct pci_dev *pci,
2899 MPU401_INFO_INTEGRATED | 2904 MPU401_INFO_INTEGRATED |
2900 MPU401_INFO_IRQ_HOOK, 2905 MPU401_INFO_IRQ_HOOK,
2901 -1, &chip->rmidi)) < 0) { 2906 -1, &chip->rmidi)) < 0) {
2902 printk(KERN_WARNING "es1968: skipping MPU-401 MIDI support..\n"); 2907 dev_warn(card->dev, "skipping MPU-401 MIDI support..\n");
2903 } 2908 }
2904 } 2909 }
2905 2910
@@ -2908,8 +2913,8 @@ static int snd_es1968_probe(struct pci_dev *pci,
2908#ifdef CONFIG_SND_ES1968_INPUT 2913#ifdef CONFIG_SND_ES1968_INPUT
2909 err = snd_es1968_input_register(chip); 2914 err = snd_es1968_input_register(chip);
2910 if (err) 2915 if (err)
2911 snd_printk(KERN_WARNING "Input device registration " 2916 dev_warn(card->dev,
2912 "failed with error %i", err); 2917 "Input device registration failed with error %i", err);
2913#endif 2918#endif
2914 2919
2915 snd_es1968_start_irq(chip); 2920 snd_es1968_start_irq(chip);
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 8b6af212cbfe..db18ccabadd6 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -254,7 +254,7 @@ static void snd_fm801_codec_write(struct snd_ac97 *ac97,
254 goto ok1; 254 goto ok1;
255 udelay(10); 255 udelay(10);
256 } 256 }
257 snd_printk(KERN_ERR "AC'97 interface is busy (1)\n"); 257 dev_err(chip->card->dev, "AC'97 interface is busy (1)\n");
258 return; 258 return;
259 259
260 ok1: 260 ok1:
@@ -269,7 +269,7 @@ static void snd_fm801_codec_write(struct snd_ac97 *ac97,
269 return; 269 return;
270 udelay(10); 270 udelay(10);
271 } 271 }
272 snd_printk(KERN_ERR "AC'97 interface #%d is busy (2)\n", ac97->num); 272 dev_err(chip->card->dev, "AC'97 interface #%d is busy (2)\n", ac97->num);
273} 273}
274 274
275static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short reg) 275static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short reg)
@@ -285,7 +285,7 @@ static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short
285 goto ok1; 285 goto ok1;
286 udelay(10); 286 udelay(10);
287 } 287 }
288 snd_printk(KERN_ERR "AC'97 interface is busy (1)\n"); 288 dev_err(chip->card->dev, "AC'97 interface is busy (1)\n");
289 return 0; 289 return 0;
290 290
291 ok1: 291 ok1:
@@ -297,7 +297,7 @@ static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short
297 goto ok2; 297 goto ok2;
298 udelay(10); 298 udelay(10);
299 } 299 }
300 snd_printk(KERN_ERR "AC'97 interface #%d is busy (2)\n", ac97->num); 300 dev_err(chip->card->dev, "AC'97 interface #%d is busy (2)\n", ac97->num);
301 return 0; 301 return 0;
302 302
303 ok2: 303 ok2:
@@ -306,7 +306,7 @@ static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short
306 goto ok3; 306 goto ok3;
307 udelay(10); 307 udelay(10);
308 } 308 }
309 snd_printk(KERN_ERR "AC'97 interface #%d is not valid (2)\n", ac97->num); 309 dev_err(chip->card->dev, "AC'97 interface #%d is not valid (2)\n", ac97->num);
310 return 0; 310 return 0;
311 311
312 ok3: 312 ok3:
@@ -1100,8 +1100,8 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume)
1100 1100
1101 if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0) 1101 if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0)
1102 if (!resume) { 1102 if (!resume) {
1103 snd_printk(KERN_INFO "Primary AC'97 codec not found, " 1103 dev_info(chip->card->dev,
1104 "assume SF64-PCR (tuner-only)\n"); 1104 "Primary AC'97 codec not found, assume SF64-PCR (tuner-only)\n");
1105 chip->tea575x_tuner = 3 | TUNER_ONLY; 1105 chip->tea575x_tuner = 3 | TUNER_ONLY;
1106 goto __ac97_ok; 1106 goto __ac97_ok;
1107 } 1107 }
@@ -1225,7 +1225,7 @@ static int snd_fm801_create(struct snd_card *card,
1225 if ((tea575x_tuner & TUNER_ONLY) == 0) { 1225 if ((tea575x_tuner & TUNER_ONLY) == 0) {
1226 if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, 1226 if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED,
1227 KBUILD_MODNAME, chip)) { 1227 KBUILD_MODNAME, chip)) {
1228 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); 1228 dev_err(card->dev, "unable to grab IRQ %d\n", chip->irq);
1229 snd_fm801_free(chip); 1229 snd_fm801_free(chip);
1230 return -EBUSY; 1230 return -EBUSY;
1231 } 1231 }
@@ -1265,7 +1265,7 @@ static int snd_fm801_create(struct snd_card *card,
1265 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 && 1265 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 &&
1266 (tea575x_tuner & TUNER_TYPE_MASK) < 4) { 1266 (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
1267 if (snd_tea575x_init(&chip->tea, THIS_MODULE)) { 1267 if (snd_tea575x_init(&chip->tea, THIS_MODULE)) {
1268 snd_printk(KERN_ERR "TEA575x radio not found\n"); 1268 dev_err(card->dev, "TEA575x radio not found\n");
1269 snd_fm801_free(chip); 1269 snd_fm801_free(chip);
1270 return -ENODEV; 1270 return -ENODEV;
1271 } 1271 }
@@ -1274,13 +1274,14 @@ static int snd_fm801_create(struct snd_card *card,
1274 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) { 1274 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) {
1275 chip->tea575x_tuner = tea575x_tuner; 1275 chip->tea575x_tuner = tea575x_tuner;
1276 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) { 1276 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) {
1277 snd_printk(KERN_INFO "detected TEA575x radio type %s\n", 1277 dev_info(card->dev,
1278 "detected TEA575x radio type %s\n",
1278 get_tea575x_gpio(chip)->name); 1279 get_tea575x_gpio(chip)->name);
1279 break; 1280 break;
1280 } 1281 }
1281 } 1282 }
1282 if (tea575x_tuner == 4) { 1283 if (tea575x_tuner == 4) {
1283 snd_printk(KERN_ERR "TEA575x radio not found\n"); 1284 dev_err(card->dev, "TEA575x radio not found\n");
1284 chip->tea575x_tuner = TUNER_DISABLED; 1285 chip->tea575x_tuner = TUNER_DISABLED;
1285 } 1286 }
1286 } 1287 }
@@ -1410,8 +1411,7 @@ static int snd_fm801_resume(struct device *dev)
1410 pci_set_power_state(pci, PCI_D0); 1411 pci_set_power_state(pci, PCI_D0);
1411 pci_restore_state(pci); 1412 pci_restore_state(pci);
1412 if (pci_enable_device(pci) < 0) { 1413 if (pci_enable_device(pci) < 0) {
1413 printk(KERN_ERR "fm801: pci_enable_device failed, " 1414 dev_err(dev, "pci_enable_device failed, disabling device\n");
1414 "disabling device\n");
1415 snd_card_disconnect(card); 1415 snd_card_disconnect(card);
1416 return -EIO; 1416 return -EIO;
1417 } 1417 }
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 55902ec40344..3b3cf4ac9060 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -1937,9 +1937,12 @@ static int aureon_add_controls(struct snd_ice1712 *ice)
1937 snd_ice1712_save_gpio_status(ice); 1937 snd_ice1712_save_gpio_status(ice);
1938 id = aureon_cs8415_get(ice, CS8415_ID); 1938 id = aureon_cs8415_get(ice, CS8415_ID);
1939 if (id != 0x41) 1939 if (id != 0x41)
1940 snd_printk(KERN_INFO "No CS8415 chip. Skipping CS8415 controls.\n"); 1940 dev_info(ice->card->dev,
1941 "No CS8415 chip. Skipping CS8415 controls.\n");
1941 else if ((id & 0x0F) != 0x01) 1942 else if ((id & 0x0F) != 0x01)
1942 snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); 1943 dev_info(ice->card->dev,
1944 "Detected unsupported CS8415 rev. (%c)\n",
1945 (char)((id & 0x0F) + 'A' - 1));
1943 else { 1946 else {
1944 for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) { 1947 for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) {
1945 struct snd_kcontrol *kctl; 1948 struct snd_kcontrol *kctl;
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 9e28cc12969b..98e5e955261e 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -425,7 +425,8 @@ static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kco
425 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 425 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
426 426
427 if (snd_i2c_sendbytes(ice->cs8427, &reg, 1) != 1) 427 if (snd_i2c_sendbytes(ice->cs8427, &reg, 1) != 1)
428 snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg); 428 dev_err(ice->card->dev,
429 "unable to send register 0x%x byte to CS8427\n", reg);
429 snd_i2c_readbytes(ice->cs8427, &reg, 1); 430 snd_i2c_readbytes(ice->cs8427, &reg, 1);
430 ucontrol->value.integer.value[0] = (reg & CS8427_UNLOCK) ? 1 : 0; 431 ucontrol->value.integer.value[0] = (reg & CS8427_UNLOCK) ? 1 : 0;
431 return 0; 432 return 0;
@@ -637,7 +638,7 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
637 case ICE1712_SUBDEVICE_VX442: 638 case ICE1712_SUBDEVICE_VX442:
638 case ICE1712_SUBDEVICE_DELTA66E: 639 case ICE1712_SUBDEVICE_DELTA66E:
639 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { 640 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
640 snd_printk(KERN_ERR "unable to create I2C bus\n"); 641 dev_err(ice->card->dev, "unable to create I2C bus\n");
641 return err; 642 return err;
642 } 643 }
643 ice->i2c->private_data = ice; 644 ice->i2c->private_data = ice;
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c
index bc2e7011c55d..817a1bc50a60 100644
--- a/sound/pci/ice1712/ews.c
+++ b/sound/pci/ice1712/ews.c
@@ -163,7 +163,8 @@ static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mas
163 163
164 __error: 164 __error:
165 snd_i2c_unlock(ice->i2c); 165 snd_i2c_unlock(ice->i2c);
166 snd_printk(KERN_ERR "AK4524 chip select failed, check cable to the front module\n"); 166 dev_err(ice->card->dev,
167 "AK4524 chip select failed, check cable to the front module\n");
167 return -EIO; 168 return -EIO;
168} 169}
169 170
@@ -174,7 +175,7 @@ static void ews88mt_ak4524_lock(struct snd_akm4xxx *ak, int chip)
174 unsigned char tmp; 175 unsigned char tmp;
175 /* assert AK4524 CS */ 176 /* assert AK4524 CS */
176 if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0) 177 if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0)
177 snd_printk(KERN_ERR "fatal error (ews88mt chip select)\n"); 178 dev_err(ice->card->dev, "fatal error (ews88mt chip select)\n");
178 snd_ice1712_save_gpio_status(ice); 179 snd_ice1712_save_gpio_status(ice);
179 tmp = ICE1712_EWS88_SERIAL_DATA | 180 tmp = ICE1712_EWS88_SERIAL_DATA |
180 ICE1712_EWS88_SERIAL_CLOCK | 181 ICE1712_EWS88_SERIAL_CLOCK |
@@ -456,7 +457,7 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
456 457
457 /* create i2c */ 458 /* create i2c */
458 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { 459 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
459 snd_printk(KERN_ERR "unable to create I2C bus\n"); 460 dev_err(ice->card->dev, "unable to create I2C bus\n");
460 return err; 461 return err;
461 } 462 }
462 ice->i2c->private_data = ice; 463 ice->i2c->private_data = ice;
@@ -469,7 +470,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
469 ICE1712_6FIRE_PCF9554_ADDR, 470 ICE1712_6FIRE_PCF9554_ADDR,
470 &spec->i2cdevs[EWS_I2C_6FIRE]); 471 &spec->i2cdevs[EWS_I2C_6FIRE]);
471 if (err < 0) { 472 if (err < 0) {
472 snd_printk(KERN_ERR "PCF9554 initialization failed\n"); 473 dev_err(ice->card->dev,
474 "PCF9554 initialization failed\n");
473 return err; 475 return err;
474 } 476 }
475 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); 477 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80);
@@ -834,7 +836,7 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg
834 byte = 0; 836 byte = 0;
835 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { 837 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
836 snd_i2c_unlock(ice->i2c); 838 snd_i2c_unlock(ice->i2c);
837 printk(KERN_ERR "cannot read pca\n"); 839 dev_err(ice->card->dev, "cannot read pca\n");
838 return -EIO; 840 return -EIO;
839 } 841 }
840 snd_i2c_unlock(ice->i2c); 842 snd_i2c_unlock(ice->i2c);
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 99c022a0d612..0710ec7e69d3 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -394,7 +394,7 @@ int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
394 err = snd_cs8427_create(ice->i2c, addr, 394 err = snd_cs8427_create(ice->i2c, addr,
395 (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427); 395 (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427);
396 if (err < 0) { 396 if (err < 0) {
397 snd_printk(KERN_ERR "CS8427 initialization failed\n"); 397 dev_err(ice->card->dev, "CS8427 initialization failed\n");
398 return err; 398 return err;
399 } 399 }
400 ice->spdif.ops.open = open_cs8427; 400 ice->spdif.ops.open = open_cs8427;
@@ -467,7 +467,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id)
467 u16 pbkstatus; 467 u16 pbkstatus;
468 struct snd_pcm_substream *substream; 468 struct snd_pcm_substream *substream;
469 pbkstatus = inw(ICEDS(ice, INTSTAT)); 469 pbkstatus = inw(ICEDS(ice, INTSTAT));
470 /* printk(KERN_DEBUG "pbkstatus = 0x%x\n", pbkstatus); */ 470 /* dev_dbg(ice->card->dev, "pbkstatus = 0x%x\n", pbkstatus); */
471 for (idx = 0; idx < 6; idx++) { 471 for (idx = 0; idx < 6; idx++) {
472 if ((pbkstatus & (3 << (idx * 2))) == 0) 472 if ((pbkstatus & (3 << (idx * 2))) == 0)
473 continue; 473 continue;
@@ -903,7 +903,8 @@ static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm *
903 if (rpcm) 903 if (rpcm)
904 *rpcm = pcm; 904 *rpcm = pcm;
905 905
906 printk(KERN_WARNING "Consumer PCM code does not work well at the moment --jk\n"); 906 dev_warn(ice->card->dev,
907 "Consumer PCM code does not work well at the moment --jk\n");
907 908
908 return 0; 909 return 0;
909} 910}
@@ -1534,7 +1535,8 @@ static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
1534 ac97.private_free = snd_ice1712_mixer_free_ac97; 1535 ac97.private_free = snd_ice1712_mixer_free_ac97;
1535 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); 1536 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
1536 if (err < 0) 1537 if (err < 0)
1537 printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); 1538 dev_warn(ice->card->dev,
1539 "cannot initialize ac97 for consumer, skipped\n");
1538 else { 1540 else {
1539 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice)); 1541 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice));
1540 if (err < 0) 1542 if (err < 0)
@@ -1552,7 +1554,8 @@ static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
1552 ac97.private_free = snd_ice1712_mixer_free_ac97; 1554 ac97.private_free = snd_ice1712_mixer_free_ac97;
1553 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); 1555 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
1554 if (err < 0) 1556 if (err < 0)
1555 printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); 1557 dev_warn(ice->card->dev,
1558 "cannot initialize pro ac97, skipped\n");
1556 else 1559 else
1557 return 0; 1560 return 0;
1558 } 1561 }
@@ -2332,7 +2335,8 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2332 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); 2335 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device);
2333 ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); 2336 ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device);
2334 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { 2337 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) {
2335 printk(KERN_ERR "ice1712: No valid ID is found\n"); 2338 dev_err(ice->card->dev,
2339 "No valid ID is found\n");
2336 return -ENXIO; 2340 return -ENXIO;
2337 } 2341 }
2338 } 2342 }
@@ -2340,21 +2344,22 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2340 for (tbl = card_tables; *tbl; tbl++) { 2344 for (tbl = card_tables; *tbl; tbl++) {
2341 for (c = *tbl; c->subvendor; c++) { 2345 for (c = *tbl; c->subvendor; c++) {
2342 if (modelname && c->model && !strcmp(modelname, c->model)) { 2346 if (modelname && c->model && !strcmp(modelname, c->model)) {
2343 printk(KERN_INFO "ice1712: Using board model %s\n", c->name); 2347 dev_info(ice->card->dev,
2348 "Using board model %s\n", c->name);
2344 ice->eeprom.subvendor = c->subvendor; 2349 ice->eeprom.subvendor = c->subvendor;
2345 } else if (c->subvendor != ice->eeprom.subvendor) 2350 } else if (c->subvendor != ice->eeprom.subvendor)
2346 continue; 2351 continue;
2347 if (!c->eeprom_size || !c->eeprom_data) 2352 if (!c->eeprom_size || !c->eeprom_data)
2348 goto found; 2353 goto found;
2349 /* if the EEPROM is given by the driver, use it */ 2354 /* if the EEPROM is given by the driver, use it */
2350 snd_printdd("using the defined eeprom..\n"); 2355 dev_dbg(ice->card->dev, "using the defined eeprom..\n");
2351 ice->eeprom.version = 1; 2356 ice->eeprom.version = 1;
2352 ice->eeprom.size = c->eeprom_size + 6; 2357 ice->eeprom.size = c->eeprom_size + 6;
2353 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); 2358 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
2354 goto read_skipped; 2359 goto read_skipped;
2355 } 2360 }
2356 } 2361 }
2357 printk(KERN_WARNING "ice1712: No matching model found for ID 0x%x\n", 2362 dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n",
2358 ice->eeprom.subvendor); 2363 ice->eeprom.subvendor);
2359 2364
2360 found: 2365 found:
@@ -2362,12 +2367,13 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2362 if (ice->eeprom.size < 6) 2367 if (ice->eeprom.size < 6)
2363 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ 2368 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */
2364 else if (ice->eeprom.size > 32) { 2369 else if (ice->eeprom.size > 32) {
2365 snd_printk(KERN_ERR "invalid EEPROM (size = %i)\n", ice->eeprom.size); 2370 dev_err(ice->card->dev,
2371 "invalid EEPROM (size = %i)\n", ice->eeprom.size);
2366 return -EIO; 2372 return -EIO;
2367 } 2373 }
2368 ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); 2374 ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05);
2369 if (ice->eeprom.version != 1) { 2375 if (ice->eeprom.version != 1) {
2370 snd_printk(KERN_ERR "invalid EEPROM version %i\n", 2376 dev_err(ice->card->dev, "invalid EEPROM version %i\n",
2371 ice->eeprom.version); 2377 ice->eeprom.version);
2372 /* return -EIO; */ 2378 /* return -EIO; */
2373 } 2379 }
@@ -2553,7 +2559,8 @@ static int snd_ice1712_create(struct snd_card *card,
2553 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2559 /* check, if we can restrict PCI DMA transfers to 28 bits */
2554 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2560 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
2555 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2561 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
2556 snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); 2562 dev_err(card->dev,
2563 "architecture does not support 28bit PCI busmaster DMA\n");
2557 pci_disable_device(pci); 2564 pci_disable_device(pci);
2558 return -ENXIO; 2565 return -ENXIO;
2559 } 2566 }
@@ -2609,7 +2616,7 @@ static int snd_ice1712_create(struct snd_card *card,
2609 2616
2610 if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED, 2617 if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED,
2611 KBUILD_MODNAME, ice)) { 2618 KBUILD_MODNAME, ice)) {
2612 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2619 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2613 snd_ice1712_free(ice); 2620 snd_ice1712_free(ice);
2614 return -EIO; 2621 return -EIO;
2615 } 2622 }
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index cf1ba116a772..5e7948f3efe9 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -146,7 +146,7 @@ static unsigned char snd_vt1724_ac97_ready(struct snd_ice1712 *ice)
146 continue; 146 continue;
147 return old_cmd; 147 return old_cmd;
148 } 148 }
149 snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n"); 149 dev_dbg(ice->card->dev, "snd_vt1724_ac97_ready: timeout\n");
150 return old_cmd; 150 return old_cmd;
151} 151}
152 152
@@ -156,7 +156,7 @@ static int snd_vt1724_ac97_wait_bit(struct snd_ice1712 *ice, unsigned char bit)
156 for (tm = 0; tm < 0x10000; tm++) 156 for (tm = 0; tm < 0x10000; tm++)
157 if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0) 157 if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0)
158 return 0; 158 return 0;
159 snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n"); 159 dev_dbg(ice->card->dev, "snd_vt1724_ac97_wait_bit: timeout\n");
160 return -EIO; 160 return -EIO;
161} 161}
162 162
@@ -430,10 +430,10 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
430 spin_lock(&ice->reg_lock); 430 spin_lock(&ice->reg_lock);
431 if (++timeout > 10) { 431 if (++timeout > 10) {
432 status = inb(ICEREG1724(ice, IRQSTAT)); 432 status = inb(ICEREG1724(ice, IRQSTAT));
433 printk(KERN_ERR "ice1724: Too long irq loop, " 433 dev_err(ice->card->dev,
434 "status = 0x%x\n", status); 434 "Too long irq loop, status = 0x%x\n", status);
435 if (status & VT1724_IRQ_MPU_TX) { 435 if (status & VT1724_IRQ_MPU_TX) {
436 printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); 436 dev_err(ice->card->dev, "Disabling MPU_TX\n");
437 enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); 437 enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
438 } 438 }
439 spin_unlock(&ice->reg_lock); 439 spin_unlock(&ice->reg_lock);
@@ -801,7 +801,7 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
801 spin_unlock_irq(&ice->reg_lock); 801 spin_unlock_irq(&ice->reg_lock);
802 802
803 /* 803 /*
804 printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, " 804 dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, "
805 "buffer = 0x%x, period = 0x%x\n", 805 "buffer = 0x%x, period = 0x%x\n",
806 substream->runtime->channels, 806 substream->runtime->channels,
807 (unsigned int)substream->runtime->dma_addr, 807 (unsigned int)substream->runtime->dma_addr,
@@ -821,13 +821,13 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea
821#if 0 /* read PLAYBACK_ADDR */ 821#if 0 /* read PLAYBACK_ADDR */
822 ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR)); 822 ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR));
823 if (ptr < substream->runtime->dma_addr) { 823 if (ptr < substream->runtime->dma_addr) {
824 snd_printd("ice1724: invalid negative ptr\n"); 824 dev_dbg(ice->card->dev, "invalid negative ptr\n");
825 return 0; 825 return 0;
826 } 826 }
827 ptr -= substream->runtime->dma_addr; 827 ptr -= substream->runtime->dma_addr;
828 ptr = bytes_to_frames(substream->runtime, ptr); 828 ptr = bytes_to_frames(substream->runtime, ptr);
829 if (ptr >= substream->runtime->buffer_size) { 829 if (ptr >= substream->runtime->buffer_size) {
830 snd_printd("ice1724: invalid ptr %d (size=%d)\n", 830 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
831 (int)ptr, (int)substream->runtime->period_size); 831 (int)ptr, (int)substream->runtime->period_size);
832 return 0; 832 return 0;
833 } 833 }
@@ -840,7 +840,7 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea
840 else if (ptr <= substream->runtime->buffer_size) 840 else if (ptr <= substream->runtime->buffer_size)
841 ptr = substream->runtime->buffer_size - ptr; 841 ptr = substream->runtime->buffer_size - ptr;
842 else { 842 else {
843 snd_printd("ice1724: invalid ptr %d (size=%d)\n", 843 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
844 (int)ptr, (int)substream->runtime->buffer_size); 844 (int)ptr, (int)substream->runtime->buffer_size);
845 ptr = 0; 845 ptr = 0;
846 } 846 }
@@ -884,7 +884,7 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substr
884 else if (ptr <= substream->runtime->buffer_size) 884 else if (ptr <= substream->runtime->buffer_size)
885 ptr = substream->runtime->buffer_size - ptr; 885 ptr = substream->runtime->buffer_size - ptr;
886 else { 886 else {
887 snd_printd("ice1724: invalid ptr %d (size=%d)\n", 887 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
888 (int)ptr, (int)substream->runtime->buffer_size); 888 (int)ptr, (int)substream->runtime->buffer_size);
889 ptr = 0; 889 ptr = 0;
890 } 890 }
@@ -1508,7 +1508,8 @@ static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice)
1508 ac97.private_data = ice; 1508 ac97.private_data = ice;
1509 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); 1509 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
1510 if (err < 0) 1510 if (err < 0)
1511 printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); 1511 dev_warn(ice->card->dev,
1512 "cannot initialize pro ac97, skipped\n");
1512 else 1513 else
1513 return 0; 1514 return 0;
1514 } 1515 }
@@ -2271,7 +2272,7 @@ static void wait_i2c_busy(struct snd_ice1712 *ice)
2271 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--) 2272 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--)
2272 ; 2273 ;
2273 if (t == -1) 2274 if (t == -1)
2274 printk(KERN_ERR "ice1724: i2c busy timeout\n"); 2275 dev_err(ice->card->dev, "i2c busy timeout\n");
2275} 2276}
2276 2277
2277unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, 2278unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
@@ -2287,7 +2288,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
2287 val = inb(ICEREG1724(ice, I2C_DATA)); 2288 val = inb(ICEREG1724(ice, I2C_DATA));
2288 mutex_unlock(&ice->i2c_mutex); 2289 mutex_unlock(&ice->i2c_mutex);
2289 /* 2290 /*
2290 printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); 2291 dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
2291 */ 2292 */
2292 return val; 2293 return val;
2293} 2294}
@@ -2298,7 +2299,7 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
2298 mutex_lock(&ice->i2c_mutex); 2299 mutex_lock(&ice->i2c_mutex);
2299 wait_i2c_busy(ice); 2300 wait_i2c_busy(ice);
2300 /* 2301 /*
2301 printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); 2302 dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
2302 */ 2303 */
2303 outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); 2304 outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
2304 outb(data, ICEREG1724(ice, I2C_DATA)); 2305 outb(data, ICEREG1724(ice, I2C_DATA));
@@ -2335,7 +2336,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2335 ((unsigned int)swab16(vendor) << 16) | swab16(device); 2336 ((unsigned int)swab16(vendor) << 16) | swab16(device);
2336 if (ice->eeprom.subvendor == 0 || 2337 if (ice->eeprom.subvendor == 0 ||
2337 ice->eeprom.subvendor == (unsigned int)-1) { 2338 ice->eeprom.subvendor == (unsigned int)-1) {
2338 printk(KERN_ERR "ice1724: No valid ID is found\n"); 2339 dev_err(ice->card->dev,
2340 "No valid ID is found\n");
2339 return -ENXIO; 2341 return -ENXIO;
2340 } 2342 }
2341 } 2343 }
@@ -2344,7 +2346,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2344 for (c = *tbl; c->name; c++) { 2346 for (c = *tbl; c->name; c++) {
2345 if (modelname && c->model && 2347 if (modelname && c->model &&
2346 !strcmp(modelname, c->model)) { 2348 !strcmp(modelname, c->model)) {
2347 printk(KERN_INFO "ice1724: Using board model %s\n", 2349 dev_info(ice->card->dev,
2350 "Using board model %s\n",
2348 c->name); 2351 c->name);
2349 ice->eeprom.subvendor = c->subvendor; 2352 ice->eeprom.subvendor = c->subvendor;
2350 } else if (c->subvendor != ice->eeprom.subvendor) 2353 } else if (c->subvendor != ice->eeprom.subvendor)
@@ -2353,14 +2356,14 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2353 if (!c->eeprom_size || !c->eeprom_data) 2356 if (!c->eeprom_size || !c->eeprom_data)
2354 goto found; 2357 goto found;
2355 /* if the EEPROM is given by the driver, use it */ 2358 /* if the EEPROM is given by the driver, use it */
2356 snd_printdd("using the defined eeprom..\n"); 2359 dev_dbg(ice->card->dev, "using the defined eeprom..\n");
2357 ice->eeprom.version = 2; 2360 ice->eeprom.version = 2;
2358 ice->eeprom.size = c->eeprom_size + 6; 2361 ice->eeprom.size = c->eeprom_size + 6;
2359 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); 2362 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
2360 goto read_skipped; 2363 goto read_skipped;
2361 } 2364 }
2362 } 2365 }
2363 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", 2366 dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n",
2364 ice->eeprom.subvendor); 2367 ice->eeprom.subvendor);
2365#ifdef CONFIG_PM_SLEEP 2368#ifdef CONFIG_PM_SLEEP
2366 /* assume AC97-only card which can suspend without additional code */ 2369 /* assume AC97-only card which can suspend without additional code */
@@ -2372,13 +2375,13 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2372 if (ice->eeprom.size < 6) 2375 if (ice->eeprom.size < 6)
2373 ice->eeprom.size = 32; 2376 ice->eeprom.size = 32;
2374 else if (ice->eeprom.size > 32) { 2377 else if (ice->eeprom.size > 32) {
2375 printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n", 2378 dev_err(ice->card->dev, "Invalid EEPROM (size = %i)\n",
2376 ice->eeprom.size); 2379 ice->eeprom.size);
2377 return -EIO; 2380 return -EIO;
2378 } 2381 }
2379 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); 2382 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
2380 if (ice->eeprom.version != 1 && ice->eeprom.version != 2) 2383 if (ice->eeprom.version != 1 && ice->eeprom.version != 2)
2381 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", 2384 dev_warn(ice->card->dev, "Invalid EEPROM version %i\n",
2382 ice->eeprom.version); 2385 ice->eeprom.version);
2383 size = ice->eeprom.size - 6; 2386 size = ice->eeprom.size - 6;
2384 for (i = 0; i < size; i++) 2387 for (i = 0; i < size; i++)
@@ -2586,7 +2589,7 @@ static int snd_vt1724_create(struct snd_card *card,
2586 2589
2587 if (request_irq(pci->irq, snd_vt1724_interrupt, 2590 if (request_irq(pci->irq, snd_vt1724_interrupt,
2588 IRQF_SHARED, KBUILD_MODNAME, ice)) { 2591 IRQF_SHARED, KBUILD_MODNAME, ice)) {
2589 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2592 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2590 snd_vt1724_free(ice); 2593 snd_vt1724_free(ice);
2591 return -EIO; 2594 return -EIO;
2592 } 2595 }
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index 8855933e710d..7a6c0786c55c 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -244,7 +244,7 @@ static void juli_akm_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
244 /* AK5385 first, since it requires cold reset affecting both codecs */ 244 /* AK5385 first, since it requires cold reset affecting both codecs */
245 old_gpio = ice->gpio.get_data(ice); 245 old_gpio = ice->gpio.get_data(ice);
246 new_gpio = (old_gpio & ~GPIO_AK5385A_MASK) | ak5385_pins; 246 new_gpio = (old_gpio & ~GPIO_AK5385A_MASK) | ak5385_pins;
247 /* printk(KERN_DEBUG "JULI - ak5385 set_rate_val: new gpio 0x%x\n", 247 /* dev_dbg(ice->card->dev, "JULI - ak5385 set_rate_val: new gpio 0x%x\n",
248 new_gpio); */ 248 new_gpio); */
249 ice->gpio.set_data(ice, new_gpio); 249 ice->gpio.set_data(ice, new_gpio);
250 250
@@ -344,7 +344,7 @@ static int juli_mute_put(struct snd_kcontrol *kcontrol,
344 new_gpio = old_gpio & 344 new_gpio = old_gpio &
345 ~((unsigned int) kcontrol->private_value); 345 ~((unsigned int) kcontrol->private_value);
346 } 346 }
347 /* printk(KERN_DEBUG 347 /* dev_dbg(ice->card->dev,
348 "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, " 348 "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, "
349 "new_gpio 0x%x\n", 349 "new_gpio 0x%x\n",
350 (unsigned int)ucontrol->value.integer.value[0], old_gpio, 350 (unsigned int)ucontrol->value.integer.value[0], old_gpio,
@@ -439,9 +439,9 @@ static void add_slaves(struct snd_card *card,
439{ 439{
440 for (; *list; list++) { 440 for (; *list; list++) {
441 struct snd_kcontrol *slave = ctl_find(card, *list); 441 struct snd_kcontrol *slave = ctl_find(card, *list);
442 /* printk(KERN_DEBUG "add_slaves - %s\n", *list); */ 442 /* dev_dbg(card->dev, "add_slaves - %s\n", *list); */
443 if (slave) { 443 if (slave) {
444 /* printk(KERN_DEBUG "slave %s found\n", *list); */ 444 /* dev_dbg(card->dev, "slave %s found\n", *list); */
445 snd_ctl_add_slave(master, slave); 445 snd_ctl_add_slave(master, slave);
446 } 446 }
447 } 447 }
@@ -536,7 +536,7 @@ static void juli_set_rate(struct snd_ice1712 *ice, unsigned int rate)
536 536
537 old = ice->gpio.get_data(ice); 537 old = ice->gpio.get_data(ice);
538 new = (old & ~GPIO_RATE_MASK) | get_gpio_val(rate); 538 new = (old & ~GPIO_RATE_MASK) | get_gpio_val(rate);
539 /* printk(KERN_DEBUG "JULI - set_rate: old %x, new %x\n", 539 /* dev_dbg(ice->card->dev, "JULI - set_rate: old %x, new %x\n",
540 old & GPIO_RATE_MASK, 540 old & GPIO_RATE_MASK,
541 new & GPIO_RATE_MASK); */ 541 new & GPIO_RATE_MASK); */
542 542
@@ -573,7 +573,7 @@ static void juli_ak4114_change(struct ak4114 *ak4114, unsigned char c0,
573 if (ice->is_spdif_master(ice) && c1) { 573 if (ice->is_spdif_master(ice) && c1) {
574 /* only for SPDIF master mode, rate was changed */ 574 /* only for SPDIF master mode, rate was changed */
575 rate = snd_ak4114_external_rate(ak4114); 575 rate = snd_ak4114_external_rate(ak4114);
576 /* printk(KERN_DEBUG "ak4114 - input rate changed to %d\n", 576 /* dev_dbg(ice->card->dev, "ak4114 - input rate changed to %d\n",
577 rate); */ 577 rate); */
578 juli_akm_set_rate_val(ice->akm, rate); 578 juli_akm_set_rate_val(ice->akm, rate);
579 } 579 }
@@ -628,7 +628,7 @@ static int juli_init(struct snd_ice1712 *ice)
628#endif 628#endif
629 629
630 if (spec->analog) { 630 if (spec->analog) {
631 printk(KERN_INFO "juli@: analog I/O detected\n"); 631 dev_info(ice->card->dev, "juli@: analog I/O detected\n");
632 ice->num_total_dacs = 2; 632 ice->num_total_dacs = 2;
633 ice->num_total_adcs = 2; 633 ice->num_total_adcs = 2;
634 634
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c
index e610339f7601..f3b491aa3e22 100644
--- a/sound/pci/ice1712/prodigy192.c
+++ b/sound/pci/ice1712/prodigy192.c
@@ -98,7 +98,7 @@ static int stac9460_dac_mute(struct snd_ice1712 *ice, int idx,
98 new = (~mute << 7 & 0x80) | (old & ~0x80); 98 new = (~mute << 7 & 0x80) | (old & ~0x80);
99 change = (new != old); 99 change = (new != old);
100 if (change) 100 if (change)
101 /*printk ("Volume register 0x%02x: 0x%02x\n", idx, new);*/ 101 /* dev_dbg(ice->card->dev, "Volume register 0x%02x: 0x%02x\n", idx, new);*/
102 stac9460_put(ice, idx, new); 102 stac9460_put(ice, idx, new);
103 return change; 103 return change;
104} 104}
@@ -133,7 +133,7 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
133 /* due to possible conflicts with stac9460_set_rate_val, mutexing */ 133 /* due to possible conflicts with stac9460_set_rate_val, mutexing */
134 mutex_lock(&spec->mute_mutex); 134 mutex_lock(&spec->mute_mutex);
135 /* 135 /*
136 printk(KERN_DEBUG "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, 136 dev_dbg(ice->card->dev, "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx,
137 ucontrol->value.integer.value[0]); 137 ucontrol->value.integer.value[0]);
138 */ 138 */
139 change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); 139 change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]);
@@ -187,7 +187,7 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
187 if (change) { 187 if (change) {
188 ovol = (0x7f - nvol) | (tmp & 0x80); 188 ovol = (0x7f - nvol) | (tmp & 0x80);
189 /* 189 /*
190 printk(KERN_DEBUG "DAC Volume: reg 0x%02x: 0x%02x\n", 190 dev_dbg(ice->card->dev, "DAC Volume: reg 0x%02x: 0x%02x\n",
191 idx, ovol); 191 idx, ovol);
192 */ 192 */
193 stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); 193 stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80));
@@ -348,7 +348,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
348 for (idx = 0; idx < 7 ; ++idx) 348 for (idx = 0; idx < 7 ; ++idx)
349 changed[idx] = stac9460_dac_mute(ice, 349 changed[idx] = stac9460_dac_mute(ice,
350 STAC946X_MASTER_VOLUME + idx, 0); 350 STAC946X_MASTER_VOLUME + idx, 0);
351 /*printk(KERN_DEBUG "Rate change: %d, new MC: 0x%02x\n", rate, new);*/ 351 /*dev_dbg(ice->card->dev, "Rate change: %d, new MC: 0x%02x\n", rate, new);*/
352 stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); 352 stac9460_put(ice, STAC946X_MASTER_CLOCKING, new);
353 udelay(10); 353 udelay(10);
354 /* unmuting - only originally unmuted dacs - 354 /* unmuting - only originally unmuted dacs -
@@ -768,9 +768,10 @@ static int prodigy192_init(struct snd_ice1712 *ice)
768 /* from this moment if err = 0 then 768 /* from this moment if err = 0 then
769 * spec->ak4114 should not be null 769 * spec->ak4114 should not be null
770 */ 770 */
771 snd_printdd("AK4114 initialized with status %d\n", err); 771 dev_dbg(ice->card->dev,
772 "AK4114 initialized with status %d\n", err);
772 } else 773 } else
773 snd_printdd("AK4114 not found\n"); 774 dev_dbg(ice->card->dev, "AK4114 not found\n");
774 if (err < 0) 775 if (err < 0)
775 return err; 776 return err;
776 777
diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c
index 71c6003ef338..2c2df4b74e01 100644
--- a/sound/pci/ice1712/quartet.c
+++ b/sound/pci/ice1712/quartet.c
@@ -280,7 +280,7 @@ static void qtet_akm_write(struct snd_akm4xxx *ak, int chip,
280 280
281 if (snd_BUG_ON(chip < 0 || chip >= 4)) 281 if (snd_BUG_ON(chip < 0 || chip >= 4))
282 return; 282 return;
283 /*printk(KERN_DEBUG "Writing to AK4620: chip=%d, addr=0x%x, 283 /*dev_dbg(ice->card->dev, "Writing to AK4620: chip=%d, addr=0x%x,
284 data=0x%x\n", chip, addr, data);*/ 284 data=0x%x\n", chip, addr, data);*/
285 orig_dir = ice->gpio.get_dir(ice); 285 orig_dir = ice->gpio.get_dir(ice);
286 ice->gpio.set_dir(ice, orig_dir | GPIO_SPI_ALL); 286 ice->gpio.set_dir(ice, orig_dir | GPIO_SPI_ALL);
@@ -898,7 +898,7 @@ static void qtet_set_rate(struct snd_ice1712 *ice, unsigned int rate)
898 new = (get_cpld(ice) & ~CPLD_CKS_MASK) | get_cks_val(rate); 898 new = (get_cpld(ice) & ~CPLD_CKS_MASK) | get_cks_val(rate);
899 /* switch to internal clock, drop CPLD_SYNC_SEL */ 899 /* switch to internal clock, drop CPLD_SYNC_SEL */
900 new &= ~CPLD_SYNC_SEL; 900 new &= ~CPLD_SYNC_SEL;
901 /* printk(KERN_DEBUG "QT - set_rate: old %x, new %x\n", 901 /* dev_dbg(ice->card->dev, "QT - set_rate: old %x, new %x\n",
902 get_cpld(ice), new); */ 902 get_cpld(ice), new); */
903 set_cpld(ice, new); 903 set_cpld(ice, new);
904} 904}
@@ -978,7 +978,7 @@ static void qtet_ak4113_change(struct ak4113 *ak4113, unsigned char c0,
978 c1) { 978 c1) {
979 /* only for SPDIF master mode, rate was changed */ 979 /* only for SPDIF master mode, rate was changed */
980 rate = snd_ak4113_external_rate(ak4113); 980 rate = snd_ak4113_external_rate(ak4113);
981 /* printk(KERN_DEBUG "ak4113 - input rate changed to %d\n", 981 /* dev_dbg(ice->card->dev, "ak4113 - input rate changed to %d\n",
982 rate); */ 982 rate); */
983 qtet_akm_set_rate_val(ice->akm, rate); 983 qtet_akm_set_rate_val(ice->akm, rate);
984 } 984 }
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index ff24acf06bdd..68340d7df76d 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -547,7 +547,8 @@ static int snd_intel8x0_codec_semaphore(struct intel8x0 *chip, unsigned int code
547 /* access to some forbidden (non existent) ac97 registers will not 547 /* access to some forbidden (non existent) ac97 registers will not
548 * reset the semaphore. So even if you don't get the semaphore, still 548 * reset the semaphore. So even if you don't get the semaphore, still
549 * continue the access. We don't need the semaphore anyway. */ 549 * continue the access. We don't need the semaphore anyway. */
550 snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", 550 dev_err(chip->card->dev,
551 "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n",
551 igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); 552 igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA)));
552 iagetword(chip, 0); /* clear semaphore flag */ 553 iagetword(chip, 0); /* clear semaphore flag */
553 /* I don't care about the semaphore */ 554 /* I don't care about the semaphore */
@@ -562,7 +563,9 @@ static void snd_intel8x0_codec_write(struct snd_ac97 *ac97,
562 563
563 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { 564 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
564 if (! chip->in_ac97_init) 565 if (! chip->in_ac97_init)
565 snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); 566 dev_err(chip->card->dev,
567 "codec_write %d: semaphore is not ready for register 0x%x\n",
568 ac97->num, reg);
566 } 569 }
567 iaputword(chip, reg + ac97->num * 0x80, val); 570 iaputword(chip, reg + ac97->num * 0x80, val);
568} 571}
@@ -576,7 +579,9 @@ static unsigned short snd_intel8x0_codec_read(struct snd_ac97 *ac97,
576 579
577 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { 580 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) {
578 if (! chip->in_ac97_init) 581 if (! chip->in_ac97_init)
579 snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); 582 dev_err(chip->card->dev,
583 "codec_read %d: semaphore is not ready for register 0x%x\n",
584 ac97->num, reg);
580 res = 0xffff; 585 res = 0xffff;
581 } else { 586 } else {
582 res = iagetword(chip, reg + ac97->num * 0x80); 587 res = iagetword(chip, reg + ac97->num * 0x80);
@@ -585,7 +590,9 @@ static unsigned short snd_intel8x0_codec_read(struct snd_ac97 *ac97,
585 iputdword(chip, ICHREG(GLOB_STA), tmp & 590 iputdword(chip, ICHREG(GLOB_STA), tmp &
586 ~(chip->codec_ready_bits | ICH_GSCI)); 591 ~(chip->codec_ready_bits | ICH_GSCI));
587 if (! chip->in_ac97_init) 592 if (! chip->in_ac97_init)
588 snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); 593 dev_err(chip->card->dev,
594 "codec_read %d: read timeout for register 0x%x\n",
595 ac97->num, reg);
589 res = 0xffff; 596 res = 0xffff;
590 } 597 }
591 } 598 }
@@ -619,7 +626,7 @@ static int snd_intel8x0_ali_codec_ready(struct intel8x0 *chip, int mask)
619 return 0; 626 return 0;
620 } 627 }
621 if (! chip->in_ac97_init) 628 if (! chip->in_ac97_init)
622 snd_printd(KERN_WARNING "intel8x0: AC97 codec ready timeout.\n"); 629 dev_warn(chip->card->dev, "AC97 codec ready timeout.\n");
623 return -EBUSY; 630 return -EBUSY;
624} 631}
625 632
@@ -631,7 +638,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip)
631 while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) 638 while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
632 udelay(1); 639 udelay(1);
633 if (! time && ! chip->in_ac97_init) 640 if (! time && ! chip->in_ac97_init)
634 snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); 641 dev_warn(chip->card->dev, "ali_codec_semaphore timeout\n");
635 return snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_CODEC_READY); 642 return snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_CODEC_READY);
636} 643}
637 644
@@ -700,7 +707,7 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich
700 bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ 707 bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */
701 ichdev->fragsize >> ichdev->pos_shift); 708 ichdev->fragsize >> ichdev->pos_shift);
702#if 0 709#if 0
703 printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", 710 dev_dbg(chip->card->dev, "bdbar[%i] = 0x%x [0x%x]\n",
704 idx + 0, bdbar[idx + 0], bdbar[idx + 1]); 711 idx + 0, bdbar[idx + 0], bdbar[idx + 1]);
705#endif 712#endif
706 } 713 }
@@ -712,8 +719,8 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich
712 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; 719 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags;
713 ichdev->position = 0; 720 ichdev->position = 0;
714#if 0 721#if 0
715 printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " 722 dev_dbg(chip->card->dev,
716 "period_size1 = 0x%x\n", 723 "lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n",
717 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, 724 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize,
718 ichdev->fragsize1); 725 ichdev->fragsize1);
719#endif 726#endif
@@ -781,8 +788,8 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich
781 ichdev->lvi_frag %= ichdev->frags; 788 ichdev->lvi_frag %= ichdev->frags;
782 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1); 789 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1);
783#if 0 790#if 0
784 printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, " 791 dev_dbg(chip->card->dev,
785 "all = 0x%x, 0x%x\n", 792 "new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n",
786 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], 793 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2],
787 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), 794 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port),
788 inl(port + 4), inb(port + ICH_REG_OFF_CR)); 795 inl(port + 4), inb(port + ICH_REG_OFF_CR));
@@ -2289,7 +2296,8 @@ static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
2289 ac97.num = i; 2296 ac97.num = i;
2290 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { 2297 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
2291 if (err != -EACCES) 2298 if (err != -EACCES)
2292 snd_printk(KERN_ERR "Unable to initialize codec #%d\n", i); 2299 dev_err(chip->card->dev,
2300 "Unable to initialize codec #%d\n", i);
2293 if (i == 0) 2301 if (i == 0)
2294 goto __err; 2302 goto __err;
2295 } 2303 }
@@ -2441,7 +2449,7 @@ static int snd_intel8x0_ich_chip_reset(struct intel8x0 *chip)
2441 return 0; 2449 return 0;
2442 schedule_timeout_uninterruptible(1); 2450 schedule_timeout_uninterruptible(1);
2443 } while (time_after_eq(end_time, jiffies)); 2451 } while (time_after_eq(end_time, jiffies));
2444 snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", 2452 dev_err(chip->card->dev, "AC'97 warm reset still in progress? [0x%x]\n",
2445 igetdword(chip, ICHREG(GLOB_CNT))); 2453 igetdword(chip, ICHREG(GLOB_CNT)));
2446 return -EIO; 2454 return -EIO;
2447} 2455}
@@ -2483,7 +2491,8 @@ static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing)
2483 } while (time_after_eq(end_time, jiffies)); 2491 } while (time_after_eq(end_time, jiffies));
2484 if (! status) { 2492 if (! status) {
2485 /* no codec is found */ 2493 /* no codec is found */
2486 snd_printk(KERN_ERR "codec_ready: codec is not ready [0x%x]\n", 2494 dev_err(chip->card->dev,
2495 "codec_ready: codec is not ready [0x%x]\n",
2487 igetdword(chip, ICHREG(GLOB_STA))); 2496 igetdword(chip, ICHREG(GLOB_STA)));
2488 return -EIO; 2497 return -EIO;
2489 } 2498 }
@@ -2547,7 +2556,7 @@ static int snd_intel8x0_ali_chip_init(struct intel8x0 *chip, int probing)
2547 goto __ok; 2556 goto __ok;
2548 schedule_timeout_uninterruptible(1); 2557 schedule_timeout_uninterruptible(1);
2549 } 2558 }
2550 snd_printk(KERN_ERR "AC'97 reset failed.\n"); 2559 dev_err(chip->card->dev, "AC'97 reset failed.\n");
2551 if (probing) 2560 if (probing)
2552 return -EIO; 2561 return -EIO;
2553 2562
@@ -2591,7 +2600,7 @@ static int snd_intel8x0_chip_init(struct intel8x0 *chip, int probing)
2591 break; 2600 break;
2592 } 2601 }
2593 if (timeout == 0) 2602 if (timeout == 0)
2594 printk(KERN_ERR "intel8x0: reset of registers failed?\n"); 2603 dev_err(chip->card->dev, "reset of registers failed?\n");
2595 } 2604 }
2596 /* initialize Buffer Descriptor Lists */ 2605 /* initialize Buffer Descriptor Lists */
2597 for (i = 0; i < chip->bdbars_count; i++) 2606 for (i = 0; i < chip->bdbars_count; i++)
@@ -2692,8 +2701,7 @@ static int intel8x0_resume(struct device *dev)
2692 pci_set_power_state(pci, PCI_D0); 2701 pci_set_power_state(pci, PCI_D0);
2693 pci_restore_state(pci); 2702 pci_restore_state(pci);
2694 if (pci_enable_device(pci) < 0) { 2703 if (pci_enable_device(pci) < 0) {
2695 printk(KERN_ERR "intel8x0: pci_enable_device failed, " 2704 dev_err(dev, "pci_enable_device failed, disabling device\n");
2696 "disabling device\n");
2697 snd_card_disconnect(card); 2705 snd_card_disconnect(card);
2698 return -EIO; 2706 return -EIO;
2699 } 2707 }
@@ -2701,8 +2709,8 @@ static int intel8x0_resume(struct device *dev)
2701 snd_intel8x0_chip_init(chip, 0); 2709 snd_intel8x0_chip_init(chip, 0);
2702 if (request_irq(pci->irq, snd_intel8x0_interrupt, 2710 if (request_irq(pci->irq, snd_intel8x0_interrupt,
2703 IRQF_SHARED, KBUILD_MODNAME, chip)) { 2711 IRQF_SHARED, KBUILD_MODNAME, chip)) {
2704 printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " 2712 dev_err(dev, "unable to grab IRQ %d, disabling device\n",
2705 "disabling device\n", pci->irq); 2713 pci->irq);
2706 snd_card_disconnect(card); 2714 snd_card_disconnect(card);
2707 return -EIO; 2715 return -EIO;
2708 } 2716 }
@@ -2779,7 +2787,8 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2779 __again: 2787 __again:
2780 subs = chip->pcm[0]->streams[0].substream; 2788 subs = chip->pcm[0]->streams[0].substream;
2781 if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { 2789 if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) {
2782 snd_printk(KERN_WARNING "no playback buffer allocated - aborting measure ac97 clock\n"); 2790 dev_warn(chip->card->dev,
2791 "no playback buffer allocated - aborting measure ac97 clock\n");
2783 return; 2792 return;
2784 } 2793 }
2785 ichdev = &chip->ichd[ICHD_PCMOUT]; 2794 ichdev = &chip->ichd[ICHD_PCMOUT];
@@ -2789,7 +2798,8 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2789 2798
2790 /* set rate */ 2799 /* set rate */
2791 if (snd_ac97_set_rate(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 48000) < 0) { 2800 if (snd_ac97_set_rate(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 48000) < 0) {
2792 snd_printk(KERN_ERR "cannot set ac97 rate: clock = %d\n", chip->ac97_bus->clock); 2801 dev_err(chip->card->dev, "cannot set ac97 rate: clock = %d\n",
2802 chip->ac97_bus->clock);
2793 return; 2803 return;
2794 } 2804 }
2795 snd_intel8x0_setup_periods(chip, ichdev); 2805 snd_intel8x0_setup_periods(chip, ichdev);
@@ -2843,7 +2853,8 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2843 spin_unlock_irq(&chip->reg_lock); 2853 spin_unlock_irq(&chip->reg_lock);
2844 2854
2845 if (pos == 0) { 2855 if (pos == 0) {
2846 snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); 2856 dev_err(chip->card->dev,
2857 "measure - unreliable DMA position..\n");
2847 __retry: 2858 __retry:
2848 if (attempt < 3) { 2859 if (attempt < 3) {
2849 msleep(300); 2860 msleep(300);
@@ -2857,16 +2868,17 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2857 t = stop_time.tv_sec - start_time.tv_sec; 2868 t = stop_time.tv_sec - start_time.tv_sec;
2858 t *= 1000000; 2869 t *= 1000000;
2859 t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000; 2870 t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000;
2860 printk(KERN_INFO "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); 2871 dev_info(chip->card->dev,
2872 "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos);
2861 if (t == 0) { 2873 if (t == 0) {
2862 snd_printk(KERN_ERR "intel8x0: ?? calculation error..\n"); 2874 dev_err(chip->card->dev, "?? calculation error..\n");
2863 goto __retry; 2875 goto __retry;
2864 } 2876 }
2865 pos *= 1000; 2877 pos *= 1000;
2866 pos = (pos / t) * 1000 + ((pos % t) * 1000) / t; 2878 pos = (pos / t) * 1000 + ((pos % t) * 1000) / t;
2867 if (pos < 40000 || pos >= 60000) { 2879 if (pos < 40000 || pos >= 60000) {
2868 /* abnormal value. hw problem? */ 2880 /* abnormal value. hw problem? */
2869 printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos); 2881 dev_info(chip->card->dev, "measured clock %ld rejected\n", pos);
2870 goto __retry; 2882 goto __retry;
2871 } else if (pos > 40500 && pos < 41500) 2883 } else if (pos > 40500 && pos < 41500)
2872 /* first exception - 41000Hz reference clock */ 2884 /* first exception - 41000Hz reference clock */
@@ -2878,7 +2890,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2878 /* not 48000Hz, tuning the clock.. */ 2890 /* not 48000Hz, tuning the clock.. */
2879 chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; 2891 chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos;
2880 __end: 2892 __end:
2881 printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); 2893 dev_info(chip->card->dev, "clocking to %d\n", chip->ac97_bus->clock);
2882 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); 2894 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0);
2883} 2895}
2884 2896
@@ -2899,7 +2911,7 @@ static int intel8x0_in_clock_list(struct intel8x0 *chip)
2899 wl = snd_pci_quirk_lookup(pci, intel8x0_clock_list); 2911 wl = snd_pci_quirk_lookup(pci, intel8x0_clock_list);
2900 if (!wl) 2912 if (!wl)
2901 return 0; 2913 return 0;
2902 printk(KERN_INFO "intel8x0: white list rate for %04x:%04x is %i\n", 2914 dev_info(chip->card->dev, "white list rate for %04x:%04x is %i\n",
2903 pci->subsystem_vendor, pci->subsystem_device, wl->value); 2915 pci->subsystem_vendor, pci->subsystem_device, wl->value);
2904 chip->ac97_bus->clock = wl->value; 2916 chip->ac97_bus->clock = wl->value;
2905 return 1; 2917 return 1;
@@ -3003,7 +3015,7 @@ static int snd_intel8x0_inside_vm(struct pci_dev *pci)
3003 3015
3004fini: 3016fini:
3005 if (msg != NULL) 3017 if (msg != NULL)
3006 printk(KERN_INFO "intel8x0: %s optimization\n", msg); 3018 dev_info(&pci->dev, "%s optimization\n", msg);
3007 3019
3008 return result; 3020 return result;
3009} 3021}
@@ -3098,7 +3110,7 @@ static int snd_intel8x0_create(struct snd_card *card,
3098 else 3110 else
3099 chip->addr = pci_iomap(pci, 0, 0); 3111 chip->addr = pci_iomap(pci, 0, 0);
3100 if (!chip->addr) { 3112 if (!chip->addr) {
3101 snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); 3113 dev_err(card->dev, "AC'97 space ioremap problem\n");
3102 snd_intel8x0_free(chip); 3114 snd_intel8x0_free(chip);
3103 return -EIO; 3115 return -EIO;
3104 } 3116 }
@@ -3107,7 +3119,7 @@ static int snd_intel8x0_create(struct snd_card *card,
3107 else 3119 else
3108 chip->bmaddr = pci_iomap(pci, 1, 0); 3120 chip->bmaddr = pci_iomap(pci, 1, 0);
3109 if (!chip->bmaddr) { 3121 if (!chip->bmaddr) {
3110 snd_printk(KERN_ERR "Controller space ioremap problem\n"); 3122 dev_err(card->dev, "Controller space ioremap problem\n");
3111 snd_intel8x0_free(chip); 3123 snd_intel8x0_free(chip);
3112 return -EIO; 3124 return -EIO;
3113 } 3125 }
@@ -3152,7 +3164,7 @@ static int snd_intel8x0_create(struct snd_card *card,
3152 chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2, 3164 chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2,
3153 &chip->bdbars) < 0) { 3165 &chip->bdbars) < 0) {
3154 snd_intel8x0_free(chip); 3166 snd_intel8x0_free(chip);
3155 snd_printk(KERN_ERR "intel8x0: cannot allocate buffer descriptors\n"); 3167 dev_err(card->dev, "cannot allocate buffer descriptors\n");
3156 return -ENOMEM; 3168 return -ENOMEM;
3157 } 3169 }
3158 /* tables must be aligned to 8 bytes here, but the kernel pages 3170 /* tables must be aligned to 8 bytes here, but the kernel pages
@@ -3206,7 +3218,7 @@ static int snd_intel8x0_create(struct snd_card *card,
3206 /* request irq after initializaing int_sta_mask, etc */ 3218 /* request irq after initializaing int_sta_mask, etc */
3207 if (request_irq(pci->irq, snd_intel8x0_interrupt, 3219 if (request_irq(pci->irq, snd_intel8x0_interrupt,
3208 IRQF_SHARED, KBUILD_MODNAME, chip)) { 3220 IRQF_SHARED, KBUILD_MODNAME, chip)) {
3209 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3221 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
3210 snd_intel8x0_free(chip); 3222 snd_intel8x0_free(chip);
3211 return -EBUSY; 3223 return -EBUSY;
3212 } 3224 }
@@ -3263,12 +3275,12 @@ static int check_default_spdif_aclink(struct pci_dev *pci)
3263 w = snd_pci_quirk_lookup(pci, spdif_aclink_defaults); 3275 w = snd_pci_quirk_lookup(pci, spdif_aclink_defaults);
3264 if (w) { 3276 if (w) {
3265 if (w->value) 3277 if (w->value)
3266 snd_printdd(KERN_INFO 3278 dev_dbg(&pci->dev,
3267 "intel8x0: Using SPDIF over AC-Link for %s\n", 3279 "Using SPDIF over AC-Link for %s\n",
3268 snd_pci_quirk_name(w)); 3280 snd_pci_quirk_name(w));
3269 else 3281 else
3270 snd_printdd(KERN_INFO 3282 dev_dbg(&pci->dev,
3271 "intel8x0: Using integrated SPDIF DMA for %s\n", 3283 "Using integrated SPDIF DMA for %s\n",
3272 snd_pci_quirk_name(w)); 3284 snd_pci_quirk_name(w));
3273 return w->value; 3285 return w->value;
3274 } 3286 }
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index f8c72bd8a3cd..b54d3e93cab1 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -334,7 +334,8 @@ static int snd_intel8x0m_codec_semaphore(struct intel8x0m *chip, unsigned int co
334 /* access to some forbidden (non existent) ac97 registers will not 334 /* access to some forbidden (non existent) ac97 registers will not
335 * reset the semaphore. So even if you don't get the semaphore, still 335 * reset the semaphore. So even if you don't get the semaphore, still
336 * continue the access. We don't need the semaphore anyway. */ 336 * continue the access. We don't need the semaphore anyway. */
337 snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", 337 dev_err(chip->card->dev,
338 "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n",
338 igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); 339 igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA)));
339 iagetword(chip, 0); /* clear semaphore flag */ 340 iagetword(chip, 0); /* clear semaphore flag */
340 /* I don't care about the semaphore */ 341 /* I don't care about the semaphore */
@@ -349,7 +350,9 @@ static void snd_intel8x0m_codec_write(struct snd_ac97 *ac97,
349 350
350 if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { 351 if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
351 if (! chip->in_ac97_init) 352 if (! chip->in_ac97_init)
352 snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); 353 dev_err(chip->card->dev,
354 "codec_write %d: semaphore is not ready for register 0x%x\n",
355 ac97->num, reg);
353 } 356 }
354 iaputword(chip, reg + ac97->num * 0x80, val); 357 iaputword(chip, reg + ac97->num * 0x80, val);
355} 358}
@@ -363,7 +366,9 @@ static unsigned short snd_intel8x0m_codec_read(struct snd_ac97 *ac97,
363 366
364 if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { 367 if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
365 if (! chip->in_ac97_init) 368 if (! chip->in_ac97_init)
366 snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); 369 dev_err(chip->card->dev,
370 "codec_read %d: semaphore is not ready for register 0x%x\n",
371 ac97->num, reg);
367 res = 0xffff; 372 res = 0xffff;
368 } else { 373 } else {
369 res = iagetword(chip, reg + ac97->num * 0x80); 374 res = iagetword(chip, reg + ac97->num * 0x80);
@@ -372,7 +377,9 @@ static unsigned short snd_intel8x0m_codec_read(struct snd_ac97 *ac97,
372 iputdword(chip, ICHREG(GLOB_STA), 377 iputdword(chip, ICHREG(GLOB_STA),
373 tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); 378 tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI));
374 if (! chip->in_ac97_init) 379 if (! chip->in_ac97_init)
375 snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); 380 dev_err(chip->card->dev,
381 "codec_read %d: read timeout for register 0x%x\n",
382 ac97->num, reg);
376 res = 0xffff; 383 res = 0xffff;
377 } 384 }
378 } 385 }
@@ -412,7 +419,7 @@ static void snd_intel8x0m_setup_periods(struct intel8x0m *chip, struct ichdev *i
412 bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ 419 bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */
413 ichdev->fragsize >> chip->pcm_pos_shift); 420 ichdev->fragsize >> chip->pcm_pos_shift);
414 /* 421 /*
415 printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", 422 dev_dbg(chip->card->dev, "bdbar[%i] = 0x%x [0x%x]\n",
416 idx + 0, bdbar[idx + 0], bdbar[idx + 1]); 423 idx + 0, bdbar[idx + 0], bdbar[idx + 1]);
417 */ 424 */
418 } 425 }
@@ -424,8 +431,8 @@ static void snd_intel8x0m_setup_periods(struct intel8x0m *chip, struct ichdev *i
424 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; 431 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags;
425 ichdev->position = 0; 432 ichdev->position = 0;
426#if 0 433#if 0
427 printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " 434 dev_dbg(chip->card->dev,
428 "period_size1 = 0x%x\n", 435 "lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n",
429 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, 436 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize,
430 ichdev->fragsize1); 437 ichdev->fragsize1);
431#endif 438#endif
@@ -470,8 +477,8 @@ static inline void snd_intel8x0m_update(struct intel8x0m *chip, struct ichdev *i
470 ichdev->lvi_frag * 477 ichdev->lvi_frag *
471 ichdev->fragsize1); 478 ichdev->fragsize1);
472#if 0 479#if 0
473 printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], " 480 dev_dbg(chip->card->dev,
474 "prefetch = %i, all = 0x%x, 0x%x\n", 481 "new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n",
475 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], 482 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2],
476 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), 483 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port),
477 inl(port + 4), inb(port + ICH_REG_OFF_CR)); 484 inl(port + 4), inb(port + ICH_REG_OFF_CR));
@@ -850,7 +857,8 @@ static int snd_intel8x0m_mixer(struct intel8x0m *chip, int ac97_clock)
850 ac97.pci = chip->pci; 857 ac97.pci = chip->pci;
851 ac97.num = glob_sta & ICH_SCR ? 1 : 0; 858 ac97.num = glob_sta & ICH_SCR ? 1 : 0;
852 if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) { 859 if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
853 snd_printk(KERN_ERR "Unable to initialize codec #%d\n", ac97.num); 860 dev_err(chip->card->dev,
861 "Unable to initialize codec #%d\n", ac97.num);
854 if (ac97.num == 0) 862 if (ac97.num == 0)
855 goto __err; 863 goto __err;
856 return err; 864 return err;
@@ -901,7 +909,7 @@ static int snd_intel8x0m_ich_chip_init(struct intel8x0m *chip, int probing)
901 goto __ok; 909 goto __ok;
902 schedule_timeout_uninterruptible(1); 910 schedule_timeout_uninterruptible(1);
903 } while (time_after_eq(end_time, jiffies)); 911 } while (time_after_eq(end_time, jiffies));
904 snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", 912 dev_err(chip->card->dev, "AC'97 warm reset still in progress? [0x%x]\n",
905 igetdword(chip, ICHREG(GLOB_CNT))); 913 igetdword(chip, ICHREG(GLOB_CNT)));
906 return -EIO; 914 return -EIO;
907 915
@@ -921,7 +929,8 @@ static int snd_intel8x0m_ich_chip_init(struct intel8x0m *chip, int probing)
921 } while (time_after_eq(end_time, jiffies)); 929 } while (time_after_eq(end_time, jiffies));
922 if (! status) { 930 if (! status) {
923 /* no codec is found */ 931 /* no codec is found */
924 snd_printk(KERN_ERR "codec_ready: codec is not ready [0x%x]\n", 932 dev_err(chip->card->dev,
933 "codec_ready: codec is not ready [0x%x]\n",
925 igetdword(chip, ICHREG(GLOB_STA))); 934 igetdword(chip, ICHREG(GLOB_STA)));
926 return -EIO; 935 return -EIO;
927 } 936 }
@@ -1042,16 +1051,15 @@ static int intel8x0m_resume(struct device *dev)
1042 pci_set_power_state(pci, PCI_D0); 1051 pci_set_power_state(pci, PCI_D0);
1043 pci_restore_state(pci); 1052 pci_restore_state(pci);
1044 if (pci_enable_device(pci) < 0) { 1053 if (pci_enable_device(pci) < 0) {
1045 printk(KERN_ERR "intel8x0m: pci_enable_device failed, " 1054 dev_err(dev, "pci_enable_device failed, disabling device\n");
1046 "disabling device\n");
1047 snd_card_disconnect(card); 1055 snd_card_disconnect(card);
1048 return -EIO; 1056 return -EIO;
1049 } 1057 }
1050 pci_set_master(pci); 1058 pci_set_master(pci);
1051 if (request_irq(pci->irq, snd_intel8x0m_interrupt, 1059 if (request_irq(pci->irq, snd_intel8x0m_interrupt,
1052 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1060 IRQF_SHARED, KBUILD_MODNAME, chip)) {
1053 printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, " 1061 dev_err(dev, "unable to grab IRQ %d, disabling device\n",
1054 "disabling device\n", pci->irq); 1062 pci->irq);
1055 snd_card_disconnect(card); 1063 snd_card_disconnect(card);
1056 return -EIO; 1064 return -EIO;
1057 } 1065 }
@@ -1165,7 +1173,7 @@ static int snd_intel8x0m_create(struct snd_card *card,
1165 else 1173 else
1166 chip->addr = pci_iomap(pci, 0, 0); 1174 chip->addr = pci_iomap(pci, 0, 0);
1167 if (!chip->addr) { 1175 if (!chip->addr) {
1168 snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); 1176 dev_err(card->dev, "AC'97 space ioremap problem\n");
1169 snd_intel8x0m_free(chip); 1177 snd_intel8x0m_free(chip);
1170 return -EIO; 1178 return -EIO;
1171 } 1179 }
@@ -1174,7 +1182,7 @@ static int snd_intel8x0m_create(struct snd_card *card,
1174 else 1182 else
1175 chip->bmaddr = pci_iomap(pci, 1, 0); 1183 chip->bmaddr = pci_iomap(pci, 1, 0);
1176 if (!chip->bmaddr) { 1184 if (!chip->bmaddr) {
1177 snd_printk(KERN_ERR "Controller space ioremap problem\n"); 1185 dev_err(card->dev, "Controller space ioremap problem\n");
1178 snd_intel8x0m_free(chip); 1186 snd_intel8x0m_free(chip);
1179 return -EIO; 1187 return -EIO;
1180 } 1188 }
@@ -1182,7 +1190,7 @@ static int snd_intel8x0m_create(struct snd_card *card,
1182 port_inited: 1190 port_inited:
1183 if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, 1191 if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED,
1184 KBUILD_MODNAME, chip)) { 1192 KBUILD_MODNAME, chip)) {
1185 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1193 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1186 snd_intel8x0m_free(chip); 1194 snd_intel8x0m_free(chip);
1187 return -EBUSY; 1195 return -EBUSY;
1188 } 1196 }
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index 56d4f94daea2..d63434d8c3fb 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -75,7 +75,7 @@ MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
75static int debug; 75static int debug;
76module_param(debug, int, 0644); 76module_param(debug, int, 0644);
77#define verbose_debug(fmt, args...) \ 77#define verbose_debug(fmt, args...) \
78 do { if (debug > 1) printk(KERN_DEBUG SFX fmt, ##args); } while (0) 78 do { if (debug > 1) pr_debug(SFX fmt, ##args); } while (0)
79#else 79#else
80#define verbose_debug(fmt, args...) 80#define verbose_debug(fmt, args...)
81#endif 81#endif
@@ -168,7 +168,7 @@ static int rirb_get_response(struct lola *chip, unsigned int *val,
168 verbose_debug("get_response: %x, %x\n", 168 verbose_debug("get_response: %x, %x\n",
169 chip->res, chip->res_ex); 169 chip->res, chip->res_ex);
170 if (chip->res_ex & LOLA_RIRB_EX_ERROR) { 170 if (chip->res_ex & LOLA_RIRB_EX_ERROR) {
171 printk(KERN_WARNING SFX "RIRB ERROR: " 171 dev_warn(chip->card->dev, "RIRB ERROR: "
172 "NID=%x, verb=%x, data=%x, ext=%x\n", 172 "NID=%x, verb=%x, data=%x, ext=%x\n",
173 chip->last_cmd_nid, 173 chip->last_cmd_nid,
174 chip->last_verb, chip->last_data, 174 chip->last_verb, chip->last_data,
@@ -182,9 +182,9 @@ static int rirb_get_response(struct lola *chip, unsigned int *val,
182 udelay(20); 182 udelay(20);
183 cond_resched(); 183 cond_resched();
184 } 184 }
185 printk(KERN_WARNING SFX "RIRB response error\n"); 185 dev_warn(chip->card->dev, "RIRB response error\n");
186 if (!chip->polling_mode) { 186 if (!chip->polling_mode) {
187 printk(KERN_WARNING SFX "switching to polling mode\n"); 187 dev_warn(chip->card->dev, "switching to polling mode\n");
188 chip->polling_mode = 1; 188 chip->polling_mode = 1;
189 goto again; 189 goto again;
190 } 190 }
@@ -327,7 +327,7 @@ static int reset_controller(struct lola *chip)
327 break; 327 break;
328 } while (time_before(jiffies, end_time)); 328 } while (time_before(jiffies, end_time));
329 if (!gctl) { 329 if (!gctl) {
330 printk(KERN_ERR SFX "cannot reset controller\n"); 330 dev_err(chip->card->dev, "cannot reset controller\n");
331 return -EIO; 331 return -EIO;
332 } 332 }
333 return 0; 333 return 0;
@@ -452,40 +452,40 @@ static int lola_parse_tree(struct lola *chip)
452 452
453 err = lola_read_param(chip, 0, LOLA_PAR_VENDOR_ID, &val); 453 err = lola_read_param(chip, 0, LOLA_PAR_VENDOR_ID, &val);
454 if (err < 0) { 454 if (err < 0) {
455 printk(KERN_ERR SFX "Can't read VENDOR_ID\n"); 455 dev_err(chip->card->dev, "Can't read VENDOR_ID\n");
456 return err; 456 return err;
457 } 457 }
458 val >>= 16; 458 val >>= 16;
459 if (val != 0x1369) { 459 if (val != 0x1369) {
460 printk(KERN_ERR SFX "Unknown codec vendor 0x%x\n", val); 460 dev_err(chip->card->dev, "Unknown codec vendor 0x%x\n", val);
461 return -EINVAL; 461 return -EINVAL;
462 } 462 }
463 463
464 err = lola_read_param(chip, 1, LOLA_PAR_FUNCTION_TYPE, &val); 464 err = lola_read_param(chip, 1, LOLA_PAR_FUNCTION_TYPE, &val);
465 if (err < 0) { 465 if (err < 0) {
466 printk(KERN_ERR SFX "Can't read FUNCTION_TYPE\n"); 466 dev_err(chip->card->dev, "Can't read FUNCTION_TYPE\n");
467 return err; 467 return err;
468 } 468 }
469 if (val != 1) { 469 if (val != 1) {
470 printk(KERN_ERR SFX "Unknown function type %d\n", val); 470 dev_err(chip->card->dev, "Unknown function type %d\n", val);
471 return -EINVAL; 471 return -EINVAL;
472 } 472 }
473 473
474 err = lola_read_param(chip, 1, LOLA_PAR_SPECIFIC_CAPS, &val); 474 err = lola_read_param(chip, 1, LOLA_PAR_SPECIFIC_CAPS, &val);
475 if (err < 0) { 475 if (err < 0) {
476 printk(KERN_ERR SFX "Can't read SPECCAPS\n"); 476 dev_err(chip->card->dev, "Can't read SPECCAPS\n");
477 return err; 477 return err;
478 } 478 }
479 chip->lola_caps = val; 479 chip->lola_caps = val;
480 chip->pin[CAPT].num_pins = LOLA_AFG_INPUT_PIN_COUNT(chip->lola_caps); 480 chip->pin[CAPT].num_pins = LOLA_AFG_INPUT_PIN_COUNT(chip->lola_caps);
481 chip->pin[PLAY].num_pins = LOLA_AFG_OUTPUT_PIN_COUNT(chip->lola_caps); 481 chip->pin[PLAY].num_pins = LOLA_AFG_OUTPUT_PIN_COUNT(chip->lola_caps);
482 snd_printdd(SFX "speccaps=0x%x, pins in=%d, out=%d\n", 482 dev_dbg(chip->card->dev, "speccaps=0x%x, pins in=%d, out=%d\n",
483 chip->lola_caps, 483 chip->lola_caps,
484 chip->pin[CAPT].num_pins, chip->pin[PLAY].num_pins); 484 chip->pin[CAPT].num_pins, chip->pin[PLAY].num_pins);
485 485
486 if (chip->pin[CAPT].num_pins > MAX_AUDIO_INOUT_COUNT || 486 if (chip->pin[CAPT].num_pins > MAX_AUDIO_INOUT_COUNT ||
487 chip->pin[PLAY].num_pins > MAX_AUDIO_INOUT_COUNT) { 487 chip->pin[PLAY].num_pins > MAX_AUDIO_INOUT_COUNT) {
488 printk(KERN_ERR SFX "Invalid Lola-spec caps 0x%x\n", val); 488 dev_err(chip->card->dev, "Invalid Lola-spec caps 0x%x\n", val);
489 return -EINVAL; 489 return -EINVAL;
490 } 490 }
491 491
@@ -586,7 +586,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
586 586
587 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 587 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
588 if (!chip) { 588 if (!chip) {
589 snd_printk(KERN_ERR SFX "cannot allocate chip\n"); 589 dev_err(chip->card->dev, "cannot allocate chip\n");
590 pci_disable_device(pci); 590 pci_disable_device(pci);
591 return -ENOMEM; 591 return -ENOMEM;
592 } 592 }
@@ -609,7 +609,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
609 chip->sample_rate_max = 192000; 609 chip->sample_rate_max = 192000;
610 break; 610 break;
611 default: 611 default:
612 snd_printk(KERN_WARNING SFX 612 dev_warn(chip->card->dev,
613 "Invalid granularity %d, reset to %d\n", 613 "Invalid granularity %d, reset to %d\n",
614 chip->granularity, LOLA_GRANULARITY_MAX); 614 chip->granularity, LOLA_GRANULARITY_MAX);
615 chip->granularity = LOLA_GRANULARITY_MAX; 615 chip->granularity = LOLA_GRANULARITY_MAX;
@@ -618,7 +618,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
618 } 618 }
619 chip->sample_rate_min = sample_rate_min[dev]; 619 chip->sample_rate_min = sample_rate_min[dev];
620 if (chip->sample_rate_min > chip->sample_rate_max) { 620 if (chip->sample_rate_min > chip->sample_rate_max) {
621 snd_printk(KERN_WARNING SFX 621 dev_warn(chip->card->dev,
622 "Invalid sample_rate_min %d, reset to 16000\n", 622 "Invalid sample_rate_min %d, reset to 16000\n",
623 chip->sample_rate_min); 623 chip->sample_rate_min);
624 chip->sample_rate_min = 16000; 624 chip->sample_rate_min = 16000;
@@ -636,7 +636,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
636 chip->bar[1].addr = pci_resource_start(pci, 2); 636 chip->bar[1].addr = pci_resource_start(pci, 2);
637 chip->bar[1].remap_addr = pci_ioremap_bar(pci, 2); 637 chip->bar[1].remap_addr = pci_ioremap_bar(pci, 2);
638 if (!chip->bar[0].remap_addr || !chip->bar[1].remap_addr) { 638 if (!chip->bar[0].remap_addr || !chip->bar[1].remap_addr) {
639 snd_printk(KERN_ERR SFX "ioremap error\n"); 639 dev_err(chip->card->dev, "ioremap error\n");
640 err = -ENXIO; 640 err = -ENXIO;
641 goto errout; 641 goto errout;
642 } 642 }
@@ -649,7 +649,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
649 649
650 if (request_irq(pci->irq, lola_interrupt, IRQF_SHARED, 650 if (request_irq(pci->irq, lola_interrupt, IRQF_SHARED,
651 KBUILD_MODNAME, chip)) { 651 KBUILD_MODNAME, chip)) {
652 printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq); 652 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
653 err = -EBUSY; 653 err = -EBUSY;
654 goto errout; 654 goto errout;
655 } 655 }
@@ -660,7 +660,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
660 chip->pcm[CAPT].num_streams = (dever >> 0) & 0x3ff; 660 chip->pcm[CAPT].num_streams = (dever >> 0) & 0x3ff;
661 chip->pcm[PLAY].num_streams = (dever >> 10) & 0x3ff; 661 chip->pcm[PLAY].num_streams = (dever >> 10) & 0x3ff;
662 chip->version = (dever >> 24) & 0xff; 662 chip->version = (dever >> 24) & 0xff;
663 snd_printdd(SFX "streams in=%d, out=%d, version=0x%x\n", 663 dev_dbg(chip->card->dev, "streams in=%d, out=%d, version=0x%x\n",
664 chip->pcm[CAPT].num_streams, chip->pcm[PLAY].num_streams, 664 chip->pcm[CAPT].num_streams, chip->pcm[PLAY].num_streams,
665 chip->version); 665 chip->version);
666 666
@@ -669,7 +669,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
669 chip->pcm[PLAY].num_streams > MAX_STREAM_OUT_COUNT || 669 chip->pcm[PLAY].num_streams > MAX_STREAM_OUT_COUNT ||
670 (!chip->pcm[CAPT].num_streams && 670 (!chip->pcm[CAPT].num_streams &&
671 !chip->pcm[PLAY].num_streams)) { 671 !chip->pcm[PLAY].num_streams)) {
672 printk(KERN_ERR SFX "invalid DEVER = %x\n", dever); 672 dev_err(chip->card->dev, "invalid DEVER = %x\n", dever);
673 err = -EINVAL; 673 err = -EINVAL;
674 goto errout; 674 goto errout;
675 } 675 }
@@ -680,7 +680,7 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci,
680 680
681 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 681 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
682 if (err < 0) { 682 if (err < 0) {
683 snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); 683 dev_err(chip->card->dev, "Error creating device [card]!\n");
684 goto errout; 684 goto errout;
685 } 685 }
686 686
@@ -720,7 +720,7 @@ static int lola_probe(struct pci_dev *pci,
720 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 720 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
721 0, &card); 721 0, &card);
722 if (err < 0) { 722 if (err < 0) {
723 snd_printk(KERN_ERR SFX "Error creating card!\n"); 723 dev_err(card->dev, "Error creating card!\n");
724 return err; 724 return err;
725 } 725 }
726 726
diff --git a/sound/pci/lola/lola_clock.c b/sound/pci/lola/lola_clock.c
index eb1d6b97df16..2bef6b412aee 100644
--- a/sound/pci/lola/lola_clock.c
+++ b/sound/pci/lola/lola_clock.c
@@ -128,21 +128,21 @@ int lola_init_clock_widget(struct lola *chip, int nid)
128 128
129 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val); 129 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
130 if (err < 0) { 130 if (err < 0) {
131 printk(KERN_ERR SFX "Can't read wcaps for 0x%x\n", nid); 131 dev_err(chip->card->dev, "Can't read wcaps for 0x%x\n", nid);
132 return err; 132 return err;
133 } 133 }
134 134
135 if ((val & 0xfff00000) != 0x01f00000) { /* test SubType and Type */ 135 if ((val & 0xfff00000) != 0x01f00000) { /* test SubType and Type */
136 snd_printdd("No valid clock widget\n"); 136 dev_dbg(chip->card->dev, "No valid clock widget\n");
137 return 0; 137 return 0;
138 } 138 }
139 139
140 chip->clock.nid = nid; 140 chip->clock.nid = nid;
141 chip->clock.items = val & 0xff; 141 chip->clock.items = val & 0xff;
142 snd_printdd("clock_list nid=%x, entries=%d\n", nid, 142 dev_dbg(chip->card->dev, "clock_list nid=%x, entries=%d\n", nid,
143 chip->clock.items); 143 chip->clock.items);
144 if (chip->clock.items > MAX_SAMPLE_CLOCK_COUNT) { 144 if (chip->clock.items > MAX_SAMPLE_CLOCK_COUNT) {
145 printk(KERN_ERR SFX "CLOCK_LIST too big: %d\n", 145 dev_err(chip->card->dev, "CLOCK_LIST too big: %d\n",
146 chip->clock.items); 146 chip->clock.items);
147 return -EINVAL; 147 return -EINVAL;
148 } 148 }
@@ -158,7 +158,7 @@ int lola_init_clock_widget(struct lola *chip, int nid)
158 err = lola_codec_read(chip, nid, LOLA_VERB_GET_CLOCK_LIST, 158 err = lola_codec_read(chip, nid, LOLA_VERB_GET_CLOCK_LIST,
159 idx, 0, &val, &res_ex); 159 idx, 0, &val, &res_ex);
160 if (err < 0) { 160 if (err < 0) {
161 printk(KERN_ERR SFX "Can't read CLOCK_LIST\n"); 161 dev_err(chip->card->dev, "Can't read CLOCK_LIST\n");
162 return -EINVAL; 162 return -EINVAL;
163 } 163 }
164 164
@@ -223,7 +223,7 @@ int lola_enable_clock_events(struct lola *chip)
223 if (err < 0) 223 if (err < 0)
224 return err; 224 return err;
225 if (res) { 225 if (res) {
226 printk(KERN_WARNING SFX "error in enable_clock_events %d\n", 226 dev_warn(chip->card->dev, "error in enable_clock_events %d\n",
227 res); 227 res);
228 return -EINVAL; 228 return -EINVAL;
229 } 229 }
@@ -242,7 +242,7 @@ int lola_set_clock_index(struct lola *chip, unsigned int idx)
242 if (err < 0) 242 if (err < 0)
243 return err; 243 return err;
244 if (res) { 244 if (res) {
245 printk(KERN_WARNING SFX "error in set_clock %d\n", res); 245 dev_warn(chip->card->dev, "error in set_clock %d\n", res);
246 return -EINVAL; 246 return -EINVAL;
247 } 247 }
248 return 0; 248 return 0;
diff --git a/sound/pci/lola/lola_mixer.c b/sound/pci/lola/lola_mixer.c
index 52c8d6b0f39b..782f4d8299ae 100644
--- a/sound/pci/lola/lola_mixer.c
+++ b/sound/pci/lola/lola_mixer.c
@@ -37,7 +37,7 @@ static int lola_init_pin(struct lola *chip, struct lola_pin *pin,
37 pin->nid = nid; 37 pin->nid = nid;
38 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val); 38 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
39 if (err < 0) { 39 if (err < 0) {
40 printk(KERN_ERR SFX "Can't read wcaps for 0x%x\n", nid); 40 dev_err(chip->card->dev, "Can't read wcaps for 0x%x\n", nid);
41 return err; 41 return err;
42 } 42 }
43 val &= 0x00f00fff; /* test TYPE and bits 0..11 */ 43 val &= 0x00f00fff; /* test TYPE and bits 0..11 */
@@ -48,7 +48,7 @@ static int lola_init_pin(struct lola *chip, struct lola_pin *pin,
48 else if (val == 0x0040000c && dir == PLAY) /* Dig=0, OutAmp/ovrd */ 48 else if (val == 0x0040000c && dir == PLAY) /* Dig=0, OutAmp/ovrd */
49 pin->is_analog = true; 49 pin->is_analog = true;
50 else { 50 else {
51 printk(KERN_ERR SFX "Invalid wcaps 0x%x for 0x%x\n", val, nid); 51 dev_err(chip->card->dev, "Invalid wcaps 0x%x for 0x%x\n", val, nid);
52 return -EINVAL; 52 return -EINVAL;
53 } 53 }
54 54
@@ -62,7 +62,7 @@ static int lola_init_pin(struct lola *chip, struct lola_pin *pin,
62 else 62 else
63 err = lola_read_param(chip, nid, LOLA_PAR_AMP_IN_CAP, &val); 63 err = lola_read_param(chip, nid, LOLA_PAR_AMP_IN_CAP, &val);
64 if (err < 0) { 64 if (err < 0) {
65 printk(KERN_ERR SFX "Can't read AMP-caps for 0x%x\n", nid); 65 dev_err(chip->card->dev, "Can't read AMP-caps for 0x%x\n", nid);
66 return err; 66 return err;
67 } 67 }
68 68
@@ -79,7 +79,7 @@ static int lola_init_pin(struct lola *chip, struct lola_pin *pin,
79 err = lola_codec_read(chip, nid, LOLA_VERB_GET_MAX_LEVEL, 0, 0, &val, 79 err = lola_codec_read(chip, nid, LOLA_VERB_GET_MAX_LEVEL, 0, 0, &val,
80 NULL); 80 NULL);
81 if (err < 0) { 81 if (err < 0) {
82 printk(KERN_ERR SFX "Can't get MAX_LEVEL 0x%x\n", nid); 82 dev_err(chip->card->dev, "Can't get MAX_LEVEL 0x%x\n", nid);
83 return err; 83 return err;
84 } 84 }
85 pin->max_level = val & 0x3ff; /* 10 bits */ 85 pin->max_level = val & 0x3ff; /* 10 bits */
@@ -119,12 +119,12 @@ int lola_init_mixer_widget(struct lola *chip, int nid)
119 119
120 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val); 120 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
121 if (err < 0) { 121 if (err < 0) {
122 printk(KERN_ERR SFX "Can't read wcaps for 0x%x\n", nid); 122 dev_err(chip->card->dev, "Can't read wcaps for 0x%x\n", nid);
123 return err; 123 return err;
124 } 124 }
125 125
126 if ((val & 0xfff00000) != 0x02f00000) { /* test SubType and Type */ 126 if ((val & 0xfff00000) != 0x02f00000) { /* test SubType and Type */
127 snd_printdd("No valid mixer widget\n"); 127 dev_dbg(chip->card->dev, "No valid mixer widget\n");
128 return 0; 128 return 0;
129 } 129 }
130 130
@@ -202,7 +202,7 @@ int lola_init_mixer_widget(struct lola *chip, int nid)
202 */ 202 */
203 if (chip->mixer.src_stream_out_ofs > MAX_AUDIO_INOUT_COUNT || 203 if (chip->mixer.src_stream_out_ofs > MAX_AUDIO_INOUT_COUNT ||
204 chip->mixer.dest_phys_out_ofs > MAX_STREAM_IN_COUNT) { 204 chip->mixer.dest_phys_out_ofs > MAX_STREAM_IN_COUNT) {
205 printk(KERN_ERR SFX "Invalid mixer widget size\n"); 205 dev_err(chip->card->dev, "Invalid mixer widget size\n");
206 return -EINVAL; 206 return -EINVAL;
207 } 207 }
208 208
@@ -213,7 +213,7 @@ int lola_init_mixer_widget(struct lola *chip, int nid)
213 (((1U << chip->mixer.dest_phys_outs) - 1) 213 (((1U << chip->mixer.dest_phys_outs) - 1)
214 << chip->mixer.dest_phys_out_ofs); 214 << chip->mixer.dest_phys_out_ofs);
215 215
216 snd_printdd("Mixer src_mask=%x, dest_mask=%x\n", 216 dev_dbg(chip->card->dev, "Mixer src_mask=%x, dest_mask=%x\n",
217 chip->mixer.src_mask, chip->mixer.dest_mask); 217 chip->mixer.src_mask, chip->mixer.dest_mask);
218 218
219 return 0; 219 return 0;
@@ -236,7 +236,8 @@ static int lola_mixer_set_src_gain(struct lola *chip, unsigned int id,
236 (gain == readw(&chip->mixer.array->src_gain[id]))) 236 (gain == readw(&chip->mixer.array->src_gain[id])))
237 return 0; 237 return 0;
238 238
239 snd_printdd("lola_mixer_set_src_gain (id=%d, gain=%d) enable=%x\n", 239 dev_dbg(chip->card->dev,
240 "lola_mixer_set_src_gain (id=%d, gain=%d) enable=%x\n",
240 id, gain, val); 241 id, gain, val);
241 writew(gain, &chip->mixer.array->src_gain[id]); 242 writew(gain, &chip->mixer.array->src_gain[id]);
242 writel(val, &chip->mixer.array->src_gain_enable); 243 writel(val, &chip->mixer.array->src_gain_enable);
@@ -409,7 +410,8 @@ static int set_analog_volume(struct lola *chip, int dir,
409 return 0; 410 return 0;
410 if (external_call) 411 if (external_call)
411 lola_codec_flush(chip); 412 lola_codec_flush(chip);
412 snd_printdd("set_analog_volume (dir=%d idx=%d, volume=%d)\n", 413 dev_dbg(chip->card->dev,
414 "set_analog_volume (dir=%d idx=%d, volume=%d)\n",
413 dir, idx, val); 415 dir, idx, val);
414 err = lola_codec_write(chip, pin->nid, 416 err = lola_codec_write(chip, pin->nid,
415 LOLA_VERB_SET_AMP_GAIN_MUTE, val, 0); 417 LOLA_VERB_SET_AMP_GAIN_MUTE, val, 0);
diff --git a/sound/pci/lola/lola_pcm.c b/sound/pci/lola/lola_pcm.c
index 5ea85e8b83ab..3bd6985430e8 100644
--- a/sound/pci/lola/lola_pcm.c
+++ b/sound/pci/lola/lola_pcm.c
@@ -103,7 +103,7 @@ static void wait_for_srst_clear(struct lola *chip, struct lola_stream *str)
103 return; 103 return;
104 msleep(1); 104 msleep(1);
105 } 105 }
106 printk(KERN_WARNING SFX "SRST not clear (stream %d)\n", str->dsd); 106 dev_warn(chip->card->dev, "SRST not clear (stream %d)\n", str->dsd);
107} 107}
108 108
109static int lola_stream_wait_for_fifo(struct lola *chip, 109static int lola_stream_wait_for_fifo(struct lola *chip,
@@ -118,7 +118,7 @@ static int lola_stream_wait_for_fifo(struct lola *chip,
118 return 0; 118 return 0;
119 msleep(1); 119 msleep(1);
120 } 120 }
121 printk(KERN_WARNING SFX "FIFO not ready (stream %d)\n", str->dsd); 121 dev_warn(chip->card->dev, "FIFO not ready (stream %d)\n", str->dsd);
122 return -EIO; 122 return -EIO;
123} 123}
124 124
@@ -156,7 +156,7 @@ static int lola_sync_wait_for_fifo(struct lola *chip,
156 return 0; 156 return 0;
157 msleep(1); 157 msleep(1);
158 } 158 }
159 printk(KERN_WARNING SFX "FIFO not ready (pending %d)\n", pending - 1); 159 dev_warn(chip->card->dev, "FIFO not ready (pending %d)\n", pending - 1);
160 return -EIO; 160 return -EIO;
161} 161}
162 162
@@ -373,7 +373,7 @@ static int lola_setup_periods(struct lola *chip, struct lola_pcm *pcm,
373 return 0; 373 return 0;
374 374
375 error: 375 error:
376 snd_printk(KERN_ERR SFX "Too many BDL entries: buffer=%d, period=%d\n", 376 dev_err(chip->card->dev, "Too many BDL entries: buffer=%d, period=%d\n",
377 str->bufsize, period_bytes); 377 str->bufsize, period_bytes);
378 return -EINVAL; 378 return -EINVAL;
379} 379}
@@ -415,7 +415,7 @@ static int lola_set_stream_config(struct lola *chip,
415 err = lola_codec_read(chip, str->nid, LOLA_VERB_SET_STREAM_FORMAT, 415 err = lola_codec_read(chip, str->nid, LOLA_VERB_SET_STREAM_FORMAT,
416 str->format_verb, 0, &val, NULL); 416 str->format_verb, 0, &val, NULL);
417 if (err < 0) { 417 if (err < 0) {
418 printk(KERN_ERR SFX "Cannot set stream format 0x%x\n", 418 dev_err(chip->card->dev, "Cannot set stream format 0x%x\n",
419 str->format_verb); 419 str->format_verb);
420 return err; 420 return err;
421 } 421 }
@@ -427,7 +427,8 @@ static int lola_set_stream_config(struct lola *chip,
427 LOLA_VERB_SET_CHANNEL_STREAMID, 0, verb, 427 LOLA_VERB_SET_CHANNEL_STREAMID, 0, verb,
428 &val, NULL); 428 &val, NULL);
429 if (err < 0) { 429 if (err < 0) {
430 printk(KERN_ERR SFX "Cannot set stream channel %d\n", i); 430 dev_err(chip->card->dev,
431 "Cannot set stream channel %d\n", i);
431 return err; 432 return err;
432 } 433 }
433 } 434 }
@@ -651,13 +652,14 @@ static int lola_init_stream(struct lola *chip, struct lola_stream *str,
651 str->dsd += MAX_STREAM_IN_COUNT; 652 str->dsd += MAX_STREAM_IN_COUNT;
652 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val); 653 err = lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
653 if (err < 0) { 654 if (err < 0) {
654 printk(KERN_ERR SFX "Can't read wcaps for 0x%x\n", nid); 655 dev_err(chip->card->dev, "Can't read wcaps for 0x%x\n", nid);
655 return err; 656 return err;
656 } 657 }
657 if (dir == PLAY) { 658 if (dir == PLAY) {
658 /* test TYPE and bits 0..11 (no test bit9 : Digital = 0/1) */ 659 /* test TYPE and bits 0..11 (no test bit9 : Digital = 0/1) */
659 if ((val & 0x00f00dff) != 0x00000010) { 660 if ((val & 0x00f00dff) != 0x00000010) {
660 printk(KERN_ERR SFX "Invalid wcaps 0x%x for 0x%x\n", 661 dev_err(chip->card->dev,
662 "Invalid wcaps 0x%x for 0x%x\n",
661 val, nid); 663 val, nid);
662 return -EINVAL; 664 return -EINVAL;
663 } 665 }
@@ -666,7 +668,8 @@ static int lola_init_stream(struct lola *chip, struct lola_stream *str,
666 * (bug : ignore bit8: Conn list = 0/1) 668 * (bug : ignore bit8: Conn list = 0/1)
667 */ 669 */
668 if ((val & 0x00f00cff) != 0x00100010) { 670 if ((val & 0x00f00cff) != 0x00100010) {
669 printk(KERN_ERR SFX "Invalid wcaps 0x%x for 0x%x\n", 671 dev_err(chip->card->dev,
672 "Invalid wcaps 0x%x for 0x%x\n",
670 val, nid); 673 val, nid);
671 return -EINVAL; 674 return -EINVAL;
672 } 675 }
@@ -677,14 +680,15 @@ static int lola_init_stream(struct lola *chip, struct lola_stream *str,
677 680
678 err = lola_read_param(chip, nid, LOLA_PAR_STREAM_FORMATS, &val); 681 err = lola_read_param(chip, nid, LOLA_PAR_STREAM_FORMATS, &val);
679 if (err < 0) { 682 if (err < 0) {
680 printk(KERN_ERR SFX "Can't read FORMATS 0x%x\n", nid); 683 dev_err(chip->card->dev, "Can't read FORMATS 0x%x\n", nid);
681 return err; 684 return err;
682 } 685 }
683 val &= 3; 686 val &= 3;
684 if (val == 3) 687 if (val == 3)
685 str->can_float = true; 688 str->can_float = true;
686 if (!(val & 1)) { 689 if (!(val & 1)) {
687 printk(KERN_ERR SFX "Invalid formats 0x%x for 0x%x", val, nid); 690 dev_err(chip->card->dev,
691 "Invalid formats 0x%x for 0x%x", val, nid);
688 return -EINVAL; 692 return -EINVAL;
689 } 693 }
690 return 0; 694 return 0;
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index b9743d4fa1cc..27f60ce8a55c 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -112,16 +112,16 @@ static int lx_hardware_open(struct lx6464es *chip,
112 112
113 snd_pcm_uframes_t period_size = runtime->period_size; 113 snd_pcm_uframes_t period_size = runtime->period_size;
114 114
115 snd_printd(LXP "allocating pipe for %d channels\n", channels); 115 dev_dbg(chip->card->dev, "allocating pipe for %d channels\n", channels);
116 err = lx_pipe_allocate(chip, 0, is_capture, channels); 116 err = lx_pipe_allocate(chip, 0, is_capture, channels);
117 if (err < 0) { 117 if (err < 0) {
118 snd_printk(KERN_ERR LXP "allocating pipe failed\n"); 118 dev_err(chip->card->dev, LXP "allocating pipe failed\n");
119 return err; 119 return err;
120 } 120 }
121 121
122 err = lx_set_granularity(chip, period_size); 122 err = lx_set_granularity(chip, period_size);
123 if (err < 0) { 123 if (err < 0) {
124 snd_printk(KERN_ERR LXP "setting granularity to %ld failed\n", 124 dev_err(chip->card->dev, "setting granularity to %ld failed\n",
125 period_size); 125 period_size);
126 return err; 126 return err;
127 } 127 }
@@ -136,24 +136,24 @@ static int lx_hardware_start(struct lx6464es *chip,
136 struct snd_pcm_runtime *runtime = substream->runtime; 136 struct snd_pcm_runtime *runtime = substream->runtime;
137 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); 137 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
138 138
139 snd_printd(LXP "setting stream format\n"); 139 dev_dbg(chip->card->dev, "setting stream format\n");
140 err = lx_stream_set_format(chip, runtime, 0, is_capture); 140 err = lx_stream_set_format(chip, runtime, 0, is_capture);
141 if (err < 0) { 141 if (err < 0) {
142 snd_printk(KERN_ERR LXP "setting stream format failed\n"); 142 dev_err(chip->card->dev, "setting stream format failed\n");
143 return err; 143 return err;
144 } 144 }
145 145
146 snd_printd(LXP "starting pipe\n"); 146 dev_dbg(chip->card->dev, "starting pipe\n");
147 err = lx_pipe_start(chip, 0, is_capture); 147 err = lx_pipe_start(chip, 0, is_capture);
148 if (err < 0) { 148 if (err < 0) {
149 snd_printk(KERN_ERR LXP "starting pipe failed\n"); 149 dev_err(chip->card->dev, "starting pipe failed\n");
150 return err; 150 return err;
151 } 151 }
152 152
153 snd_printd(LXP "waiting for pipe to start\n"); 153 dev_dbg(chip->card->dev, "waiting for pipe to start\n");
154 err = lx_pipe_wait_for_start(chip, 0, is_capture); 154 err = lx_pipe_wait_for_start(chip, 0, is_capture);
155 if (err < 0) { 155 if (err < 0) {
156 snd_printk(KERN_ERR LXP "waiting for pipe failed\n"); 156 dev_err(chip->card->dev, "waiting for pipe failed\n");
157 return err; 157 return err;
158 } 158 }
159 159
@@ -167,24 +167,24 @@ static int lx_hardware_stop(struct lx6464es *chip,
167 int err = 0; 167 int err = 0;
168 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); 168 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
169 169
170 snd_printd(LXP "pausing pipe\n"); 170 dev_dbg(chip->card->dev, "pausing pipe\n");
171 err = lx_pipe_pause(chip, 0, is_capture); 171 err = lx_pipe_pause(chip, 0, is_capture);
172 if (err < 0) { 172 if (err < 0) {
173 snd_printk(KERN_ERR LXP "pausing pipe failed\n"); 173 dev_err(chip->card->dev, "pausing pipe failed\n");
174 return err; 174 return err;
175 } 175 }
176 176
177 snd_printd(LXP "waiting for pipe to become idle\n"); 177 dev_dbg(chip->card->dev, "waiting for pipe to become idle\n");
178 err = lx_pipe_wait_for_idle(chip, 0, is_capture); 178 err = lx_pipe_wait_for_idle(chip, 0, is_capture);
179 if (err < 0) { 179 if (err < 0) {
180 snd_printk(KERN_ERR LXP "waiting for pipe failed\n"); 180 dev_err(chip->card->dev, "waiting for pipe failed\n");
181 return err; 181 return err;
182 } 182 }
183 183
184 snd_printd(LXP "stopping pipe\n"); 184 dev_dbg(chip->card->dev, "stopping pipe\n");
185 err = lx_pipe_stop(chip, 0, is_capture); 185 err = lx_pipe_stop(chip, 0, is_capture);
186 if (err < 0) { 186 if (err < 0) {
187 snd_printk(LXP "stopping pipe failed\n"); 187 dev_err(chip->card->dev, "stopping pipe failed\n");
188 return err; 188 return err;
189 } 189 }
190 190
@@ -198,10 +198,10 @@ static int lx_hardware_close(struct lx6464es *chip,
198 int err = 0; 198 int err = 0;
199 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); 199 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
200 200
201 snd_printd(LXP "releasing pipe\n"); 201 dev_dbg(chip->card->dev, "releasing pipe\n");
202 err = lx_pipe_release(chip, 0, is_capture); 202 err = lx_pipe_release(chip, 0, is_capture);
203 if (err < 0) { 203 if (err < 0) {
204 snd_printk(LXP "releasing pipe failed\n"); 204 dev_err(chip->card->dev, "releasing pipe failed\n");
205 return err; 205 return err;
206 } 206 }
207 207
@@ -216,7 +216,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream)
216 int err = 0; 216 int err = 0;
217 int board_rate; 217 int board_rate;
218 218
219 snd_printdd("->lx_pcm_open\n"); 219 dev_dbg(chip->card->dev, "->lx_pcm_open\n");
220 mutex_lock(&chip->setup_mutex); 220 mutex_lock(&chip->setup_mutex);
221 221
222 /* copy the struct snd_pcm_hardware struct */ 222 /* copy the struct snd_pcm_hardware struct */
@@ -227,7 +227,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream)
227 err = snd_pcm_hw_constraint_integer(runtime, 227 err = snd_pcm_hw_constraint_integer(runtime,
228 SNDRV_PCM_HW_PARAM_PERIODS); 228 SNDRV_PCM_HW_PARAM_PERIODS);
229 if (err < 0) { 229 if (err < 0) {
230 snd_printk(KERN_WARNING LXP "could not constrain periods\n"); 230 dev_warn(chip->card->dev, "could not constrain periods\n");
231 goto exit; 231 goto exit;
232 } 232 }
233#endif 233#endif
@@ -238,7 +238,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream)
238 board_rate, board_rate); 238 board_rate, board_rate);
239 239
240 if (err < 0) { 240 if (err < 0) {
241 snd_printk(KERN_WARNING LXP "could not constrain periods\n"); 241 dev_warn(chip->card->dev, "could not constrain periods\n");
242 goto exit; 242 goto exit;
243 } 243 }
244 244
@@ -248,7 +248,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream)
248 MICROBLAZE_IBL_MIN, 248 MICROBLAZE_IBL_MIN,
249 MICROBLAZE_IBL_MAX); 249 MICROBLAZE_IBL_MAX);
250 if (err < 0) { 250 if (err < 0) {
251 snd_printk(KERN_WARNING LXP 251 dev_warn(chip->card->dev,
252 "could not constrain period size\n"); 252 "could not constrain period size\n");
253 goto exit; 253 goto exit;
254 } 254 }
@@ -263,14 +263,14 @@ exit:
263 runtime->private_data = chip; 263 runtime->private_data = chip;
264 264
265 mutex_unlock(&chip->setup_mutex); 265 mutex_unlock(&chip->setup_mutex);
266 snd_printdd("<-lx_pcm_open, %d\n", err); 266 dev_dbg(chip->card->dev, "<-lx_pcm_open, %d\n", err);
267 return err; 267 return err;
268} 268}
269 269
270static int lx_pcm_close(struct snd_pcm_substream *substream) 270static int lx_pcm_close(struct snd_pcm_substream *substream)
271{ 271{
272 int err = 0; 272 int err = 0;
273 snd_printdd("->lx_pcm_close\n"); 273 dev_dbg(substream->pcm->card->dev, "->lx_pcm_close\n");
274 return err; 274 return err;
275} 275}
276 276
@@ -285,13 +285,13 @@ static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream
285 struct lx_stream *lx_stream = is_capture ? &chip->capture_stream : 285 struct lx_stream *lx_stream = is_capture ? &chip->capture_stream :
286 &chip->playback_stream; 286 &chip->playback_stream;
287 287
288 snd_printdd("->lx_pcm_stream_pointer\n"); 288 dev_dbg(chip->card->dev, "->lx_pcm_stream_pointer\n");
289 289
290 spin_lock_irqsave(&chip->lock, flags); 290 spin_lock_irqsave(&chip->lock, flags);
291 pos = lx_stream->frame_pos * substream->runtime->period_size; 291 pos = lx_stream->frame_pos * substream->runtime->period_size;
292 spin_unlock_irqrestore(&chip->lock, flags); 292 spin_unlock_irqrestore(&chip->lock, flags);
293 293
294 snd_printdd(LXP "stream_pointer at %ld\n", pos); 294 dev_dbg(chip->card->dev, "stream_pointer at %ld\n", pos);
295 return pos; 295 return pos;
296} 296}
297 297
@@ -301,37 +301,37 @@ static int lx_pcm_prepare(struct snd_pcm_substream *substream)
301 int err = 0; 301 int err = 0;
302 const int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); 302 const int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
303 303
304 snd_printdd("->lx_pcm_prepare\n"); 304 dev_dbg(chip->card->dev, "->lx_pcm_prepare\n");
305 305
306 mutex_lock(&chip->setup_mutex); 306 mutex_lock(&chip->setup_mutex);
307 307
308 if (chip->hardware_running[is_capture]) { 308 if (chip->hardware_running[is_capture]) {
309 err = lx_hardware_stop(chip, substream); 309 err = lx_hardware_stop(chip, substream);
310 if (err < 0) { 310 if (err < 0) {
311 snd_printk(KERN_ERR LXP "failed to stop hardware. " 311 dev_err(chip->card->dev, "failed to stop hardware. "
312 "Error code %d\n", err); 312 "Error code %d\n", err);
313 goto exit; 313 goto exit;
314 } 314 }
315 315
316 err = lx_hardware_close(chip, substream); 316 err = lx_hardware_close(chip, substream);
317 if (err < 0) { 317 if (err < 0) {
318 snd_printk(KERN_ERR LXP "failed to close hardware. " 318 dev_err(chip->card->dev, "failed to close hardware. "
319 "Error code %d\n", err); 319 "Error code %d\n", err);
320 goto exit; 320 goto exit;
321 } 321 }
322 } 322 }
323 323
324 snd_printd(LXP "opening hardware\n"); 324 dev_dbg(chip->card->dev, "opening hardware\n");
325 err = lx_hardware_open(chip, substream); 325 err = lx_hardware_open(chip, substream);
326 if (err < 0) { 326 if (err < 0) {
327 snd_printk(KERN_ERR LXP "failed to open hardware. " 327 dev_err(chip->card->dev, "failed to open hardware. "
328 "Error code %d\n", err); 328 "Error code %d\n", err);
329 goto exit; 329 goto exit;
330 } 330 }
331 331
332 err = lx_hardware_start(chip, substream); 332 err = lx_hardware_start(chip, substream);
333 if (err < 0) { 333 if (err < 0) {
334 snd_printk(KERN_ERR LXP "failed to start hardware. " 334 dev_err(chip->card->dev, "failed to start hardware. "
335 "Error code %d\n", err); 335 "Error code %d\n", err);
336 goto exit; 336 goto exit;
337 } 337 }
@@ -354,7 +354,7 @@ static int lx_pcm_hw_params(struct snd_pcm_substream *substream,
354 struct lx6464es *chip = snd_pcm_substream_chip(substream); 354 struct lx6464es *chip = snd_pcm_substream_chip(substream);
355 int err = 0; 355 int err = 0;
356 356
357 snd_printdd("->lx_pcm_hw_params\n"); 357 dev_dbg(chip->card->dev, "->lx_pcm_hw_params\n");
358 358
359 mutex_lock(&chip->setup_mutex); 359 mutex_lock(&chip->setup_mutex);
360 360
@@ -389,20 +389,20 @@ static int lx_pcm_hw_free(struct snd_pcm_substream *substream)
389 int err = 0; 389 int err = 0;
390 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); 390 int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
391 391
392 snd_printdd("->lx_pcm_hw_free\n"); 392 dev_dbg(chip->card->dev, "->lx_pcm_hw_free\n");
393 mutex_lock(&chip->setup_mutex); 393 mutex_lock(&chip->setup_mutex);
394 394
395 if (chip->hardware_running[is_capture]) { 395 if (chip->hardware_running[is_capture]) {
396 err = lx_hardware_stop(chip, substream); 396 err = lx_hardware_stop(chip, substream);
397 if (err < 0) { 397 if (err < 0) {
398 snd_printk(KERN_ERR LXP "failed to stop hardware. " 398 dev_err(chip->card->dev, "failed to stop hardware. "
399 "Error code %d\n", err); 399 "Error code %d\n", err);
400 goto exit; 400 goto exit;
401 } 401 }
402 402
403 err = lx_hardware_close(chip, substream); 403 err = lx_hardware_close(chip, substream);
404 if (err < 0) { 404 if (err < 0) {
405 snd_printk(KERN_ERR LXP "failed to close hardware. " 405 dev_err(chip->card->dev, "failed to close hardware. "
406 "Error code %d\n", err); 406 "Error code %d\n", err);
407 goto exit; 407 goto exit;
408 } 408 }
@@ -446,25 +446,25 @@ static void lx_trigger_start(struct lx6464es *chip, struct lx_stream *lx_stream)
446 446
447 err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, 447 err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed,
448 size_array); 448 size_array);
449 snd_printdd(LXP "starting: needed %d, freed %d\n", 449 dev_dbg(chip->card->dev, "starting: needed %d, freed %d\n",
450 needed, freed); 450 needed, freed);
451 451
452 err = lx_buffer_give(chip, 0, is_capture, period_bytes, 452 err = lx_buffer_give(chip, 0, is_capture, period_bytes,
453 lower_32_bits(buf), upper_32_bits(buf), 453 lower_32_bits(buf), upper_32_bits(buf),
454 &buffer_index); 454 &buffer_index);
455 455
456 snd_printdd(LXP "starting: buffer index %x on 0x%lx (%d bytes)\n", 456 dev_dbg(chip->card->dev, "starting: buffer index %x on 0x%lx (%d bytes)\n",
457 buffer_index, (unsigned long)buf, period_bytes); 457 buffer_index, (unsigned long)buf, period_bytes);
458 buf += period_bytes; 458 buf += period_bytes;
459 } 459 }
460 460
461 err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, size_array); 461 err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, size_array);
462 snd_printdd(LXP "starting: needed %d, freed %d\n", needed, freed); 462 dev_dbg(chip->card->dev, "starting: needed %d, freed %d\n", needed, freed);
463 463
464 snd_printd(LXP "starting: starting stream\n"); 464 dev_dbg(chip->card->dev, "starting: starting stream\n");
465 err = lx_stream_start(chip, 0, is_capture); 465 err = lx_stream_start(chip, 0, is_capture);
466 if (err < 0) 466 if (err < 0)
467 snd_printk(KERN_ERR LXP "couldn't start stream\n"); 467 dev_err(chip->card->dev, "couldn't start stream\n");
468 else 468 else
469 lx_stream->status = LX_STREAM_STATUS_RUNNING; 469 lx_stream->status = LX_STREAM_STATUS_RUNNING;
470 470
@@ -476,10 +476,10 @@ static void lx_trigger_stop(struct lx6464es *chip, struct lx_stream *lx_stream)
476 const unsigned int is_capture = lx_stream->is_capture; 476 const unsigned int is_capture = lx_stream->is_capture;
477 int err; 477 int err;
478 478
479 snd_printd(LXP "stopping: stopping stream\n"); 479 dev_dbg(chip->card->dev, "stopping: stopping stream\n");
480 err = lx_stream_stop(chip, 0, is_capture); 480 err = lx_stream_stop(chip, 0, is_capture);
481 if (err < 0) 481 if (err < 0)
482 snd_printk(KERN_ERR LXP "couldn't stop stream\n"); 482 dev_err(chip->card->dev, "couldn't stop stream\n");
483 else 483 else
484 lx_stream->status = LX_STREAM_STATUS_FREE; 484 lx_stream->status = LX_STREAM_STATUS_FREE;
485 485
@@ -507,7 +507,7 @@ static void lx_trigger_tasklet(unsigned long data)
507 struct lx6464es *chip = (struct lx6464es *)data; 507 struct lx6464es *chip = (struct lx6464es *)data;
508 unsigned long flags; 508 unsigned long flags;
509 509
510 snd_printdd("->lx_trigger_tasklet\n"); 510 dev_dbg(chip->card->dev, "->lx_trigger_tasklet\n");
511 511
512 spin_lock_irqsave(&chip->lock, flags); 512 spin_lock_irqsave(&chip->lock, flags);
513 lx_trigger_tasklet_dispatch_stream(chip, &chip->capture_stream); 513 lx_trigger_tasklet_dispatch_stream(chip, &chip->capture_stream);
@@ -547,14 +547,14 @@ static int lx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
547 struct lx_stream *stream = is_capture ? &chip->capture_stream : 547 struct lx_stream *stream = is_capture ? &chip->capture_stream :
548 &chip->playback_stream; 548 &chip->playback_stream;
549 549
550 snd_printdd("->lx_pcm_trigger\n"); 550 dev_dbg(chip->card->dev, "->lx_pcm_trigger\n");
551 551
552 return lx_pcm_trigger_dispatch(chip, stream, cmd); 552 return lx_pcm_trigger_dispatch(chip, stream, cmd);
553} 553}
554 554
555static int snd_lx6464es_free(struct lx6464es *chip) 555static int snd_lx6464es_free(struct lx6464es *chip)
556{ 556{
557 snd_printdd("->snd_lx6464es_free\n"); 557 dev_dbg(chip->card->dev, "->snd_lx6464es_free\n");
558 558
559 lx_irq_disable(chip); 559 lx_irq_disable(chip);
560 560
@@ -583,7 +583,7 @@ static int lx_init_xilinx_reset(struct lx6464es *chip)
583 int i; 583 int i;
584 u32 plx_reg = lx_plx_reg_read(chip, ePLX_CHIPSC); 584 u32 plx_reg = lx_plx_reg_read(chip, ePLX_CHIPSC);
585 585
586 snd_printdd("->lx_init_xilinx_reset\n"); 586 dev_dbg(chip->card->dev, "->lx_init_xilinx_reset\n");
587 587
588 /* activate reset of xilinx */ 588 /* activate reset of xilinx */
589 plx_reg &= ~CHIPSC_RESET_XILINX; 589 plx_reg &= ~CHIPSC_RESET_XILINX;
@@ -603,8 +603,8 @@ static int lx_init_xilinx_reset(struct lx6464es *chip)
603 msleep(10); 603 msleep(10);
604 reg_mbox3 = lx_plx_reg_read(chip, ePLX_MBOX3); 604 reg_mbox3 = lx_plx_reg_read(chip, ePLX_MBOX3);
605 if (reg_mbox3) { 605 if (reg_mbox3) {
606 snd_printd(LXP "xilinx reset done\n"); 606 dev_dbg(chip->card->dev, "xilinx reset done\n");
607 snd_printdd(LXP "xilinx took %d loops\n", i); 607 dev_dbg(chip->card->dev, "xilinx took %d loops\n", i);
608 break; 608 break;
609 } 609 }
610 } 610 }
@@ -624,7 +624,7 @@ static int lx_init_xilinx_test(struct lx6464es *chip)
624{ 624{
625 u32 reg; 625 u32 reg;
626 626
627 snd_printdd("->lx_init_xilinx_test\n"); 627 dev_dbg(chip->card->dev, "->lx_init_xilinx_test\n");
628 628
629 /* TEST if we have access to Xilinx/MicroBlaze */ 629 /* TEST if we have access to Xilinx/MicroBlaze */
630 lx_dsp_reg_write(chip, eReg_CSM, 0); 630 lx_dsp_reg_write(chip, eReg_CSM, 0);
@@ -632,19 +632,19 @@ static int lx_init_xilinx_test(struct lx6464es *chip)
632 reg = lx_dsp_reg_read(chip, eReg_CSM); 632 reg = lx_dsp_reg_read(chip, eReg_CSM);
633 633
634 if (reg) { 634 if (reg) {
635 snd_printk(KERN_ERR LXP "Problem: Reg_CSM %x.\n", reg); 635 dev_err(chip->card->dev, "Problem: Reg_CSM %x.\n", reg);
636 636
637 /* PCI9056_SPACE0_REMAP */ 637 /* PCI9056_SPACE0_REMAP */
638 lx_plx_reg_write(chip, ePLX_PCICR, 1); 638 lx_plx_reg_write(chip, ePLX_PCICR, 1);
639 639
640 reg = lx_dsp_reg_read(chip, eReg_CSM); 640 reg = lx_dsp_reg_read(chip, eReg_CSM);
641 if (reg) { 641 if (reg) {
642 snd_printk(KERN_ERR LXP "Error: Reg_CSM %x.\n", reg); 642 dev_err(chip->card->dev, "Error: Reg_CSM %x.\n", reg);
643 return -EAGAIN; /* seems to be appropriate */ 643 return -EAGAIN; /* seems to be appropriate */
644 } 644 }
645 } 645 }
646 646
647 snd_printd(LXP "Xilinx/MicroBlaze access test successful\n"); 647 dev_dbg(chip->card->dev, "Xilinx/MicroBlaze access test successful\n");
648 648
649 return 0; 649 return 0;
650} 650}
@@ -661,7 +661,7 @@ static int lx_init_ethersound_config(struct lx6464es *chip)
661 (64 << IOCR_OUTPUTS_OFFSET) | 661 (64 << IOCR_OUTPUTS_OFFSET) |
662 (FREQ_RATIO_SINGLE_MODE << FREQ_RATIO_OFFSET); 662 (FREQ_RATIO_SINGLE_MODE << FREQ_RATIO_OFFSET);
663 663
664 snd_printdd("->lx_init_ethersound\n"); 664 dev_dbg(chip->card->dev, "->lx_init_ethersound\n");
665 665
666 chip->freq_ratio = FREQ_RATIO_SINGLE_MODE; 666 chip->freq_ratio = FREQ_RATIO_SINGLE_MODE;
667 667
@@ -675,18 +675,18 @@ static int lx_init_ethersound_config(struct lx6464es *chip)
675 675
676 for (i = 0; i != 1000; ++i) { 676 for (i = 0; i != 1000; ++i) {
677 if (lx_dsp_reg_read(chip, eReg_CSES) & 4) { 677 if (lx_dsp_reg_read(chip, eReg_CSES) & 4) {
678 snd_printd(LXP "ethersound initialized after %dms\n", 678 dev_dbg(chip->card->dev, "ethersound initialized after %dms\n",
679 i); 679 i);
680 goto ethersound_initialized; 680 goto ethersound_initialized;
681 } 681 }
682 msleep(1); 682 msleep(1);
683 } 683 }
684 snd_printk(KERN_WARNING LXP 684 dev_warn(chip->card->dev,
685 "ethersound could not be initialized after %dms\n", i); 685 "ethersound could not be initialized after %dms\n", i);
686 return -ETIMEDOUT; 686 return -ETIMEDOUT;
687 687
688 ethersound_initialized: 688 ethersound_initialized:
689 snd_printd(LXP "ethersound initialized\n"); 689 dev_dbg(chip->card->dev, "ethersound initialized\n");
690 return 0; 690 return 0;
691} 691}
692 692
@@ -696,14 +696,14 @@ static int lx_init_get_version_features(struct lx6464es *chip)
696 696
697 int err; 697 int err;
698 698
699 snd_printdd("->lx_init_get_version_features\n"); 699 dev_dbg(chip->card->dev, "->lx_init_get_version_features\n");
700 700
701 err = lx_dsp_get_version(chip, &dsp_version); 701 err = lx_dsp_get_version(chip, &dsp_version);
702 702
703 if (err == 0) { 703 if (err == 0) {
704 u32 freq; 704 u32 freq;
705 705
706 snd_printk(LXP "DSP version: V%02d.%02d #%d\n", 706 dev_info(chip->card->dev, "DSP version: V%02d.%02d #%d\n",
707 (dsp_version>>16) & 0xff, (dsp_version>>8) & 0xff, 707 (dsp_version>>16) & 0xff, (dsp_version>>8) & 0xff,
708 dsp_version & 0xff); 708 dsp_version & 0xff);
709 709
@@ -718,9 +718,9 @@ static int lx_init_get_version_features(struct lx6464es *chip)
718 err = lx_dsp_get_clock_frequency(chip, &freq); 718 err = lx_dsp_get_clock_frequency(chip, &freq);
719 if (err == 0) 719 if (err == 0)
720 chip->board_sample_rate = freq; 720 chip->board_sample_rate = freq;
721 snd_printd(LXP "actual clock frequency %d\n", freq); 721 dev_dbg(chip->card->dev, "actual clock frequency %d\n", freq);
722 } else { 722 } else {
723 snd_printk(KERN_ERR LXP "DSP corrupted \n"); 723 dev_err(chip->card->dev, "DSP corrupted \n");
724 err = -EAGAIN; 724 err = -EAGAIN;
725 } 725 }
726 726
@@ -732,7 +732,7 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran)
732 int err = 0; 732 int err = 0;
733 u32 snapped_gran = MICROBLAZE_IBL_MIN; 733 u32 snapped_gran = MICROBLAZE_IBL_MIN;
734 734
735 snd_printdd("->lx_set_granularity\n"); 735 dev_dbg(chip->card->dev, "->lx_set_granularity\n");
736 736
737 /* blocksize is a power of 2 */ 737 /* blocksize is a power of 2 */
738 while ((snapped_gran < gran) && 738 while ((snapped_gran < gran) &&
@@ -745,14 +745,14 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran)
745 745
746 err = lx_dsp_set_granularity(chip, snapped_gran); 746 err = lx_dsp_set_granularity(chip, snapped_gran);
747 if (err < 0) { 747 if (err < 0) {
748 snd_printk(KERN_WARNING LXP "could not set granularity\n"); 748 dev_warn(chip->card->dev, "could not set granularity\n");
749 err = -EAGAIN; 749 err = -EAGAIN;
750 } 750 }
751 751
752 if (snapped_gran != gran) 752 if (snapped_gran != gran)
753 snd_printk(LXP "snapped blocksize to %d\n", snapped_gran); 753 dev_err(chip->card->dev, "snapped blocksize to %d\n", snapped_gran);
754 754
755 snd_printd(LXP "set blocksize on board %d\n", snapped_gran); 755 dev_dbg(chip->card->dev, "set blocksize on board %d\n", snapped_gran);
756 chip->pcm_granularity = snapped_gran; 756 chip->pcm_granularity = snapped_gran;
757 757
758 return err; 758 return err;
@@ -764,19 +764,19 @@ static int lx_init_dsp(struct lx6464es *chip)
764 int err; 764 int err;
765 int i; 765 int i;
766 766
767 snd_printdd("->lx_init_dsp\n"); 767 dev_dbg(chip->card->dev, "->lx_init_dsp\n");
768 768
769 snd_printd(LXP "initialize board\n"); 769 dev_dbg(chip->card->dev, "initialize board\n");
770 err = lx_init_xilinx_reset(chip); 770 err = lx_init_xilinx_reset(chip);
771 if (err) 771 if (err)
772 return err; 772 return err;
773 773
774 snd_printd(LXP "testing board\n"); 774 dev_dbg(chip->card->dev, "testing board\n");
775 err = lx_init_xilinx_test(chip); 775 err = lx_init_xilinx_test(chip);
776 if (err) 776 if (err)
777 return err; 777 return err;
778 778
779 snd_printd(LXP "initialize ethersound configuration\n"); 779 dev_dbg(chip->card->dev, "initialize ethersound configuration\n");
780 err = lx_init_ethersound_config(chip); 780 err = lx_init_ethersound_config(chip);
781 if (err) 781 if (err)
782 return err; 782 return err;
@@ -797,8 +797,9 @@ static int lx_init_dsp(struct lx6464es *chip)
797 return -ETIMEDOUT; 797 return -ETIMEDOUT;
798 798
799mac_ready: 799mac_ready:
800 snd_printd(LXP "mac address ready read after: %dms\n", i); 800 dev_dbg(chip->card->dev, "mac address ready read after: %dms\n", i);
801 snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n", 801 dev_info(chip->card->dev,
802 "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
802 chip->mac_address[0], chip->mac_address[1], chip->mac_address[2], 803 chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
803 chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]); 804 chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
804 805
@@ -977,7 +978,7 @@ static int snd_lx6464es_create(struct snd_card *card,
977 .dev_free = snd_lx6464es_dev_free, 978 .dev_free = snd_lx6464es_dev_free,
978 }; 979 };
979 980
980 snd_printdd("->snd_lx6464es_create\n"); 981 dev_dbg(card->dev, "->snd_lx6464es_create\n");
981 982
982 *rchip = NULL; 983 *rchip = NULL;
983 984
@@ -991,8 +992,8 @@ static int snd_lx6464es_create(struct snd_card *card,
991 /* check if we can restrict PCI DMA transfers to 32 bits */ 992 /* check if we can restrict PCI DMA transfers to 32 bits */
992 err = pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 993 err = pci_set_dma_mask(pci, DMA_BIT_MASK(32));
993 if (err < 0) { 994 if (err < 0) {
994 snd_printk(KERN_ERR "architecture does not support " 995 dev_err(card->dev,
995 "32bit PCI busmaster DMA\n"); 996 "architecture does not support 32bit PCI busmaster DMA\n");
996 pci_disable_device(pci); 997 pci_disable_device(pci);
997 return -ENXIO; 998 return -ENXIO;
998 } 999 }
@@ -1034,7 +1035,7 @@ static int snd_lx6464es_create(struct snd_card *card,
1034 err = request_irq(pci->irq, lx_interrupt, IRQF_SHARED, 1035 err = request_irq(pci->irq, lx_interrupt, IRQF_SHARED,
1035 KBUILD_MODNAME, chip); 1036 KBUILD_MODNAME, chip);
1036 if (err) { 1037 if (err) {
1037 snd_printk(KERN_ERR LXP "unable to grab IRQ %d\n", pci->irq); 1038 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1038 goto request_irq_failed; 1039 goto request_irq_failed;
1039 } 1040 }
1040 chip->irq = pci->irq; 1041 chip->irq = pci->irq;
@@ -1045,7 +1046,7 @@ static int snd_lx6464es_create(struct snd_card *card,
1045 1046
1046 err = lx_init_dsp(chip); 1047 err = lx_init_dsp(chip);
1047 if (err < 0) { 1048 if (err < 0) {
1048 snd_printk(KERN_ERR LXP "error during DSP initialization\n"); 1049 dev_err(card->dev, "error during DSP initialization\n");
1049 return err; 1050 return err;
1050 } 1051 }
1051 1052
@@ -1088,7 +1089,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
1088 struct lx6464es *chip; 1089 struct lx6464es *chip;
1089 int err; 1090 int err;
1090 1091
1091 snd_printdd("->snd_lx6464es_probe\n"); 1092 dev_dbg(&pci->dev, "->snd_lx6464es_probe\n");
1092 1093
1093 if (dev >= SNDRV_CARDS) 1094 if (dev >= SNDRV_CARDS)
1094 return -ENODEV; 1095 return -ENODEV;
@@ -1104,7 +1105,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
1104 1105
1105 err = snd_lx6464es_create(card, pci, &chip); 1106 err = snd_lx6464es_create(card, pci, &chip);
1106 if (err < 0) { 1107 if (err < 0) {
1107 snd_printk(KERN_ERR LXP "error during snd_lx6464es_create\n"); 1108 dev_err(card->dev, "error during snd_lx6464es_create\n");
1108 goto out_free; 1109 goto out_free;
1109 } 1110 }
1110 1111
@@ -1124,7 +1125,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
1124 if (err < 0) 1125 if (err < 0)
1125 goto out_free; 1126 goto out_free;
1126 1127
1127 snd_printdd(LXP "initialization successful\n"); 1128 dev_dbg(chip->card->dev, "initialization successful\n");
1128 pci_set_drvdata(pci, card); 1129 pci_set_drvdata(pci, card);
1129 dev++; 1130 dev++;
1130 return 0; 1131 return 0;
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c
index df4044d4f43d..2d8e95e9fbe5 100644
--- a/sound/pci/lx6464es/lx_core.c
+++ b/sound/pci/lx6464es/lx_core.c
@@ -273,7 +273,7 @@ static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh)
273 int dwloop; 273 int dwloop;
274 274
275 if (lx_dsp_reg_read(chip, eReg_CSM) & (Reg_CSM_MC | Reg_CSM_MR)) { 275 if (lx_dsp_reg_read(chip, eReg_CSM) & (Reg_CSM_MC | Reg_CSM_MR)) {
276 snd_printk(KERN_ERR LXP "PIOSendMessage eReg_CSM %x\n", reg); 276 dev_err(chip->card->dev, "PIOSendMessage eReg_CSM %x\n", reg);
277 return -EBUSY; 277 return -EBUSY;
278 } 278 }
279 279
@@ -294,7 +294,7 @@ static int lx_message_send_atomic(struct lx6464es *chip, struct lx_rmh *rmh)
294 } else 294 } else
295 udelay(1); 295 udelay(1);
296 } 296 }
297 snd_printk(KERN_WARNING LXP "TIMEOUT lx_message_send_atomic! " 297 dev_warn(chip->card->dev, "TIMEOUT lx_message_send_atomic! "
298 "polling failed\n"); 298 "polling failed\n");
299 299
300polling_successful: 300polling_successful:
@@ -306,18 +306,18 @@ polling_successful:
306 rmh->stat_len); 306 rmh->stat_len);
307 } 307 }
308 } else 308 } else
309 snd_printk(LXP "rmh error: %08x\n", reg); 309 dev_err(chip->card->dev, "rmh error: %08x\n", reg);
310 310
311 /* clear Reg_CSM_MR */ 311 /* clear Reg_CSM_MR */
312 lx_dsp_reg_write(chip, eReg_CSM, 0); 312 lx_dsp_reg_write(chip, eReg_CSM, 0);
313 313
314 switch (reg) { 314 switch (reg) {
315 case ED_DSP_TIMED_OUT: 315 case ED_DSP_TIMED_OUT:
316 snd_printk(KERN_WARNING LXP "lx_message_send: dsp timeout\n"); 316 dev_warn(chip->card->dev, "lx_message_send: dsp timeout\n");
317 return -ETIMEDOUT; 317 return -ETIMEDOUT;
318 318
319 case ED_DSP_CRASHED: 319 case ED_DSP_CRASHED:
320 snd_printk(KERN_WARNING LXP "lx_message_send: dsp crashed\n"); 320 dev_warn(chip->card->dev, "lx_message_send: dsp crashed\n");
321 return -EAGAIN; 321 return -EAGAIN;
322 } 322 }
323 323
@@ -458,7 +458,7 @@ int lx_pipe_allocate(struct lx6464es *chip, u32 pipe, int is_capture,
458 spin_unlock_irqrestore(&chip->msg_lock, flags); 458 spin_unlock_irqrestore(&chip->msg_lock, flags);
459 459
460 if (err != 0) 460 if (err != 0)
461 snd_printk(KERN_ERR "lx6464es: could not allocate pipe\n"); 461 dev_err(chip->card->dev, "could not allocate pipe\n");
462 462
463 return err; 463 return err;
464} 464}
@@ -520,11 +520,13 @@ int lx_buffer_ask(struct lx6464es *chip, u32 pipe, int is_capture,
520 } 520 }
521 521
522#if 0 522#if 0
523 snd_printdd(LXP "CMD_08_ASK_BUFFERS: needed %d, freed %d\n", 523 dev_dbg(chip->card->dev,
524 "CMD_08_ASK_BUFFERS: needed %d, freed %d\n",
524 *r_needed, *r_freed); 525 *r_needed, *r_freed);
525 for (i = 0; i < MAX_STREAM_BUFFER; ++i) { 526 for (i = 0; i < MAX_STREAM_BUFFER; ++i) {
526 for (i = 0; i != chip->rmh.stat_len; ++i) 527 for (i = 0; i != chip->rmh.stat_len; ++i)
527 snd_printdd(" stat[%d]: %x, %x\n", i, 528 dev_dbg(chip->card->dev,
529 " stat[%d]: %x, %x\n", i,
528 chip->rmh.stat[i], 530 chip->rmh.stat[i],
529 chip->rmh.stat[i] & MASK_DATA_SIZE); 531 chip->rmh.stat[i] & MASK_DATA_SIZE);
530 } 532 }
@@ -617,8 +619,8 @@ int lx_pipe_sample_count(struct lx6464es *chip, u32 pipe, int is_capture,
617 err = lx_message_send_atomic(chip, &chip->rmh); /* don't sleep! */ 619 err = lx_message_send_atomic(chip, &chip->rmh); /* don't sleep! */
618 620
619 if (err != 0) 621 if (err != 0)
620 snd_printk(KERN_ERR 622 dev_err(chip->card->dev,
621 "lx6464es: could not query pipe's sample count\n"); 623 "could not query pipe's sample count\n");
622 else { 624 else {
623 *rsample_count = ((u64)(chip->rmh.stat[0] & MASK_SPL_COUNT_HI) 625 *rsample_count = ((u64)(chip->rmh.stat[0] & MASK_SPL_COUNT_HI)
624 << 24) /* hi part */ 626 << 24) /* hi part */
@@ -644,7 +646,7 @@ int lx_pipe_state(struct lx6464es *chip, u32 pipe, int is_capture, u16 *rstate)
644 err = lx_message_send_atomic(chip, &chip->rmh); 646 err = lx_message_send_atomic(chip, &chip->rmh);
645 647
646 if (err != 0) 648 if (err != 0)
647 snd_printk(KERN_ERR "lx6464es: could not query pipe's state\n"); 649 dev_err(chip->card->dev, "could not query pipe's state\n");
648 else 650 else
649 *rstate = (chip->rmh.stat[0] >> PSTATE_OFFSET) & 0x0F; 651 *rstate = (chip->rmh.stat[0] >> PSTATE_OFFSET) & 0x0F;
650 652
@@ -717,7 +719,7 @@ int lx_stream_set_format(struct lx6464es *chip, struct snd_pcm_runtime *runtime,
717 u32 channels = runtime->channels; 719 u32 channels = runtime->channels;
718 720
719 if (runtime->channels != channels) 721 if (runtime->channels != channels)
720 snd_printk(KERN_ERR LXP "channel count mismatch: %d vs %d", 722 dev_err(chip->card->dev, "channel count mismatch: %d vs %d",
721 runtime->channels, channels); 723 runtime->channels, channels);
722 724
723 spin_lock_irqsave(&chip->msg_lock, flags); 725 spin_lock_irqsave(&chip->msg_lock, flags);
@@ -820,13 +822,16 @@ int lx_buffer_give(struct lx6464es *chip, u32 pipe, int is_capture,
820 } 822 }
821 823
822 if (err == EB_RBUFFERS_TABLE_OVERFLOW) 824 if (err == EB_RBUFFERS_TABLE_OVERFLOW)
823 snd_printk(LXP "lx_buffer_give EB_RBUFFERS_TABLE_OVERFLOW\n"); 825 dev_err(chip->card->dev,
826 "lx_buffer_give EB_RBUFFERS_TABLE_OVERFLOW\n");
824 827
825 if (err == EB_INVALID_STREAM) 828 if (err == EB_INVALID_STREAM)
826 snd_printk(LXP "lx_buffer_give EB_INVALID_STREAM\n"); 829 dev_err(chip->card->dev,
830 "lx_buffer_give EB_INVALID_STREAM\n");
827 831
828 if (err == EB_CMD_REFUSED) 832 if (err == EB_CMD_REFUSED)
829 snd_printk(LXP "lx_buffer_give EB_CMD_REFUSED\n"); 833 dev_err(chip->card->dev,
834 "lx_buffer_give EB_CMD_REFUSED\n");
830 835
831 done: 836 done:
832 spin_unlock_irqrestore(&chip->msg_lock, flags); 837 spin_unlock_irqrestore(&chip->msg_lock, flags);
@@ -899,7 +904,8 @@ int lx_level_unmute(struct lx6464es *chip, int is_capture, int unmute)
899 chip->rmh.cmd[1] = (u32)(mute_mask >> (u64)32); /* hi part */ 904 chip->rmh.cmd[1] = (u32)(mute_mask >> (u64)32); /* hi part */
900 chip->rmh.cmd[2] = (u32)(mute_mask & (u64)0xFFFFFFFF); /* lo part */ 905 chip->rmh.cmd[2] = (u32)(mute_mask & (u64)0xFFFFFFFF); /* lo part */
901 906
902 snd_printk("mute %x %x %x\n", chip->rmh.cmd[0], chip->rmh.cmd[1], 907 dev_dbg(chip->card->dev,
908 "mute %x %x %x\n", chip->rmh.cmd[0], chip->rmh.cmd[1],
903 chip->rmh.cmd[2]); 909 chip->rmh.cmd[2]);
904 910
905 err = lx_message_send_atomic(chip, &chip->rmh); 911 err = lx_message_send_atomic(chip, &chip->rmh);
@@ -1009,7 +1015,7 @@ static int lx_interrupt_ack(struct lx6464es *chip, u32 *r_irqsrc,
1009 } 1015 }
1010 1016
1011 if (irq_async) { 1017 if (irq_async) {
1012 /* snd_printd("interrupt: async event pending\n"); */ 1018 /* dev_dbg(chip->card->dev, "interrupt: async event pending\n"); */
1013 *r_async_pending = 1; 1019 *r_async_pending = 1;
1014 } 1020 }
1015 1021
@@ -1055,13 +1061,13 @@ static int lx_interrupt_handle_async_events(struct lx6464es *chip, u32 irqsrc,
1055 if (eb_pending_in) { 1061 if (eb_pending_in) {
1056 *r_notified_in_pipe_mask = ((u64)stat[3] << 32) 1062 *r_notified_in_pipe_mask = ((u64)stat[3] << 32)
1057 + stat[4]; 1063 + stat[4];
1058 snd_printdd(LXP "interrupt: EOBI pending %llx\n", 1064 dev_dbg(chip->card->dev, "interrupt: EOBI pending %llx\n",
1059 *r_notified_in_pipe_mask); 1065 *r_notified_in_pipe_mask);
1060 } 1066 }
1061 if (eb_pending_out) { 1067 if (eb_pending_out) {
1062 *r_notified_out_pipe_mask = ((u64)stat[1] << 32) 1068 *r_notified_out_pipe_mask = ((u64)stat[1] << 32)
1063 + stat[2]; 1069 + stat[2];
1064 snd_printdd(LXP "interrupt: EOBO pending %llx\n", 1070 dev_dbg(chip->card->dev, "interrupt: EOBO pending %llx\n",
1065 *r_notified_out_pipe_mask); 1071 *r_notified_out_pipe_mask);
1066 } 1072 }
1067 1073
@@ -1097,17 +1103,19 @@ static int lx_interrupt_request_new_buffer(struct lx6464es *chip,
1097 u32 needed, freed; 1103 u32 needed, freed;
1098 u32 size_array[MAX_STREAM_BUFFER]; 1104 u32 size_array[MAX_STREAM_BUFFER];
1099 1105
1100 snd_printdd("->lx_interrupt_request_new_buffer\n"); 1106 dev_dbg(chip->card->dev, "->lx_interrupt_request_new_buffer\n");
1101 1107
1102 spin_lock_irqsave(&chip->lock, flags); 1108 spin_lock_irqsave(&chip->lock, flags);
1103 1109
1104 err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, size_array); 1110 err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, size_array);
1105 snd_printdd(LXP "interrupt: needed %d, freed %d\n", needed, freed); 1111 dev_dbg(chip->card->dev,
1112 "interrupt: needed %d, freed %d\n", needed, freed);
1106 1113
1107 unpack_pointer(buf, &buf_lo, &buf_hi); 1114 unpack_pointer(buf, &buf_lo, &buf_hi);
1108 err = lx_buffer_give(chip, 0, is_capture, period_bytes, buf_lo, buf_hi, 1115 err = lx_buffer_give(chip, 0, is_capture, period_bytes, buf_lo, buf_hi,
1109 &buffer_index); 1116 &buffer_index);
1110 snd_printdd(LXP "interrupt: gave buffer index %x on 0x%lx (%d bytes)\n", 1117 dev_dbg(chip->card->dev,
1118 "interrupt: gave buffer index %x on 0x%lx (%d bytes)\n",
1111 buffer_index, (unsigned long)buf, period_bytes); 1119 buffer_index, (unsigned long)buf, period_bytes);
1112 1120
1113 lx_stream->frame_pos = next_pos; 1121 lx_stream->frame_pos = next_pos;
@@ -1122,11 +1130,11 @@ void lx_tasklet_playback(unsigned long data)
1122 struct lx_stream *lx_stream = &chip->playback_stream; 1130 struct lx_stream *lx_stream = &chip->playback_stream;
1123 int err; 1131 int err;
1124 1132
1125 snd_printdd("->lx_tasklet_playback\n"); 1133 dev_dbg(chip->card->dev, "->lx_tasklet_playback\n");
1126 1134
1127 err = lx_interrupt_request_new_buffer(chip, lx_stream); 1135 err = lx_interrupt_request_new_buffer(chip, lx_stream);
1128 if (err < 0) 1136 if (err < 0)
1129 snd_printk(KERN_ERR LXP 1137 dev_err(chip->card->dev,
1130 "cannot request new buffer for playback\n"); 1138 "cannot request new buffer for playback\n");
1131 1139
1132 snd_pcm_period_elapsed(lx_stream->stream); 1140 snd_pcm_period_elapsed(lx_stream->stream);
@@ -1138,10 +1146,10 @@ void lx_tasklet_capture(unsigned long data)
1138 struct lx_stream *lx_stream = &chip->capture_stream; 1146 struct lx_stream *lx_stream = &chip->capture_stream;
1139 int err; 1147 int err;
1140 1148
1141 snd_printdd("->lx_tasklet_capture\n"); 1149 dev_dbg(chip->card->dev, "->lx_tasklet_capture\n");
1142 err = lx_interrupt_request_new_buffer(chip, lx_stream); 1150 err = lx_interrupt_request_new_buffer(chip, lx_stream);
1143 if (err < 0) 1151 if (err < 0)
1144 snd_printk(KERN_ERR LXP 1152 dev_err(chip->card->dev,
1145 "cannot request new buffer for capture\n"); 1153 "cannot request new buffer for capture\n");
1146 1154
1147 snd_pcm_period_elapsed(lx_stream->stream); 1155 snd_pcm_period_elapsed(lx_stream->stream);
@@ -1156,12 +1164,14 @@ static int lx_interrupt_handle_audio_transfer(struct lx6464es *chip,
1156 int err = 0; 1164 int err = 0;
1157 1165
1158 if (notified_in_pipe_mask) { 1166 if (notified_in_pipe_mask) {
1159 snd_printdd(LXP "requesting audio transfer for capture\n"); 1167 dev_dbg(chip->card->dev,
1168 "requesting audio transfer for capture\n");
1160 tasklet_hi_schedule(&chip->tasklet_capture); 1169 tasklet_hi_schedule(&chip->tasklet_capture);
1161 } 1170 }
1162 1171
1163 if (notified_out_pipe_mask) { 1172 if (notified_out_pipe_mask) {
1164 snd_printdd(LXP "requesting audio transfer for playback\n"); 1173 dev_dbg(chip->card->dev,
1174 "requesting audio transfer for playback\n");
1165 tasklet_hi_schedule(&chip->tasklet_playback); 1175 tasklet_hi_schedule(&chip->tasklet_playback);
1166 } 1176 }
1167 1177
@@ -1177,11 +1187,12 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1177 1187
1178 spin_lock(&chip->lock); 1188 spin_lock(&chip->lock);
1179 1189
1180 snd_printdd("**************************************************\n"); 1190 dev_dbg(chip->card->dev,
1191 "**************************************************\n");
1181 1192
1182 if (!lx_interrupt_ack(chip, &irqsrc, &async_pending, &async_escmd)) { 1193 if (!lx_interrupt_ack(chip, &irqsrc, &async_pending, &async_escmd)) {
1183 spin_unlock(&chip->lock); 1194 spin_unlock(&chip->lock);
1184 snd_printdd("IRQ_NONE\n"); 1195 dev_dbg(chip->card->dev, "IRQ_NONE\n");
1185 return IRQ_NONE; /* this device did not cause the interrupt */ 1196 return IRQ_NONE; /* this device did not cause the interrupt */
1186 } 1197 }
1187 1198
@@ -1190,16 +1201,16 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1190 1201
1191#if 0 1202#if 0
1192 if (irqsrc & MASK_SYS_STATUS_EOBI) 1203 if (irqsrc & MASK_SYS_STATUS_EOBI)
1193 snd_printdd(LXP "interrupt: EOBI\n"); 1204 dev_dgg(chip->card->dev, "interrupt: EOBI\n");
1194 1205
1195 if (irqsrc & MASK_SYS_STATUS_EOBO) 1206 if (irqsrc & MASK_SYS_STATUS_EOBO)
1196 snd_printdd(LXP "interrupt: EOBO\n"); 1207 dev_dbg(chip->card->dev, "interrupt: EOBO\n");
1197 1208
1198 if (irqsrc & MASK_SYS_STATUS_URUN) 1209 if (irqsrc & MASK_SYS_STATUS_URUN)
1199 snd_printdd(LXP "interrupt: URUN\n"); 1210 dev_dbg(chip->card->dev, "interrupt: URUN\n");
1200 1211
1201 if (irqsrc & MASK_SYS_STATUS_ORUN) 1212 if (irqsrc & MASK_SYS_STATUS_ORUN)
1202 snd_printdd(LXP "interrupt: ORUN\n"); 1213 dev_dbg(chip->card->dev, "interrupt: ORUN\n");
1203#endif 1214#endif
1204 1215
1205 if (async_pending) { 1216 if (async_pending) {
@@ -1214,7 +1225,7 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1214 &notified_in_pipe_mask, 1225 &notified_in_pipe_mask,
1215 &notified_out_pipe_mask); 1226 &notified_out_pipe_mask);
1216 if (err) 1227 if (err)
1217 snd_printk(KERN_ERR LXP 1228 dev_err(chip->card->dev,
1218 "error handling async events\n"); 1229 "error handling async events\n");
1219 1230
1220 err = lx_interrupt_handle_audio_transfer(chip, 1231 err = lx_interrupt_handle_audio_transfer(chip,
@@ -1222,7 +1233,7 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1222 notified_out_pipe_mask 1233 notified_out_pipe_mask
1223 ); 1234 );
1224 if (err) 1235 if (err)
1225 snd_printk(KERN_ERR LXP 1236 dev_err(chip->card->dev,
1226 "error during audio transfer\n"); 1237 "error during audio transfer\n");
1227 } 1238 }
1228 1239
@@ -1234,7 +1245,7 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1234 * 1245 *
1235 * */ 1246 * */
1236 1247
1237 snd_printdd("lx6464es: interrupt requests escmd handling\n"); 1248 dev_dbg(chip->card->dev, "interrupt requests escmd handling\n");
1238#endif 1249#endif
1239 } 1250 }
1240 1251
@@ -1262,12 +1273,12 @@ static void lx_irq_set(struct lx6464es *chip, int enable)
1262 1273
1263void lx_irq_enable(struct lx6464es *chip) 1274void lx_irq_enable(struct lx6464es *chip)
1264{ 1275{
1265 snd_printdd("->lx_irq_enable\n"); 1276 dev_dbg(chip->card->dev, "->lx_irq_enable\n");
1266 lx_irq_set(chip, 1); 1277 lx_irq_set(chip, 1);
1267} 1278}
1268 1279
1269void lx_irq_disable(struct lx6464es *chip) 1280void lx_irq_disable(struct lx6464es *chip)
1270{ 1281{
1271 snd_printdd("->lx_irq_disable\n"); 1282 dev_dbg(chip->card->dev, "->lx_irq_disable\n");
1272 lx_irq_set(chip, 0); 1283 lx_irq_set(chip, 0);
1273} 1284}
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 076c3ec000c0..0d3ea3e79952 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -1403,7 +1403,7 @@ static int snd_m3_pcm_hw_params(struct snd_pcm_substream *substream,
1403 /* set buffer address */ 1403 /* set buffer address */
1404 s->buffer_addr = substream->runtime->dma_addr; 1404 s->buffer_addr = substream->runtime->dma_addr;
1405 if (s->buffer_addr & 0x3) { 1405 if (s->buffer_addr & 0x3) {
1406 snd_printk(KERN_ERR "oh my, not aligned\n"); 1406 dev_err(substream->pcm->card->dev, "oh my, not aligned\n");
1407 s->buffer_addr = s->buffer_addr & ~0x3; 1407 s->buffer_addr = s->buffer_addr & ~0x3;
1408 } 1408 }
1409 return 0; 1409 return 0;
@@ -1900,7 +1900,7 @@ static int snd_m3_ac97_wait(struct snd_m3 *chip)
1900 cpu_relax(); 1900 cpu_relax();
1901 } while (i-- > 0); 1901 } while (i-- > 0);
1902 1902
1903 snd_printk(KERN_ERR "ac97 serial bus busy\n"); 1903 dev_err(chip->card->dev, "ac97 serial bus busy\n");
1904 return 1; 1904 return 1;
1905} 1905}
1906 1906
@@ -2015,7 +2015,8 @@ static void snd_m3_ac97_reset(struct snd_m3 *chip)
2015 delay1 += 10; 2015 delay1 += 10;
2016 delay2 += 100; 2016 delay2 += 100;
2017 2017
2018 snd_printd("maestro3: retrying codec reset with delays of %d and %d ms\n", 2018 dev_dbg(chip->card->dev,
2019 "retrying codec reset with delays of %d and %d ms\n",
2019 delay1, delay2); 2020 delay1, delay2);
2020 } 2021 }
2021 2022
@@ -2194,7 +2195,8 @@ static int snd_m3_assp_client_init(struct snd_m3 *chip, struct m3_dma *s, int in
2194 address = 0x1100 + ((data_bytes/2) * index); 2195 address = 0x1100 + ((data_bytes/2) * index);
2195 2196
2196 if ((address + (data_bytes/2)) >= 0x1c00) { 2197 if ((address + (data_bytes/2)) >= 0x1c00) {
2197 snd_printk(KERN_ERR "no memory for %d bytes at ind %d (addr 0x%x)\n", 2198 dev_err(chip->card->dev,
2199 "no memory for %d bytes at ind %d (addr 0x%x)\n",
2198 data_bytes, index, address); 2200 data_bytes, index, address);
2199 return -ENOMEM; 2201 return -ENOMEM;
2200 } 2202 }
@@ -2439,8 +2441,7 @@ static int m3_resume(struct device *dev)
2439 pci_set_power_state(pci, PCI_D0); 2441 pci_set_power_state(pci, PCI_D0);
2440 pci_restore_state(pci); 2442 pci_restore_state(pci);
2441 if (pci_enable_device(pci) < 0) { 2443 if (pci_enable_device(pci) < 0) {
2442 printk(KERN_ERR "maestor3: pci_enable_device failed, " 2444 dev_err(dev, "pci_enable_device failed, disabling device\n");
2443 "disabling device\n");
2444 snd_card_disconnect(card); 2445 snd_card_disconnect(card);
2445 return -EIO; 2446 return -EIO;
2446 } 2447 }
@@ -2553,7 +2554,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2553 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2554 /* check, if we can restrict PCI DMA transfers to 28 bits */
2554 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2555 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
2555 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2556 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
2556 snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); 2557 dev_err(card->dev,
2558 "architecture does not support 28bit PCI busmaster DMA\n");
2557 pci_disable_device(pci); 2559 pci_disable_device(pci);
2558 return -ENXIO; 2560 return -ENXIO;
2559 } 2561 }
@@ -2586,9 +2588,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2586 else { 2588 else {
2587 quirk = snd_pci_quirk_lookup(pci, m3_amp_quirk_list); 2589 quirk = snd_pci_quirk_lookup(pci, m3_amp_quirk_list);
2588 if (quirk) { 2590 if (quirk) {
2589 snd_printdd(KERN_INFO 2591 dev_info(card->dev, "set amp-gpio for '%s'\n",
2590 "maestro3: set amp-gpio for '%s'\n", 2592 snd_pci_quirk_name(quirk));
2591 snd_pci_quirk_name(quirk));
2592 chip->amp_gpio = quirk->value; 2593 chip->amp_gpio = quirk->value;
2593 } else if (chip->allegro_flag) 2594 } else if (chip->allegro_flag)
2594 chip->amp_gpio = GPO_EXT_AMP_ALLEGRO; 2595 chip->amp_gpio = GPO_EXT_AMP_ALLEGRO;
@@ -2598,9 +2599,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2598 2599
2599 quirk = snd_pci_quirk_lookup(pci, m3_irda_quirk_list); 2600 quirk = snd_pci_quirk_lookup(pci, m3_irda_quirk_list);
2600 if (quirk) { 2601 if (quirk) {
2601 snd_printdd(KERN_INFO 2602 dev_info(card->dev, "enabled irda workaround for '%s'\n",
2602 "maestro3: enabled irda workaround for '%s'\n", 2603 snd_pci_quirk_name(quirk));
2603 snd_pci_quirk_name(quirk));
2604 chip->irda_workaround = 1; 2604 chip->irda_workaround = 1;
2605 } 2605 }
2606 quirk = snd_pci_quirk_lookup(pci, m3_hv_quirk_list); 2606 quirk = snd_pci_quirk_lookup(pci, m3_hv_quirk_list);
@@ -2652,7 +2652,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2652 2652
2653 if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED, 2653 if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED,
2654 KBUILD_MODNAME, chip)) { 2654 KBUILD_MODNAME, chip)) {
2655 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2655 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2656 snd_m3_free(chip); 2656 snd_m3_free(chip);
2657 return -ENOMEM; 2657 return -ENOMEM;
2658 } 2658 }
@@ -2661,7 +2661,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2661#ifdef CONFIG_PM_SLEEP 2661#ifdef CONFIG_PM_SLEEP
2662 chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH)); 2662 chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH));
2663 if (chip->suspend_mem == NULL) 2663 if (chip->suspend_mem == NULL)
2664 snd_printk(KERN_WARNING "can't allocate apm buffer\n"); 2664 dev_warn(card->dev, "can't allocate apm buffer\n");
2665#endif 2665#endif
2666 2666
2667 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 2667 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
@@ -2685,8 +2685,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2685 if (chip->hv_config & HV_CTRL_ENABLE) { 2685 if (chip->hv_config & HV_CTRL_ENABLE) {
2686 err = snd_m3_input_register(chip); 2686 err = snd_m3_input_register(chip);
2687 if (err) 2687 if (err)
2688 snd_printk(KERN_WARNING "Input device registration " 2688 dev_warn(card->dev,
2689 "failed with error %i", err); 2689 "Input device registration failed with error %i",
2690 err);
2690 } 2691 }
2691#endif 2692#endif
2692 2693
@@ -2763,7 +2764,7 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2763 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK, 2764 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
2764 -1, &chip->rmidi); 2765 -1, &chip->rmidi);
2765 if (err < 0) 2766 if (err < 0)
2766 printk(KERN_WARNING "maestro3: no MIDI support.\n"); 2767 dev_warn(card->dev, "no MIDI support.\n");
2767#endif 2768#endif
2768 2769
2769 pci_set_drvdata(pci, card); 2770 pci_set_drvdata(pci, card);
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 9ab057bb9859..a93e7af51eed 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -87,7 +87,8 @@ static int mixart_set_pipe_state(struct mixart_mgr *mgr,
87 if(!start) return 0; /* already stopped */ 87 if(!start) return 0; /* already stopped */
88 break; 88 break;
89 default: 89 default:
90 snd_printk(KERN_ERR "error mixart_set_pipe_state called with wrong pipe->status!\n"); 90 dev_err(&mgr->pci->dev,
91 "error mixart_set_pipe_state called with wrong pipe->status!\n");
91 return -EINVAL; /* function called with wrong pipe status */ 92 return -EINVAL; /* function called with wrong pipe status */
92 } 93 }
93 94
@@ -102,7 +103,8 @@ static int mixart_set_pipe_state(struct mixart_mgr *mgr,
102 103
103 err = snd_mixart_send_msg_wait_notif(mgr, &request, system_msg_uid); 104 err = snd_mixart_send_msg_wait_notif(mgr, &request, system_msg_uid);
104 if(err) { 105 if(err) {
105 snd_printk(KERN_ERR "error : MSG_SYSTEM_WAIT_SYNCHRO_CMD was not notified !\n"); 106 dev_err(&mgr->pci->dev,
107 "error : MSG_SYSTEM_WAIT_SYNCHRO_CMD was not notified !\n");
106 return err; 108 return err;
107 } 109 }
108 110
@@ -123,7 +125,9 @@ static int mixart_set_pipe_state(struct mixart_mgr *mgr,
123 125
124 err = snd_mixart_send_msg(mgr, &request, sizeof(group_state_resp), &group_state_resp); 126 err = snd_mixart_send_msg(mgr, &request, sizeof(group_state_resp), &group_state_resp);
125 if (err < 0 || group_state_resp.txx_status != 0) { 127 if (err < 0 || group_state_resp.txx_status != 0) {
126 snd_printk(KERN_ERR "error MSG_STREAM_ST***_STREAM_GRP_PACKET err=%x stat=%x !\n", err, group_state_resp.txx_status); 128 dev_err(&mgr->pci->dev,
129 "error MSG_STREAM_ST***_STREAM_GRP_PACKET err=%x stat=%x !\n",
130 err, group_state_resp.txx_status);
127 return -EINVAL; 131 return -EINVAL;
128 } 132 }
129 133
@@ -134,7 +138,9 @@ static int mixart_set_pipe_state(struct mixart_mgr *mgr,
134 138
135 err = snd_mixart_send_msg(mgr, &request, sizeof(group_state_resp), &group_state_resp); 139 err = snd_mixart_send_msg(mgr, &request, sizeof(group_state_resp), &group_state_resp);
136 if (err < 0 || group_state_resp.txx_status != 0) { 140 if (err < 0 || group_state_resp.txx_status != 0) {
137 snd_printk(KERN_ERR "error MSG_STREAM_START_STREAM_GRP_PACKET err=%x stat=%x !\n", err, group_state_resp.txx_status); 141 dev_err(&mgr->pci->dev,
142 "error MSG_STREAM_START_STREAM_GRP_PACKET err=%x stat=%x !\n",
143 err, group_state_resp.txx_status);
138 return -EINVAL; 144 return -EINVAL;
139 } 145 }
140 146
@@ -147,7 +153,9 @@ static int mixart_set_pipe_state(struct mixart_mgr *mgr,
147 153
148 err = snd_mixart_send_msg(mgr, &request, sizeof(stat), &stat); 154 err = snd_mixart_send_msg(mgr, &request, sizeof(stat), &stat);
149 if (err < 0 || stat != 0) { 155 if (err < 0 || stat != 0) {
150 snd_printk(KERN_ERR "error MSG_SYSTEM_SEND_SYNCHRO_CMD err=%x stat=%x !\n", err, stat); 156 dev_err(&mgr->pci->dev,
157 "error MSG_SYSTEM_SEND_SYNCHRO_CMD err=%x stat=%x !\n",
158 err, stat);
151 return -EINVAL; 159 return -EINVAL;
152 } 160 }
153 161
@@ -178,7 +186,9 @@ static int mixart_set_clock(struct mixart_mgr *mgr,
178 if(rate == 0) 186 if(rate == 0)
179 return 0; /* nothing to do */ 187 return 0; /* nothing to do */
180 else { 188 else {
181 snd_printk(KERN_ERR "error mixart_set_clock(%d) called with wrong pipe->status !\n", rate); 189 dev_err(&mgr->pci->dev,
190 "error mixart_set_clock(%d) called with wrong pipe->status !\n",
191 rate);
182 return -EINVAL; 192 return -EINVAL;
183 } 193 }
184 } 194 }
@@ -190,7 +200,7 @@ static int mixart_set_clock(struct mixart_mgr *mgr,
190 clock_properties.nb_callers = 1; /* only one entry in uid_caller ! */ 200 clock_properties.nb_callers = 1; /* only one entry in uid_caller ! */
191 clock_properties.uid_caller[0] = pipe->group_uid; 201 clock_properties.uid_caller[0] = pipe->group_uid;
192 202
193 snd_printdd("mixart_set_clock to %d kHz\n", rate); 203 dev_dbg(&mgr->pci->dev, "mixart_set_clock to %d kHz\n", rate);
194 204
195 request.message_id = MSG_CLOCK_SET_PROPERTIES; 205 request.message_id = MSG_CLOCK_SET_PROPERTIES;
196 request.uid = mgr->uid_console_manager; 206 request.uid = mgr->uid_console_manager;
@@ -199,7 +209,9 @@ static int mixart_set_clock(struct mixart_mgr *mgr,
199 209
200 err = snd_mixart_send_msg(mgr, &request, sizeof(clock_prop_resp), &clock_prop_resp); 210 err = snd_mixart_send_msg(mgr, &request, sizeof(clock_prop_resp), &clock_prop_resp);
201 if (err < 0 || clock_prop_resp.status != 0 || clock_prop_resp.clock_mode != CM_STANDALONE) { 211 if (err < 0 || clock_prop_resp.status != 0 || clock_prop_resp.clock_mode != CM_STANDALONE) {
202 snd_printk(KERN_ERR "error MSG_CLOCK_SET_PROPERTIES err=%x stat=%x mod=%x !\n", err, clock_prop_resp.status, clock_prop_resp.clock_mode); 212 dev_err(&mgr->pci->dev,
213 "error MSG_CLOCK_SET_PROPERTIES err=%x stat=%x mod=%x !\n",
214 err, clock_prop_resp.status, clock_prop_resp.clock_mode);
203 return -EINVAL; 215 return -EINVAL;
204 } 216 }
205 217
@@ -252,7 +264,9 @@ snd_mixart_add_ref_pipe(struct snd_mixart *chip, int pcm_number, int capture,
252 struct mixart_streaming_group sgroup_resp; 264 struct mixart_streaming_group sgroup_resp;
253 } *buf; 265 } *buf;
254 266
255 snd_printdd("add_ref_pipe audio chip(%d) pcm(%d)\n", chip->chip_idx, pcm_number); 267 dev_dbg(chip->card->dev,
268 "add_ref_pipe audio chip(%d) pcm(%d)\n",
269 chip->chip_idx, pcm_number);
256 270
257 buf = kmalloc(sizeof(*buf), GFP_KERNEL); 271 buf = kmalloc(sizeof(*buf), GFP_KERNEL);
258 if (!buf) 272 if (!buf)
@@ -302,7 +316,9 @@ snd_mixart_add_ref_pipe(struct snd_mixart *chip, int pcm_number, int capture,
302 316
303 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(buf->sgroup_resp), &buf->sgroup_resp); 317 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(buf->sgroup_resp), &buf->sgroup_resp);
304 if((err < 0) || (buf->sgroup_resp.status != 0)) { 318 if((err < 0) || (buf->sgroup_resp.status != 0)) {
305 snd_printk(KERN_ERR "error MSG_STREAM_ADD_**PUT_GROUP err=%x stat=%x !\n", err, buf->sgroup_resp.status); 319 dev_err(chip->card->dev,
320 "error MSG_STREAM_ADD_**PUT_GROUP err=%x stat=%x !\n",
321 err, buf->sgroup_resp.status);
306 kfree(buf); 322 kfree(buf);
307 return NULL; 323 return NULL;
308 } 324 }
@@ -343,13 +359,14 @@ int snd_mixart_kill_ref_pipe(struct mixart_mgr *mgr,
343 /* release the clock */ 359 /* release the clock */
344 err = mixart_set_clock( mgr, pipe, 0); 360 err = mixart_set_clock( mgr, pipe, 0);
345 if( err < 0 ) { 361 if( err < 0 ) {
346 snd_printk(KERN_ERR "mixart_set_clock(0) return error!\n"); 362 dev_err(&mgr->pci->dev,
363 "mixart_set_clock(0) return error!\n");
347 } 364 }
348 365
349 /* stop the pipe */ 366 /* stop the pipe */
350 err = mixart_set_pipe_state(mgr, pipe, 0); 367 err = mixart_set_pipe_state(mgr, pipe, 0);
351 if( err < 0 ) { 368 if( err < 0 ) {
352 snd_printk(KERN_ERR "error stopping pipe!\n"); 369 dev_err(&mgr->pci->dev, "error stopping pipe!\n");
353 } 370 }
354 371
355 request.message_id = MSG_STREAM_DELETE_GROUP; 372 request.message_id = MSG_STREAM_DELETE_GROUP;
@@ -360,7 +377,9 @@ int snd_mixart_kill_ref_pipe(struct mixart_mgr *mgr,
360 /* delete the pipe */ 377 /* delete the pipe */
361 err = snd_mixart_send_msg(mgr, &request, sizeof(delete_resp), &delete_resp); 378 err = snd_mixart_send_msg(mgr, &request, sizeof(delete_resp), &delete_resp);
362 if ((err < 0) || (delete_resp.status != 0)) { 379 if ((err < 0) || (delete_resp.status != 0)) {
363 snd_printk(KERN_ERR "error MSG_STREAM_DELETE_GROUP err(%x), status(%x)\n", err, delete_resp.status); 380 dev_err(&mgr->pci->dev,
381 "error MSG_STREAM_DELETE_GROUP err(%x), status(%x)\n",
382 err, delete_resp.status);
364 } 383 }
365 384
366 pipe->group_uid = (struct mixart_uid){0,0}; 385 pipe->group_uid = (struct mixart_uid){0,0};
@@ -414,7 +433,7 @@ static int snd_mixart_trigger(struct snd_pcm_substream *subs, int cmd)
414 switch (cmd) { 433 switch (cmd) {
415 case SNDRV_PCM_TRIGGER_START: 434 case SNDRV_PCM_TRIGGER_START:
416 435
417 snd_printdd("SNDRV_PCM_TRIGGER_START\n"); 436 dev_dbg(subs->pcm->card->dev, "SNDRV_PCM_TRIGGER_START\n");
418 437
419 /* START_STREAM */ 438 /* START_STREAM */
420 if( mixart_set_stream_state(stream, 1) ) 439 if( mixart_set_stream_state(stream, 1) )
@@ -431,19 +450,19 @@ static int snd_mixart_trigger(struct snd_pcm_substream *subs, int cmd)
431 450
432 stream->status = MIXART_STREAM_STATUS_OPEN; 451 stream->status = MIXART_STREAM_STATUS_OPEN;
433 452
434 snd_printdd("SNDRV_PCM_TRIGGER_STOP\n"); 453 dev_dbg(subs->pcm->card->dev, "SNDRV_PCM_TRIGGER_STOP\n");
435 454
436 break; 455 break;
437 456
438 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 457 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
439 /* TODO */ 458 /* TODO */
440 stream->status = MIXART_STREAM_STATUS_PAUSE; 459 stream->status = MIXART_STREAM_STATUS_PAUSE;
441 snd_printdd("SNDRV_PCM_PAUSE_PUSH\n"); 460 dev_dbg(subs->pcm->card->dev, "SNDRV_PCM_PAUSE_PUSH\n");
442 break; 461 break;
443 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 462 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
444 /* TODO */ 463 /* TODO */
445 stream->status = MIXART_STREAM_STATUS_RUNNING; 464 stream->status = MIXART_STREAM_STATUS_RUNNING;
446 snd_printdd("SNDRV_PCM_PAUSE_RELEASE\n"); 465 dev_dbg(subs->pcm->card->dev, "SNDRV_PCM_PAUSE_RELEASE\n");
447 break; 466 break;
448 default: 467 default:
449 return -EINVAL; 468 return -EINVAL;
@@ -456,7 +475,8 @@ static int mixart_sync_nonblock_events(struct mixart_mgr *mgr)
456 unsigned long timeout = jiffies + HZ; 475 unsigned long timeout = jiffies + HZ;
457 while (atomic_read(&mgr->msg_processed) > 0) { 476 while (atomic_read(&mgr->msg_processed) > 0) {
458 if (time_after(jiffies, timeout)) { 477 if (time_after(jiffies, timeout)) {
459 snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); 478 dev_err(&mgr->pci->dev,
479 "mixart: cannot process nonblock events!\n");
460 return -EBUSY; 480 return -EBUSY;
461 } 481 }
462 schedule_timeout_uninterruptible(1); 482 schedule_timeout_uninterruptible(1);
@@ -474,7 +494,7 @@ static int snd_mixart_prepare(struct snd_pcm_substream *subs)
474 494
475 /* TODO de façon non bloquante, réappliquer les hw_params (rate, bits, codec) */ 495 /* TODO de façon non bloquante, réappliquer les hw_params (rate, bits, codec) */
476 496
477 snd_printdd("snd_mixart_prepare\n"); 497 dev_dbg(chip->card->dev, "snd_mixart_prepare\n");
478 498
479 mixart_sync_nonblock_events(chip->mgr); 499 mixart_sync_nonblock_events(chip->mgr);
480 500
@@ -542,11 +562,13 @@ static int mixart_set_format(struct mixart_stream *stream, snd_pcm_format_t form
542 stream_param.sample_size = 32; 562 stream_param.sample_size = 32;
543 break; 563 break;
544 default: 564 default:
545 snd_printk(KERN_ERR "error mixart_set_format() : unknown format\n"); 565 dev_err(chip->card->dev,
566 "error mixart_set_format() : unknown format\n");
546 return -EINVAL; 567 return -EINVAL;
547 } 568 }
548 569
549 snd_printdd("set SNDRV_PCM_FORMAT sample_type(%d) sample_size(%d) freq(%d) channels(%d)\n", 570 dev_dbg(chip->card->dev,
571 "set SNDRV_PCM_FORMAT sample_type(%d) sample_size(%d) freq(%d) channels(%d)\n",
550 stream_param.sample_type, stream_param.sample_size, stream_param.sampling_freq, stream->channels); 572 stream_param.sample_type, stream_param.sample_size, stream_param.sampling_freq, stream->channels);
551 573
552 /* TODO: what else to configure ? */ 574 /* TODO: what else to configure ? */
@@ -566,7 +588,9 @@ static int mixart_set_format(struct mixart_stream *stream, snd_pcm_format_t form
566 588
567 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(resp), &resp); 589 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(resp), &resp);
568 if((err < 0) || resp.error_code) { 590 if((err < 0) || resp.error_code) {
569 snd_printk(KERN_ERR "MSG_STREAM_SET_INPUT_STAGE_PARAM err=%x; resp=%x\n", err, resp.error_code); 591 dev_err(chip->card->dev,
592 "MSG_STREAM_SET_INPUT_STAGE_PARAM err=%x; resp=%x\n",
593 err, resp.error_code);
570 return -EINVAL; 594 return -EINVAL;
571 } 595 }
572 return 0; 596 return 0;
@@ -627,8 +651,9 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
627 bufferinfo[i].available_length = subs->runtime->dma_bytes; 651 bufferinfo[i].available_length = subs->runtime->dma_bytes;
628 /* bufferinfo[i].buffer_id is already defined */ 652 /* bufferinfo[i].buffer_id is already defined */
629 653
630 snd_printdd("snd_mixart_hw_params(pcm %d) : dma_addr(%x) dma_bytes(%x) subs-number(%d)\n", i, 654 dev_dbg(chip->card->dev,
631 bufferinfo[i].buffer_address, 655 "snd_mixart_hw_params(pcm %d) : dma_addr(%x) dma_bytes(%x) subs-number(%d)\n",
656 i, bufferinfo[i].buffer_address,
632 bufferinfo[i].available_length, 657 bufferinfo[i].available_length,
633 subs->number); 658 subs->number);
634 } 659 }
@@ -714,14 +739,18 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
714 pcm_number = MIXART_PCM_DIGITAL; 739 pcm_number = MIXART_PCM_DIGITAL;
715 runtime->hw = snd_mixart_digital_caps; 740 runtime->hw = snd_mixart_digital_caps;
716 } 741 }
717 snd_printdd("snd_mixart_playback_open C%d/P%d/Sub%d\n", chip->chip_idx, pcm_number, subs->number); 742 dev_dbg(chip->card->dev,
743 "snd_mixart_playback_open C%d/P%d/Sub%d\n",
744 chip->chip_idx, pcm_number, subs->number);
718 745
719 /* get stream info */ 746 /* get stream info */
720 stream = &(chip->playback_stream[pcm_number][subs->number]); 747 stream = &(chip->playback_stream[pcm_number][subs->number]);
721 748
722 if (stream->status != MIXART_STREAM_STATUS_FREE){ 749 if (stream->status != MIXART_STREAM_STATUS_FREE){
723 /* streams in use */ 750 /* streams in use */
724 snd_printk(KERN_ERR "snd_mixart_playback_open C%d/P%d/Sub%d in use\n", chip->chip_idx, pcm_number, subs->number); 751 dev_err(chip->card->dev,
752 "snd_mixart_playback_open C%d/P%d/Sub%d in use\n",
753 chip->chip_idx, pcm_number, subs->number);
725 err = -EBUSY; 754 err = -EBUSY;
726 goto _exit_open; 755 goto _exit_open;
727 } 756 }
@@ -737,7 +766,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
737 /* start the pipe if necessary */ 766 /* start the pipe if necessary */
738 err = mixart_set_pipe_state(chip->mgr, pipe, 1); 767 err = mixart_set_pipe_state(chip->mgr, pipe, 1);
739 if( err < 0 ) { 768 if( err < 0 ) {
740 snd_printk(KERN_ERR "error starting pipe!\n"); 769 dev_err(chip->card->dev, "error starting pipe!\n");
741 snd_mixart_kill_ref_pipe(chip->mgr, pipe, 0); 770 snd_mixart_kill_ref_pipe(chip->mgr, pipe, 0);
742 err = -EINVAL; 771 err = -EINVAL;
743 goto _exit_open; 772 goto _exit_open;
@@ -792,14 +821,17 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
792 821
793 runtime->hw.channels_min = 2; /* for instance, no mono */ 822 runtime->hw.channels_min = 2; /* for instance, no mono */
794 823
795 snd_printdd("snd_mixart_capture_open C%d/P%d/Sub%d\n", chip->chip_idx, pcm_number, subs->number); 824 dev_dbg(chip->card->dev, "snd_mixart_capture_open C%d/P%d/Sub%d\n",
825 chip->chip_idx, pcm_number, subs->number);
796 826
797 /* get stream info */ 827 /* get stream info */
798 stream = &(chip->capture_stream[pcm_number]); 828 stream = &(chip->capture_stream[pcm_number]);
799 829
800 if (stream->status != MIXART_STREAM_STATUS_FREE){ 830 if (stream->status != MIXART_STREAM_STATUS_FREE){
801 /* streams in use */ 831 /* streams in use */
802 snd_printk(KERN_ERR "snd_mixart_capture_open C%d/P%d/Sub%d in use\n", chip->chip_idx, pcm_number, subs->number); 832 dev_err(chip->card->dev,
833 "snd_mixart_capture_open C%d/P%d/Sub%d in use\n",
834 chip->chip_idx, pcm_number, subs->number);
803 err = -EBUSY; 835 err = -EBUSY;
804 goto _exit_open; 836 goto _exit_open;
805 } 837 }
@@ -815,7 +847,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
815 /* start the pipe if necessary */ 847 /* start the pipe if necessary */
816 err = mixart_set_pipe_state(chip->mgr, pipe, 1); 848 err = mixart_set_pipe_state(chip->mgr, pipe, 1);
817 if( err < 0 ) { 849 if( err < 0 ) {
818 snd_printk(KERN_ERR "error starting pipe!\n"); 850 dev_err(chip->card->dev, "error starting pipe!\n");
819 snd_mixart_kill_ref_pipe(chip->mgr, pipe, 0); 851 snd_mixart_kill_ref_pipe(chip->mgr, pipe, 0);
820 err = -EINVAL; 852 err = -EINVAL;
821 goto _exit_open; 853 goto _exit_open;
@@ -855,7 +887,8 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
855 887
856 mutex_lock(&mgr->setup_mutex); 888 mutex_lock(&mgr->setup_mutex);
857 889
858 snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number); 890 dev_dbg(chip->card->dev, "snd_mixart_close C%d/P%d/Sub%d\n",
891 chip->chip_idx, stream->pcm_number, subs->number);
859 892
860 /* sample rate released */ 893 /* sample rate released */
861 if(--mgr->ref_count_rate == 0) { 894 if(--mgr->ref_count_rate == 0) {
@@ -865,7 +898,9 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
865 /* delete pipe */ 898 /* delete pipe */
866 if (snd_mixart_kill_ref_pipe(mgr, stream->pipe, 0 ) < 0) { 899 if (snd_mixart_kill_ref_pipe(mgr, stream->pipe, 0 ) < 0) {
867 900
868 snd_printk(KERN_ERR "error snd_mixart_kill_ref_pipe C%dP%d\n", chip->chip_idx, stream->pcm_number); 901 dev_err(chip->card->dev,
902 "error snd_mixart_kill_ref_pipe C%dP%d\n",
903 chip->chip_idx, stream->pcm_number);
869 } 904 }
870 905
871 stream->pipe = NULL; 906 stream->pipe = NULL;
@@ -940,7 +975,8 @@ static int snd_mixart_pcm_analog(struct snd_mixart *chip)
940 if ((err = snd_pcm_new(chip->card, name, MIXART_PCM_ANALOG, 975 if ((err = snd_pcm_new(chip->card, name, MIXART_PCM_ANALOG,
941 MIXART_PLAYBACK_STREAMS, 976 MIXART_PLAYBACK_STREAMS,
942 MIXART_CAPTURE_STREAMS, &pcm)) < 0) { 977 MIXART_CAPTURE_STREAMS, &pcm)) < 0) {
943 snd_printk(KERN_ERR "cannot create the analog pcm %d\n", chip->chip_idx); 978 dev_err(chip->card->dev,
979 "cannot create the analog pcm %d\n", chip->chip_idx);
944 return err; 980 return err;
945 } 981 }
946 982
@@ -971,7 +1007,8 @@ static int snd_mixart_pcm_digital(struct snd_mixart *chip)
971 if ((err = snd_pcm_new(chip->card, name, MIXART_PCM_DIGITAL, 1007 if ((err = snd_pcm_new(chip->card, name, MIXART_PCM_DIGITAL,
972 MIXART_PLAYBACK_STREAMS, 1008 MIXART_PLAYBACK_STREAMS,
973 MIXART_CAPTURE_STREAMS, &pcm)) < 0) { 1009 MIXART_CAPTURE_STREAMS, &pcm)) < 0) {
974 snd_printk(KERN_ERR "cannot create the digital pcm %d\n", chip->chip_idx); 1010 dev_err(chip->card->dev,
1011 "cannot create the digital pcm %d\n", chip->chip_idx);
975 return err; 1012 return err;
976 } 1013 }
977 1014
@@ -1014,7 +1051,7 @@ static int snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int
1014 1051
1015 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1052 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1016 if (! chip) { 1053 if (! chip) {
1017 snd_printk(KERN_ERR "cannot allocate chip\n"); 1054 dev_err(card->dev, "cannot allocate chip\n");
1018 return -ENOMEM; 1055 return -ENOMEM;
1019 } 1056 }
1020 1057
@@ -1071,7 +1108,7 @@ static int snd_mixart_free(struct mixart_mgr *mgr)
1071 /* reset board if some firmware was loaded */ 1108 /* reset board if some firmware was loaded */
1072 if(mgr->dsp_loaded) { 1109 if(mgr->dsp_loaded) {
1073 snd_mixart_reset_board(mgr); 1110 snd_mixart_reset_board(mgr);
1074 snd_printdd("reset miXart !\n"); 1111 dev_dbg(&mgr->pci->dev, "reset miXart !\n");
1075 } 1112 }
1076 1113
1077 /* release the i/o ports */ 1114 /* release the i/o ports */
@@ -1232,7 +1269,8 @@ static int snd_mixart_probe(struct pci_dev *pci,
1232 1269
1233 /* check if we can restrict PCI DMA transfers to 32 bits */ 1270 /* check if we can restrict PCI DMA transfers to 32 bits */
1234 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1271 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
1235 snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n"); 1272 dev_err(&pci->dev,
1273 "architecture does not support 32bit PCI busmaster DMA\n");
1236 pci_disable_device(pci); 1274 pci_disable_device(pci);
1237 return -ENXIO; 1275 return -ENXIO;
1238 } 1276 }
@@ -1258,7 +1296,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
1258 mgr->mem[i].phys = pci_resource_start(pci, i); 1296 mgr->mem[i].phys = pci_resource_start(pci, i);
1259 mgr->mem[i].virt = pci_ioremap_bar(pci, i); 1297 mgr->mem[i].virt = pci_ioremap_bar(pci, i);
1260 if (!mgr->mem[i].virt) { 1298 if (!mgr->mem[i].virt) {
1261 printk(KERN_ERR "unable to remap resource 0x%lx\n", 1299 dev_err(&pci->dev, "unable to remap resource 0x%lx\n",
1262 mgr->mem[i].phys); 1300 mgr->mem[i].phys);
1263 snd_mixart_free(mgr); 1301 snd_mixart_free(mgr);
1264 return -EBUSY; 1302 return -EBUSY;
@@ -1267,7 +1305,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
1267 1305
1268 if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED, 1306 if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED,
1269 KBUILD_MODNAME, mgr)) { 1307 KBUILD_MODNAME, mgr)) {
1270 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1308 dev_err(&pci->dev, "unable to grab IRQ %d\n", pci->irq);
1271 snd_mixart_free(mgr); 1309 snd_mixart_free(mgr);
1272 return -EBUSY; 1310 return -EBUSY;
1273 } 1311 }
@@ -1310,7 +1348,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
1310 0, &card); 1348 0, &card);
1311 1349
1312 if (err < 0) { 1350 if (err < 0) {
1313 snd_printk(KERN_ERR "cannot allocate the card %d\n", i); 1351 dev_err(&pci->dev, "cannot allocate the card %d\n", i);
1314 snd_mixart_free(mgr); 1352 snd_mixart_free(mgr);
1315 return err; 1353 return err;
1316 } 1354 }
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index 3df0f530f67c..71f4bdcc4055 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <linux/pci.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27#include <sound/core.h> 28#include <sound/core.h>
@@ -94,7 +95,8 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
94 95
95 if( (size < MSG_DESCRIPTOR_SIZE) || (resp->size < (size - MSG_DESCRIPTOR_SIZE))) { 96 if( (size < MSG_DESCRIPTOR_SIZE) || (resp->size < (size - MSG_DESCRIPTOR_SIZE))) {
96 err = -EINVAL; 97 err = -EINVAL;
97 snd_printk(KERN_ERR "problem with response size = %d\n", size); 98 dev_err(&mgr->pci->dev,
99 "problem with response size = %d\n", size);
98 goto _clean_exit; 100 goto _clean_exit;
99 } 101 }
100 size -= MSG_DESCRIPTOR_SIZE; 102 size -= MSG_DESCRIPTOR_SIZE;
@@ -161,7 +163,7 @@ static int send_msg( struct mixart_mgr *mgr,
161 headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_HEAD)); 163 headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_HEAD));
162 164
163 if (tailptr == headptr) { 165 if (tailptr == headptr) {
164 snd_printk(KERN_ERR "error: no message frame available\n"); 166 dev_err(&mgr->pci->dev, "error: no message frame available\n");
165 return -EBUSY; 167 return -EBUSY;
166 } 168 }
167 169
@@ -265,7 +267,8 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
265 if (! timeout) { 267 if (! timeout) {
266 /* error - no ack */ 268 /* error - no ack */
267 mutex_unlock(&mgr->msg_mutex); 269 mutex_unlock(&mgr->msg_mutex);
268 snd_printk(KERN_ERR "error: no response on msg %x\n", msg_frame); 270 dev_err(&mgr->pci->dev,
271 "error: no response on msg %x\n", msg_frame);
269 return -EIO; 272 return -EIO;
270 } 273 }
271 274
@@ -278,7 +281,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
278 err = get_msg(mgr, &resp, msg_frame); 281 err = get_msg(mgr, &resp, msg_frame);
279 282
280 if( request->message_id != resp.message_id ) 283 if( request->message_id != resp.message_id )
281 snd_printk(KERN_ERR "RESPONSE ERROR!\n"); 284 dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n");
282 285
283 mutex_unlock(&mgr->msg_mutex); 286 mutex_unlock(&mgr->msg_mutex);
284 return err; 287 return err;
@@ -321,7 +324,8 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
321 if (! timeout) { 324 if (! timeout) {
322 /* error - no ack */ 325 /* error - no ack */
323 mutex_unlock(&mgr->msg_mutex); 326 mutex_unlock(&mgr->msg_mutex);
324 snd_printk(KERN_ERR "error: notification %x not received\n", notif_event); 327 dev_err(&mgr->pci->dev,
328 "error: notification %x not received\n", notif_event);
325 return -EIO; 329 return -EIO;
326 } 330 }
327 331
@@ -378,7 +382,9 @@ void snd_mixart_msg_tasklet(unsigned long arg)
378 resp.size = sizeof(mixart_msg_data); 382 resp.size = sizeof(mixart_msg_data);
379 err = get_msg(mgr, &resp, addr); 383 err = get_msg(mgr, &resp, addr);
380 if( err < 0 ) { 384 if( err < 0 ) {
381 snd_printk(KERN_ERR "tasklet: error(%d) reading mf %x\n", err, msg); 385 dev_err(&mgr->pci->dev,
386 "tasklet: error(%d) reading mf %x\n",
387 err, msg);
382 break; 388 break;
383 } 389 }
384 390
@@ -388,10 +394,13 @@ void snd_mixart_msg_tasklet(unsigned long arg)
388 case MSG_STREAM_STOP_INPUT_STAGE_PACKET: 394 case MSG_STREAM_STOP_INPUT_STAGE_PACKET:
389 case MSG_STREAM_STOP_OUTPUT_STAGE_PACKET: 395 case MSG_STREAM_STOP_OUTPUT_STAGE_PACKET:
390 if(mixart_msg_data[0]) 396 if(mixart_msg_data[0])
391 snd_printk(KERN_ERR "tasklet : error MSG_STREAM_ST***_***PUT_STAGE_PACKET status=%x\n", mixart_msg_data[0]); 397 dev_err(&mgr->pci->dev,
398 "tasklet : error MSG_STREAM_ST***_***PUT_STAGE_PACKET status=%x\n",
399 mixart_msg_data[0]);
392 break; 400 break;
393 default: 401 default:
394 snd_printdd("tasklet received mf(%x) : msg_id(%x) uid(%x, %x) size(%zd)\n", 402 dev_dbg(&mgr->pci->dev,
403 "tasklet received mf(%x) : msg_id(%x) uid(%x, %x) size(%zd)\n",
395 msg, resp.message_id, resp.uid.object_id, resp.uid.desc, resp.size); 404 msg, resp.message_id, resp.uid.object_id, resp.uid.desc, resp.size);
396 break; 405 break;
397 } 406 }
@@ -401,7 +410,9 @@ void snd_mixart_msg_tasklet(unsigned long arg)
401 case MSG_TYPE_COMMAND: 410 case MSG_TYPE_COMMAND:
402 /* get_msg() necessary */ 411 /* get_msg() necessary */
403 default: 412 default:
404 snd_printk(KERN_ERR "tasklet doesn't know what to do with message %x\n", msg); 413 dev_err(&mgr->pci->dev,
414 "tasklet doesn't know what to do with message %x\n",
415 msg);
405 } /* switch type */ 416 } /* switch type */
406 417
407 /* decrement counter */ 418 /* decrement counter */
@@ -451,7 +462,9 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
451 resp.size = sizeof(mixart_msg_data); 462 resp.size = sizeof(mixart_msg_data);
452 err = get_msg(mgr, &resp, msg & ~MSG_TYPE_MASK); 463 err = get_msg(mgr, &resp, msg & ~MSG_TYPE_MASK);
453 if( err < 0 ) { 464 if( err < 0 ) {
454 snd_printk(KERN_ERR "interrupt: error(%d) reading mf %x\n", err, msg); 465 dev_err(&mgr->pci->dev,
466 "interrupt: error(%d) reading mf %x\n",
467 err, msg);
455 break; 468 break;
456 } 469 }
457 470
@@ -472,7 +485,8 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
472 struct mixart_stream *stream; 485 struct mixart_stream *stream;
473 486
474 if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) { 487 if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) {
475 snd_printk(KERN_ERR "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n", 488 dev_err(&mgr->pci->dev,
489 "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n",
476 buffer_id, notify->streams[i].sample_pos_low_part); 490 buffer_id, notify->streams[i].sample_pos_low_part);
477 break; 491 break;
478 } 492 }
@@ -524,18 +538,22 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
524 } 538 }
525#endif 539#endif
526 ((char*)mixart_msg_data)[resp.size - 1] = 0; 540 ((char*)mixart_msg_data)[resp.size - 1] = 0;
527 snd_printdd("MIXART TRACE : %s\n", (char*)mixart_msg_data); 541 dev_dbg(&mgr->pci->dev,
542 "MIXART TRACE : %s\n",
543 (char *)mixart_msg_data);
528 } 544 }
529 break; 545 break;
530 } 546 }
531 547
532 snd_printdd("command %x not handled\n", resp.message_id); 548 dev_dbg(&mgr->pci->dev, "command %x not handled\n",
549 resp.message_id);
533 break; 550 break;
534 551
535 case MSG_TYPE_NOTIFY: 552 case MSG_TYPE_NOTIFY:
536 if(msg & MSG_CANCEL_NOTIFY_MASK) { 553 if(msg & MSG_CANCEL_NOTIFY_MASK) {
537 msg &= ~MSG_CANCEL_NOTIFY_MASK; 554 msg &= ~MSG_CANCEL_NOTIFY_MASK;
538 snd_printk(KERN_ERR "canceled notification %x !\n", msg); 555 dev_err(&mgr->pci->dev,
556 "canceled notification %x !\n", msg);
539 } 557 }
540 /* no break, continue ! */ 558 /* no break, continue ! */
541 case MSG_TYPE_ANSWER: 559 case MSG_TYPE_ANSWER:
@@ -556,7 +574,8 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id)
556 break; 574 break;
557 case MSG_TYPE_REQUEST: 575 case MSG_TYPE_REQUEST:
558 default: 576 default:
559 snd_printdd("interrupt received request %x\n", msg); 577 dev_dbg(&mgr->pci->dev,
578 "interrupt received request %x\n", msg);
560 /* TODO : are there things to do here ? */ 579 /* TODO : are there things to do here ? */
561 break; 580 break;
562 } /* switch on msg type */ 581 } /* switch on msg type */
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c
index ece1f831c16a..581e1e74863c 100644
--- a/sound/pci/mixart/mixart_hwdep.c
+++ b/sound/pci/mixart/mixart_hwdep.c
@@ -165,7 +165,8 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
165 165
166 err = snd_mixart_send_msg(mgr, &request, sizeof(*connector), connector); 166 err = snd_mixart_send_msg(mgr, &request, sizeof(*connector), connector);
167 if((err < 0) || (connector->error_code) || (connector->uid_count > MIXART_MAX_PHYS_CONNECTORS)) { 167 if((err < 0) || (connector->error_code) || (connector->uid_count > MIXART_MAX_PHYS_CONNECTORS)) {
168 snd_printk(KERN_ERR "error MSG_SYSTEM_ENUM_PLAY_CONNECTOR\n"); 168 dev_err(&mgr->pci->dev,
169 "error MSG_SYSTEM_ENUM_PLAY_CONNECTOR\n");
169 err = -EINVAL; 170 err = -EINVAL;
170 goto __error; 171 goto __error;
171 } 172 }
@@ -184,7 +185,7 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
184 pipe->uid_left_connector = connector->uid[k]; /* even */ 185 pipe->uid_left_connector = connector->uid[k]; /* even */
185 } 186 }
186 187
187 /* snd_printk(KERN_DEBUG "playback connector[%d].object_id = %x\n", k, connector->uid[k].object_id); */ 188 /* dev_dbg(&mgr->pci->dev, "playback connector[%d].object_id = %x\n", k, connector->uid[k].object_id); */
188 189
189 /* TODO: really need send_msg MSG_CONNECTOR_GET_AUDIO_INFO for each connector ? perhaps for analog level caps ? */ 190 /* TODO: really need send_msg MSG_CONNECTOR_GET_AUDIO_INFO for each connector ? perhaps for analog level caps ? */
190 request.message_id = MSG_CONNECTOR_GET_AUDIO_INFO; 191 request.message_id = MSG_CONNECTOR_GET_AUDIO_INFO;
@@ -194,10 +195,11 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
194 195
195 err = snd_mixart_send_msg(mgr, &request, sizeof(*audio_info), audio_info); 196 err = snd_mixart_send_msg(mgr, &request, sizeof(*audio_info), audio_info);
196 if( err < 0 ) { 197 if( err < 0 ) {
197 snd_printk(KERN_ERR "error MSG_CONNECTOR_GET_AUDIO_INFO\n"); 198 dev_err(&mgr->pci->dev,
199 "error MSG_CONNECTOR_GET_AUDIO_INFO\n");
198 goto __error; 200 goto __error;
199 } 201 }
200 /*snd_printk(KERN_DEBUG "play analog_info.analog_level_present = %x\n", audio_info->info.analog_info.analog_level_present);*/ 202 /*dev_dbg(&mgr->pci->dev, "play analog_info.analog_level_present = %x\n", audio_info->info.analog_info.analog_level_present);*/
201 } 203 }
202 204
203 request.message_id = MSG_SYSTEM_ENUM_RECORD_CONNECTOR; 205 request.message_id = MSG_SYSTEM_ENUM_RECORD_CONNECTOR;
@@ -207,7 +209,8 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
207 209
208 err = snd_mixart_send_msg(mgr, &request, sizeof(*connector), connector); 210 err = snd_mixart_send_msg(mgr, &request, sizeof(*connector), connector);
209 if((err < 0) || (connector->error_code) || (connector->uid_count > MIXART_MAX_PHYS_CONNECTORS)) { 211 if((err < 0) || (connector->error_code) || (connector->uid_count > MIXART_MAX_PHYS_CONNECTORS)) {
210 snd_printk(KERN_ERR "error MSG_SYSTEM_ENUM_RECORD_CONNECTOR\n"); 212 dev_err(&mgr->pci->dev,
213 "error MSG_SYSTEM_ENUM_RECORD_CONNECTOR\n");
211 err = -EINVAL; 214 err = -EINVAL;
212 goto __error; 215 goto __error;
213 } 216 }
@@ -226,7 +229,7 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
226 pipe->uid_left_connector = connector->uid[k]; /* even */ 229 pipe->uid_left_connector = connector->uid[k]; /* even */
227 } 230 }
228 231
229 /* snd_printk(KERN_DEBUG "capture connector[%d].object_id = %x\n", k, connector->uid[k].object_id); */ 232 /* dev_dbg(&mgr->pci->dev, "capture connector[%d].object_id = %x\n", k, connector->uid[k].object_id); */
230 233
231 /* TODO: really need send_msg MSG_CONNECTOR_GET_AUDIO_INFO for each connector ? perhaps for analog level caps ? */ 234 /* TODO: really need send_msg MSG_CONNECTOR_GET_AUDIO_INFO for each connector ? perhaps for analog level caps ? */
232 request.message_id = MSG_CONNECTOR_GET_AUDIO_INFO; 235 request.message_id = MSG_CONNECTOR_GET_AUDIO_INFO;
@@ -236,10 +239,11 @@ static int mixart_enum_connectors(struct mixart_mgr *mgr)
236 239
237 err = snd_mixart_send_msg(mgr, &request, sizeof(*audio_info), audio_info); 240 err = snd_mixart_send_msg(mgr, &request, sizeof(*audio_info), audio_info);
238 if( err < 0 ) { 241 if( err < 0 ) {
239 snd_printk(KERN_ERR "error MSG_CONNECTOR_GET_AUDIO_INFO\n"); 242 dev_err(&mgr->pci->dev,
243 "error MSG_CONNECTOR_GET_AUDIO_INFO\n");
240 goto __error; 244 goto __error;
241 } 245 }
242 /*snd_printk(KERN_DEBUG "rec analog_info.analog_level_present = %x\n", audio_info->info.analog_info.analog_level_present);*/ 246 /*dev_dbg(&mgr->pci->dev, "rec analog_info.analog_level_present = %x\n", audio_info->info.analog_info.analog_level_present);*/
243 } 247 }
244 err = 0; 248 err = 0;
245 249
@@ -272,7 +276,9 @@ static int mixart_enum_physio(struct mixart_mgr *mgr)
272 err = snd_mixart_send_msg(mgr, &request, sizeof(console_mgr), &console_mgr); 276 err = snd_mixart_send_msg(mgr, &request, sizeof(console_mgr), &console_mgr);
273 277
274 if( (err < 0) || (console_mgr.error_code != 0) ) { 278 if( (err < 0) || (console_mgr.error_code != 0) ) {
275 snd_printk(KERN_DEBUG "error MSG_CONSOLE_GET_CLOCK_UID : err=%x\n", console_mgr.error_code); 279 dev_dbg(&mgr->pci->dev,
280 "error MSG_CONSOLE_GET_CLOCK_UID : err=%x\n",
281 console_mgr.error_code);
276 return -EINVAL; 282 return -EINVAL;
277 } 283 }
278 284
@@ -286,7 +292,9 @@ static int mixart_enum_physio(struct mixart_mgr *mgr)
286 292
287 err = snd_mixart_send_msg(mgr, &request, sizeof(phys_io), &phys_io); 293 err = snd_mixart_send_msg(mgr, &request, sizeof(phys_io), &phys_io);
288 if( (err < 0) || ( phys_io.error_code != 0 ) ) { 294 if( (err < 0) || ( phys_io.error_code != 0 ) ) {
289 snd_printk(KERN_ERR "error MSG_SYSTEM_ENUM_PHYSICAL_IO err(%x) error_code(%x)\n", err, phys_io.error_code ); 295 dev_err(&mgr->pci->dev,
296 "error MSG_SYSTEM_ENUM_PHYSICAL_IO err(%x) error_code(%x)\n",
297 err, phys_io.error_code);
290 return -EINVAL; 298 return -EINVAL;
291 } 299 }
292 300
@@ -322,7 +330,7 @@ static int mixart_first_init(struct mixart_mgr *mgr)
322 /* this command has no data. response is a 32 bit status */ 330 /* this command has no data. response is a 32 bit status */
323 err = snd_mixart_send_msg(mgr, &request, sizeof(k), &k); 331 err = snd_mixart_send_msg(mgr, &request, sizeof(k), &k);
324 if( (err < 0) || (k != 0) ) { 332 if( (err < 0) || (k != 0) ) {
325 snd_printk(KERN_ERR "error MSG_SYSTEM_SEND_SYNCHRO_CMD\n"); 333 dev_err(&mgr->pci->dev, "error MSG_SYSTEM_SEND_SYNCHRO_CMD\n");
326 return err == 0 ? -EINVAL : err; 334 return err == 0 ? -EINVAL : err;
327 } 335 }
328 336
@@ -348,7 +356,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
348 356
349 /* motherboard xilinx status 5 will say that the board is performing a reset */ 357 /* motherboard xilinx status 5 will say that the board is performing a reset */
350 if (status_xilinx == 5) { 358 if (status_xilinx == 5) {
351 snd_printk(KERN_ERR "miXart is resetting !\n"); 359 dev_err(&mgr->pci->dev, "miXart is resetting !\n");
352 return -EAGAIN; /* try again later */ 360 return -EAGAIN; /* try again later */
353 } 361 }
354 362
@@ -357,12 +365,13 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
357 365
358 /* xilinx already loaded ? */ 366 /* xilinx already loaded ? */
359 if (status_xilinx == 4) { 367 if (status_xilinx == 4) {
360 snd_printk(KERN_DEBUG "xilinx is already loaded !\n"); 368 dev_dbg(&mgr->pci->dev, "xilinx is already loaded !\n");
361 return 0; 369 return 0;
362 } 370 }
363 /* the status should be 0 == "idle" */ 371 /* the status should be 0 == "idle" */
364 if (status_xilinx != 0) { 372 if (status_xilinx != 0) {
365 snd_printk(KERN_ERR "xilinx load error ! status = %d\n", 373 dev_err(&mgr->pci->dev,
374 "xilinx load error ! status = %d\n",
366 status_xilinx); 375 status_xilinx);
367 return -EIO; /* modprob -r may help ? */ 376 return -EIO; /* modprob -r may help ? */
368 } 377 }
@@ -393,13 +402,14 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
393 case MIXART_MOTHERBOARD_ELF_INDEX: 402 case MIXART_MOTHERBOARD_ELF_INDEX:
394 403
395 if (status_elf == 4) { 404 if (status_elf == 4) {
396 snd_printk(KERN_DEBUG "elf file already loaded !\n"); 405 dev_dbg(&mgr->pci->dev, "elf file already loaded !\n");
397 return 0; 406 return 0;
398 } 407 }
399 408
400 /* the status should be 0 == "idle" */ 409 /* the status should be 0 == "idle" */
401 if (status_elf != 0) { 410 if (status_elf != 0) {
402 snd_printk(KERN_ERR "elf load error ! status = %d\n", 411 dev_err(&mgr->pci->dev,
412 "elf load error ! status = %d\n",
403 status_elf); 413 status_elf);
404 return -EIO; /* modprob -r may help ? */ 414 return -EIO; /* modprob -r may help ? */
405 } 415 }
@@ -407,7 +417,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
407 /* wait for xilinx status == 4 */ 417 /* wait for xilinx status == 4 */
408 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET, 1, 4, 500); /* 5sec */ 418 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET, 1, 4, 500); /* 5sec */
409 if (err < 0) { 419 if (err < 0) {
410 snd_printk(KERN_ERR "xilinx was not loaded or " 420 dev_err(&mgr->pci->dev, "xilinx was not loaded or "
411 "could not be started\n"); 421 "could not be started\n");
412 return err; 422 return err;
413 } 423 }
@@ -429,7 +439,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
429 /* wait for elf status == 4 */ 439 /* wait for elf status == 4 */
430 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_ELF_STATUS_OFFSET, 1, 4, 300); /* 3sec */ 440 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_ELF_STATUS_OFFSET, 1, 4, 300); /* 3sec */
431 if (err < 0) { 441 if (err < 0) {
432 snd_printk(KERN_ERR "elf could not be started\n"); 442 dev_err(&mgr->pci->dev, "elf could not be started\n");
433 return err; 443 return err;
434 } 444 }
435 445
@@ -443,7 +453,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
443 453
444 /* elf and xilinx should be loaded */ 454 /* elf and xilinx should be loaded */
445 if (status_elf != 4 || status_xilinx != 4) { 455 if (status_elf != 4 || status_xilinx != 4) {
446 printk(KERN_ERR "xilinx or elf not " 456 dev_err(&mgr->pci->dev, "xilinx or elf not "
447 "successfully loaded\n"); 457 "successfully loaded\n");
448 return -EIO; /* modprob -r may help ? */ 458 return -EIO; /* modprob -r may help ? */
449 } 459 }
@@ -451,7 +461,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
451 /* wait for daughter detection != 0 */ 461 /* wait for daughter detection != 0 */
452 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DBRD_PRESENCE_OFFSET, 0, 0, 30); /* 300msec */ 462 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DBRD_PRESENCE_OFFSET, 0, 0, 30); /* 300msec */
453 if (err < 0) { 463 if (err < 0) {
454 snd_printk(KERN_ERR "error starting elf file\n"); 464 dev_err(&mgr->pci->dev, "error starting elf file\n");
455 return err; 465 return err;
456 } 466 }
457 467
@@ -467,7 +477,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
467 477
468 /* daughter should be idle */ 478 /* daughter should be idle */
469 if (status_daught != 0) { 479 if (status_daught != 0) {
470 printk(KERN_ERR "daughter load error ! status = %d\n", 480 dev_err(&mgr->pci->dev,
481 "daughter load error ! status = %d\n",
471 status_daught); 482 status_daught);
472 return -EIO; /* modprob -r may help ? */ 483 return -EIO; /* modprob -r may help ? */
473 } 484 }
@@ -487,7 +498,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
487 /* wait for status == 2 */ 498 /* wait for status == 2 */
488 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 2, 30); /* 300msec */ 499 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 2, 30); /* 300msec */
489 if (err < 0) { 500 if (err < 0) {
490 snd_printk(KERN_ERR "daughter board load error\n"); 501 dev_err(&mgr->pci->dev, "daughter board load error\n");
491 return err; 502 return err;
492 } 503 }
493 504
@@ -509,7 +520,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
509 /* wait for daughter status == 3 */ 520 /* wait for daughter status == 3 */
510 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 3, 300); /* 3sec */ 521 err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 3, 300); /* 3sec */
511 if (err < 0) { 522 if (err < 0) {
512 snd_printk(KERN_ERR 523 dev_err(&mgr->pci->dev,
513 "daughter board could not be initialised\n"); 524 "daughter board could not be initialised\n");
514 return err; 525 return err;
515 } 526 }
@@ -520,7 +531,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
520 /* first communication with embedded */ 531 /* first communication with embedded */
521 err = mixart_first_init(mgr); 532 err = mixart_first_init(mgr);
522 if (err < 0) { 533 if (err < 0) {
523 snd_printk(KERN_ERR "miXart could not be set up\n"); 534 dev_err(&mgr->pci->dev, "miXart could not be set up\n");
524 return err; 535 return err;
525 } 536 }
526 537
@@ -540,7 +551,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
540 return err; 551 return err;
541 } 552 }
542 553
543 snd_printdd("miXart firmware downloaded and successfully set up\n"); 554 dev_dbg(&mgr->pci->dev,
555 "miXart firmware downloaded and successfully set up\n");
544 556
545 return 0; 557 return 0;
546} 558}
@@ -559,7 +571,8 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
559 for (i = 0; i < 3; i++) { 571 for (i = 0; i < 3; i++) {
560 sprintf(path, "mixart/%s", fw_files[i]); 572 sprintf(path, "mixart/%s", fw_files[i]);
561 if (request_firmware(&fw_entry, path, &mgr->pci->dev)) { 573 if (request_firmware(&fw_entry, path, &mgr->pci->dev)) {
562 snd_printk(KERN_ERR "miXart: can't load firmware %s\n", path); 574 dev_err(&mgr->pci->dev,
575 "miXart: can't load firmware %s\n", path);
563 return -ENOENT; 576 return -ENOENT;
564 } 577 }
565 /* fake hwdep dsp record */ 578 /* fake hwdep dsp record */
diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c
index 3ba6174c3df1..24a1955b8c29 100644
--- a/sound/pci/mixart/mixart_mixer.c
+++ b/sound/pci/mixart/mixart_mixer.c
@@ -329,7 +329,9 @@ static int mixart_update_analog_audio_level(struct snd_mixart* chip, int is_capt
329 329
330 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(resp), &resp); 330 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(resp), &resp);
331 if((err<0) || (resp.error_code)) { 331 if((err<0) || (resp.error_code)) {
332 snd_printk(KERN_DEBUG "error MSG_PHYSICALIO_SET_LEVEL card(%d) is_capture(%d) error_code(%x)\n", chip->chip_idx, is_capture, resp.error_code); 332 dev_dbg(chip->card->dev,
333 "error MSG_PHYSICALIO_SET_LEVEL card(%d) is_capture(%d) error_code(%x)\n",
334 chip->chip_idx, is_capture, resp.error_code);
333 return -EINVAL; 335 return -EINVAL;
334 } 336 }
335 return 0; 337 return 0;
@@ -762,7 +764,9 @@ int mixart_update_playback_stream_level(struct snd_mixart* chip, int is_aes, int
762 764
763 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(status), &status); 765 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(status), &status);
764 if((err<0) || status) { 766 if((err<0) || status) {
765 snd_printk(KERN_DEBUG "error MSG_STREAM_SET_OUT_STREAM_LEVEL card(%d) status(%x)\n", chip->chip_idx, status); 767 dev_dbg(chip->card->dev,
768 "error MSG_STREAM_SET_OUT_STREAM_LEVEL card(%d) status(%x)\n",
769 chip->chip_idx, status);
766 return -EINVAL; 770 return -EINVAL;
767 } 771 }
768 return 0; 772 return 0;
@@ -805,7 +809,9 @@ int mixart_update_capture_stream_level(struct snd_mixart* chip, int is_aes)
805 809
806 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(status), &status); 810 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(status), &status);
807 if((err<0) || status) { 811 if((err<0) || status) {
808 snd_printk(KERN_DEBUG "error MSG_STREAM_SET_IN_AUDIO_LEVEL card(%d) status(%x)\n", chip->chip_idx, status); 812 dev_dbg(chip->card->dev,
813 "error MSG_STREAM_SET_IN_AUDIO_LEVEL card(%d) status(%x)\n",
814 chip->chip_idx, status);
809 return -EINVAL; 815 return -EINVAL;
810 } 816 }
811 return 0; 817 return 0;
@@ -977,7 +983,9 @@ static int mixart_update_monitoring(struct snd_mixart* chip, int channel)
977 983
978 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(resp), &resp); 984 err = snd_mixart_send_msg(chip->mgr, &request, sizeof(resp), &resp);
979 if((err<0) || resp) { 985 if((err<0) || resp) {
980 snd_printk(KERN_DEBUG "error MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL card(%d) resp(%x)\n", chip->chip_idx, resp); 986 dev_dbg(chip->card->dev,
987 "error MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL card(%d) resp(%x)\n",
988 chip->chip_idx, resp);
981 return -EINVAL; 989 return -EINVAL;
982 } 990 }
983 return 0; 991 return 0;
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index b7afd9c8dcd7..ddc60215cc10 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -318,7 +318,8 @@ snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size)
318 offset -= chip->buffer_start; 318 offset -= chip->buffer_start;
319#ifdef CONFIG_SND_DEBUG 319#ifdef CONFIG_SND_DEBUG
320 if (offset < 0 || offset >= chip->buffer_size) { 320 if (offset < 0 || offset >= chip->buffer_size) {
321 snd_printk(KERN_ERR "write_buffer invalid offset = %d size = %d\n", 321 dev_err(chip->card->dev,
322 "write_buffer invalid offset = %d size = %d\n",
322 offset, size); 323 offset, size);
323 return; 324 return;
324 } 325 }
@@ -366,7 +367,8 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
366 NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET); 367 NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET);
367 368
368 if (snd_nm256_readb(chip, poffset) & 1) { 369 if (snd_nm256_readb(chip, poffset) & 1) {
369 snd_printd("NM256: Engine was enabled while loading coefficients!\n"); 370 dev_dbg(chip->card->dev,
371 "NM256: Engine was enabled while loading coefficients!\n");
370 return; 372 return;
371 } 373 }
372 374
@@ -466,7 +468,8 @@ static int snd_nm256_acquire_irq(struct nm256 *chip)
466 if (chip->irq < 0) { 468 if (chip->irq < 0) {
467 if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED, 469 if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED,
468 KBUILD_MODNAME, chip)) { 470 KBUILD_MODNAME, chip)) {
469 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); 471 dev_err(chip->card->dev,
472 "unable to grab IRQ %d\n", chip->pci->irq);
470 mutex_unlock(&chip->irq_mutex); 473 mutex_unlock(&chip->irq_mutex);
471 return -EBUSY; 474 return -EBUSY;
472 } 475 }
@@ -1039,7 +1042,7 @@ snd_nm256_interrupt(int irq, void *dev_id)
1039 if (status & NM_MISC_INT_1) { 1042 if (status & NM_MISC_INT_1) {
1040 status &= ~NM_MISC_INT_1; 1043 status &= ~NM_MISC_INT_1;
1041 NM_ACK_INT(chip, NM_MISC_INT_1); 1044 NM_ACK_INT(chip, NM_MISC_INT_1);
1042 snd_printd("NM256: Got misc interrupt #1\n"); 1045 dev_dbg(chip->card->dev, "NM256: Got misc interrupt #1\n");
1043 snd_nm256_writew(chip, NM_INT_REG, 0x8000); 1046 snd_nm256_writew(chip, NM_INT_REG, 0x8000);
1044 cbyte = snd_nm256_readb(chip, 0x400); 1047 cbyte = snd_nm256_readb(chip, 0x400);
1045 snd_nm256_writeb(chip, 0x400, cbyte | 2); 1048 snd_nm256_writeb(chip, 0x400, cbyte | 2);
@@ -1048,14 +1051,15 @@ snd_nm256_interrupt(int irq, void *dev_id)
1048 if (status & NM_MISC_INT_2) { 1051 if (status & NM_MISC_INT_2) {
1049 status &= ~NM_MISC_INT_2; 1052 status &= ~NM_MISC_INT_2;
1050 NM_ACK_INT(chip, NM_MISC_INT_2); 1053 NM_ACK_INT(chip, NM_MISC_INT_2);
1051 snd_printd("NM256: Got misc interrupt #2\n"); 1054 dev_dbg(chip->card->dev, "NM256: Got misc interrupt #2\n");
1052 cbyte = snd_nm256_readb(chip, 0x400); 1055 cbyte = snd_nm256_readb(chip, 0x400);
1053 snd_nm256_writeb(chip, 0x400, cbyte & ~2); 1056 snd_nm256_writeb(chip, 0x400, cbyte & ~2);
1054 } 1057 }
1055 1058
1056 /* Unknown interrupt. */ 1059 /* Unknown interrupt. */
1057 if (status) { 1060 if (status) {
1058 snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n", 1061 dev_dbg(chip->card->dev,
1062 "NM256: Fire in the hole! Unknown status 0x%x\n",
1059 status); 1063 status);
1060 /* Pray. */ 1064 /* Pray. */
1061 NM_ACK_INT(chip, status); 1065 NM_ACK_INT(chip, status);
@@ -1104,7 +1108,7 @@ snd_nm256_interrupt_zx(int irq, void *dev_id)
1104 if (status & NM2_MISC_INT_1) { 1108 if (status & NM2_MISC_INT_1) {
1105 status &= ~NM2_MISC_INT_1; 1109 status &= ~NM2_MISC_INT_1;
1106 NM2_ACK_INT(chip, NM2_MISC_INT_1); 1110 NM2_ACK_INT(chip, NM2_MISC_INT_1);
1107 snd_printd("NM256: Got misc interrupt #1\n"); 1111 dev_dbg(chip->card->dev, "NM256: Got misc interrupt #1\n");
1108 cbyte = snd_nm256_readb(chip, 0x400); 1112 cbyte = snd_nm256_readb(chip, 0x400);
1109 snd_nm256_writeb(chip, 0x400, cbyte | 2); 1113 snd_nm256_writeb(chip, 0x400, cbyte | 2);
1110 } 1114 }
@@ -1112,14 +1116,15 @@ snd_nm256_interrupt_zx(int irq, void *dev_id)
1112 if (status & NM2_MISC_INT_2) { 1116 if (status & NM2_MISC_INT_2) {
1113 status &= ~NM2_MISC_INT_2; 1117 status &= ~NM2_MISC_INT_2;
1114 NM2_ACK_INT(chip, NM2_MISC_INT_2); 1118 NM2_ACK_INT(chip, NM2_MISC_INT_2);
1115 snd_printd("NM256: Got misc interrupt #2\n"); 1119 dev_dbg(chip->card->dev, "NM256: Got misc interrupt #2\n");
1116 cbyte = snd_nm256_readb(chip, 0x400); 1120 cbyte = snd_nm256_readb(chip, 0x400);
1117 snd_nm256_writeb(chip, 0x400, cbyte & ~2); 1121 snd_nm256_writeb(chip, 0x400, cbyte & ~2);
1118 } 1122 }
1119 1123
1120 /* Unknown interrupt. */ 1124 /* Unknown interrupt. */
1121 if (status) { 1125 if (status) {
1122 snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n", 1126 dev_dbg(chip->card->dev,
1127 "NM256: Fire in the hole! Unknown status 0x%x\n",
1123 status); 1128 status);
1124 /* Pray. */ 1129 /* Pray. */
1125 NM2_ACK_INT(chip, status); 1130 NM2_ACK_INT(chip, status);
@@ -1245,7 +1250,7 @@ snd_nm256_ac97_write(struct snd_ac97 *ac97,
1245 return; 1250 return;
1246 } 1251 }
1247 } 1252 }
1248 snd_printd("nm256: ac97 codec not ready..\n"); 1253 dev_dbg(chip->card->dev, "nm256: ac97 codec not ready..\n");
1249} 1254}
1250 1255
1251/* static resolution table */ 1256/* static resolution table */
@@ -1347,7 +1352,8 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
1347 1352
1348 temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16); 1353 temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16);
1349 if (temp == NULL) { 1354 if (temp == NULL) {
1350 snd_printk(KERN_ERR "Unable to scan for card signature in video RAM\n"); 1355 dev_err(chip->card->dev,
1356 "Unable to scan for card signature in video RAM\n");
1351 return -EBUSY; 1357 return -EBUSY;
1352 } 1358 }
1353 1359
@@ -1361,12 +1367,14 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
1361 if (pointer == 0xffffffff || 1367 if (pointer == 0xffffffff ||
1362 pointer < chip->buffer_size || 1368 pointer < chip->buffer_size ||
1363 pointer > chip->buffer_end) { 1369 pointer > chip->buffer_end) {
1364 snd_printk(KERN_ERR "invalid signature found: 0x%x\n", pointer); 1370 dev_err(chip->card->dev,
1371 "invalid signature found: 0x%x\n", pointer);
1365 iounmap(temp); 1372 iounmap(temp);
1366 return -ENODEV; 1373 return -ENODEV;
1367 } else { 1374 } else {
1368 pointer_found = pointer; 1375 pointer_found = pointer;
1369 printk(KERN_INFO "nm256: found card signature in video RAM: 0x%x\n", 1376 dev_info(chip->card->dev,
1377 "found card signature in video RAM: 0x%x\n",
1370 pointer); 1378 pointer);
1371 } 1379 }
1372 } 1380 }
@@ -1411,8 +1419,7 @@ static int nm256_resume(struct device *dev)
1411 pci_set_power_state(pci, PCI_D0); 1419 pci_set_power_state(pci, PCI_D0);
1412 pci_restore_state(pci); 1420 pci_restore_state(pci);
1413 if (pci_enable_device(pci) < 0) { 1421 if (pci_enable_device(pci) < 0) {
1414 printk(KERN_ERR "nm256: pci_enable_device failed, " 1422 dev_err(dev, "pci_enable_device failed, disabling device\n");
1415 "disabling device\n");
1416 snd_card_disconnect(card); 1423 snd_card_disconnect(card);
1417 return -EIO; 1424 return -EIO;
1418 } 1425 }
@@ -1520,14 +1527,15 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1520 chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE, 1527 chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE,
1521 card->driver); 1528 card->driver);
1522 if (chip->res_cport == NULL) { 1529 if (chip->res_cport == NULL) {
1523 snd_printk(KERN_ERR "memory region 0x%lx (size 0x%x) busy\n", 1530 dev_err(card->dev, "memory region 0x%lx (size 0x%x) busy\n",
1524 chip->cport_addr, NM_PORT2_SIZE); 1531 chip->cport_addr, NM_PORT2_SIZE);
1525 err = -EBUSY; 1532 err = -EBUSY;
1526 goto __error; 1533 goto __error;
1527 } 1534 }
1528 chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE); 1535 chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE);
1529 if (chip->cport == NULL) { 1536 if (chip->cport == NULL) {
1530 snd_printk(KERN_ERR "unable to map control port %lx\n", chip->cport_addr); 1537 dev_err(card->dev, "unable to map control port %lx\n",
1538 chip->cport_addr);
1531 err = -ENOMEM; 1539 err = -ENOMEM;
1532 goto __error; 1540 goto __error;
1533 } 1541 }
@@ -1537,12 +1545,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1537 pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); 1545 pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE);
1538 if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { 1546 if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) {
1539 if (! force_ac97) { 1547 if (! force_ac97) {
1540 printk(KERN_ERR "nm256: no ac97 is found!\n"); 1548 dev_err(card->dev,
1541 printk(KERN_ERR " force the driver to load by " 1549 "no ac97 is found!\n");
1542 "passing in the module parameter\n"); 1550 dev_err(card->dev,
1543 printk(KERN_ERR " force_ac97=1\n"); 1551 "force the driver to load by passing in the module parameter\n");
1544 printk(KERN_ERR " or try sb16, opl3sa2, or " 1552 dev_err(card->dev,
1545 "cs423x drivers instead.\n"); 1553 " force_ac97=1\n");
1554 dev_err(card->dev,
1555 "or try sb16, opl3sa2, or cs423x drivers instead.\n");
1546 err = -ENXIO; 1556 err = -ENXIO;
1547 goto __error; 1557 goto __error;
1548 } 1558 }
@@ -1581,14 +1591,14 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1581 chip->buffer_start = chip->buffer_end - chip->buffer_size; 1591 chip->buffer_start = chip->buffer_end - chip->buffer_size;
1582 chip->buffer_addr += chip->buffer_start; 1592 chip->buffer_addr += chip->buffer_start;
1583 1593
1584 printk(KERN_INFO "nm256: Mapping port 1 from 0x%x - 0x%x\n", 1594 dev_info(card->dev, "Mapping port 1 from 0x%x - 0x%x\n",
1585 chip->buffer_start, chip->buffer_end); 1595 chip->buffer_start, chip->buffer_end);
1586 1596
1587 chip->res_buffer = request_mem_region(chip->buffer_addr, 1597 chip->res_buffer = request_mem_region(chip->buffer_addr,
1588 chip->buffer_size, 1598 chip->buffer_size,
1589 card->driver); 1599 card->driver);
1590 if (chip->res_buffer == NULL) { 1600 if (chip->res_buffer == NULL) {
1591 snd_printk(KERN_ERR "nm256: buffer 0x%lx (size 0x%x) busy\n", 1601 dev_err(card->dev, "buffer 0x%lx (size 0x%x) busy\n",
1592 chip->buffer_addr, chip->buffer_size); 1602 chip->buffer_addr, chip->buffer_size);
1593 err = -EBUSY; 1603 err = -EBUSY;
1594 goto __error; 1604 goto __error;
@@ -1596,7 +1606,8 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1596 chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size); 1606 chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size);
1597 if (chip->buffer == NULL) { 1607 if (chip->buffer == NULL) {
1598 err = -ENOMEM; 1608 err = -ENOMEM;
1599 snd_printk(KERN_ERR "unable to map ring buffer at %lx\n", chip->buffer_addr); 1609 dev_err(card->dev, "unable to map ring buffer at %lx\n",
1610 chip->buffer_addr);
1600 goto __error; 1611 goto __error;
1601 } 1612 }
1602 1613
@@ -1658,12 +1669,12 @@ static int snd_nm256_probe(struct pci_dev *pci,
1658 1669
1659 q = snd_pci_quirk_lookup(pci, nm256_quirks); 1670 q = snd_pci_quirk_lookup(pci, nm256_quirks);
1660 if (q) { 1671 if (q) {
1661 snd_printdd(KERN_INFO "nm256: Enabled quirk for %s.\n", 1672 dev_dbg(&pci->dev, "Enabled quirk for %s.\n",
1662 snd_pci_quirk_name(q)); 1673 snd_pci_quirk_name(q));
1663 switch (q->value) { 1674 switch (q->value) {
1664 case NM_BLACKLISTED: 1675 case NM_BLACKLISTED:
1665 printk(KERN_INFO "nm256: The device is blacklisted. " 1676 dev_info(&pci->dev,
1666 "Loading stopped\n"); 1677 "The device is blacklisted. Loading stopped\n");
1667 return -ENODEV; 1678 return -ENODEV;
1668 case NM_RESET_WORKAROUND_2: 1679 case NM_RESET_WORKAROUND_2:
1669 reset_workaround_2 = 1; 1680 reset_workaround_2 = 1;
@@ -1689,7 +1700,7 @@ static int snd_nm256_probe(struct pci_dev *pci,
1689 strcpy(card->driver, "NM256XL+"); 1700 strcpy(card->driver, "NM256XL+");
1690 break; 1701 break;
1691 default: 1702 default:
1692 snd_printk(KERN_ERR "invalid device id 0x%x\n", pci->device); 1703 dev_err(&pci->dev, "invalid device id 0x%x\n", pci->device);
1693 snd_card_free(card); 1704 snd_card_free(card);
1694 return -EINVAL; 1705 return -EINVAL;
1695 } 1706 }
@@ -1712,12 +1723,12 @@ static int snd_nm256_probe(struct pci_dev *pci,
1712 card->private_data = chip; 1723 card->private_data = chip;
1713 1724
1714 if (reset_workaround) { 1725 if (reset_workaround) {
1715 snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); 1726 dev_dbg(&pci->dev, "reset_workaround activated\n");
1716 chip->reset_workaround = 1; 1727 chip->reset_workaround = 1;
1717 } 1728 }
1718 1729
1719 if (reset_workaround_2) { 1730 if (reset_workaround_2) {
1720 snd_printdd(KERN_INFO "nm256: reset_workaround_2 activated\n"); 1731 dev_dbg(&pci->dev, "reset_workaround_2 activated\n");
1721 chip->reset_workaround_2 = 1; 1732 chip->reset_workaround_2 = 1;
1722 } 1733 }
1723 1734
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c
index 3274907189fe..4b8a32c37e31 100644
--- a/sound/pci/oxygen/oxygen_io.c
+++ b/sound/pci/oxygen/oxygen_io.c
@@ -147,7 +147,7 @@ void oxygen_write_ac97(struct oxygen *chip, unsigned int codec,
147 return; 147 return;
148 } 148 }
149 } 149 }
150 snd_printk(KERN_ERR "AC'97 write timeout\n"); 150 dev_err(chip->card->dev, "AC'97 write timeout\n");
151} 151}
152EXPORT_SYMBOL(oxygen_write_ac97); 152EXPORT_SYMBOL(oxygen_write_ac97);
153 153
@@ -179,7 +179,7 @@ u16 oxygen_read_ac97(struct oxygen *chip, unsigned int codec,
179 reg ^= 0xffff; 179 reg ^= 0xffff;
180 } 180 }
181 } 181 }
182 snd_printk(KERN_ERR "AC'97 read timeout on codec %u\n", codec); 182 dev_err(chip->card->dev, "AC'97 read timeout on codec %u\n", codec);
183 return 0; 183 return 0;
184} 184}
185EXPORT_SYMBOL(oxygen_read_ac97); 185EXPORT_SYMBOL(oxygen_read_ac97);
@@ -208,7 +208,7 @@ static int oxygen_wait_spi(struct oxygen *chip)
208 OXYGEN_SPI_BUSY) == 0) 208 OXYGEN_SPI_BUSY) == 0)
209 return 0; 209 return 0;
210 } 210 }
211 snd_printk(KERN_ERR "oxygen: SPI wait timeout\n"); 211 dev_err(chip->card->dev, "oxygen: SPI wait timeout\n");
212 return -EIO; 212 return -EIO;
213} 213}
214 214
@@ -288,5 +288,5 @@ void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value)
288 & OXYGEN_EEPROM_BUSY)) 288 & OXYGEN_EEPROM_BUSY))
289 return; 289 return;
290 } 290 }
291 snd_printk(KERN_ERR "EEPROM write timeout\n"); 291 dev_err(chip->card->dev, "EEPROM write timeout\n");
292} 292}
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index efa610cd735c..b67e30602473 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -313,7 +313,7 @@ static void oxygen_restore_eeprom(struct oxygen *chip,
313 oxygen_clear_bits8(chip, OXYGEN_MISC, 313 oxygen_clear_bits8(chip, OXYGEN_MISC,
314 OXYGEN_MISC_WRITE_PCI_SUBID); 314 OXYGEN_MISC_WRITE_PCI_SUBID);
315 315
316 snd_printk(KERN_INFO "EEPROM ID restored\n"); 316 dev_info(chip->card->dev, "EEPROM ID restored\n");
317 } 317 }
318} 318}
319 319
@@ -617,13 +617,13 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
617 617
618 err = pci_request_regions(pci, DRIVER); 618 err = pci_request_regions(pci, DRIVER);
619 if (err < 0) { 619 if (err < 0) {
620 snd_printk(KERN_ERR "cannot reserve PCI resources\n"); 620 dev_err(card->dev, "cannot reserve PCI resources\n");
621 goto err_pci_enable; 621 goto err_pci_enable;
622 } 622 }
623 623
624 if (!(pci_resource_flags(pci, 0) & IORESOURCE_IO) || 624 if (!(pci_resource_flags(pci, 0) & IORESOURCE_IO) ||
625 pci_resource_len(pci, 0) < OXYGEN_IO_SIZE) { 625 pci_resource_len(pci, 0) < OXYGEN_IO_SIZE) {
626 snd_printk(KERN_ERR "invalid PCI I/O range\n"); 626 dev_err(card->dev, "invalid PCI I/O range\n");
627 err = -ENXIO; 627 err = -ENXIO;
628 goto err_pci_regions; 628 goto err_pci_regions;
629 } 629 }
@@ -658,7 +658,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
658 err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, 658 err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED,
659 KBUILD_MODNAME, chip); 659 KBUILD_MODNAME, chip);
660 if (err < 0) { 660 if (err < 0) {
661 snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq); 661 dev_err(card->dev, "cannot grab interrupt %d\n", pci->irq);
662 goto err_card; 662 goto err_card;
663 } 663 }
664 chip->irq = pci->irq; 664 chip->irq = pci->irq;
@@ -796,7 +796,7 @@ static int oxygen_pci_resume(struct device *dev)
796 pci_set_power_state(pci, PCI_D0); 796 pci_set_power_state(pci, PCI_D0);
797 pci_restore_state(pci); 797 pci_restore_state(pci);
798 if (pci_enable_device(pci) < 0) { 798 if (pci_enable_device(pci) < 0) {
799 snd_printk(KERN_ERR "cannot reenable device"); 799 dev_err(dev, "cannot reenable device");
800 snd_card_disconnect(card); 800 snd_card_disconnect(card);
801 return -EIO; 801 return -EIO;
802 } 802 }
diff --git a/sound/pci/oxygen/xonar_hdmi.c b/sound/pci/oxygen/xonar_hdmi.c
index 136dac6a3964..91d92bc32b75 100644
--- a/sound/pci/oxygen/xonar_hdmi.c
+++ b/sound/pci/oxygen/xonar_hdmi.c
@@ -120,7 +120,7 @@ void xonar_hdmi_uart_input(struct oxygen *chip)
120 if (chip->uart_input_count >= 2 && 120 if (chip->uart_input_count >= 2 &&
121 chip->uart_input[chip->uart_input_count - 2] == 'O' && 121 chip->uart_input[chip->uart_input_count - 2] == 'O' &&
122 chip->uart_input[chip->uart_input_count - 1] == 'K') { 122 chip->uart_input[chip->uart_input_count - 1] == 'K') {
123 printk(KERN_DEBUG "message from HDMI chip received:\n"); 123 dev_dbg(chip->card->dev, "message from HDMI chip received:\n");
124 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 124 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
125 chip->uart_input, chip->uart_input_count); 125 chip->uart_input, chip->uart_input_count);
126 chip->uart_input_count = 0; 126 chip->uart_input_count = 0;
diff --git a/sound/pci/oxygen/xonar_lib.c b/sound/pci/oxygen/xonar_lib.c
index 0ebe7f5916f9..706b1a42163f 100644
--- a/sound/pci/oxygen/xonar_lib.c
+++ b/sound/pci/oxygen/xonar_lib.c
@@ -56,9 +56,9 @@ static void xonar_ext_power_gpio_changed(struct oxygen *chip)
56 if (has_power != data->has_power) { 56 if (has_power != data->has_power) {
57 data->has_power = has_power; 57 data->has_power = has_power;
58 if (has_power) { 58 if (has_power) {
59 snd_printk(KERN_NOTICE "power restored\n"); 59 dev_notice(chip->card->dev, "power restored\n");
60 } else { 60 } else {
61 snd_printk(KERN_CRIT 61 dev_crit(chip->card->dev,
62 "Hey! Don't unplug the power cable!\n"); 62 "Hey! Don't unplug the power cable!\n");
63 /* TODO: stop PCMs */ 63 /* TODO: stop PCMs */
64 } 64 }
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 3880f6da9a87..8d09444ff88b 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -284,7 +284,7 @@ static int pcxhr_get_clock_reg(struct pcxhr_mgr *mgr, unsigned int rate,
284 rmh.cmd_len = 3; 284 rmh.cmd_len = 3;
285 err = pcxhr_send_msg(mgr, &rmh); 285 err = pcxhr_send_msg(mgr, &rmh);
286 if (err < 0) { 286 if (err < 0) {
287 snd_printk(KERN_ERR 287 dev_err(&mgr->pci->dev,
288 "error CMD_ACCESS_IO_WRITE " 288 "error CMD_ACCESS_IO_WRITE "
289 "for PLL register : %x!\n", err); 289 "for PLL register : %x!\n", err);
290 return err; 290 return err;
@@ -357,7 +357,7 @@ static int pcxhr_sub_set_clock(struct pcxhr_mgr *mgr,
357 return err; 357 return err;
358 } 358 }
359 /* set the new frequency */ 359 /* set the new frequency */
360 snd_printdd("clock register : set %x\n", val); 360 dev_dbg(&mgr->pci->dev, "clock register : set %x\n", val);
361 err = pcxhr_write_io_num_reg_cont(mgr, PCXHR_FREQ_REG_MASK, 361 err = pcxhr_write_io_num_reg_cont(mgr, PCXHR_FREQ_REG_MASK,
362 val, changed); 362 val, changed);
363 if (err) 363 if (err)
@@ -380,7 +380,7 @@ static int pcxhr_sub_set_clock(struct pcxhr_mgr *mgr,
380 mgr->codec_speed = speed; /* save new codec speed */ 380 mgr->codec_speed = speed; /* save new codec speed */
381 } 381 }
382 382
383 snd_printdd("pcxhr_sub_set_clock to %dHz (realfreq=%d)\n", 383 dev_dbg(&mgr->pci->dev, "pcxhr_sub_set_clock to %dHz (realfreq=%d)\n",
384 rate, realfreq); 384 rate, realfreq);
385 return 0; 385 return 0;
386} 386}
@@ -480,7 +480,7 @@ static int pcxhr_sub_get_external_clock(struct pcxhr_mgr *mgr,
480 case REG_STATUS_SYNC_192000 : rate = 192000; break; 480 case REG_STATUS_SYNC_192000 : rate = 192000; break;
481 default: rate = 0; 481 default: rate = 0;
482 } 482 }
483 snd_printdd("External clock is at %d Hz\n", rate); 483 dev_dbg(&mgr->pci->dev, "External clock is at %d Hz\n", rate);
484 *sample_rate = rate; 484 *sample_rate = rate;
485 return 0; 485 return 0;
486} 486}
@@ -537,8 +537,8 @@ static int pcxhr_set_stream_state(struct pcxhr_stream *stream)
537 537
538 err = pcxhr_send_msg(chip->mgr, &rmh); 538 err = pcxhr_send_msg(chip->mgr, &rmh);
539 if (err) 539 if (err)
540 snd_printk(KERN_ERR "ERROR pcxhr_set_stream_state err=%x;\n", 540 dev_err(chip->card->dev,
541 err); 541 "ERROR pcxhr_set_stream_state err=%x;\n", err);
542 stream->status = 542 stream->status =
543 start ? PCXHR_STREAM_STATUS_STARTED : PCXHR_STREAM_STATUS_STOPPED; 543 start ? PCXHR_STREAM_STATUS_STARTED : PCXHR_STREAM_STATUS_STOPPED;
544 return err; 544 return err;
@@ -628,7 +628,8 @@ static int pcxhr_set_format(struct pcxhr_stream *stream)
628 rmh.cmd[rmh.cmd_len++] = (header & 0xff) << 16; 628 rmh.cmd[rmh.cmd_len++] = (header & 0xff) << 16;
629 err = pcxhr_send_msg(chip->mgr, &rmh); 629 err = pcxhr_send_msg(chip->mgr, &rmh);
630 if (err) 630 if (err)
631 snd_printk(KERN_ERR "ERROR pcxhr_set_format err=%x;\n", err); 631 dev_err(chip->card->dev,
632 "ERROR pcxhr_set_format err=%x;\n", err);
632 return err; 633 return err;
633} 634}
634 635
@@ -665,7 +666,7 @@ static int pcxhr_update_r_buffer(struct pcxhr_stream *stream)
665 rmh.cmd_len = 4; 666 rmh.cmd_len = 4;
666 err = pcxhr_send_msg(chip->mgr, &rmh); 667 err = pcxhr_send_msg(chip->mgr, &rmh);
667 if (err) 668 if (err)
668 snd_printk(KERN_ERR 669 dev_err(chip->card->dev,
669 "ERROR CMD_UPDATE_R_BUFFERS err=%x;\n", err); 670 "ERROR CMD_UPDATE_R_BUFFERS err=%x;\n", err);
670 return err; 671 return err;
671} 672}
@@ -735,11 +736,11 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
735 } 736 }
736 if (capture_mask == 0 && playback_mask == 0) { 737 if (capture_mask == 0 && playback_mask == 0) {
737 mutex_unlock(&mgr->setup_mutex); 738 mutex_unlock(&mgr->setup_mutex);
738 snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n"); 739 dev_err(&mgr->pci->dev, "pcxhr_trigger_tasklet : no pipes\n");
739 return; 740 return;
740 } 741 }
741 742
742 snd_printdd("pcxhr_trigger_tasklet : " 743 dev_dbg(&mgr->pci->dev, "pcxhr_trigger_tasklet : "
743 "playback_mask=%x capture_mask=%x\n", 744 "playback_mask=%x capture_mask=%x\n",
744 playback_mask, capture_mask); 745 playback_mask, capture_mask);
745 746
@@ -747,7 +748,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
747 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); 748 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0);
748 if (err) { 749 if (err) {
749 mutex_unlock(&mgr->setup_mutex); 750 mutex_unlock(&mgr->setup_mutex);
750 snd_printk(KERN_ERR "pcxhr_trigger_tasklet : " 751 dev_err(&mgr->pci->dev, "pcxhr_trigger_tasklet : "
751 "error stop pipes (P%x C%x)\n", 752 "error stop pipes (P%x C%x)\n",
752 playback_mask, capture_mask); 753 playback_mask, capture_mask);
753 return; 754 return;
@@ -792,7 +793,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
792 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1); 793 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1);
793 if (err) { 794 if (err) {
794 mutex_unlock(&mgr->setup_mutex); 795 mutex_unlock(&mgr->setup_mutex);
795 snd_printk(KERN_ERR "pcxhr_trigger_tasklet : " 796 dev_err(&mgr->pci->dev, "pcxhr_trigger_tasklet : "
796 "error start pipes (P%x C%x)\n", 797 "error start pipes (P%x C%x)\n",
797 playback_mask, capture_mask); 798 playback_mask, capture_mask);
798 return; 799 return;
@@ -825,7 +826,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
825 826
826#ifdef CONFIG_SND_DEBUG_VERBOSE 827#ifdef CONFIG_SND_DEBUG_VERBOSE
827 do_gettimeofday(&my_tv2); 828 do_gettimeofday(&my_tv2);
828 snd_printdd("***TRIGGER TASKLET*** TIME = %ld (err = %x)\n", 829 dev_dbg(&mgr->pci->dev, "***TRIGGER TASKLET*** TIME = %ld (err = %x)\n",
829 (long)(my_tv2.tv_usec - my_tv1.tv_usec), err); 830 (long)(my_tv2.tv_usec - my_tv1.tv_usec), err);
830#endif 831#endif
831} 832}
@@ -902,7 +903,7 @@ static int pcxhr_hardware_timer(struct pcxhr_mgr *mgr, int start)
902 } 903 }
903 err = pcxhr_send_msg(mgr, &rmh); 904 err = pcxhr_send_msg(mgr, &rmh);
904 if (err < 0) 905 if (err < 0)
905 snd_printk(KERN_ERR "error pcxhr_hardware_timer err(%x)\n", 906 dev_err(&mgr->pci->dev, "error pcxhr_hardware_timer err(%x)\n",
906 err); 907 err);
907 return err; 908 return err;
908} 909}
@@ -916,7 +917,8 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs)
916 struct pcxhr_mgr *mgr = chip->mgr; 917 struct pcxhr_mgr *mgr = chip->mgr;
917 int err = 0; 918 int err = 0;
918 919
919 snd_printdd("pcxhr_prepare : period_size(%lx) periods(%x) buffer_size(%lx)\n", 920 dev_dbg(chip->card->dev,
921 "pcxhr_prepare : period_size(%lx) periods(%x) buffer_size(%lx)\n",
920 subs->runtime->period_size, subs->runtime->periods, 922 subs->runtime->period_size, subs->runtime->periods,
921 subs->runtime->buffer_size); 923 subs->runtime->buffer_size);
922 924
@@ -1025,11 +1027,11 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
1025 runtime->hw = pcxhr_caps; 1027 runtime->hw = pcxhr_caps;
1026 1028
1027 if( subs->stream == SNDRV_PCM_STREAM_PLAYBACK ) { 1029 if( subs->stream == SNDRV_PCM_STREAM_PLAYBACK ) {
1028 snd_printdd("pcxhr_open playback chip%d subs%d\n", 1030 dev_dbg(chip->card->dev, "pcxhr_open playback chip%d subs%d\n",
1029 chip->chip_idx, subs->number); 1031 chip->chip_idx, subs->number);
1030 stream = &chip->playback_stream[subs->number]; 1032 stream = &chip->playback_stream[subs->number];
1031 } else { 1033 } else {
1032 snd_printdd("pcxhr_open capture chip%d subs%d\n", 1034 dev_dbg(chip->card->dev, "pcxhr_open capture chip%d subs%d\n",
1033 chip->chip_idx, subs->number); 1035 chip->chip_idx, subs->number);
1034 if (mgr->mono_capture) 1036 if (mgr->mono_capture)
1035 runtime->hw.channels_max = 1; 1037 runtime->hw.channels_max = 1;
@@ -1039,7 +1041,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs)
1039 } 1041 }
1040 if (stream->status != PCXHR_STREAM_STATUS_FREE){ 1042 if (stream->status != PCXHR_STREAM_STATUS_FREE){
1041 /* streams in use */ 1043 /* streams in use */
1042 snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n", 1044 dev_err(chip->card->dev, "pcxhr_open chip%d subs%d in use\n",
1043 chip->chip_idx, subs->number); 1045 chip->chip_idx, subs->number);
1044 mutex_unlock(&mgr->setup_mutex); 1046 mutex_unlock(&mgr->setup_mutex);
1045 return -EBUSY; 1047 return -EBUSY;
@@ -1105,7 +1107,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs)
1105 1107
1106 mutex_lock(&mgr->setup_mutex); 1108 mutex_lock(&mgr->setup_mutex);
1107 1109
1108 snd_printdd("pcxhr_close chip%d subs%d\n", 1110 dev_dbg(chip->card->dev, "pcxhr_close chip%d subs%d\n",
1109 chip->chip_idx, subs->number); 1111 chip->chip_idx, subs->number);
1110 1112
1111 /* sample rate released */ 1113 /* sample rate released */
@@ -1168,7 +1170,7 @@ int pcxhr_create_pcm(struct snd_pcxhr *chip)
1168 if ((err = snd_pcm_new(chip->card, name, 0, 1170 if ((err = snd_pcm_new(chip->card, name, 0,
1169 chip->nb_streams_play, 1171 chip->nb_streams_play,
1170 chip->nb_streams_capt, &pcm)) < 0) { 1172 chip->nb_streams_capt, &pcm)) < 0) {
1171 snd_printk(KERN_ERR "cannot create pcm %s\n", name); 1173 dev_err(chip->card->dev, "cannot create pcm %s\n", name);
1172 return err; 1174 return err;
1173 } 1175 }
1174 pcm->private_data = chip; 1176 pcm->private_data = chip;
@@ -1214,7 +1216,7 @@ static int pcxhr_create(struct pcxhr_mgr *mgr,
1214 1216
1215 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1217 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1216 if (! chip) { 1218 if (! chip) {
1217 snd_printk(KERN_ERR "cannot allocate chip\n"); 1219 dev_err(card->dev, "cannot allocate chip\n");
1218 return -ENOMEM; 1220 return -ENOMEM;
1219 } 1221 }
1220 1222
@@ -1487,7 +1489,7 @@ static int pcxhr_free(struct pcxhr_mgr *mgr)
1487 /* reset board if some firmware was loaded */ 1489 /* reset board if some firmware was loaded */
1488 if(mgr->dsp_loaded) { 1490 if(mgr->dsp_loaded) {
1489 pcxhr_reset_board(mgr); 1491 pcxhr_reset_board(mgr);
1490 snd_printdd("reset pcxhr !\n"); 1492 dev_dbg(&mgr->pci->dev, "reset pcxhr !\n");
1491 } 1493 }
1492 1494
1493 /* release irq */ 1495 /* release irq */
@@ -1536,8 +1538,8 @@ static int pcxhr_probe(struct pci_dev *pci,
1536 1538
1537 /* check if we can restrict PCI DMA transfers to 32 bits */ 1539 /* check if we can restrict PCI DMA transfers to 32 bits */
1538 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1540 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
1539 snd_printk(KERN_ERR "architecture does not support " 1541 dev_err(&pci->dev,
1540 "32bit PCI busmaster DMA\n"); 1542 "architecture does not support 32bit PCI busmaster DMA\n");
1541 pci_disable_device(pci); 1543 pci_disable_device(pci);
1542 return -ENXIO; 1544 return -ENXIO;
1543 } 1545 }
@@ -1588,7 +1590,7 @@ static int pcxhr_probe(struct pci_dev *pci,
1588 1590
1589 if (request_irq(pci->irq, pcxhr_interrupt, IRQF_SHARED, 1591 if (request_irq(pci->irq, pcxhr_interrupt, IRQF_SHARED,
1590 KBUILD_MODNAME, mgr)) { 1592 KBUILD_MODNAME, mgr)) {
1591 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1593 dev_err(&pci->dev, "unable to grab IRQ %d\n", pci->irq);
1592 pcxhr_free(mgr); 1594 pcxhr_free(mgr);
1593 return -EBUSY; 1595 return -EBUSY;
1594 } 1596 }
@@ -1641,7 +1643,7 @@ static int pcxhr_probe(struct pci_dev *pci,
1641 0, &card); 1643 0, &card);
1642 1644
1643 if (err < 0) { 1645 if (err < 0) {
1644 snd_printk(KERN_ERR "cannot allocate the card %d\n", i); 1646 dev_err(card->dev, "cannot allocate the card %d\n", i);
1645 pcxhr_free(mgr); 1647 pcxhr_free(mgr);
1646 return err; 1648 return err;
1647 } 1649 }
diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c
index 37b431b9b69d..df9371918601 100644
--- a/sound/pci/pcxhr/pcxhr_core.c
+++ b/sound/pci/pcxhr/pcxhr_core.c
@@ -23,6 +23,7 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/pci.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <sound/core.h> 28#include <sound/core.h>
28#include "pcxhr.h" 29#include "pcxhr.h"
@@ -132,14 +133,14 @@ static int pcxhr_check_reg_bit(struct pcxhr_mgr *mgr, unsigned int reg,
132 *read = PCXHR_INPB(mgr, reg); 133 *read = PCXHR_INPB(mgr, reg);
133 if ((*read & mask) == bit) { 134 if ((*read & mask) == bit) {
134 if (i > 100) 135 if (i > 100)
135 snd_printdd("ATTENTION! check_reg(%x) " 136 dev_dbg(&mgr->pci->dev,
136 "loopcount=%d\n", 137 "ATTENTION! check_reg(%x) loopcount=%d\n",
137 reg, i); 138 reg, i);
138 return 0; 139 return 0;
139 } 140 }
140 i++; 141 i++;
141 } while (time_after_eq(end_time, jiffies)); 142 } while (time_after_eq(end_time, jiffies));
142 snd_printk(KERN_ERR 143 dev_err(&mgr->pci->dev,
143 "pcxhr_check_reg_bit: timeout, reg=%x, mask=0x%x, val=%x\n", 144 "pcxhr_check_reg_bit: timeout, reg=%x, mask=0x%x, val=%x\n",
144 reg, mask, *read); 145 reg, mask, *read);
145 return -EIO; 146 return -EIO;
@@ -216,7 +217,7 @@ static int pcxhr_send_it_dsp(struct pcxhr_mgr *mgr,
216 err = pcxhr_check_reg_bit(mgr, PCXHR_DSP_CVR, PCXHR_CVR_HI08_HC, 0, 217 err = pcxhr_check_reg_bit(mgr, PCXHR_DSP_CVR, PCXHR_CVR_HI08_HC, 0,
217 PCXHR_TIMEOUT_DSP, &reg); 218 PCXHR_TIMEOUT_DSP, &reg);
218 if (err) { 219 if (err) {
219 snd_printk(KERN_ERR "pcxhr_send_it_dsp : TIMEOUT CVR\n"); 220 dev_err(&mgr->pci->dev, "pcxhr_send_it_dsp : TIMEOUT CVR\n");
220 return err; 221 return err;
221 } 222 }
222 if (itdsp & PCXHR_MASK_IT_MANAGE_HF5) { 223 if (itdsp & PCXHR_MASK_IT_MANAGE_HF5) {
@@ -227,7 +228,7 @@ static int pcxhr_send_it_dsp(struct pcxhr_mgr *mgr,
227 PCXHR_TIMEOUT_DSP, 228 PCXHR_TIMEOUT_DSP,
228 &reg); 229 &reg);
229 if (err) { 230 if (err) {
230 snd_printk(KERN_ERR 231 dev_err(&mgr->pci->dev,
231 "pcxhr_send_it_dsp : TIMEOUT HF5\n"); 232 "pcxhr_send_it_dsp : TIMEOUT HF5\n");
232 return err; 233 return err;
233 } 234 }
@@ -294,7 +295,7 @@ int pcxhr_load_xilinx_binary(struct pcxhr_mgr *mgr,
294 */ 295 */
295 if(second) { 296 if(second) {
296 if ((chipsc & PCXHR_CHIPSC_GPI_USERI) == 0) { 297 if ((chipsc & PCXHR_CHIPSC_GPI_USERI) == 0) {
297 snd_printk(KERN_ERR "error loading first xilinx\n"); 298 dev_err(&mgr->pci->dev, "error loading first xilinx\n");
298 return -EINVAL; 299 return -EINVAL;
299 } 300 }
300 /* activate second xilinx */ 301 /* activate second xilinx */
@@ -360,7 +361,7 @@ static int pcxhr_download_dsp(struct pcxhr_mgr *mgr, const struct firmware *dsp)
360 PCXHR_ISR_HI08_TRDY, 361 PCXHR_ISR_HI08_TRDY,
361 PCXHR_TIMEOUT_DSP, &dummy); 362 PCXHR_TIMEOUT_DSP, &dummy);
362 if (err) { 363 if (err) {
363 snd_printk(KERN_ERR 364 dev_err(&mgr->pci->dev,
364 "dsp loading error at position %d\n", i); 365 "dsp loading error at position %d\n", i);
365 return err; 366 return err;
366 } 367 }
@@ -396,7 +397,7 @@ int pcxhr_load_eeprom_binary(struct pcxhr_mgr *mgr,
396 msleep(PCXHR_WAIT_DEFAULT); 397 msleep(PCXHR_WAIT_DEFAULT);
397 PCXHR_OUTPB(mgr, PCXHR_DSP_ICR, reg); 398 PCXHR_OUTPB(mgr, PCXHR_DSP_ICR, reg);
398 msleep(PCXHR_WAIT_DEFAULT); 399 msleep(PCXHR_WAIT_DEFAULT);
399 snd_printdd("no need to load eeprom boot\n"); 400 dev_dbg(&mgr->pci->dev, "no need to load eeprom boot\n");
400 return 0; 401 return 0;
401 } 402 }
402 PCXHR_OUTPB(mgr, PCXHR_DSP_ICR, reg); 403 PCXHR_OUTPB(mgr, PCXHR_DSP_ICR, reg);
@@ -561,9 +562,9 @@ static int pcxhr_read_rmh_status(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
561 PCXHR_ISR_HI08_RXDF, 562 PCXHR_ISR_HI08_RXDF,
562 PCXHR_TIMEOUT_DSP, &reg); 563 PCXHR_TIMEOUT_DSP, &reg);
563 if (err) { 564 if (err) {
564 snd_printk(KERN_ERR "ERROR RMH stat: " 565 dev_err(&mgr->pci->dev,
565 "ISR:RXDF=1 (ISR = %x; i=%d )\n", 566 "ERROR RMH stat: ISR:RXDF=1 (ISR = %x; i=%d )\n",
566 reg, i); 567 reg, i);
567 return err; 568 return err;
568 } 569 }
569 /* read data */ 570 /* read data */
@@ -591,13 +592,13 @@ static int pcxhr_read_rmh_status(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
591 } 592 }
592#ifdef CONFIG_SND_DEBUG_VERBOSE 593#ifdef CONFIG_SND_DEBUG_VERBOSE
593 if (rmh->cmd_idx < CMD_LAST_INDEX) 594 if (rmh->cmd_idx < CMD_LAST_INDEX)
594 snd_printdd(" stat[%d]=%x\n", i, data); 595 dev_dbg(&mgr->pci->dev, " stat[%d]=%x\n", i, data);
595#endif 596#endif
596 if (i < max_stat_len) 597 if (i < max_stat_len)
597 rmh->stat[i] = data; 598 rmh->stat[i] = data;
598 } 599 }
599 if (rmh->stat_len > max_stat_len) { 600 if (rmh->stat_len > max_stat_len) {
600 snd_printdd("PCXHR : rmh->stat_len=%x too big\n", 601 dev_dbg(&mgr->pci->dev, "PCXHR : rmh->stat_len=%x too big\n",
601 rmh->stat_len); 602 rmh->stat_len);
602 rmh->stat_len = max_stat_len; 603 rmh->stat_len = max_stat_len;
603 } 604 }
@@ -615,7 +616,8 @@ static int pcxhr_send_msg_nolock(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
615 return -EINVAL; 616 return -EINVAL;
616 err = pcxhr_send_it_dsp(mgr, PCXHR_IT_MESSAGE, 1); 617 err = pcxhr_send_it_dsp(mgr, PCXHR_IT_MESSAGE, 1);
617 if (err) { 618 if (err) {
618 snd_printk(KERN_ERR "pcxhr_send_message : ED_DSP_CRASHED\n"); 619 dev_err(&mgr->pci->dev,
620 "pcxhr_send_message : ED_DSP_CRASHED\n");
619 return err; 621 return err;
620 } 622 }
621 /* wait for chk bit */ 623 /* wait for chk bit */
@@ -641,7 +643,7 @@ static int pcxhr_send_msg_nolock(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
641 data &= 0xff7fff; /* MASK_1_WORD_COMMAND */ 643 data &= 0xff7fff; /* MASK_1_WORD_COMMAND */
642#ifdef CONFIG_SND_DEBUG_VERBOSE 644#ifdef CONFIG_SND_DEBUG_VERBOSE
643 if (rmh->cmd_idx < CMD_LAST_INDEX) 645 if (rmh->cmd_idx < CMD_LAST_INDEX)
644 snd_printdd("MSG cmd[0]=%x (%s)\n", 646 dev_dbg(&mgr->pci->dev, "MSG cmd[0]=%x (%s)\n",
645 data, cmd_names[rmh->cmd_idx]); 647 data, cmd_names[rmh->cmd_idx]);
646#endif 648#endif
647 649
@@ -671,7 +673,8 @@ static int pcxhr_send_msg_nolock(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
671 data = rmh->cmd[i]; 673 data = rmh->cmd[i];
672#ifdef CONFIG_SND_DEBUG_VERBOSE 674#ifdef CONFIG_SND_DEBUG_VERBOSE
673 if (rmh->cmd_idx < CMD_LAST_INDEX) 675 if (rmh->cmd_idx < CMD_LAST_INDEX)
674 snd_printdd(" cmd[%d]=%x\n", i, data); 676 dev_dbg(&mgr->pci->dev,
677 " cmd[%d]=%x\n", i, data);
675#endif 678#endif
676 err = pcxhr_check_reg_bit(mgr, PCXHR_DSP_ISR, 679 err = pcxhr_check_reg_bit(mgr, PCXHR_DSP_ISR,
677 PCXHR_ISR_HI08_TRDY, 680 PCXHR_ISR_HI08_TRDY,
@@ -697,14 +700,15 @@ static int pcxhr_send_msg_nolock(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
697 PCXHR_ISR_HI08_RXDF, 700 PCXHR_ISR_HI08_RXDF,
698 PCXHR_TIMEOUT_DSP, &reg); 701 PCXHR_TIMEOUT_DSP, &reg);
699 if (err) { 702 if (err) {
700 snd_printk(KERN_ERR "ERROR RMH: ISR:RXDF=1 (ISR = %x)\n", reg); 703 dev_err(&mgr->pci->dev,
704 "ERROR RMH: ISR:RXDF=1 (ISR = %x)\n", reg);
701 return err; 705 return err;
702 } 706 }
703 /* read error code */ 707 /* read error code */
704 data = PCXHR_INPB(mgr, PCXHR_DSP_TXH) << 16; 708 data = PCXHR_INPB(mgr, PCXHR_DSP_TXH) << 16;
705 data |= PCXHR_INPB(mgr, PCXHR_DSP_TXM) << 8; 709 data |= PCXHR_INPB(mgr, PCXHR_DSP_TXM) << 8;
706 data |= PCXHR_INPB(mgr, PCXHR_DSP_TXL); 710 data |= PCXHR_INPB(mgr, PCXHR_DSP_TXL);
707 snd_printk(KERN_ERR "ERROR RMH(%d): 0x%x\n", 711 dev_err(&mgr->pci->dev, "ERROR RMH(%d): 0x%x\n",
708 rmh->cmd_idx, data); 712 rmh->cmd_idx, data);
709 err = -EINVAL; 713 err = -EINVAL;
710 } else { 714 } else {
@@ -780,7 +784,7 @@ static inline int pcxhr_pipes_running(struct pcxhr_mgr *mgr)
780 * (PCXHR_PIPE_STATE_CAPTURE_OFFSET) 784 * (PCXHR_PIPE_STATE_CAPTURE_OFFSET)
781 */ 785 */
782 start_mask &= 0xffffff; 786 start_mask &= 0xffffff;
783 snd_printdd("CMD_PIPE_STATE MBOX2=0x%06x\n", start_mask); 787 dev_dbg(&mgr->pci->dev, "CMD_PIPE_STATE MBOX2=0x%06x\n", start_mask);
784 return start_mask; 788 return start_mask;
785} 789}
786 790
@@ -809,7 +813,7 @@ static int pcxhr_prepair_pipe_start(struct pcxhr_mgr *mgr,
809 } 813 }
810 err = pcxhr_send_msg(mgr, &rmh); 814 err = pcxhr_send_msg(mgr, &rmh);
811 if (err) { 815 if (err) {
812 snd_printk(KERN_ERR 816 dev_err(&mgr->pci->dev,
813 "error pipe start " 817 "error pipe start "
814 "(CMD_CAN_START_PIPE) err=%x!\n", 818 "(CMD_CAN_START_PIPE) err=%x!\n",
815 err); 819 err);
@@ -847,7 +851,7 @@ static int pcxhr_stop_pipes(struct pcxhr_mgr *mgr, int audio_mask)
847 } 851 }
848 err = pcxhr_send_msg(mgr, &rmh); 852 err = pcxhr_send_msg(mgr, &rmh);
849 if (err) { 853 if (err) {
850 snd_printk(KERN_ERR 854 dev_err(&mgr->pci->dev,
851 "error pipe stop " 855 "error pipe stop "
852 "(CMD_STOP_PIPE) err=%x!\n", err); 856 "(CMD_STOP_PIPE) err=%x!\n", err);
853 return err; 857 return err;
@@ -876,7 +880,7 @@ static int pcxhr_toggle_pipes(struct pcxhr_mgr *mgr, int audio_mask)
876 1 << (audio - PCXHR_PIPE_STATE_CAPTURE_OFFSET)); 880 1 << (audio - PCXHR_PIPE_STATE_CAPTURE_OFFSET));
877 err = pcxhr_send_msg(mgr, &rmh); 881 err = pcxhr_send_msg(mgr, &rmh);
878 if (err) { 882 if (err) {
879 snd_printk(KERN_ERR 883 dev_err(&mgr->pci->dev,
880 "error pipe start " 884 "error pipe start "
881 "(CMD_CONF_PIPE) err=%x!\n", err); 885 "(CMD_CONF_PIPE) err=%x!\n", err);
882 return err; 886 return err;
@@ -889,7 +893,7 @@ static int pcxhr_toggle_pipes(struct pcxhr_mgr *mgr, int audio_mask)
889 pcxhr_init_rmh(&rmh, CMD_SEND_IRQA); 893 pcxhr_init_rmh(&rmh, CMD_SEND_IRQA);
890 err = pcxhr_send_msg(mgr, &rmh); 894 err = pcxhr_send_msg(mgr, &rmh);
891 if (err) { 895 if (err) {
892 snd_printk(KERN_ERR 896 dev_err(&mgr->pci->dev,
893 "error pipe start (CMD_SEND_IRQA) err=%x!\n", 897 "error pipe start (CMD_SEND_IRQA) err=%x!\n",
894 err); 898 err);
895 return err; 899 return err;
@@ -913,7 +917,8 @@ int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask,
913 (capture_mask << PCXHR_PIPE_STATE_CAPTURE_OFFSET)); 917 (capture_mask << PCXHR_PIPE_STATE_CAPTURE_OFFSET));
914 /* current pipe state (playback + record) */ 918 /* current pipe state (playback + record) */
915 state = pcxhr_pipes_running(mgr); 919 state = pcxhr_pipes_running(mgr);
916 snd_printdd("pcxhr_set_pipe_state %s (mask %x current %x)\n", 920 dev_dbg(&mgr->pci->dev,
921 "pcxhr_set_pipe_state %s (mask %x current %x)\n",
917 start ? "START" : "STOP", audio_mask, state); 922 start ? "START" : "STOP", audio_mask, state);
918 if (start) { 923 if (start) {
919 /* start only pipes that are not yet started */ 924 /* start only pipes that are not yet started */
@@ -944,7 +949,7 @@ int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask,
944 if ((state & audio_mask) == (start ? audio_mask : 0)) 949 if ((state & audio_mask) == (start ? audio_mask : 0))
945 break; 950 break;
946 if (++i >= MAX_WAIT_FOR_DSP * 100) { 951 if (++i >= MAX_WAIT_FOR_DSP * 100) {
947 snd_printk(KERN_ERR "error pipe start/stop\n"); 952 dev_err(&mgr->pci->dev, "error pipe start/stop\n");
948 return -EBUSY; 953 return -EBUSY;
949 } 954 }
950 udelay(10); /* wait 10 microseconds */ 955 udelay(10); /* wait 10 microseconds */
@@ -956,7 +961,7 @@ int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask,
956 } 961 }
957#ifdef CONFIG_SND_DEBUG_VERBOSE 962#ifdef CONFIG_SND_DEBUG_VERBOSE
958 do_gettimeofday(&my_tv2); 963 do_gettimeofday(&my_tv2);
959 snd_printdd("***SET PIPE STATE*** TIME = %ld (err = %x)\n", 964 dev_dbg(&mgr->pci->dev, "***SET PIPE STATE*** TIME = %ld (err = %x)\n",
960 (long)(my_tv2.tv_usec - my_tv1.tv_usec), err); 965 (long)(my_tv2.tv_usec - my_tv1.tv_usec), err);
961#endif 966#endif
962 return 0; 967 return 0;
@@ -971,7 +976,8 @@ int pcxhr_write_io_num_reg_cont(struct pcxhr_mgr *mgr, unsigned int mask,
971 976
972 spin_lock_irqsave(&mgr->msg_lock, flags); 977 spin_lock_irqsave(&mgr->msg_lock, flags);
973 if ((mgr->io_num_reg_cont & mask) == value) { 978 if ((mgr->io_num_reg_cont & mask) == value) {
974 snd_printdd("IO_NUM_REG_CONT mask %x already is set to %x\n", 979 dev_dbg(&mgr->pci->dev,
980 "IO_NUM_REG_CONT mask %x already is set to %x\n",
975 mask, value); 981 mask, value);
976 if (changed) 982 if (changed)
977 *changed = 0; 983 *changed = 0;
@@ -1024,7 +1030,7 @@ static int pcxhr_handle_async_err(struct pcxhr_mgr *mgr, u32 err,
1024 err = ((err >> 12) & 0xfff); 1030 err = ((err >> 12) & 0xfff);
1025 if (!err) 1031 if (!err)
1026 return 0; 1032 return 0;
1027 snd_printdd("CMD_ASYNC : Error %s %s Pipe %d err=%x\n", 1033 dev_dbg(&mgr->pci->dev, "CMD_ASYNC : Error %s %s Pipe %d err=%x\n",
1028 err_src_name[err_src], 1034 err_src_name[err_src],
1029 is_capture ? "Record" : "Play", pipe, err); 1035 is_capture ? "Record" : "Play", pipe, err);
1030 if (err == 0xe01) 1036 if (err == 0xe01)
@@ -1045,20 +1051,24 @@ void pcxhr_msg_tasklet(unsigned long arg)
1045 int i, j; 1051 int i, j;
1046 1052
1047 if (mgr->src_it_dsp & PCXHR_IRQ_FREQ_CHANGE) 1053 if (mgr->src_it_dsp & PCXHR_IRQ_FREQ_CHANGE)
1048 snd_printdd("TASKLET : PCXHR_IRQ_FREQ_CHANGE event occurred\n"); 1054 dev_dbg(&mgr->pci->dev,
1055 "TASKLET : PCXHR_IRQ_FREQ_CHANGE event occurred\n");
1049 if (mgr->src_it_dsp & PCXHR_IRQ_TIME_CODE) 1056 if (mgr->src_it_dsp & PCXHR_IRQ_TIME_CODE)
1050 snd_printdd("TASKLET : PCXHR_IRQ_TIME_CODE event occurred\n"); 1057 dev_dbg(&mgr->pci->dev,
1058 "TASKLET : PCXHR_IRQ_TIME_CODE event occurred\n");
1051 if (mgr->src_it_dsp & PCXHR_IRQ_NOTIFY) 1059 if (mgr->src_it_dsp & PCXHR_IRQ_NOTIFY)
1052 snd_printdd("TASKLET : PCXHR_IRQ_NOTIFY event occurred\n"); 1060 dev_dbg(&mgr->pci->dev,
1061 "TASKLET : PCXHR_IRQ_NOTIFY event occurred\n");
1053 if (mgr->src_it_dsp & (PCXHR_IRQ_FREQ_CHANGE | PCXHR_IRQ_TIME_CODE)) { 1062 if (mgr->src_it_dsp & (PCXHR_IRQ_FREQ_CHANGE | PCXHR_IRQ_TIME_CODE)) {
1054 /* clear events FREQ_CHANGE and TIME_CODE */ 1063 /* clear events FREQ_CHANGE and TIME_CODE */
1055 pcxhr_init_rmh(prmh, CMD_TEST_IT); 1064 pcxhr_init_rmh(prmh, CMD_TEST_IT);
1056 err = pcxhr_send_msg(mgr, prmh); 1065 err = pcxhr_send_msg(mgr, prmh);
1057 snd_printdd("CMD_TEST_IT : err=%x, stat=%x\n", 1066 dev_dbg(&mgr->pci->dev, "CMD_TEST_IT : err=%x, stat=%x\n",
1058 err, prmh->stat[0]); 1067 err, prmh->stat[0]);
1059 } 1068 }
1060 if (mgr->src_it_dsp & PCXHR_IRQ_ASYNC) { 1069 if (mgr->src_it_dsp & PCXHR_IRQ_ASYNC) {
1061 snd_printdd("TASKLET : PCXHR_IRQ_ASYNC event occurred\n"); 1070 dev_dbg(&mgr->pci->dev,
1071 "TASKLET : PCXHR_IRQ_ASYNC event occurred\n");
1062 1072
1063 pcxhr_init_rmh(prmh, CMD_ASYNC); 1073 pcxhr_init_rmh(prmh, CMD_ASYNC);
1064 prmh->cmd[0] |= 1; /* add SEL_ASYNC_EVENTS */ 1074 prmh->cmd[0] |= 1; /* add SEL_ASYNC_EVENTS */
@@ -1066,7 +1076,7 @@ void pcxhr_msg_tasklet(unsigned long arg)
1066 prmh->stat_len = PCXHR_SIZE_MAX_LONG_STATUS; 1076 prmh->stat_len = PCXHR_SIZE_MAX_LONG_STATUS;
1067 err = pcxhr_send_msg(mgr, prmh); 1077 err = pcxhr_send_msg(mgr, prmh);
1068 if (err) 1078 if (err)
1069 snd_printk(KERN_ERR "ERROR pcxhr_msg_tasklet=%x;\n", 1079 dev_err(&mgr->pci->dev, "ERROR pcxhr_msg_tasklet=%x;\n",
1070 err); 1080 err);
1071 i = 1; 1081 i = 1;
1072 while (i < prmh->stat_len) { 1082 while (i < prmh->stat_len) {
@@ -1079,7 +1089,8 @@ void pcxhr_msg_tasklet(unsigned long arg)
1079 u32 err2; 1089 u32 err2;
1080 1090
1081 if (prmh->stat[i] & 0x800000) { /* if BIT_END */ 1091 if (prmh->stat[i] & 0x800000) { /* if BIT_END */
1082 snd_printdd("TASKLET : End%sPipe %d\n", 1092 dev_dbg(&mgr->pci->dev,
1093 "TASKLET : End%sPipe %d\n",
1083 is_capture ? "Record" : "Play", 1094 is_capture ? "Record" : "Play",
1084 pipe); 1095 pipe);
1085 } 1096 }
@@ -1136,7 +1147,8 @@ static u_int64_t pcxhr_stream_read_position(struct pcxhr_mgr *mgr,
1136 hw_sample_count = ((u_int64_t)rmh.stat[0]) << 24; 1147 hw_sample_count = ((u_int64_t)rmh.stat[0]) << 24;
1137 hw_sample_count += (u_int64_t)rmh.stat[1]; 1148 hw_sample_count += (u_int64_t)rmh.stat[1];
1138 1149
1139 snd_printdd("stream %c%d : abs samples real(%llu) timer(%llu)\n", 1150 dev_dbg(&mgr->pci->dev,
1151 "stream %c%d : abs samples real(%llu) timer(%llu)\n",
1140 stream->pipe->is_capture ? 'C' : 'P', 1152 stream->pipe->is_capture ? 'C' : 'P',
1141 stream->substream->number, 1153 stream->substream->number,
1142 hw_sample_count, 1154 hw_sample_count,
@@ -1202,7 +1214,7 @@ static void pcxhr_update_timer_pos(struct pcxhr_mgr *mgr,
1202 (u_int32_t)(new_sample_count - 1214 (u_int32_t)(new_sample_count -
1203 stream->timer_abs_periods); 1215 stream->timer_abs_periods);
1204 } else { 1216 } else {
1205 snd_printk(KERN_ERR 1217 dev_err(&mgr->pci->dev,
1206 "ERROR new_sample_count too small ??? %ld\n", 1218 "ERROR new_sample_count too small ??? %ld\n",
1207 (long unsigned int)new_sample_count); 1219 (long unsigned int)new_sample_count);
1208 } 1220 }
@@ -1247,33 +1259,39 @@ irqreturn_t pcxhr_interrupt(int irq, void *dev_id)
1247 (mgr->dsp_time_last != PCXHR_DSP_TIME_INVALID)) { 1259 (mgr->dsp_time_last != PCXHR_DSP_TIME_INVALID)) {
1248 /* handle dsp counter wraparound without resync */ 1260 /* handle dsp counter wraparound without resync */
1249 int tmp_diff = dsp_time_diff + PCXHR_DSP_TIME_MASK + 1; 1261 int tmp_diff = dsp_time_diff + PCXHR_DSP_TIME_MASK + 1;
1250 snd_printdd("WARNING DSP timestamp old(%d) new(%d)", 1262 dev_dbg(&mgr->pci->dev,
1263 "WARNING DSP timestamp old(%d) new(%d)",
1251 mgr->dsp_time_last, dsp_time_new); 1264 mgr->dsp_time_last, dsp_time_new);
1252 if (tmp_diff > 0 && tmp_diff <= (2*mgr->granularity)) { 1265 if (tmp_diff > 0 && tmp_diff <= (2*mgr->granularity)) {
1253 snd_printdd("-> timestamp wraparound OK: " 1266 dev_dbg(&mgr->pci->dev,
1267 "-> timestamp wraparound OK: "
1254 "diff=%d\n", tmp_diff); 1268 "diff=%d\n", tmp_diff);
1255 dsp_time_diff = tmp_diff; 1269 dsp_time_diff = tmp_diff;
1256 } else { 1270 } else {
1257 snd_printdd("-> resynchronize all streams\n"); 1271 dev_dbg(&mgr->pci->dev,
1272 "-> resynchronize all streams\n");
1258 mgr->dsp_time_err++; 1273 mgr->dsp_time_err++;
1259 } 1274 }
1260 } 1275 }
1261#ifdef CONFIG_SND_DEBUG_VERBOSE 1276#ifdef CONFIG_SND_DEBUG_VERBOSE
1262 if (dsp_time_diff == 0) 1277 if (dsp_time_diff == 0)
1263 snd_printdd("ERROR DSP TIME NO DIFF time(%d)\n", 1278 dev_dbg(&mgr->pci->dev,
1279 "ERROR DSP TIME NO DIFF time(%d)\n",
1264 dsp_time_new); 1280 dsp_time_new);
1265 else if (dsp_time_diff >= (2*mgr->granularity)) 1281 else if (dsp_time_diff >= (2*mgr->granularity))
1266 snd_printdd("ERROR DSP TIME TOO BIG old(%d) add(%d)\n", 1282 dev_dbg(&mgr->pci->dev,
1283 "ERROR DSP TIME TOO BIG old(%d) add(%d)\n",
1267 mgr->dsp_time_last, 1284 mgr->dsp_time_last,
1268 dsp_time_new - mgr->dsp_time_last); 1285 dsp_time_new - mgr->dsp_time_last);
1269 else if (dsp_time_diff % mgr->granularity) 1286 else if (dsp_time_diff % mgr->granularity)
1270 snd_printdd("ERROR DSP TIME increased by %d\n", 1287 dev_dbg(&mgr->pci->dev,
1288 "ERROR DSP TIME increased by %d\n",
1271 dsp_time_diff); 1289 dsp_time_diff);
1272#endif 1290#endif
1273 mgr->dsp_time_last = dsp_time_new; 1291 mgr->dsp_time_last = dsp_time_new;
1274 1292
1275 if (timer_toggle == mgr->timer_toggle) { 1293 if (timer_toggle == mgr->timer_toggle) {
1276 snd_printdd("ERROR TIMER TOGGLE\n"); 1294 dev_dbg(&mgr->pci->dev, "ERROR TIMER TOGGLE\n");
1277 mgr->dsp_time_err++; 1295 mgr->dsp_time_err++;
1278 } 1296 }
1279 mgr->timer_toggle = timer_toggle; 1297 mgr->timer_toggle = timer_toggle;
@@ -1308,7 +1326,7 @@ irqreturn_t pcxhr_interrupt(int irq, void *dev_id)
1308 } 1326 }
1309#ifdef CONFIG_SND_DEBUG_VERBOSE 1327#ifdef CONFIG_SND_DEBUG_VERBOSE
1310 if (reg & PCXHR_FATAL_DSP_ERR) 1328 if (reg & PCXHR_FATAL_DSP_ERR)
1311 snd_printdd("FATAL DSP ERROR : %x\n", reg); 1329 dev_dbg(&mgr->pci->dev, "FATAL DSP ERROR : %x\n", reg);
1312#endif 1330#endif
1313 spin_unlock(&mgr->lock); 1331 spin_unlock(&mgr->lock);
1314 return IRQ_HANDLED; /* this device caused the interrupt */ 1332 return IRQ_HANDLED; /* this device caused the interrupt */
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c
index d995175c1c48..15a8ce5f1f48 100644
--- a/sound/pci/pcxhr/pcxhr_hwdep.c
+++ b/sound/pci/pcxhr/pcxhr_hwdep.c
@@ -72,7 +72,8 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr)
72 /* test max nb substream per pipe */ 72 /* test max nb substream per pipe */
73 if (((rmh.stat[1] >> 7) & 0x5F) < PCXHR_PLAYBACK_STREAMS) 73 if (((rmh.stat[1] >> 7) & 0x5F) < PCXHR_PLAYBACK_STREAMS)
74 return -EINVAL; 74 return -EINVAL;
75 snd_printdd("supported formats : playback=%x capture=%x\n", 75 dev_dbg(&mgr->pci->dev,
76 "supported formats : playback=%x capture=%x\n",
76 rmh.stat[2], rmh.stat[3]); 77 rmh.stat[2], rmh.stat[3]);
77 78
78 pcxhr_init_rmh(&rmh, CMD_VERSION); 79 pcxhr_init_rmh(&rmh, CMD_VERSION);
@@ -84,7 +85,8 @@ static int pcxhr_init_board(struct pcxhr_mgr *mgr)
84 err = pcxhr_send_msg(mgr, &rmh); 85 err = pcxhr_send_msg(mgr, &rmh);
85 if (err) 86 if (err)
86 return err; 87 return err;
87 snd_printdd("PCXHR DSP version is %d.%d.%d\n", (rmh.stat[0]>>16)&0xff, 88 dev_dbg(&mgr->pci->dev,
89 "PCXHR DSP version is %d.%d.%d\n", (rmh.stat[0]>>16)&0xff,
88 (rmh.stat[0]>>8)&0xff, rmh.stat[0]&0xff); 90 (rmh.stat[0]>>8)&0xff, rmh.stat[0]&0xff);
89 mgr->dsp_version = rmh.stat[0]; 91 mgr->dsp_version = rmh.stat[0];
90 92
@@ -179,7 +181,7 @@ static int pcxhr_dsp_allocate_pipe(struct pcxhr_mgr *mgr,
179 stream_count = PCXHR_PLAYBACK_STREAMS; 181 stream_count = PCXHR_PLAYBACK_STREAMS;
180 audio_count = 2; /* always stereo */ 182 audio_count = 2; /* always stereo */
181 } 183 }
182 snd_printdd("snd_add_ref_pipe pin(%d) pcm%c0\n", 184 dev_dbg(&mgr->pci->dev, "snd_add_ref_pipe pin(%d) pcm%c0\n",
183 pin, is_capture ? 'c' : 'p'); 185 pin, is_capture ? 'c' : 'p');
184 pipe->is_capture = is_capture; 186 pipe->is_capture = is_capture;
185 pipe->first_audio = pin; 187 pipe->first_audio = pin;
@@ -194,7 +196,7 @@ static int pcxhr_dsp_allocate_pipe(struct pcxhr_mgr *mgr,
194 } 196 }
195 err = pcxhr_send_msg(mgr, &rmh); 197 err = pcxhr_send_msg(mgr, &rmh);
196 if (err < 0) { 198 if (err < 0) {
197 snd_printk(KERN_ERR "error pipe allocation " 199 dev_err(&mgr->pci->dev, "error pipe allocation "
198 "(CMD_RES_PIPE) err=%x!\n", err); 200 "(CMD_RES_PIPE) err=%x!\n", err);
199 return err; 201 return err;
200 } 202 }
@@ -222,14 +224,14 @@ static int pcxhr_dsp_free_pipe( struct pcxhr_mgr *mgr, struct pcxhr_pipe *pipe)
222 /* stop one pipe */ 224 /* stop one pipe */
223 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); 225 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0);
224 if (err < 0) 226 if (err < 0)
225 snd_printk(KERN_ERR "error stopping pipe!\n"); 227 dev_err(&mgr->pci->dev, "error stopping pipe!\n");
226 /* release the pipe */ 228 /* release the pipe */
227 pcxhr_init_rmh(&rmh, CMD_FREE_PIPE); 229 pcxhr_init_rmh(&rmh, CMD_FREE_PIPE);
228 pcxhr_set_pipe_cmd_params(&rmh, pipe->is_capture, pipe->first_audio, 230 pcxhr_set_pipe_cmd_params(&rmh, pipe->is_capture, pipe->first_audio,
229 0, 0); 231 0, 0);
230 err = pcxhr_send_msg(mgr, &rmh); 232 err = pcxhr_send_msg(mgr, &rmh);
231 if (err < 0) 233 if (err < 0)
232 snd_printk(KERN_ERR "error pipe release " 234 dev_err(&mgr->pci->dev, "error pipe release "
233 "(CMD_FREE_PIPE) err(%x)\n", err); 235 "(CMD_FREE_PIPE) err(%x)\n", err);
234 pipe->status = PCXHR_PIPE_UNDEFINED; 236 pipe->status = PCXHR_PIPE_UNDEFINED;
235 return err; 237 return err;
@@ -289,7 +291,8 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index,
289{ 291{
290 int err, card_index; 292 int err, card_index;
291 293
292 snd_printdd("loading dsp [%d] size = %Zd\n", index, dsp->size); 294 dev_dbg(&mgr->pci->dev,
295 "loading dsp [%d] size = %Zd\n", index, dsp->size);
293 296
294 switch (index) { 297 switch (index) {
295 case PCXHR_FIRMWARE_XLX_INT_INDEX: 298 case PCXHR_FIRMWARE_XLX_INT_INDEX:
@@ -313,19 +316,19 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index,
313 return err; 316 return err;
314 break; /* continue with first init */ 317 break; /* continue with first init */
315 default: 318 default:
316 snd_printk(KERN_ERR "wrong file index\n"); 319 dev_err(&mgr->pci->dev, "wrong file index\n");
317 return -EFAULT; 320 return -EFAULT;
318 } /* end of switch file index*/ 321 } /* end of switch file index*/
319 322
320 /* first communication with embedded */ 323 /* first communication with embedded */
321 err = pcxhr_init_board(mgr); 324 err = pcxhr_init_board(mgr);
322 if (err < 0) { 325 if (err < 0) {
323 snd_printk(KERN_ERR "pcxhr could not be set up\n"); 326 dev_err(&mgr->pci->dev, "pcxhr could not be set up\n");
324 return err; 327 return err;
325 } 328 }
326 err = pcxhr_config_pipes(mgr); 329 err = pcxhr_config_pipes(mgr);
327 if (err < 0) { 330 if (err < 0) {
328 snd_printk(KERN_ERR "pcxhr pipes could not be set up\n"); 331 dev_err(&mgr->pci->dev, "pcxhr pipes could not be set up\n");
329 return err; 332 return err;
330 } 333 }
331 /* create devices and mixer in accordance with HW options*/ 334 /* create devices and mixer in accordance with HW options*/
@@ -344,10 +347,11 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index,
344 } 347 }
345 err = pcxhr_start_pipes(mgr); 348 err = pcxhr_start_pipes(mgr);
346 if (err < 0) { 349 if (err < 0) {
347 snd_printk(KERN_ERR "pcxhr pipes could not be started\n"); 350 dev_err(&mgr->pci->dev, "pcxhr pipes could not be started\n");
348 return err; 351 return err;
349 } 352 }
350 snd_printdd("pcxhr firmware downloaded and successfully set up\n"); 353 dev_dbg(&mgr->pci->dev,
354 "pcxhr firmware downloaded and successfully set up\n");
351 355
352 return 0; 356 return 0;
353} 357}
@@ -382,7 +386,8 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
382 continue; 386 continue;
383 sprintf(path, "pcxhr/%s", fw_files[fw_set][i]); 387 sprintf(path, "pcxhr/%s", fw_files[fw_set][i]);
384 if (request_firmware(&fw_entry, path, &mgr->pci->dev)) { 388 if (request_firmware(&fw_entry, path, &mgr->pci->dev)) {
385 snd_printk(KERN_ERR "pcxhr: can't load firmware %s\n", 389 dev_err(&mgr->pci->dev,
390 "pcxhr: can't load firmware %s\n",
386 path); 391 path);
387 return -ENOENT; 392 return -ENOENT;
388 } 393 }
diff --git a/sound/pci/pcxhr/pcxhr_mix22.c b/sound/pci/pcxhr/pcxhr_mix22.c
index 84fe57626eba..6a56e5306a65 100644
--- a/sound/pci/pcxhr/pcxhr_mix22.c
+++ b/sound/pci/pcxhr/pcxhr_mix22.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/pci.h>
25#include <sound/core.h> 26#include <sound/core.h>
26#include <sound/control.h> 27#include <sound/control.h>
27#include <sound/tlv.h> 28#include <sound/tlv.h>
@@ -290,7 +291,8 @@ int hr222_sub_init(struct pcxhr_mgr *mgr)
290 reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS); 291 reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS);
291 if (reg & PCXHR_STAT_MIC_CAPS) 292 if (reg & PCXHR_STAT_MIC_CAPS)
292 mgr->board_has_mic = 1; /* microphone available */ 293 mgr->board_has_mic = 1; /* microphone available */
293 snd_printdd("MIC input available = %d\n", mgr->board_has_mic); 294 dev_dbg(&mgr->pci->dev,
295 "MIC input available = %d\n", mgr->board_has_mic);
294 296
295 /* reset codec */ 297 /* reset codec */
296 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, 298 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET,
@@ -405,7 +407,7 @@ int hr222_sub_set_clock(struct pcxhr_mgr *mgr,
405 407
406 hr222_config_akm(mgr, AKM_UNMUTE_CMD); 408 hr222_config_akm(mgr, AKM_UNMUTE_CMD);
407 409
408 snd_printdd("set_clock to %dHz (realfreq=%d pllreg=%x)\n", 410 dev_dbg(&mgr->pci->dev, "set_clock to %dHz (realfreq=%d pllreg=%x)\n",
409 rate, realfreq, pllreg); 411 rate, realfreq, pllreg);
410 return 0; 412 return 0;
411} 413}
@@ -431,13 +433,15 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr,
431 reg = PCXHR_STAT_FREQ_UER1_MASK; 433 reg = PCXHR_STAT_FREQ_UER1_MASK;
432 434
433 } else { 435 } else {
434 snd_printdd("get_external_clock : type %d not supported\n", 436 dev_dbg(&mgr->pci->dev,
437 "get_external_clock : type %d not supported\n",
435 clock_type); 438 clock_type);
436 return -EINVAL; /* other clocks not supported */ 439 return -EINVAL; /* other clocks not supported */
437 } 440 }
438 441
439 if ((PCXHR_INPB(mgr, PCXHR_XLX_CSUER) & mask) != mask) { 442 if ((PCXHR_INPB(mgr, PCXHR_XLX_CSUER) & mask) != mask) {
440 snd_printdd("get_external_clock(%d) = 0 Hz\n", clock_type); 443 dev_dbg(&mgr->pci->dev,
444 "get_external_clock(%d) = 0 Hz\n", clock_type);
441 *sample_rate = 0; 445 *sample_rate = 0;
442 return 0; /* no external clock locked */ 446 return 0; /* no external clock locked */
443 } 447 }
@@ -495,7 +499,7 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr,
495 else 499 else
496 rate = 0; 500 rate = 0;
497 501
498 snd_printdd("External clock is at %d Hz (measured %d Hz)\n", 502 dev_dbg(&mgr->pci->dev, "External clock is at %d Hz (measured %d Hz)\n",
499 rate, calc_rate); 503 rate, calc_rate);
500 *sample_rate = rate; 504 *sample_rate = rate;
501 return 0; 505 return 0;
@@ -542,7 +546,8 @@ int hr222_manage_timecode(struct pcxhr_mgr *mgr, int enable)
542int hr222_update_analog_audio_level(struct snd_pcxhr *chip, 546int hr222_update_analog_audio_level(struct snd_pcxhr *chip,
543 int is_capture, int channel) 547 int is_capture, int channel)
544{ 548{
545 snd_printdd("hr222_update_analog_audio_level(%s chan=%d)\n", 549 dev_dbg(chip->card->dev,
550 "hr222_update_analog_audio_level(%s chan=%d)\n",
546 is_capture ? "capture" : "playback", channel); 551 is_capture ? "capture" : "playback", channel);
547 if (is_capture) { 552 if (is_capture) {
548 int level_l, level_r, level_mic; 553 int level_l, level_r, level_mic;
@@ -642,7 +647,7 @@ int hr222_iec958_capture_byte(struct snd_pcxhr *chip,
642 if (PCXHR_INPB(chip->mgr, PCXHR_XLX_CSUER) & mask) 647 if (PCXHR_INPB(chip->mgr, PCXHR_XLX_CSUER) & mask)
643 temp |= 1; 648 temp |= 1;
644 } 649 }
645 snd_printdd("read iec958 AES %d byte %d = 0x%x\n", 650 dev_dbg(chip->card->dev, "read iec958 AES %d byte %d = 0x%x\n",
646 chip->chip_idx, aes_idx, temp); 651 chip->chip_idx, aes_idx, temp);
647 *aes_bits = temp; 652 *aes_bits = temp;
648 return 0; 653 return 0;
@@ -684,7 +689,7 @@ static void hr222_micro_boost(struct pcxhr_mgr *mgr, int level)
684 689
685 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic); 690 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic);
686 691
687 snd_printdd("hr222_micro_boost : set %x\n", boost_mask); 692 dev_dbg(&mgr->pci->dev, "hr222_micro_boost : set %x\n", boost_mask);
688} 693}
689 694
690static void hr222_phantom_power(struct pcxhr_mgr *mgr, int power) 695static void hr222_phantom_power(struct pcxhr_mgr *mgr, int power)
@@ -696,7 +701,7 @@ static void hr222_phantom_power(struct pcxhr_mgr *mgr, int power)
696 701
697 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic); 702 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic);
698 703
699 snd_printdd("hr222_phantom_power : set %d\n", power); 704 dev_dbg(&mgr->pci->dev, "hr222_phantom_power : set %d\n", power);
700} 705}
701 706
702 707
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c
index fec049344621..95c9571780d8 100644
--- a/sound/pci/pcxhr/pcxhr_mixer.c
+++ b/sound/pci/pcxhr/pcxhr_mixer.c
@@ -72,7 +72,8 @@ static int pcxhr_update_analog_audio_level(struct snd_pcxhr *chip,
72 rmh.cmd_len = 3; 72 rmh.cmd_len = 3;
73 err = pcxhr_send_msg(chip->mgr, &rmh); 73 err = pcxhr_send_msg(chip->mgr, &rmh);
74 if (err < 0) { 74 if (err < 0) {
75 snd_printk(KERN_DEBUG "error update_analog_audio_level card(%d)" 75 dev_dbg(chip->card->dev,
76 "error update_analog_audio_level card(%d)"
76 " is_capture(%d) err(%x)\n", 77 " is_capture(%d) err(%x)\n",
77 chip->chip_idx, is_capture, err); 78 chip->chip_idx, is_capture, err);
78 return -EINVAL; 79 return -EINVAL;
@@ -284,7 +285,7 @@ static int pcxhr_update_playback_stream_level(struct snd_pcxhr* chip, int idx)
284 285
285 err = pcxhr_send_msg(chip->mgr, &rmh); 286 err = pcxhr_send_msg(chip->mgr, &rmh);
286 if (err < 0) { 287 if (err < 0) {
287 snd_printk(KERN_DEBUG "error update_playback_stream_level " 288 dev_dbg(chip->card->dev, "error update_playback_stream_level "
288 "card(%d) err(%x)\n", chip->chip_idx, err); 289 "card(%d) err(%x)\n", chip->chip_idx, err);
289 return -EINVAL; 290 return -EINVAL;
290 } 291 }
@@ -335,7 +336,8 @@ static int pcxhr_update_audio_pipe_level(struct snd_pcxhr *chip,
335 336
336 err = pcxhr_send_msg(chip->mgr, &rmh); 337 err = pcxhr_send_msg(chip->mgr, &rmh);
337 if (err < 0) { 338 if (err < 0) {
338 snd_printk(KERN_DEBUG "error update_audio_level(%d) err=%x\n", 339 dev_dbg(chip->card->dev,
340 "error update_audio_level(%d) err=%x\n",
339 chip->chip_idx, err); 341 chip->chip_idx, err);
340 return -EINVAL; 342 return -EINVAL;
341 } 343 }
@@ -930,7 +932,7 @@ static int pcxhr_iec958_capture_byte(struct snd_pcxhr *chip,
930 temp |= 1; 932 temp |= 1;
931 } 933 }
932 } 934 }
933 snd_printdd("read iec958 AES %d byte %d = 0x%x\n", 935 dev_dbg(chip->card->dev, "read iec958 AES %d byte %d = 0x%x\n",
934 chip->chip_idx, aes_idx, temp); 936 chip->chip_idx, aes_idx, temp);
935 *aes_bits = temp; 937 *aes_bits = temp;
936 return 0; 938 return 0;
@@ -992,7 +994,8 @@ static int pcxhr_iec958_update_byte(struct snd_pcxhr *chip,
992 rmh.cmd[0] |= IO_NUM_REG_CUER; 994 rmh.cmd[0] |= IO_NUM_REG_CUER;
993 rmh.cmd[1] = cmd; 995 rmh.cmd[1] = cmd;
994 rmh.cmd_len = 2; 996 rmh.cmd_len = 2;
995 snd_printdd("write iec958 AES %d byte %d bit %d (cmd %x)\n", 997 dev_dbg(chip->card->dev,
998 "write iec958 AES %d byte %d bit %d (cmd %x)\n",
996 chip->chip_idx, aes_idx, i, cmd); 999 chip->chip_idx, aes_idx, i, cmd);
997 err = pcxhr_send_msg(chip->mgr, &rmh); 1000 err = pcxhr_send_msg(chip->mgr, &rmh);
998 if (err) 1001 if (err)
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 77465cc03e95..cc2f0c1b6484 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1349,14 +1349,15 @@ static int snd_rme32_create(struct rme32 *rme32)
1349 1349
1350 rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE); 1350 rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE);
1351 if (!rme32->iobase) { 1351 if (!rme32->iobase) {
1352 snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", 1352 dev_err(rme32->card->dev,
1353 "unable to remap memory region 0x%lx-0x%lx\n",
1353 rme32->port, rme32->port + RME32_IO_SIZE - 1); 1354 rme32->port, rme32->port + RME32_IO_SIZE - 1);
1354 return -ENOMEM; 1355 return -ENOMEM;
1355 } 1356 }
1356 1357
1357 if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_SHARED, 1358 if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_SHARED,
1358 KBUILD_MODNAME, rme32)) { 1359 KBUILD_MODNAME, rme32)) {
1359 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1360 dev_err(rme32->card->dev, "unable to grab IRQ %d\n", pci->irq);
1360 return -EBUSY; 1361 return -EBUSY;
1361 } 1362 }
1362 rme32->irq = pci->irq; 1363 rme32->irq = pci->irq;
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 00d46116e04a..76169929770d 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -240,7 +240,7 @@ struct rme96 {
240 240
241 u8 rev; /* card revision number */ 241 u8 rev; /* card revision number */
242 242
243#ifdef CONFIG_PM 243#ifdef CONFIG_PM_SLEEP
244 u32 playback_pointer; 244 u32 playback_pointer;
245 u32 capture_pointer; 245 u32 capture_pointer;
246 void *playback_suspend_buffer; 246 void *playback_suspend_buffer;
@@ -1570,7 +1570,7 @@ snd_rme96_free(void *private_data)
1570 pci_release_regions(rme96->pci); 1570 pci_release_regions(rme96->pci);
1571 rme96->port = 0; 1571 rme96->port = 0;
1572 } 1572 }
1573#ifdef CONFIG_PM 1573#ifdef CONFIG_PM_SLEEP
1574 vfree(rme96->playback_suspend_buffer); 1574 vfree(rme96->playback_suspend_buffer);
1575 vfree(rme96->capture_suspend_buffer); 1575 vfree(rme96->capture_suspend_buffer);
1576#endif 1576#endif
@@ -1609,13 +1609,15 @@ snd_rme96_create(struct rme96 *rme96)
1609 1609
1610 rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE); 1610 rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE);
1611 if (!rme96->iobase) { 1611 if (!rme96->iobase) {
1612 snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1); 1612 dev_err(rme96->card->dev,
1613 "unable to remap memory region 0x%lx-0x%lx\n",
1614 rme96->port, rme96->port + RME96_IO_SIZE - 1);
1613 return -ENOMEM; 1615 return -ENOMEM;
1614 } 1616 }
1615 1617
1616 if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_SHARED, 1618 if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_SHARED,
1617 KBUILD_MODNAME, rme96)) { 1619 KBUILD_MODNAME, rme96)) {
1618 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1620 dev_err(rme96->card->dev, "unable to grab IRQ %d\n", pci->irq);
1619 return -EBUSY; 1621 return -EBUSY;
1620 } 1622 }
1621 rme96->irq = pci->irq; 1623 rme96->irq = pci->irq;
@@ -2372,13 +2374,12 @@ snd_rme96_create_switches(struct snd_card *card,
2372 * Card initialisation 2374 * Card initialisation
2373 */ 2375 */
2374 2376
2375#ifdef CONFIG_PM 2377#ifdef CONFIG_PM_SLEEP
2376 2378
2377static int 2379static int rme96_suspend(struct device *dev)
2378snd_rme96_suspend(struct pci_dev *pci,
2379 pm_message_t state)
2380{ 2380{
2381 struct snd_card *card = pci_get_drvdata(pci); 2381 struct pci_dev *pci = to_pci_dev(dev);
2382 struct snd_card *card = dev_get_drvdata(dev);
2382 struct rme96 *rme96 = card->private_data; 2383 struct rme96 *rme96 = card->private_data;
2383 2384
2384 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2385 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -2407,15 +2408,15 @@ snd_rme96_suspend(struct pci_dev *pci,
2407 return 0; 2408 return 0;
2408} 2409}
2409 2410
2410static int 2411static int rme96_resume(struct device *dev)
2411snd_rme96_resume(struct pci_dev *pci)
2412{ 2412{
2413 struct snd_card *card = pci_get_drvdata(pci); 2413 struct pci_dev *pci = to_pci_dev(dev);
2414 struct snd_card *card = dev_get_drvdata(dev);
2414 struct rme96 *rme96 = card->private_data; 2415 struct rme96 *rme96 = card->private_data;
2415 2416
2416 pci_restore_state(pci); 2417 pci_restore_state(pci);
2417 if (pci_enable_device(pci) < 0) { 2418 if (pci_enable_device(pci) < 0) {
2418 printk(KERN_ERR "rme96: pci_enable_device failed, disabling device\n"); 2419 dev_err(dev, "pci_enable_device failed, disabling device\n");
2419 snd_card_disconnect(card); 2420 snd_card_disconnect(card);
2420 return -EIO; 2421 return -EIO;
2421 } 2422 }
@@ -2451,7 +2452,11 @@ snd_rme96_resume(struct pci_dev *pci)
2451 return 0; 2452 return 0;
2452} 2453}
2453 2454
2454#endif 2455static SIMPLE_DEV_PM_OPS(rme96_pm, rme96_suspend, rme96_resume);
2456#define RME96_PM_OPS &rme96_pm
2457#else
2458#define RME96_PM_OPS NULL
2459#endif /* CONFIG_PM_SLEEP */
2455 2460
2456static void snd_rme96_card_free(struct snd_card *card) 2461static void snd_rme96_card_free(struct snd_card *card)
2457{ 2462{
@@ -2488,17 +2493,17 @@ snd_rme96_probe(struct pci_dev *pci,
2488 return err; 2493 return err;
2489 } 2494 }
2490 2495
2491#ifdef CONFIG_PM 2496#ifdef CONFIG_PM_SLEEP
2492 rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE); 2497 rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
2493 if (!rme96->playback_suspend_buffer) { 2498 if (!rme96->playback_suspend_buffer) {
2494 snd_printk(KERN_ERR 2499 dev_err(card->dev,
2495 "Failed to allocate playback suspend buffer!\n"); 2500 "Failed to allocate playback suspend buffer!\n");
2496 snd_card_free(card); 2501 snd_card_free(card);
2497 return -ENOMEM; 2502 return -ENOMEM;
2498 } 2503 }
2499 rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE); 2504 rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
2500 if (!rme96->capture_suspend_buffer) { 2505 if (!rme96->capture_suspend_buffer) {
2501 snd_printk(KERN_ERR 2506 dev_err(card->dev,
2502 "Failed to allocate capture suspend buffer!\n"); 2507 "Failed to allocate capture suspend buffer!\n");
2503 snd_card_free(card); 2508 snd_card_free(card);
2504 return -ENOMEM; 2509 return -ENOMEM;
@@ -2547,10 +2552,9 @@ static struct pci_driver rme96_driver = {
2547 .id_table = snd_rme96_ids, 2552 .id_table = snd_rme96_ids,
2548 .probe = snd_rme96_probe, 2553 .probe = snd_rme96_probe,
2549 .remove = snd_rme96_remove, 2554 .remove = snd_rme96_remove,
2550#ifdef CONFIG_PM 2555 .driver = {
2551 .suspend = snd_rme96_suspend, 2556 .pm = RME96_PM_OPS,
2552 .resume = snd_rme96_resume, 2557 },
2553#endif
2554}; 2558};
2555 2559
2556module_pci_driver(rme96_driver); 2560module_pci_driver(rme96_driver);
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 825fbbea7f6f..4c6f5d1c9882 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -675,14 +675,15 @@ static int hdsp_check_for_iobox (struct hdsp *hdsp)
675 if (0 == (hdsp_read(hdsp, HDSP_statusRegister) & 675 if (0 == (hdsp_read(hdsp, HDSP_statusRegister) &
676 HDSP_ConfigError)) { 676 HDSP_ConfigError)) {
677 if (i) { 677 if (i) {
678 snd_printd("Hammerfall-DSP: IO box found after %d ms\n", 678 dev_dbg(hdsp->card->dev,
679 "IO box found after %d ms\n",
679 (20 * i)); 680 (20 * i));
680 } 681 }
681 return 0; 682 return 0;
682 } 683 }
683 msleep(20); 684 msleep(20);
684 } 685 }
685 snd_printk(KERN_ERR "Hammerfall-DSP: no IO box connected!\n"); 686 dev_err(hdsp->card->dev, "no IO box connected!\n");
686 hdsp->state &= ~HDSP_FirmwareLoaded; 687 hdsp->state &= ~HDSP_FirmwareLoaded;
687 return -EIO; 688 return -EIO;
688} 689}
@@ -699,13 +700,13 @@ static int hdsp_wait_for_iobox(struct hdsp *hdsp, unsigned int loops,
699 if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError) 700 if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError)
700 msleep(delay); 701 msleep(delay);
701 else { 702 else {
702 snd_printd("Hammerfall-DSP: iobox found after %ums!\n", 703 dev_dbg(hdsp->card->dev, "iobox found after %ums!\n",
703 i * delay); 704 i * delay);
704 return 0; 705 return 0;
705 } 706 }
706 } 707 }
707 708
708 snd_printk("Hammerfall-DSP: no IO box connected!\n"); 709 dev_info(hdsp->card->dev, "no IO box connected!\n");
709 hdsp->state &= ~HDSP_FirmwareLoaded; 710 hdsp->state &= ~HDSP_FirmwareLoaded;
710 return -EIO; 711 return -EIO;
711} 712}
@@ -728,13 +729,14 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
728 729
729 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 730 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
730 731
731 snd_printk ("Hammerfall-DSP: loading firmware\n"); 732 dev_info(hdsp->card->dev, "loading firmware\n");
732 733
733 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); 734 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM);
734 hdsp_write (hdsp, HDSP_fifoData, 0); 735 hdsp_write (hdsp, HDSP_fifoData, 0);
735 736
736 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { 737 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) {
737 snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); 738 dev_info(hdsp->card->dev,
739 "timeout waiting for download preparation\n");
738 hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200); 740 hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200);
739 return -EIO; 741 return -EIO;
740 } 742 }
@@ -744,7 +746,8 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
744 for (i = 0; i < HDSP_FIRMWARE_SIZE / 4; ++i) { 746 for (i = 0; i < HDSP_FIRMWARE_SIZE / 4; ++i) {
745 hdsp_write(hdsp, HDSP_fifoData, cache[i]); 747 hdsp_write(hdsp, HDSP_fifoData, cache[i]);
746 if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { 748 if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) {
747 snd_printk ("Hammerfall-DSP: timeout during firmware loading\n"); 749 dev_info(hdsp->card->dev,
750 "timeout during firmware loading\n");
748 hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200); 751 hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200);
749 return -EIO; 752 return -EIO;
750 } 753 }
@@ -760,11 +763,12 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
760 hdsp->control2_register = 0; 763 hdsp->control2_register = 0;
761#endif 764#endif
762 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 765 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
763 snd_printk ("Hammerfall-DSP: finished firmware loading\n"); 766 dev_info(hdsp->card->dev, "finished firmware loading\n");
764 767
765 } 768 }
766 if (hdsp->state & HDSP_InitializationComplete) { 769 if (hdsp->state & HDSP_InitializationComplete) {
767 snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); 770 dev_info(hdsp->card->dev,
771 "firmware loaded from cache, restoring defaults\n");
768 spin_lock_irqsave(&hdsp->lock, flags); 772 spin_lock_irqsave(&hdsp->lock, flags);
769 snd_hdsp_set_defaults(hdsp); 773 snd_hdsp_set_defaults(hdsp);
770 spin_unlock_irqrestore(&hdsp->lock, flags); 774 spin_unlock_irqrestore(&hdsp->lock, flags);
@@ -791,7 +795,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
791 hdsp_write (hdsp, HDSP_fifoData, 0); 795 hdsp_write (hdsp, HDSP_fifoData, 0);
792 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { 796 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) {
793 hdsp->io_type = Multiface; 797 hdsp->io_type = Multiface;
794 snd_printk("Hammerfall-DSP: Multiface found\n"); 798 dev_info(hdsp->card->dev, "Multiface found\n");
795 return 0; 799 return 0;
796 } 800 }
797 801
@@ -799,7 +803,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
799 hdsp_write(hdsp, HDSP_fifoData, 0); 803 hdsp_write(hdsp, HDSP_fifoData, 0);
800 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { 804 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) {
801 hdsp->io_type = Digiface; 805 hdsp->io_type = Digiface;
802 snd_printk("Hammerfall-DSP: Digiface found\n"); 806 dev_info(hdsp->card->dev, "Digiface found\n");
803 return 0; 807 return 0;
804 } 808 }
805 809
@@ -808,7 +812,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
808 hdsp_write(hdsp, HDSP_fifoData, 0); 812 hdsp_write(hdsp, HDSP_fifoData, 0);
809 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { 813 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) {
810 hdsp->io_type = Multiface; 814 hdsp->io_type = Multiface;
811 snd_printk("Hammerfall-DSP: Multiface found\n"); 815 dev_info(hdsp->card->dev, "Multiface found\n");
812 return 0; 816 return 0;
813 } 817 }
814 818
@@ -817,12 +821,12 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
817 hdsp_write(hdsp, HDSP_fifoData, 0); 821 hdsp_write(hdsp, HDSP_fifoData, 0);
818 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { 822 if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) {
819 hdsp->io_type = Multiface; 823 hdsp->io_type = Multiface;
820 snd_printk("Hammerfall-DSP: Multiface found\n"); 824 dev_info(hdsp->card->dev, "Multiface found\n");
821 return 0; 825 return 0;
822 } 826 }
823 827
824 hdsp->io_type = RPM; 828 hdsp->io_type = RPM;
825 snd_printk("Hammerfall-DSP: RPM found\n"); 829 dev_info(hdsp->card->dev, "RPM found\n");
826 return 0; 830 return 0;
827 } else { 831 } else {
828 /* firmware was already loaded, get iobox type */ 832 /* firmware was already loaded, get iobox type */
@@ -847,20 +851,18 @@ static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
847 hdsp->state &= ~HDSP_FirmwareLoaded; 851 hdsp->state &= ~HDSP_FirmwareLoaded;
848 if (! load_on_demand) 852 if (! load_on_demand)
849 return -EIO; 853 return -EIO;
850 snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n"); 854 dev_err(hdsp->card->dev, "firmware not present.\n");
851 /* try to load firmware */ 855 /* try to load firmware */
852 if (! (hdsp->state & HDSP_FirmwareCached)) { 856 if (! (hdsp->state & HDSP_FirmwareCached)) {
853 if (! hdsp_request_fw_loader(hdsp)) 857 if (! hdsp_request_fw_loader(hdsp))
854 return 0; 858 return 0;
855 snd_printk(KERN_ERR 859 dev_err(hdsp->card->dev,
856 "Hammerfall-DSP: No firmware loaded nor " 860 "No firmware loaded nor cached, please upload firmware.\n");
857 "cached, please upload firmware.\n");
858 return -EIO; 861 return -EIO;
859 } 862 }
860 if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { 863 if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) {
861 snd_printk(KERN_ERR 864 dev_err(hdsp->card->dev,
862 "Hammerfall-DSP: Firmware loading from " 865 "Firmware loading from cache failed, please upload manually.\n");
863 "cache failed, please upload manually.\n");
864 return -EIO; 866 return -EIO;
865 } 867 }
866 } 868 }
@@ -888,7 +890,8 @@ static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout)
888 udelay (100); 890 udelay (100);
889 } 891 }
890 892
891 snd_printk ("Hammerfall-DSP: wait for FIFO status <= %d failed after %d iterations\n", 893 dev_warn(hdsp->card->dev,
894 "wait for FIFO status <= %d failed after %d iterations\n",
892 count, timeout); 895 count, timeout);
893 return -1; 896 return -1;
894} 897}
@@ -1005,7 +1008,9 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp)
1005 default: 1008 default:
1006 break; 1009 break;
1007 } 1010 }
1008 snd_printk ("Hammerfall-DSP: unknown spdif frequency status; bits = 0x%x, status = 0x%x\n", rate_bits, status); 1011 dev_warn(hdsp->card->dev,
1012 "unknown spdif frequency status; bits = 0x%x, status = 0x%x\n",
1013 rate_bits, status);
1009 return 0; 1014 return 0;
1010} 1015}
1011 1016
@@ -1139,7 +1144,8 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally)
1139 if (!(hdsp->control_register & HDSP_ClockModeMaster)) { 1144 if (!(hdsp->control_register & HDSP_ClockModeMaster)) {
1140 if (called_internally) { 1145 if (called_internally) {
1141 /* request from ctl or card initialization */ 1146 /* request from ctl or card initialization */
1142 snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); 1147 dev_err(hdsp->card->dev,
1148 "device is not running as a clock master: cannot set sample rate.\n");
1143 return -1; 1149 return -1;
1144 } else { 1150 } else {
1145 /* hw_param request while in AutoSync mode */ 1151 /* hw_param request while in AutoSync mode */
@@ -1147,11 +1153,14 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally)
1147 int spdif_freq = hdsp_spdif_sample_rate(hdsp); 1153 int spdif_freq = hdsp_spdif_sample_rate(hdsp);
1148 1154
1149 if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) 1155 if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1))
1150 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); 1156 dev_info(hdsp->card->dev,
1157 "Detected ADAT in double speed mode\n");
1151 else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) 1158 else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1))
1152 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); 1159 dev_info(hdsp->card->dev,
1160 "Detected ADAT in quad speed mode\n");
1153 else if (rate != external_freq) { 1161 else if (rate != external_freq) {
1154 snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); 1162 dev_info(hdsp->card->dev,
1163 "No AutoSync source for requested rate\n");
1155 return -1; 1164 return -1;
1156 } 1165 }
1157 } 1166 }
@@ -1223,7 +1232,8 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally)
1223 } 1232 }
1224 1233
1225 if (reject_if_open && (hdsp->capture_pid >= 0 || hdsp->playback_pid >= 0)) { 1234 if (reject_if_open && (hdsp->capture_pid >= 0 || hdsp->playback_pid >= 0)) {
1226 snd_printk ("Hammerfall-DSP: cannot change speed mode (capture PID = %d, playback PID = %d)\n", 1235 dev_warn(hdsp->card->dev,
1236 "cannot change speed mode (capture PID = %d, playback PID = %d)\n",
1227 hdsp->capture_pid, 1237 hdsp->capture_pid,
1228 hdsp->playback_pid); 1238 hdsp->playback_pid);
1229 return -EBUSY; 1239 return -EBUSY;
@@ -3785,7 +3795,8 @@ static int snd_hdsp_initialize_memory(struct hdsp *hdsp)
3785 snd_hammerfall_get_buffer(hdsp->pci, &hdsp->playback_dma_buf, HDSP_DMA_AREA_BYTES) < 0) { 3795 snd_hammerfall_get_buffer(hdsp->pci, &hdsp->playback_dma_buf, HDSP_DMA_AREA_BYTES) < 0) {
3786 if (hdsp->capture_dma_buf.area) 3796 if (hdsp->capture_dma_buf.area)
3787 snd_dma_free_pages(&hdsp->capture_dma_buf); 3797 snd_dma_free_pages(&hdsp->capture_dma_buf);
3788 printk(KERN_ERR "%s: no buffers available\n", hdsp->card_name); 3798 dev_err(hdsp->card->dev,
3799 "%s: no buffers available\n", hdsp->card_name);
3789 return -ENOMEM; 3800 return -ENOMEM;
3790 } 3801 }
3791 3802
@@ -4747,7 +4758,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4747 return err; 4758 return err;
4748 4759
4749 if (!(hdsp->state & HDSP_FirmwareLoaded)) { 4760 if (!(hdsp->state & HDSP_FirmwareLoaded)) {
4750 snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); 4761 dev_err(hdsp->card->dev,
4762 "firmware needs to be uploaded to the card.\n");
4751 return -EINVAL; 4763 return -EINVAL;
4752 } 4764 }
4753 4765
@@ -4858,7 +4870,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4858 if (hdsp->state & (HDSP_FirmwareCached | HDSP_FirmwareLoaded)) 4870 if (hdsp->state & (HDSP_FirmwareCached | HDSP_FirmwareLoaded))
4859 return -EBUSY; 4871 return -EBUSY;
4860 4872
4861 snd_printk(KERN_INFO "Hammerfall-DSP: initializing firmware upload\n"); 4873 dev_info(hdsp->card->dev,
4874 "initializing firmware upload\n");
4862 firmware = (struct hdsp_firmware __user *)argp; 4875 firmware = (struct hdsp_firmware __user *)argp;
4863 4876
4864 if (get_user(firmware_data, &firmware->firmware_data)) 4877 if (get_user(firmware_data, &firmware->firmware_data))
@@ -4893,7 +4906,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4893 snd_hdsp_initialize_midi_flush(hdsp); 4906 snd_hdsp_initialize_midi_flush(hdsp);
4894 4907
4895 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { 4908 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
4896 snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); 4909 dev_err(hdsp->card->dev,
4910 "error creating alsa devices\n");
4897 return err; 4911 return err;
4898 } 4912 }
4899 } 4913 }
@@ -4983,7 +4997,8 @@ static int snd_hdsp_enable_io (struct hdsp *hdsp)
4983 int i; 4997 int i;
4984 4998
4985 if (hdsp_fifo_wait (hdsp, 0, 100)) { 4999 if (hdsp_fifo_wait (hdsp, 0, 100)) {
4986 snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); 5000 dev_err(hdsp->card->dev,
5001 "enable_io fifo_wait failed\n");
4987 return -EIO; 5002 return -EIO;
4988 } 5003 }
4989 5004
@@ -5057,25 +5072,29 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
5057 int err; 5072 int err;
5058 5073
5059 if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { 5074 if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) {
5060 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); 5075 dev_err(card->dev,
5076 "Error creating pcm interface\n");
5061 return err; 5077 return err;
5062 } 5078 }
5063 5079
5064 5080
5065 if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { 5081 if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) {
5066 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); 5082 dev_err(card->dev,
5083 "Error creating first midi interface\n");
5067 return err; 5084 return err;
5068 } 5085 }
5069 5086
5070 if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { 5087 if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
5071 if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) { 5088 if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) {
5072 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating second midi interface\n"); 5089 dev_err(card->dev,
5090 "Error creating second midi interface\n");
5073 return err; 5091 return err;
5074 } 5092 }
5075 } 5093 }
5076 5094
5077 if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) { 5095 if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) {
5078 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating ctl interface\n"); 5096 dev_err(card->dev,
5097 "Error creating ctl interface\n");
5079 return err; 5098 return err;
5080 } 5099 }
5081 5100
@@ -5088,7 +5107,8 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
5088 hdsp->playback_substream = NULL; 5107 hdsp->playback_substream = NULL;
5089 5108
5090 if ((err = snd_hdsp_set_defaults(hdsp)) < 0) { 5109 if ((err = snd_hdsp_set_defaults(hdsp)) < 0) {
5091 snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); 5110 dev_err(card->dev,
5111 "Error setting default values\n");
5092 return err; 5112 return err;
5093 } 5113 }
5094 5114
@@ -5098,7 +5118,8 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
5098 hdsp->port, hdsp->irq); 5118 hdsp->port, hdsp->irq);
5099 5119
5100 if ((err = snd_card_register(card)) < 0) { 5120 if ((err = snd_card_register(card)) < 0) {
5101 snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); 5121 dev_err(card->dev,
5122 "error registering card\n");
5102 return err; 5123 return err;
5103 } 5124 }
5104 hdsp->state |= HDSP_InitializationComplete; 5125 hdsp->state |= HDSP_InitializationComplete;
@@ -5141,16 +5162,19 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
5141 fwfile = "digiface_firmware_rev11.bin"; 5162 fwfile = "digiface_firmware_rev11.bin";
5142 break; 5163 break;
5143 default: 5164 default:
5144 snd_printk(KERN_ERR "Hammerfall-DSP: invalid io_type %d\n", hdsp->io_type); 5165 dev_err(hdsp->card->dev,
5166 "invalid io_type %d\n", hdsp->io_type);
5145 return -EINVAL; 5167 return -EINVAL;
5146 } 5168 }
5147 5169
5148 if (request_firmware(&fw, fwfile, &hdsp->pci->dev)) { 5170 if (request_firmware(&fw, fwfile, &hdsp->pci->dev)) {
5149 snd_printk(KERN_ERR "Hammerfall-DSP: cannot load firmware %s\n", fwfile); 5171 dev_err(hdsp->card->dev,
5172 "cannot load firmware %s\n", fwfile);
5150 return -ENOENT; 5173 return -ENOENT;
5151 } 5174 }
5152 if (fw->size < HDSP_FIRMWARE_SIZE) { 5175 if (fw->size < HDSP_FIRMWARE_SIZE) {
5153 snd_printk(KERN_ERR "Hammerfall-DSP: too short firmware size %d (expected %d)\n", 5176 dev_err(hdsp->card->dev,
5177 "too short firmware size %d (expected %d)\n",
5154 (int)fw->size, HDSP_FIRMWARE_SIZE); 5178 (int)fw->size, HDSP_FIRMWARE_SIZE);
5155 return -EINVAL; 5179 return -EINVAL;
5156 } 5180 }
@@ -5167,13 +5191,15 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
5167 return err; 5191 return err;
5168 5192
5169 if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) { 5193 if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) {
5170 snd_printk(KERN_ERR "Hammerfall-DSP: error creating hwdep device\n"); 5194 dev_err(hdsp->card->dev,
5195 "error creating hwdep device\n");
5171 return err; 5196 return err;
5172 } 5197 }
5173 snd_hdsp_initialize_channels(hdsp); 5198 snd_hdsp_initialize_channels(hdsp);
5174 snd_hdsp_initialize_midi_flush(hdsp); 5199 snd_hdsp_initialize_midi_flush(hdsp);
5175 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { 5200 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
5176 snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); 5201 dev_err(hdsp->card->dev,
5202 "error creating alsa devices\n");
5177 return err; 5203 return err;
5178 } 5204 }
5179 } 5205 }
@@ -5249,13 +5275,14 @@ static int snd_hdsp_create(struct snd_card *card,
5249 return err; 5275 return err;
5250 hdsp->port = pci_resource_start(pci, 0); 5276 hdsp->port = pci_resource_start(pci, 0);
5251 if ((hdsp->iobase = ioremap_nocache(hdsp->port, HDSP_IO_EXTENT)) == NULL) { 5277 if ((hdsp->iobase = ioremap_nocache(hdsp->port, HDSP_IO_EXTENT)) == NULL) {
5252 snd_printk(KERN_ERR "Hammerfall-DSP: unable to remap region 0x%lx-0x%lx\n", hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1); 5278 dev_err(hdsp->card->dev, "unable to remap region 0x%lx-0x%lx\n",
5279 hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1);
5253 return -EBUSY; 5280 return -EBUSY;
5254 } 5281 }
5255 5282
5256 if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED, 5283 if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED,
5257 KBUILD_MODNAME, hdsp)) { 5284 KBUILD_MODNAME, hdsp)) {
5258 snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); 5285 dev_err(hdsp->card->dev, "unable to use IRQ %d\n", pci->irq);
5259 return -EBUSY; 5286 return -EBUSY;
5260 } 5287 }
5261 5288
@@ -5281,17 +5308,20 @@ static int snd_hdsp_create(struct snd_card *card,
5281 if userspace is not ready for 5308 if userspace is not ready for
5282 firmware upload 5309 firmware upload
5283 */ 5310 */
5284 snd_printk(KERN_ERR "Hammerfall-DSP: couldn't get firmware from userspace. try using hdsploader\n"); 5311 dev_err(hdsp->card->dev,
5312 "couldn't get firmware from userspace. try using hdsploader\n");
5285 else 5313 else
5286 /* init is complete, we return */ 5314 /* init is complete, we return */
5287 return 0; 5315 return 0;
5288 /* we defer initialization */ 5316 /* we defer initialization */
5289 snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); 5317 dev_info(hdsp->card->dev,
5318 "card initialization pending : waiting for firmware\n");
5290 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) 5319 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
5291 return err; 5320 return err;
5292 return 0; 5321 return 0;
5293 } else { 5322 } else {
5294 snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); 5323 dev_info(hdsp->card->dev,
5324 "Firmware already present, initializing card.\n");
5295 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version2) 5325 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version2)
5296 hdsp->io_type = RPM; 5326 hdsp->io_type = RPM;
5297 else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) 5327 else if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 76016287e46f..cb82b593473a 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -1651,9 +1651,8 @@ static int hdspm_set_rate(struct hdspm * hdspm, int rate, int called_internally)
1651 just make a warning an remember setting 1651 just make a warning an remember setting
1652 for future master mode switching */ 1652 for future master mode switching */
1653 1653
1654 snd_printk(KERN_WARNING "HDSPM: " 1654 dev_warn(hdspm->card->dev,
1655 "Warning: device is not running " 1655 "Warning: device is not running as a clock master.\n");
1656 "as a clock master.\n");
1657 not_set = 1; 1656 not_set = 1;
1658 } else { 1657 } else {
1659 1658
@@ -1664,15 +1663,14 @@ static int hdspm_set_rate(struct hdspm * hdspm, int rate, int called_internally)
1664 if (hdspm_autosync_ref(hdspm) == 1663 if (hdspm_autosync_ref(hdspm) ==
1665 HDSPM_AUTOSYNC_FROM_NONE) { 1664 HDSPM_AUTOSYNC_FROM_NONE) {
1666 1665
1667 snd_printk(KERN_WARNING "HDSPM: " 1666 dev_warn(hdspm->card->dev,
1668 "Detected no Externel Sync \n"); 1667 "Detected no Externel Sync\n");
1669 not_set = 1; 1668 not_set = 1;
1670 1669
1671 } else if (rate != external_freq) { 1670 } else if (rate != external_freq) {
1672 1671
1673 snd_printk(KERN_WARNING "HDSPM: " 1672 dev_warn(hdspm->card->dev,
1674 "Warning: No AutoSync source for " 1673 "Warning: No AutoSync source for requested rate\n");
1675 "requested rate\n");
1676 not_set = 1; 1674 not_set = 1;
1677 } 1675 }
1678 } 1676 }
@@ -1738,13 +1736,11 @@ static int hdspm_set_rate(struct hdspm * hdspm, int rate, int called_internally)
1738 1736
1739 if (current_speed != target_speed 1737 if (current_speed != target_speed
1740 && (hdspm->capture_pid >= 0 || hdspm->playback_pid >= 0)) { 1738 && (hdspm->capture_pid >= 0 || hdspm->playback_pid >= 0)) {
1741 snd_printk 1739 dev_err(hdspm->card->dev,
1742 (KERN_ERR "HDSPM: " 1740 "cannot change from %s speed to %s speed mode (capture PID = %d, playback PID = %d)\n",
1743 "cannot change from %s speed to %s speed mode " 1741 hdspm_speed_names[current_speed],
1744 "(capture PID = %d, playback PID = %d)\n", 1742 hdspm_speed_names[target_speed],
1745 hdspm_speed_names[current_speed], 1743 hdspm->capture_pid, hdspm->playback_pid);
1746 hdspm_speed_names[target_speed],
1747 hdspm->capture_pid, hdspm->playback_pid);
1748 return -EBUSY; 1744 return -EBUSY;
1749 } 1745 }
1750 1746
@@ -5446,7 +5442,7 @@ static irqreturn_t snd_hdspm_interrupt(int irq, void *dev_id)
5446 * 0 64 ~3998231 ~8191558 5442 * 0 64 ~3998231 ~8191558
5447 **/ 5443 **/
5448 /* 5444 /*
5449 snd_printk(KERN_INFO "snd_hdspm_interrupt %llu @ %llx\n", 5445 dev_info(hdspm->card->dev, "snd_hdspm_interrupt %llu @ %llx\n",
5450 now-hdspm->last_interrupt, status & 0xFFC0); 5446 now-hdspm->last_interrupt, status & 0xFFC0);
5451 hdspm->last_interrupt = now; 5447 hdspm->last_interrupt = now;
5452 */ 5448 */
@@ -5583,7 +5579,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
5583 spin_lock_irq(&hdspm->lock); 5579 spin_lock_irq(&hdspm->lock);
5584 err = hdspm_set_rate(hdspm, params_rate(params), 0); 5580 err = hdspm_set_rate(hdspm, params_rate(params), 0);
5585 if (err < 0) { 5581 if (err < 0) {
5586 snd_printk(KERN_INFO "err on hdspm_set_rate: %d\n", err); 5582 dev_info(hdspm->card->dev, "err on hdspm_set_rate: %d\n", err);
5587 spin_unlock_irq(&hdspm->lock); 5583 spin_unlock_irq(&hdspm->lock);
5588 _snd_pcm_hw_param_setempty(params, 5584 _snd_pcm_hw_param_setempty(params,
5589 SNDRV_PCM_HW_PARAM_RATE); 5585 SNDRV_PCM_HW_PARAM_RATE);
@@ -5594,7 +5590,8 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
5594 err = hdspm_set_interrupt_interval(hdspm, 5590 err = hdspm_set_interrupt_interval(hdspm,
5595 params_period_size(params)); 5591 params_period_size(params));
5596 if (err < 0) { 5592 if (err < 0) {
5597 snd_printk(KERN_INFO "err on hdspm_set_interrupt_interval: %d\n", err); 5593 dev_info(hdspm->card->dev,
5594 "err on hdspm_set_interrupt_interval: %d\n", err);
5598 _snd_pcm_hw_param_setempty(params, 5595 _snd_pcm_hw_param_setempty(params,
5599 SNDRV_PCM_HW_PARAM_PERIOD_SIZE); 5596 SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
5600 return err; 5597 return err;
@@ -5610,7 +5607,8 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
5610 err = 5607 err =
5611 snd_pcm_lib_malloc_pages(substream, HDSPM_DMA_AREA_BYTES); 5608 snd_pcm_lib_malloc_pages(substream, HDSPM_DMA_AREA_BYTES);
5612 if (err < 0) { 5609 if (err < 0) {
5613 snd_printk(KERN_INFO "err on snd_pcm_lib_malloc_pages: %d\n", err); 5610 dev_info(hdspm->card->dev,
5611 "err on snd_pcm_lib_malloc_pages: %d\n", err);
5614 return err; 5612 return err;
5615 } 5613 }
5616 5614
@@ -5624,7 +5622,8 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
5624 5622
5625 hdspm->playback_buffer = 5623 hdspm->playback_buffer =
5626 (unsigned char *) substream->runtime->dma_area; 5624 (unsigned char *) substream->runtime->dma_area;
5627 snd_printdd("Allocated sample buffer for playback at %p\n", 5625 dev_dbg(hdspm->card->dev,
5626 "Allocated sample buffer for playback at %p\n",
5628 hdspm->playback_buffer); 5627 hdspm->playback_buffer);
5629 } else { 5628 } else {
5630 hdspm_set_sgbuf(hdspm, substream, HDSPM_pageAddressBufferIn, 5629 hdspm_set_sgbuf(hdspm, substream, HDSPM_pageAddressBufferIn,
@@ -5635,18 +5634,21 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
5635 5634
5636 hdspm->capture_buffer = 5635 hdspm->capture_buffer =
5637 (unsigned char *) substream->runtime->dma_area; 5636 (unsigned char *) substream->runtime->dma_area;
5638 snd_printdd("Allocated sample buffer for capture at %p\n", 5637 dev_dbg(hdspm->card->dev,
5638 "Allocated sample buffer for capture at %p\n",
5639 hdspm->capture_buffer); 5639 hdspm->capture_buffer);
5640 } 5640 }
5641 5641
5642 /* 5642 /*
5643 snd_printdd("Allocated sample buffer for %s at 0x%08X\n", 5643 dev_dbg(hdspm->card->dev,
5644 "Allocated sample buffer for %s at 0x%08X\n",
5644 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 5645 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
5645 "playback" : "capture", 5646 "playback" : "capture",
5646 snd_pcm_sgbuf_get_addr(substream, 0)); 5647 snd_pcm_sgbuf_get_addr(substream, 0));
5647 */ 5648 */
5648 /* 5649 /*
5649 snd_printdd("set_hwparams: %s %d Hz, %d channels, bs = %d\n", 5650 dev_dbg(hdspm->card->dev,
5651 "set_hwparams: %s %d Hz, %d channels, bs = %d\n",
5650 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 5652 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
5651 "playback" : "capture", 5653 "playback" : "capture",
5652 params_rate(params), params_channels(params), 5654 params_rate(params), params_channels(params),
@@ -5667,12 +5669,14 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
5667 /* Switch to native float format if requested */ 5669 /* Switch to native float format if requested */
5668 if (SNDRV_PCM_FORMAT_FLOAT_LE == params_format(params)) { 5670 if (SNDRV_PCM_FORMAT_FLOAT_LE == params_format(params)) {
5669 if (!(hdspm->control_register & HDSPe_FLOAT_FORMAT)) 5671 if (!(hdspm->control_register & HDSPe_FLOAT_FORMAT))
5670 snd_printk(KERN_INFO "hdspm: Switching to native 32bit LE float format.\n"); 5672 dev_info(hdspm->card->dev,
5673 "Switching to native 32bit LE float format.\n");
5671 5674
5672 hdspm->control_register |= HDSPe_FLOAT_FORMAT; 5675 hdspm->control_register |= HDSPe_FLOAT_FORMAT;
5673 } else if (SNDRV_PCM_FORMAT_S32_LE == params_format(params)) { 5676 } else if (SNDRV_PCM_FORMAT_S32_LE == params_format(params)) {
5674 if (hdspm->control_register & HDSPe_FLOAT_FORMAT) 5677 if (hdspm->control_register & HDSPe_FLOAT_FORMAT)
5675 snd_printk(KERN_INFO "hdspm: Switching to native 32bit LE integer format.\n"); 5678 dev_info(hdspm->card->dev,
5679 "Switching to native 32bit LE integer format.\n");
5676 5680
5677 hdspm->control_register &= ~HDSPe_FLOAT_FORMAT; 5681 hdspm->control_register &= ~HDSPe_FLOAT_FORMAT;
5678 } 5682 }
@@ -5715,12 +5719,16 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream,
5715 5719
5716 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 5720 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
5717 if (snd_BUG_ON(info->channel >= hdspm->max_channels_out)) { 5721 if (snd_BUG_ON(info->channel >= hdspm->max_channels_out)) {
5718 snd_printk(KERN_INFO "snd_hdspm_channel_info: output channel out of range (%d)\n", info->channel); 5722 dev_info(hdspm->card->dev,
5723 "snd_hdspm_channel_info: output channel out of range (%d)\n",
5724 info->channel);
5719 return -EINVAL; 5725 return -EINVAL;
5720 } 5726 }
5721 5727
5722 if (hdspm->channel_map_out[info->channel] < 0) { 5728 if (hdspm->channel_map_out[info->channel] < 0) {
5723 snd_printk(KERN_INFO "snd_hdspm_channel_info: output channel %d mapped out\n", info->channel); 5729 dev_info(hdspm->card->dev,
5730 "snd_hdspm_channel_info: output channel %d mapped out\n",
5731 info->channel);
5724 return -EINVAL; 5732 return -EINVAL;
5725 } 5733 }
5726 5734
@@ -5728,12 +5736,16 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream,
5728 HDSPM_CHANNEL_BUFFER_BYTES; 5736 HDSPM_CHANNEL_BUFFER_BYTES;
5729 } else { 5737 } else {
5730 if (snd_BUG_ON(info->channel >= hdspm->max_channels_in)) { 5738 if (snd_BUG_ON(info->channel >= hdspm->max_channels_in)) {
5731 snd_printk(KERN_INFO "snd_hdspm_channel_info: input channel out of range (%d)\n", info->channel); 5739 dev_info(hdspm->card->dev,
5740 "snd_hdspm_channel_info: input channel out of range (%d)\n",
5741 info->channel);
5732 return -EINVAL; 5742 return -EINVAL;
5733 } 5743 }
5734 5744
5735 if (hdspm->channel_map_in[info->channel] < 0) { 5745 if (hdspm->channel_map_in[info->channel] < 0) {
5736 snd_printk(KERN_INFO "snd_hdspm_channel_info: input channel %d mapped out\n", info->channel); 5746 dev_info(hdspm->card->dev,
5747 "snd_hdspm_channel_info: input channel %d mapped out\n",
5748 info->channel);
5737 return -EINVAL; 5749 return -EINVAL;
5738 } 5750 }
5739 5751
@@ -6283,7 +6295,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6283 6295
6284 s = copy_to_user(argp, levels, sizeof(struct hdspm_peak_rms)); 6296 s = copy_to_user(argp, levels, sizeof(struct hdspm_peak_rms));
6285 if (0 != s) { 6297 if (0 != s) {
6286 /* snd_printk(KERN_ERR "copy_to_user(.., .., %lu): %lu 6298 /* dev_err(hdspm->card->dev, "copy_to_user(.., .., %lu): %lu
6287 [Levels]\n", sizeof(struct hdspm_peak_rms), s); 6299 [Levels]\n", sizeof(struct hdspm_peak_rms), s);
6288 */ 6300 */
6289 return -EFAULT; 6301 return -EFAULT;
@@ -6329,7 +6341,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6329 s = copy_to_user(argp, &ltc, sizeof(struct hdspm_ltc)); 6341 s = copy_to_user(argp, &ltc, sizeof(struct hdspm_ltc));
6330 if (0 != s) { 6342 if (0 != s) {
6331 /* 6343 /*
6332 snd_printk(KERN_ERR "copy_to_user(.., .., %lu): %lu [LTC]\n", sizeof(struct hdspm_ltc), s); */ 6344 dev_err(hdspm->card->dev, "copy_to_user(.., .., %lu): %lu [LTC]\n", sizeof(struct hdspm_ltc), s); */
6333 return -EFAULT; 6345 return -EFAULT;
6334 } 6346 }
6335 6347
@@ -6494,11 +6506,13 @@ static int snd_hdspm_preallocate_memory(struct hdspm *hdspm)
6494 wanted, 6506 wanted,
6495 wanted); 6507 wanted);
6496 if (err < 0) { 6508 if (err < 0) {
6497 snd_printdd("Could not preallocate %zd Bytes\n", wanted); 6509 dev_dbg(hdspm->card->dev,
6510 "Could not preallocate %zd Bytes\n", wanted);
6498 6511
6499 return err; 6512 return err;
6500 } else 6513 } else
6501 snd_printdd(" Preallocated %zd Bytes\n", wanted); 6514 dev_dbg(hdspm->card->dev,
6515 " Preallocated %zd Bytes\n", wanted);
6502 6516
6503 return 0; 6517 return 0;
6504} 6518}
@@ -6559,7 +6573,7 @@ static int snd_hdspm_create_alsa_devices(struct snd_card *card,
6559{ 6573{
6560 int err, i; 6574 int err, i;
6561 6575
6562 snd_printdd("Create card...\n"); 6576 dev_dbg(card->dev, "Create card...\n");
6563 err = snd_hdspm_create_pcm(card, hdspm); 6577 err = snd_hdspm_create_pcm(card, hdspm);
6564 if (err < 0) 6578 if (err < 0)
6565 return err; 6579 return err;
@@ -6581,7 +6595,7 @@ static int snd_hdspm_create_alsa_devices(struct snd_card *card,
6581 if (err < 0) 6595 if (err < 0)
6582 return err; 6596 return err;
6583 6597
6584 snd_printdd("proc init...\n"); 6598 dev_dbg(card->dev, "proc init...\n");
6585 snd_hdspm_proc_init(hdspm); 6599 snd_hdspm_proc_init(hdspm);
6586 6600
6587 hdspm->system_sample_rate = -1; 6601 hdspm->system_sample_rate = -1;
@@ -6592,23 +6606,23 @@ static int snd_hdspm_create_alsa_devices(struct snd_card *card,
6592 hdspm->capture_substream = NULL; 6606 hdspm->capture_substream = NULL;
6593 hdspm->playback_substream = NULL; 6607 hdspm->playback_substream = NULL;
6594 6608
6595 snd_printdd("Set defaults...\n"); 6609 dev_dbg(card->dev, "Set defaults...\n");
6596 err = snd_hdspm_set_defaults(hdspm); 6610 err = snd_hdspm_set_defaults(hdspm);
6597 if (err < 0) 6611 if (err < 0)
6598 return err; 6612 return err;
6599 6613
6600 snd_printdd("Update mixer controls...\n"); 6614 dev_dbg(card->dev, "Update mixer controls...\n");
6601 hdspm_update_simple_mixer_controls(hdspm); 6615 hdspm_update_simple_mixer_controls(hdspm);
6602 6616
6603 snd_printdd("Initializeing complete ???\n"); 6617 dev_dbg(card->dev, "Initializeing complete ???\n");
6604 6618
6605 err = snd_card_register(card); 6619 err = snd_card_register(card);
6606 if (err < 0) { 6620 if (err < 0) {
6607 snd_printk(KERN_ERR "HDSPM: error registering card\n"); 6621 dev_err(card->dev, "error registering card\n");
6608 return err; 6622 return err;
6609 } 6623 }
6610 6624
6611 snd_printdd("... yes now\n"); 6625 dev_dbg(card->dev, "... yes now\n");
6612 6626
6613 return 0; 6627 return 0;
6614} 6628}
@@ -6662,8 +6676,8 @@ static int snd_hdspm_create(struct snd_card *card,
6662 hdspm->card_name = "RME MADI"; 6676 hdspm->card_name = "RME MADI";
6663 hdspm->midiPorts = 3; 6677 hdspm->midiPorts = 3;
6664 } else { 6678 } else {
6665 snd_printk(KERN_ERR 6679 dev_err(card->dev,
6666 "HDSPM: unknown firmware revision %x\n", 6680 "unknown firmware revision %x\n",
6667 hdspm->firmware_rev); 6681 hdspm->firmware_rev);
6668 return -ENODEV; 6682 return -ENODEV;
6669 } 6683 }
@@ -6682,36 +6696,35 @@ static int snd_hdspm_create(struct snd_card *card,
6682 hdspm->port = pci_resource_start(pci, 0); 6696 hdspm->port = pci_resource_start(pci, 0);
6683 io_extent = pci_resource_len(pci, 0); 6697 io_extent = pci_resource_len(pci, 0);
6684 6698
6685 snd_printdd("grabbed memory region 0x%lx-0x%lx\n", 6699 dev_dbg(card->dev, "grabbed memory region 0x%lx-0x%lx\n",
6686 hdspm->port, hdspm->port + io_extent - 1); 6700 hdspm->port, hdspm->port + io_extent - 1);
6687 6701
6688 hdspm->iobase = ioremap_nocache(hdspm->port, io_extent); 6702 hdspm->iobase = ioremap_nocache(hdspm->port, io_extent);
6689 if (!hdspm->iobase) { 6703 if (!hdspm->iobase) {
6690 snd_printk(KERN_ERR "HDSPM: " 6704 dev_err(card->dev, "unable to remap region 0x%lx-0x%lx\n",
6691 "unable to remap region 0x%lx-0x%lx\n",
6692 hdspm->port, hdspm->port + io_extent - 1); 6705 hdspm->port, hdspm->port + io_extent - 1);
6693 return -EBUSY; 6706 return -EBUSY;
6694 } 6707 }
6695 snd_printdd("remapped region (0x%lx) 0x%lx-0x%lx\n", 6708 dev_dbg(card->dev, "remapped region (0x%lx) 0x%lx-0x%lx\n",
6696 (unsigned long)hdspm->iobase, hdspm->port, 6709 (unsigned long)hdspm->iobase, hdspm->port,
6697 hdspm->port + io_extent - 1); 6710 hdspm->port + io_extent - 1);
6698 6711
6699 if (request_irq(pci->irq, snd_hdspm_interrupt, 6712 if (request_irq(pci->irq, snd_hdspm_interrupt,
6700 IRQF_SHARED, KBUILD_MODNAME, hdspm)) { 6713 IRQF_SHARED, KBUILD_MODNAME, hdspm)) {
6701 snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq); 6714 dev_err(card->dev, "unable to use IRQ %d\n", pci->irq);
6702 return -EBUSY; 6715 return -EBUSY;
6703 } 6716 }
6704 6717
6705 snd_printdd("use IRQ %d\n", pci->irq); 6718 dev_dbg(card->dev, "use IRQ %d\n", pci->irq);
6706 6719
6707 hdspm->irq = pci->irq; 6720 hdspm->irq = pci->irq;
6708 6721
6709 snd_printdd("kmalloc Mixer memory of %zd Bytes\n", 6722 dev_dbg(card->dev, "kmalloc Mixer memory of %zd Bytes\n",
6710 sizeof(struct hdspm_mixer)); 6723 sizeof(struct hdspm_mixer));
6711 hdspm->mixer = kzalloc(sizeof(struct hdspm_mixer), GFP_KERNEL); 6724 hdspm->mixer = kzalloc(sizeof(struct hdspm_mixer), GFP_KERNEL);
6712 if (!hdspm->mixer) { 6725 if (!hdspm->mixer) {
6713 snd_printk(KERN_ERR "HDSPM: " 6726 dev_err(card->dev,
6714 "unable to kmalloc Mixer memory of %d Bytes\n", 6727 "unable to kmalloc Mixer memory of %d Bytes\n",
6715 (int)sizeof(struct hdspm_mixer)); 6728 (int)sizeof(struct hdspm_mixer));
6716 return -ENOMEM; 6729 return -ENOMEM;
6717 } 6730 }
@@ -6780,14 +6793,14 @@ static int snd_hdspm_create(struct snd_card *card,
6780 hdspm->qs_out_channels = AIO_OUT_QS_CHANNELS; 6793 hdspm->qs_out_channels = AIO_OUT_QS_CHANNELS;
6781 6794
6782 if (0 == (hdspm_read(hdspm, HDSPM_statusRegister2) & HDSPM_s2_AEBI_D)) { 6795 if (0 == (hdspm_read(hdspm, HDSPM_statusRegister2) & HDSPM_s2_AEBI_D)) {
6783 snd_printk(KERN_INFO "HDSPM: AEB input board found\n"); 6796 dev_info(card->dev, "AEB input board found\n");
6784 hdspm->ss_in_channels += 4; 6797 hdspm->ss_in_channels += 4;
6785 hdspm->ds_in_channels += 4; 6798 hdspm->ds_in_channels += 4;
6786 hdspm->qs_in_channels += 4; 6799 hdspm->qs_in_channels += 4;
6787 } 6800 }
6788 6801
6789 if (0 == (hdspm_read(hdspm, HDSPM_statusRegister2) & HDSPM_s2_AEBO_D)) { 6802 if (0 == (hdspm_read(hdspm, HDSPM_statusRegister2) & HDSPM_s2_AEBO_D)) {
6790 snd_printk(KERN_INFO "HDSPM: AEB output board found\n"); 6803 dev_info(card->dev, "AEB output board found\n");
6791 hdspm->ss_out_channels += 4; 6804 hdspm->ss_out_channels += 4;
6792 hdspm->ds_out_channels += 4; 6805 hdspm->ds_out_channels += 4;
6793 hdspm->qs_out_channels += 4; 6806 hdspm->qs_out_channels += 4;
@@ -6854,7 +6867,7 @@ static int snd_hdspm_create(struct snd_card *card,
6854 if (NULL != hdspm->tco) { 6867 if (NULL != hdspm->tco) {
6855 hdspm_tco_write(hdspm); 6868 hdspm_tco_write(hdspm);
6856 } 6869 }
6857 snd_printk(KERN_INFO "HDSPM: AIO/RayDAT TCO module found\n"); 6870 dev_info(card->dev, "AIO/RayDAT TCO module found\n");
6858 } else { 6871 } else {
6859 hdspm->tco = NULL; 6872 hdspm->tco = NULL;
6860 } 6873 }
@@ -6869,7 +6882,7 @@ static int snd_hdspm_create(struct snd_card *card,
6869 if (NULL != hdspm->tco) { 6882 if (NULL != hdspm->tco) {
6870 hdspm_tco_write(hdspm); 6883 hdspm_tco_write(hdspm);
6871 } 6884 }
6872 snd_printk(KERN_INFO "HDSPM: MADI/AES TCO module found\n"); 6885 dev_info(card->dev, "MADI/AES TCO module found\n");
6873 } else { 6886 } else {
6874 hdspm->tco = NULL; 6887 hdspm->tco = NULL;
6875 } 6888 }
@@ -6951,7 +6964,7 @@ static int snd_hdspm_create(struct snd_card *card,
6951 } 6964 }
6952 } 6965 }
6953 6966
6954 snd_printdd("create alsa devices.\n"); 6967 dev_dbg(card->dev, "create alsa devices.\n");
6955 err = snd_hdspm_create_alsa_devices(card, hdspm); 6968 err = snd_hdspm_create_alsa_devices(card, hdspm);
6956 if (err < 0) 6969 if (err < 0)
6957 return err; 6970 return err;
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index a62d6e13d8ce..1d9be90f7748 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -394,7 +394,9 @@ static snd_pcm_uframes_t rme9652_hw_pointer(struct snd_rme9652 *rme9652)
394 if (offset < period_size) { 394 if (offset < period_size) {
395 if (offset > rme9652->max_jitter) { 395 if (offset > rme9652->max_jitter) {
396 if (frag) 396 if (frag)
397 printk(KERN_ERR "Unexpected hw_pointer position (bufid == 0): status: %x offset: %d\n", status, offset); 397 dev_err(rme9652->card->dev,
398 "Unexpected hw_pointer position (bufid == 0): status: %x offset: %d\n",
399 status, offset);
398 } else if (!frag) 400 } else if (!frag)
399 return 0; 401 return 0;
400 offset -= rme9652->max_jitter; 402 offset -= rme9652->max_jitter;
@@ -403,7 +405,9 @@ static snd_pcm_uframes_t rme9652_hw_pointer(struct snd_rme9652 *rme9652)
403 } else { 405 } else {
404 if (offset > period_size + rme9652->max_jitter) { 406 if (offset > period_size + rme9652->max_jitter) {
405 if (!frag) 407 if (!frag)
406 printk(KERN_ERR "Unexpected hw_pointer position (bufid == 1): status: %x offset: %d\n", status, offset); 408 dev_err(rme9652->card->dev,
409 "Unexpected hw_pointer position (bufid == 1): status: %x offset: %d\n",
410 status, offset);
407 } else if (frag) 411 } else if (frag)
408 return period_size; 412 return period_size;
409 offset -= rme9652->max_jitter; 413 offset -= rme9652->max_jitter;
@@ -769,7 +773,8 @@ static inline int rme9652_spdif_sample_rate(struct snd_rme9652 *s)
769 break; 773 break;
770 774
771 default: 775 default:
772 snd_printk(KERN_ERR "%s: unknown S/PDIF input rate (bits = 0x%x)\n", 776 dev_err(s->card->dev,
777 "%s: unknown S/PDIF input rate (bits = 0x%x)\n",
773 s->card_name, rate_bits); 778 s->card_name, rate_bits);
774 return 0; 779 return 0;
775 break; 780 break;
@@ -1790,7 +1795,8 @@ static int snd_rme9652_initialize_memory(struct snd_rme9652 *rme9652)
1790 snd_hammerfall_get_buffer(rme9652->pci, &rme9652->playback_dma_buf, RME9652_DMA_AREA_BYTES) < 0) { 1795 snd_hammerfall_get_buffer(rme9652->pci, &rme9652->playback_dma_buf, RME9652_DMA_AREA_BYTES) < 0) {
1791 if (rme9652->capture_dma_buf.area) 1796 if (rme9652->capture_dma_buf.area)
1792 snd_dma_free_pages(&rme9652->capture_dma_buf); 1797 snd_dma_free_pages(&rme9652->capture_dma_buf);
1793 printk(KERN_ERR "%s: no buffers available\n", rme9652->card_name); 1798 dev_err(rme9652->card->dev,
1799 "%s: no buffers available\n", rme9652->card_name);
1794 return -ENOMEM; 1800 return -ENOMEM;
1795 } 1801 }
1796 1802
@@ -2468,13 +2474,14 @@ static int snd_rme9652_create(struct snd_card *card,
2468 rme9652->port = pci_resource_start(pci, 0); 2474 rme9652->port = pci_resource_start(pci, 0);
2469 rme9652->iobase = ioremap_nocache(rme9652->port, RME9652_IO_EXTENT); 2475 rme9652->iobase = ioremap_nocache(rme9652->port, RME9652_IO_EXTENT);
2470 if (rme9652->iobase == NULL) { 2476 if (rme9652->iobase == NULL) {
2471 snd_printk(KERN_ERR "unable to remap region 0x%lx-0x%lx\n", rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1); 2477 dev_err(card->dev, "unable to remap region 0x%lx-0x%lx\n",
2478 rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1);
2472 return -EBUSY; 2479 return -EBUSY;
2473 } 2480 }
2474 2481
2475 if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_SHARED, 2482 if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_SHARED,
2476 KBUILD_MODNAME, rme9652)) { 2483 KBUILD_MODNAME, rme9652)) {
2477 snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq); 2484 dev_err(card->dev, "unable to request IRQ %d\n", pci->irq);
2478 return -EBUSY; 2485 return -EBUSY;
2479 } 2486 }
2480 rme9652->irq = pci->irq; 2487 rme9652->irq = pci->irq;
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 9ff408fff7b0..2044dc742071 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -273,7 +273,7 @@ static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic,
273 outl(count, sonic->dmaa_port + SV_DMA_COUNT0); 273 outl(count, sonic->dmaa_port + SV_DMA_COUNT0);
274 outb(0x18, sonic->dmaa_port + SV_DMA_MODE); 274 outb(0x18, sonic->dmaa_port + SV_DMA_MODE);
275#if 0 275#if 0
276 printk(KERN_DEBUG "program dmaa: addr = 0x%x, paddr = 0x%x\n", 276 dev_dbg(sonic->card->dev, "program dmaa: addr = 0x%x, paddr = 0x%x\n",
277 addr, inl(sonic->dmaa_port + SV_DMA_ADDR0)); 277 addr, inl(sonic->dmaa_port + SV_DMA_ADDR0));
278#endif 278#endif
279} 279}
@@ -289,7 +289,7 @@ static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic,
289 outl(count, sonic->dmac_port + SV_DMA_COUNT0); 289 outl(count, sonic->dmac_port + SV_DMA_COUNT0);
290 outb(0x14, sonic->dmac_port + SV_DMA_MODE); 290 outb(0x14, sonic->dmac_port + SV_DMA_MODE);
291#if 0 291#if 0
292 printk(KERN_DEBUG "program dmac: addr = 0x%x, paddr = 0x%x\n", 292 dev_dbg(sonic->card->dev, "program dmac: addr = 0x%x, paddr = 0x%x\n",
293 addr, inl(sonic->dmac_port + SV_DMA_ADDR0)); 293 addr, inl(sonic->dmac_port + SV_DMA_ADDR0));
294#endif 294#endif
295} 295}
@@ -357,105 +357,105 @@ static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char
357#if 0 357#if 0
358static void snd_sonicvibes_debug(struct sonicvibes * sonic) 358static void snd_sonicvibes_debug(struct sonicvibes * sonic)
359{ 359{
360 printk(KERN_DEBUG 360 dev_dbg(sonic->card->dev,
361 "SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX))); 361 "SV REGS: INDEX = 0x%02x STATUS = 0x%02x\n",
362 printk(" STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS))); 362 inb(SV_REG(sonic, INDEX)), inb(SV_REG(sonic, STATUS)));
363 printk(KERN_DEBUG 363 dev_dbg(sonic->card->dev,
364 " 0x00: left input = 0x%02x ", snd_sonicvibes_in(sonic, 0x00)); 364 " 0x00: left input = 0x%02x 0x20: synth rate low = 0x%02x\n",
365 printk(" 0x20: synth rate low = 0x%02x\n", snd_sonicvibes_in(sonic, 0x20)); 365 snd_sonicvibes_in(sonic, 0x00), snd_sonicvibes_in(sonic, 0x20));
366 printk(KERN_DEBUG 366 dev_dbg(sonic->card->dev,
367 " 0x01: right input = 0x%02x ", snd_sonicvibes_in(sonic, 0x01)); 367 " 0x01: right input = 0x%02x 0x21: synth rate high = 0x%02x\n",
368 printk(" 0x21: synth rate high = 0x%02x\n", snd_sonicvibes_in(sonic, 0x21)); 368 snd_sonicvibes_in(sonic, 0x01), snd_sonicvibes_in(sonic, 0x21));
369 printk(KERN_DEBUG 369 dev_dbg(sonic->card->dev,
370 " 0x02: left AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x02)); 370 " 0x02: left AUX1 = 0x%02x 0x22: ADC clock = 0x%02x\n",
371 printk(" 0x22: ADC clock = 0x%02x\n", snd_sonicvibes_in(sonic, 0x22)); 371 snd_sonicvibes_in(sonic, 0x02), snd_sonicvibes_in(sonic, 0x22));
372 printk(KERN_DEBUG 372 dev_dbg(sonic->card->dev,
373 " 0x03: right AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x03)); 373 " 0x03: right AUX1 = 0x%02x 0x23: ADC alt rate = 0x%02x\n",
374 printk(" 0x23: ADC alt rate = 0x%02x\n", snd_sonicvibes_in(sonic, 0x23)); 374 snd_sonicvibes_in(sonic, 0x03), snd_sonicvibes_in(sonic, 0x23));
375 printk(KERN_DEBUG 375 dev_dbg(sonic->card->dev,
376 " 0x04: left CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x04)); 376 " 0x04: left CD = 0x%02x 0x24: ADC pll M = 0x%02x\n",
377 printk(" 0x24: ADC pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x24)); 377 snd_sonicvibes_in(sonic, 0x04), snd_sonicvibes_in(sonic, 0x24));
378 printk(KERN_DEBUG 378 dev_dbg(sonic->card->dev,
379 " 0x05: right CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x05)); 379 " 0x05: right CD = 0x%02x 0x25: ADC pll N = 0x%02x\n",
380 printk(" 0x25: ADC pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x25)); 380 snd_sonicvibes_in(sonic, 0x05), snd_sonicvibes_in(sonic, 0x25));
381 printk(KERN_DEBUG 381 dev_dbg(sonic->card->dev,
382 " 0x06: left line = 0x%02x ", snd_sonicvibes_in(sonic, 0x06)); 382 " 0x06: left line = 0x%02x 0x26: Synth pll M = 0x%02x\n",
383 printk(" 0x26: Synth pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x26)); 383 snd_sonicvibes_in(sonic, 0x06), snd_sonicvibes_in(sonic, 0x26));
384 printk(KERN_DEBUG 384 dev_dbg(sonic->card->dev,
385 " 0x07: right line = 0x%02x ", snd_sonicvibes_in(sonic, 0x07)); 385 " 0x07: right line = 0x%02x 0x27: Synth pll N = 0x%02x\n",
386 printk(" 0x27: Synth pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x27)); 386 snd_sonicvibes_in(sonic, 0x07), snd_sonicvibes_in(sonic, 0x27));
387 printk(KERN_DEBUG 387 dev_dbg(sonic->card->dev,
388 " 0x08: MIC = 0x%02x ", snd_sonicvibes_in(sonic, 0x08)); 388 " 0x08: MIC = 0x%02x 0x28: --- = 0x%02x\n",
389 printk(" 0x28: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x28)); 389 snd_sonicvibes_in(sonic, 0x08), snd_sonicvibes_in(sonic, 0x28));
390 printk(KERN_DEBUG 390 dev_dbg(sonic->card->dev,
391 " 0x09: Game port = 0x%02x ", snd_sonicvibes_in(sonic, 0x09)); 391 " 0x09: Game port = 0x%02x 0x29: --- = 0x%02x\n",
392 printk(" 0x29: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x29)); 392 snd_sonicvibes_in(sonic, 0x09), snd_sonicvibes_in(sonic, 0x29));
393 printk(KERN_DEBUG 393 dev_dbg(sonic->card->dev,
394 " 0x0a: left synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0a)); 394 " 0x0a: left synth = 0x%02x 0x2a: MPU401 = 0x%02x\n",
395 printk(" 0x2a: MPU401 = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2a)); 395 snd_sonicvibes_in(sonic, 0x0a), snd_sonicvibes_in(sonic, 0x2a));
396 printk(KERN_DEBUG 396 dev_dbg(sonic->card->dev,
397 " 0x0b: right synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0b)); 397 " 0x0b: right synth = 0x%02x 0x2b: drive ctrl = 0x%02x\n",
398 printk(" 0x2b: drive ctrl = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2b)); 398 snd_sonicvibes_in(sonic, 0x0b), snd_sonicvibes_in(sonic, 0x2b));
399 printk(KERN_DEBUG 399 dev_dbg(sonic->card->dev,
400 " 0x0c: left AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0c)); 400 " 0x0c: left AUX2 = 0x%02x 0x2c: SRS space = 0x%02x\n",
401 printk(" 0x2c: SRS space = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2c)); 401 snd_sonicvibes_in(sonic, 0x0c), snd_sonicvibes_in(sonic, 0x2c));
402 printk(KERN_DEBUG 402 dev_dbg(sonic->card->dev,
403 " 0x0d: right AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0d)); 403 " 0x0d: right AUX2 = 0x%02x 0x2d: SRS center = 0x%02x\n",
404 printk(" 0x2d: SRS center = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2d)); 404 snd_sonicvibes_in(sonic, 0x0d), snd_sonicvibes_in(sonic, 0x2d));
405 printk(KERN_DEBUG 405 dev_dbg(sonic->card->dev,
406 " 0x0e: left analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0e)); 406 " 0x0e: left analog = 0x%02x 0x2e: wave source = 0x%02x\n",
407 printk(" 0x2e: wave source = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2e)); 407 snd_sonicvibes_in(sonic, 0x0e), snd_sonicvibes_in(sonic, 0x2e));
408 printk(KERN_DEBUG 408 dev_dbg(sonic->card->dev,
409 " 0x0f: right analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0f)); 409 " 0x0f: right analog = 0x%02x 0x2f: --- = 0x%02x\n",
410 printk(" 0x2f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2f)); 410 snd_sonicvibes_in(sonic, 0x0f), snd_sonicvibes_in(sonic, 0x2f));
411 printk(KERN_DEBUG 411 dev_dbg(sonic->card->dev,
412 " 0x10: left PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x10)); 412 " 0x10: left PCM = 0x%02x 0x30: analog power = 0x%02x\n",
413 printk(" 0x30: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x30)); 413 snd_sonicvibes_in(sonic, 0x10), snd_sonicvibes_in(sonic, 0x30));
414 printk(KERN_DEBUG 414 dev_dbg(sonic->card->dev,
415 " 0x11: right PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x11)); 415 " 0x11: right PCM = 0x%02x 0x31: analog power = 0x%02x\n",
416 printk(" 0x31: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x31)); 416 snd_sonicvibes_in(sonic, 0x11), snd_sonicvibes_in(sonic, 0x31));
417 printk(KERN_DEBUG 417 dev_dbg(sonic->card->dev,
418 " 0x12: DMA data format = 0x%02x ", snd_sonicvibes_in(sonic, 0x12)); 418 " 0x12: DMA data format = 0x%02x 0x32: --- = 0x%02x\n",
419 printk(" 0x32: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x32)); 419 snd_sonicvibes_in(sonic, 0x12), snd_sonicvibes_in(sonic, 0x32));
420 printk(KERN_DEBUG 420 dev_dbg(sonic->card->dev,
421 " 0x13: P/C enable = 0x%02x ", snd_sonicvibes_in(sonic, 0x13)); 421 " 0x13: P/C enable = 0x%02x 0x33: --- = 0x%02x\n",
422 printk(" 0x33: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x33)); 422 snd_sonicvibes_in(sonic, 0x13), snd_sonicvibes_in(sonic, 0x33));
423 printk(KERN_DEBUG 423 dev_dbg(sonic->card->dev,
424 " 0x14: U/D button = 0x%02x ", snd_sonicvibes_in(sonic, 0x14)); 424 " 0x14: U/D button = 0x%02x 0x34: --- = 0x%02x\n",
425 printk(" 0x34: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x34)); 425 snd_sonicvibes_in(sonic, 0x14), snd_sonicvibes_in(sonic, 0x34));
426 printk(KERN_DEBUG 426 dev_dbg(sonic->card->dev,
427 " 0x15: revision = 0x%02x ", snd_sonicvibes_in(sonic, 0x15)); 427 " 0x15: revision = 0x%02x 0x35: --- = 0x%02x\n",
428 printk(" 0x35: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x35)); 428 snd_sonicvibes_in(sonic, 0x15), snd_sonicvibes_in(sonic, 0x35));
429 printk(KERN_DEBUG 429 dev_dbg(sonic->card->dev,
430 " 0x16: ADC output ctrl = 0x%02x ", snd_sonicvibes_in(sonic, 0x16)); 430 " 0x16: ADC output ctrl = 0x%02x 0x36: --- = 0x%02x\n",
431 printk(" 0x36: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x36)); 431 snd_sonicvibes_in(sonic, 0x16), snd_sonicvibes_in(sonic, 0x36));
432 printk(KERN_DEBUG 432 dev_dbg(sonic->card->dev,
433 " 0x17: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x17)); 433 " 0x17: --- = 0x%02x 0x37: --- = 0x%02x\n",
434 printk(" 0x37: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x37)); 434 snd_sonicvibes_in(sonic, 0x17), snd_sonicvibes_in(sonic, 0x37));
435 printk(KERN_DEBUG 435 dev_dbg(sonic->card->dev,
436 " 0x18: DMA A upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x18)); 436 " 0x18: DMA A upper cnt = 0x%02x 0x38: --- = 0x%02x\n",
437 printk(" 0x38: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x38)); 437 snd_sonicvibes_in(sonic, 0x18), snd_sonicvibes_in(sonic, 0x38));
438 printk(KERN_DEBUG 438 dev_dbg(sonic->card->dev,
439 " 0x19: DMA A lower cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x19)); 439 " 0x19: DMA A lower cnt = 0x%02x 0x39: --- = 0x%02x\n",
440 printk(" 0x39: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x39)); 440 snd_sonicvibes_in(sonic, 0x19), snd_sonicvibes_in(sonic, 0x39));
441 printk(KERN_DEBUG 441 dev_dbg(sonic->card->dev,
442 " 0x1a: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1a)); 442 " 0x1a: --- = 0x%02x 0x3a: --- = 0x%02x\n",
443 printk(" 0x3a: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3a)); 443 snd_sonicvibes_in(sonic, 0x1a), snd_sonicvibes_in(sonic, 0x3a));
444 printk(KERN_DEBUG 444 dev_dbg(sonic->card->dev,
445 " 0x1b: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1b)); 445 " 0x1b: --- = 0x%02x 0x3b: --- = 0x%02x\n",
446 printk(" 0x3b: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3b)); 446 snd_sonicvibes_in(sonic, 0x1b), snd_sonicvibes_in(sonic, 0x3b));
447 printk(KERN_DEBUG 447 dev_dbg(sonic->card->dev,
448 " 0x1c: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1c)); 448 " 0x1c: DMA C upper cnt = 0x%02x 0x3c: --- = 0x%02x\n",
449 printk(" 0x3c: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3c)); 449 snd_sonicvibes_in(sonic, 0x1c), snd_sonicvibes_in(sonic, 0x3c));
450 printk(KERN_DEBUG 450 dev_dbg(sonic->card->dev,
451 " 0x1d: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1d)); 451 " 0x1d: DMA C upper cnt = 0x%02x 0x3d: --- = 0x%02x\n",
452 printk(" 0x3d: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3d)); 452 snd_sonicvibes_in(sonic, 0x1d), snd_sonicvibes_in(sonic, 0x3d));
453 printk(KERN_DEBUG 453 dev_dbg(sonic->card->dev,
454 " 0x1e: PCM rate low = 0x%02x ", snd_sonicvibes_in(sonic, 0x1e)); 454 " 0x1e: PCM rate low = 0x%02x 0x3e: --- = 0x%02x\n",
455 printk(" 0x3e: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3e)); 455 snd_sonicvibes_in(sonic, 0x1e), snd_sonicvibes_in(sonic, 0x3e));
456 printk(KERN_DEBUG 456 dev_dbg(sonic->card->dev,
457 " 0x1f: PCM rate high = 0x%02x ", snd_sonicvibes_in(sonic, 0x1f)); 457 " 0x1f: PCM rate high = 0x%02x 0x3f: --- = 0x%02x\n",
458 printk(" 0x3f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3f)); 458 snd_sonicvibes_in(sonic, 0x1f), snd_sonicvibes_in(sonic, 0x3f));
459} 459}
460 460
461#endif 461#endif
@@ -511,8 +511,10 @@ static void snd_sonicvibes_pll(unsigned int rate,
511 *res_m = m; 511 *res_m = m;
512 *res_n = n; 512 *res_n = n;
513#if 0 513#if 0
514 printk(KERN_DEBUG "metric = %i, xm = %i, xn = %i\n", metric, xm, xn); 514 dev_dbg(sonic->card->dev,
515 printk(KERN_DEBUG "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n); 515 "metric = %i, xm = %i, xn = %i\n", metric, xm, xn);
516 dev_dbg(sonic->card->dev,
517 "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n);
516#endif 518#endif
517} 519}
518 520
@@ -624,7 +626,8 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id)
624 return IRQ_NONE; 626 return IRQ_NONE;
625 if (status == 0xff) { /* failure */ 627 if (status == 0xff) { /* failure */
626 outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK)); 628 outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK));
627 snd_printk(KERN_ERR "IRQ failure - interrupts disabled!!\n"); 629 dev_err(sonic->card->dev,
630 "IRQ failure - interrupts disabled!!\n");
628 return IRQ_HANDLED; 631 return IRQ_HANDLED;
629 } 632 }
630 if (sonic->pcm) { 633 if (sonic->pcm) {
@@ -1198,7 +1201,8 @@ static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
1198 1201
1199 sonic->gameport = gp = gameport_allocate_port(); 1202 sonic->gameport = gp = gameport_allocate_port();
1200 if (!gp) { 1203 if (!gp) {
1201 printk(KERN_ERR "sonicvibes: cannot allocate memory for gameport\n"); 1204 dev_err(sonic->card->dev,
1205 "sonicvibes: cannot allocate memory for gameport\n");
1202 return -ENOMEM; 1206 return -ENOMEM;
1203 } 1207 }
1204 1208
@@ -1267,7 +1271,8 @@ static int snd_sonicvibes_create(struct snd_card *card,
1267 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1271 /* check, if we can restrict PCI DMA transfers to 24 bits */
1268 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1272 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
1269 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1273 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
1270 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1274 dev_err(card->dev,
1275 "architecture does not support 24bit PCI busmaster DMA\n");
1271 pci_disable_device(pci); 1276 pci_disable_device(pci);
1272 return -ENXIO; 1277 return -ENXIO;
1273 } 1278 }
@@ -1296,7 +1301,7 @@ static int snd_sonicvibes_create(struct snd_card *card,
1296 1301
1297 if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED, 1302 if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED,
1298 KBUILD_MODNAME, sonic)) { 1303 KBUILD_MODNAME, sonic)) {
1299 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1304 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1300 snd_sonicvibes_free(sonic); 1305 snd_sonicvibes_free(sonic);
1301 return -EBUSY; 1306 return -EBUSY;
1302 } 1307 }
@@ -1310,24 +1315,32 @@ static int snd_sonicvibes_create(struct snd_card *card,
1310 if (!dmaa) { 1315 if (!dmaa) {
1311 dmaa = dmaio; 1316 dmaa = dmaio;
1312 dmaio += 0x10; 1317 dmaio += 0x10;
1313 snd_printk(KERN_INFO "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa); 1318 dev_info(card->dev,
1319 "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n",
1320 dmaa);
1314 } 1321 }
1315 if (!dmac) { 1322 if (!dmac) {
1316 dmac = dmaio; 1323 dmac = dmaio;
1317 dmaio += 0x10; 1324 dmaio += 0x10;
1318 snd_printk(KERN_INFO "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac); 1325 dev_info(card->dev,
1326 "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n",
1327 dmac);
1319 } 1328 }
1320 pci_write_config_dword(pci, 0x40, dmaa); 1329 pci_write_config_dword(pci, 0x40, dmaa);
1321 pci_write_config_dword(pci, 0x48, dmac); 1330 pci_write_config_dword(pci, 0x48, dmac);
1322 1331
1323 if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) { 1332 if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) {
1324 snd_sonicvibes_free(sonic); 1333 snd_sonicvibes_free(sonic);
1325 snd_printk(KERN_ERR "unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1); 1334 dev_err(card->dev,
1335 "unable to grab DDMA-A port at 0x%x-0x%x\n",
1336 dmaa, dmaa + 0x10 - 1);
1326 return -EBUSY; 1337 return -EBUSY;
1327 } 1338 }
1328 if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) { 1339 if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) {
1329 snd_sonicvibes_free(sonic); 1340 snd_sonicvibes_free(sonic);
1330 snd_printk(KERN_ERR "unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1); 1341 dev_err(card->dev,
1342 "unable to grab DDMA-C port at 0x%x-0x%x\n",
1343 dmac, dmac + 0x10 - 1);
1331 return -EBUSY; 1344 return -EBUSY;
1332 } 1345 }
1333 1346
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 4f3c4be30a48..1272c18a2544 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -69,40 +69,40 @@ static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice)
69{ 69{
70 unsigned int val, tmp; 70 unsigned int val, tmp;
71 71
72 printk(KERN_DEBUG "Trident voice %i:\n", voice); 72 dev_dbg(trident->card->dev, "Trident voice %i:\n", voice);
73 outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR)); 73 outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR));
74 val = inl(TRID_REG(trident, CH_LBA)); 74 val = inl(TRID_REG(trident, CH_LBA));
75 printk(KERN_DEBUG "LBA: 0x%x\n", val); 75 dev_dbg(trident->card->dev, "LBA: 0x%x\n", val);
76 val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); 76 val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
77 printk(KERN_DEBUG "GVSel: %i\n", val >> 31); 77 dev_dbg(trident->card->dev, "GVSel: %i\n", val >> 31);
78 printk(KERN_DEBUG "Pan: 0x%x\n", (val >> 24) & 0x7f); 78 dev_dbg(trident->card->dev, "Pan: 0x%x\n", (val >> 24) & 0x7f);
79 printk(KERN_DEBUG "Vol: 0x%x\n", (val >> 16) & 0xff); 79 dev_dbg(trident->card->dev, "Vol: 0x%x\n", (val >> 16) & 0xff);
80 printk(KERN_DEBUG "CTRL: 0x%x\n", (val >> 12) & 0x0f); 80 dev_dbg(trident->card->dev, "CTRL: 0x%x\n", (val >> 12) & 0x0f);
81 printk(KERN_DEBUG "EC: 0x%x\n", val & 0x0fff); 81 dev_dbg(trident->card->dev, "EC: 0x%x\n", val & 0x0fff);
82 if (trident->device != TRIDENT_DEVICE_ID_NX) { 82 if (trident->device != TRIDENT_DEVICE_ID_NX) {
83 val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS)); 83 val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS));
84 printk(KERN_DEBUG "CSO: 0x%x\n", val >> 16); 84 dev_dbg(trident->card->dev, "CSO: 0x%x\n", val >> 16);
85 printk("Alpha: 0x%x\n", (val >> 4) & 0x0fff); 85 dev_dbg(trident->card->dev, "Alpha: 0x%x\n", (val >> 4) & 0x0fff);
86 printk(KERN_DEBUG "FMS: 0x%x\n", val & 0x0f); 86 dev_dbg(trident->card->dev, "FMS: 0x%x\n", val & 0x0f);
87 val = inl(TRID_REG(trident, CH_DX_ESO_DELTA)); 87 val = inl(TRID_REG(trident, CH_DX_ESO_DELTA));
88 printk(KERN_DEBUG "ESO: 0x%x\n", val >> 16); 88 dev_dbg(trident->card->dev, "ESO: 0x%x\n", val >> 16);
89 printk(KERN_DEBUG "Delta: 0x%x\n", val & 0xffff); 89 dev_dbg(trident->card->dev, "Delta: 0x%x\n", val & 0xffff);
90 val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); 90 val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL));
91 } else { // TRIDENT_DEVICE_ID_NX 91 } else { // TRIDENT_DEVICE_ID_NX
92 val = inl(TRID_REG(trident, CH_NX_DELTA_CSO)); 92 val = inl(TRID_REG(trident, CH_NX_DELTA_CSO));
93 tmp = (val >> 24) & 0xff; 93 tmp = (val >> 24) & 0xff;
94 printk(KERN_DEBUG "CSO: 0x%x\n", val & 0x00ffffff); 94 dev_dbg(trident->card->dev, "CSO: 0x%x\n", val & 0x00ffffff);
95 val = inl(TRID_REG(trident, CH_NX_DELTA_ESO)); 95 val = inl(TRID_REG(trident, CH_NX_DELTA_ESO));
96 tmp |= (val >> 16) & 0xff00; 96 tmp |= (val >> 16) & 0xff00;
97 printk(KERN_DEBUG "Delta: 0x%x\n", tmp); 97 dev_dbg(trident->card->dev, "Delta: 0x%x\n", tmp);
98 printk(KERN_DEBUG "ESO: 0x%x\n", val & 0x00ffffff); 98 dev_dbg(trident->card->dev, "ESO: 0x%x\n", val & 0x00ffffff);
99 val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL)); 99 val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL));
100 printk(KERN_DEBUG "Alpha: 0x%x\n", val >> 20); 100 dev_dbg(trident->card->dev, "Alpha: 0x%x\n", val >> 20);
101 printk(KERN_DEBUG "FMS: 0x%x\n", (val >> 16) & 0x0f); 101 dev_dbg(trident->card->dev, "FMS: 0x%x\n", (val >> 16) & 0x0f);
102 } 102 }
103 printk(KERN_DEBUG "FMC: 0x%x\n", (val >> 14) & 3); 103 dev_dbg(trident->card->dev, "FMC: 0x%x\n", (val >> 14) & 3);
104 printk(KERN_DEBUG "RVol: 0x%x\n", (val >> 7) & 0x7f); 104 dev_dbg(trident->card->dev, "RVol: 0x%x\n", (val >> 7) & 0x7f);
105 printk(KERN_DEBUG "CVol: 0x%x\n", val & 0x7f); 105 dev_dbg(trident->card->dev, "CVol: 0x%x\n", val & 0x7f);
106} 106}
107#endif 107#endif
108 108
@@ -156,7 +156,8 @@ static unsigned short snd_trident_codec_read(struct snd_ac97 *ac97, unsigned sho
156 } 156 }
157 157
158 if (count == 0 && !trident->ac97_detect) { 158 if (count == 0 && !trident->ac97_detect) {
159 snd_printk(KERN_ERR "ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n", 159 dev_err(trident->card->dev,
160 "ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n",
160 reg, data); 161 reg, data);
161 data = 0; 162 data = 0;
162 } 163 }
@@ -497,16 +498,16 @@ void snd_trident_write_voice_regs(struct snd_trident * trident,
497 outl(regs[4], TRID_REG(trident, CH_START + 16)); 498 outl(regs[4], TRID_REG(trident, CH_START + 16));
498 499
499#if 0 500#if 0
500 printk(KERN_DEBUG "written %i channel:\n", voice->number); 501 dev_dbg(trident->card->dev, "written %i channel:\n", voice->number);
501 printk(KERN_DEBUG " regs[0] = 0x%x/0x%x\n", 502 dev_dbg(trident->card->dev, " regs[0] = 0x%x/0x%x\n",
502 regs[0], inl(TRID_REG(trident, CH_START + 0))); 503 regs[0], inl(TRID_REG(trident, CH_START + 0)));
503 printk(KERN_DEBUG " regs[1] = 0x%x/0x%x\n", 504 dev_dbg(trident->card->dev, " regs[1] = 0x%x/0x%x\n",
504 regs[1], inl(TRID_REG(trident, CH_START + 4))); 505 regs[1], inl(TRID_REG(trident, CH_START + 4)));
505 printk(KERN_DEBUG " regs[2] = 0x%x/0x%x\n", 506 dev_dbg(trident->card->dev, " regs[2] = 0x%x/0x%x\n",
506 regs[2], inl(TRID_REG(trident, CH_START + 8))); 507 regs[2], inl(TRID_REG(trident, CH_START + 8)));
507 printk(KERN_DEBUG " regs[3] = 0x%x/0x%x\n", 508 dev_dbg(trident->card->dev, " regs[3] = 0x%x/0x%x\n",
508 regs[3], inl(TRID_REG(trident, CH_START + 12))); 509 regs[3], inl(TRID_REG(trident, CH_START + 12)));
509 printk(KERN_DEBUG " regs[4] = 0x%x/0x%x\n", 510 dev_dbg(trident->card->dev, " regs[4] = 0x%x/0x%x\n",
510 regs[4], inl(TRID_REG(trident, CH_START + 16))); 511 regs[4], inl(TRID_REG(trident, CH_START + 16)));
511#endif 512#endif
512} 513}
@@ -589,7 +590,7 @@ static void snd_trident_write_vol_reg(struct snd_trident * trident,
589 outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2)); 590 outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2));
590 break; 591 break;
591 case TRIDENT_DEVICE_ID_SI7018: 592 case TRIDENT_DEVICE_ID_SI7018:
592 /* printk(KERN_DEBUG "voice->Vol = 0x%x\n", voice->Vol); */ 593 /* dev_dbg(trident->card->dev, "voice->Vol = 0x%x\n", voice->Vol); */
593 outw((voice->CTRL << 12) | voice->Vol, 594 outw((voice->CTRL << 12) | voice->Vol,
594 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); 595 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
595 break; 596 break;
@@ -3013,13 +3014,15 @@ static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device)
3013 _ac97.num = 1; 3014 _ac97.num = 1;
3014 err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec); 3015 err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec);
3015 if (err < 0) 3016 if (err < 0)
3016 snd_printk(KERN_ERR "SI7018: the secondary codec - invalid access\n"); 3017 dev_err(trident->card->dev,
3018 "SI7018: the secondary codec - invalid access\n");
3017#if 0 // only for my testing purpose --jk 3019#if 0 // only for my testing purpose --jk
3018 { 3020 {
3019 struct snd_ac97 *mc97; 3021 struct snd_ac97 *mc97;
3020 err = snd_ac97_modem(trident->card, &_ac97, &mc97); 3022 err = snd_ac97_modem(trident->card, &_ac97, &mc97);
3021 if (err < 0) 3023 if (err < 0)
3022 snd_printk(KERN_ERR "snd_ac97_modem returned error %i\n", err); 3024 dev_err(trident->card->dev,
3025 "snd_ac97_modem returned error %i\n", err);
3023 } 3026 }
3024#endif 3027#endif
3025 } 3028 }
@@ -3197,7 +3200,8 @@ int snd_trident_create_gameport(struct snd_trident *chip)
3197 3200
3198 chip->gameport = gp = gameport_allocate_port(); 3201 chip->gameport = gp = gameport_allocate_port();
3199 if (!gp) { 3202 if (!gp) {
3200 printk(KERN_ERR "trident: cannot allocate memory for gameport\n"); 3203 dev_err(chip->card->dev,
3204 "cannot allocate memory for gameport\n");
3201 return -ENOMEM; 3205 return -ENOMEM;
3202 } 3206 }
3203 3207
@@ -3270,7 +3274,8 @@ static int snd_trident_sis_reset(struct snd_trident *trident)
3270 goto __si7018_ok; 3274 goto __si7018_ok;
3271 do_delay(trident); 3275 do_delay(trident);
3272 } while (time_after_eq(end_time, jiffies)); 3276 } while (time_after_eq(end_time, jiffies));
3273 snd_printk(KERN_ERR "AC'97 codec ready error [0x%x]\n", inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL))); 3277 dev_err(trident->card->dev, "AC'97 codec ready error [0x%x]\n",
3278 inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)));
3274 if (r-- > 0) { 3279 if (r-- > 0) {
3275 end_time = jiffies + HZ; 3280 end_time = jiffies + HZ;
3276 do { 3281 do {
@@ -3367,7 +3372,7 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident)
3367 3372
3368 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), 3373 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci),
3369 2 * SNDRV_TRIDENT_MAX_PAGES * 4, &trident->tlb.buffer) < 0) { 3374 2 * SNDRV_TRIDENT_MAX_PAGES * 4, &trident->tlb.buffer) < 0) {
3370 snd_printk(KERN_ERR "trident: unable to allocate TLB buffer\n"); 3375 dev_err(trident->card->dev, "unable to allocate TLB buffer\n");
3371 return -ENOMEM; 3376 return -ENOMEM;
3372 } 3377 }
3373 trident->tlb.entries = (unsigned int*)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4); 3378 trident->tlb.entries = (unsigned int*)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4);
@@ -3375,13 +3380,14 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident)
3375 /* allocate shadow TLB page table (virtual addresses) */ 3380 /* allocate shadow TLB page table (virtual addresses) */
3376 trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long)); 3381 trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long));
3377 if (trident->tlb.shadow_entries == NULL) { 3382 if (trident->tlb.shadow_entries == NULL) {
3378 snd_printk(KERN_ERR "trident: unable to allocate shadow TLB entries\n"); 3383 dev_err(trident->card->dev,
3384 "unable to allocate shadow TLB entries\n");
3379 return -ENOMEM; 3385 return -ENOMEM;
3380 } 3386 }
3381 /* allocate and setup silent page and initialise TLB entries */ 3387 /* allocate and setup silent page and initialise TLB entries */
3382 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), 3388 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci),
3383 SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) { 3389 SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) {
3384 snd_printk(KERN_ERR "trident: unable to allocate silent page\n"); 3390 dev_err(trident->card->dev, "unable to allocate silent page\n");
3385 return -ENOMEM; 3391 return -ENOMEM;
3386 } 3392 }
3387 memset(trident->tlb.silent_page.area, 0, SNDRV_TRIDENT_PAGE_SIZE); 3393 memset(trident->tlb.silent_page.area, 0, SNDRV_TRIDENT_PAGE_SIZE);
@@ -3439,7 +3445,7 @@ static int snd_trident_4d_dx_init(struct snd_trident *trident)
3439 goto __dx_ok; 3445 goto __dx_ok;
3440 do_delay(trident); 3446 do_delay(trident);
3441 } while (time_after_eq(end_time, jiffies)); 3447 } while (time_after_eq(end_time, jiffies));
3442 snd_printk(KERN_ERR "AC'97 codec ready error\n"); 3448 dev_err(trident->card->dev, "AC'97 codec ready error\n");
3443 return -EIO; 3449 return -EIO;
3444 3450
3445 __dx_ok: 3451 __dx_ok:
@@ -3477,7 +3483,8 @@ static int snd_trident_4d_nx_init(struct snd_trident *trident)
3477 goto __nx_ok; 3483 goto __nx_ok;
3478 do_delay(trident); 3484 do_delay(trident);
3479 } while (time_after_eq(end_time, jiffies)); 3485 } while (time_after_eq(end_time, jiffies));
3480 snd_printk(KERN_ERR "AC'97 codec ready error [0x%x]\n", inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT))); 3486 dev_err(trident->card->dev, "AC'97 codec ready error [0x%x]\n",
3487 inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT)));
3481 return -EIO; 3488 return -EIO;
3482 3489
3483 __nx_ok: 3490 __nx_ok:
@@ -3562,7 +3569,8 @@ int snd_trident_create(struct snd_card *card,
3562 /* check, if we can restrict PCI DMA transfers to 30 bits */ 3569 /* check, if we can restrict PCI DMA transfers to 30 bits */
3563 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 || 3570 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 ||
3564 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { 3571 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) {
3565 snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); 3572 dev_err(card->dev,
3573 "architecture does not support 30bit PCI busmaster DMA\n");
3566 pci_disable_device(pci); 3574 pci_disable_device(pci);
3567 return -ENXIO; 3575 return -ENXIO;
3568 } 3576 }
@@ -3600,7 +3608,7 @@ int snd_trident_create(struct snd_card *card,
3600 3608
3601 if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED, 3609 if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED,
3602 KBUILD_MODNAME, trident)) { 3610 KBUILD_MODNAME, trident)) {
3603 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3611 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
3604 snd_trident_free(trident); 3612 snd_trident_free(trident);
3605 return -EBUSY; 3613 return -EBUSY;
3606 } 3614 }
@@ -3949,8 +3957,7 @@ static int snd_trident_resume(struct device *dev)
3949 pci_set_power_state(pci, PCI_D0); 3957 pci_set_power_state(pci, PCI_D0);
3950 pci_restore_state(pci); 3958 pci_restore_state(pci);
3951 if (pci_enable_device(pci) < 0) { 3959 if (pci_enable_device(pci) < 0) {
3952 printk(KERN_ERR "trident: pci_enable_device failed, " 3960 dev_err(dev, "pci_enable_device failed, disabling device\n");
3953 "disabling device\n");
3954 snd_card_disconnect(card); 3961 snd_card_disconnect(card);
3955 return -EIO; 3962 return -EIO;
3956 } 3963 }
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 20d2eeeecf47..95b98f537b67 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -459,7 +459,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
459 unsigned int addr; 459 unsigned int addr;
460 460
461 if (idx >= VIA_TABLE_SIZE) { 461 if (idx >= VIA_TABLE_SIZE) {
462 snd_printk(KERN_ERR "via82xx: too much table size!\n"); 462 dev_err(&pci->dev, "too much table size!\n");
463 return -EINVAL; 463 return -EINVAL;
464 } 464 }
465 addr = snd_pcm_sgbuf_get_addr(substream, ofs); 465 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
474 } else 474 } else
475 flag = 0; /* period continues to the next */ 475 flag = 0; /* period continues to the next */
476 /* 476 /*
477 printk(KERN_DEBUG "via: tbl %d: at %d size %d " 477 dev_dbg(&pci->dev,
478 "(rest %d)\n", idx, ofs, r, rest); 478 "tbl %d: at %d size %d (rest %d)\n",
479 idx, ofs, r, rest);
479 */ 480 */
480 ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); 481 ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag);
481 dev->idx_table[idx].offset = ofs; 482 dev->idx_table[idx].offset = ofs;
@@ -528,7 +529,7 @@ static int snd_via82xx_codec_ready(struct via82xx *chip, int secondary)
528 if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) 529 if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY))
529 return val & 0xffff; 530 return val & 0xffff;
530 } 531 }
531 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", 532 dev_err(chip->card->dev, "codec_ready: codec %i is not ready [0x%x]\n",
532 secondary, snd_via82xx_codec_xread(chip)); 533 secondary, snd_via82xx_codec_xread(chip));
533 return -EIO; 534 return -EIO;
534} 535}
@@ -587,7 +588,8 @@ static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned sho
587 xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; 588 xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT;
588 while (1) { 589 while (1) {
589 if (again++ > 3) { 590 if (again++ > 3) {
590 snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", 591 dev_err(chip->card->dev,
592 "codec_read: codec %i is not valid [0x%x]\n",
591 ac97->num, snd_via82xx_codec_xread(chip)); 593 ac97->num, snd_via82xx_codec_xread(chip));
592 return 0xffff; 594 return 0xffff;
593 } 595 }
@@ -777,7 +779,9 @@ static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
777 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\ 779 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\
778 viadev->lastpos < viadev->bufsize2)) 780 viadev->lastpos < viadev->bufsize2))
779 781
780static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx, 782static inline unsigned int calc_linear_pos(struct via82xx *chip,
783 struct viadev *viadev,
784 unsigned int idx,
781 unsigned int count) 785 unsigned int count)
782{ 786{
783 unsigned int size, base, res; 787 unsigned int size, base, res;
@@ -790,7 +794,8 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
790 794
791 /* check the validity of the calculated position */ 795 /* check the validity of the calculated position */
792 if (size < count) { 796 if (size < count) {
793 snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", 797 dev_dbg(chip->card->dev,
798 "invalid via82xx_cur_ptr (size = %d, count = %d)\n",
794 (int)size, (int)count); 799 (int)size, (int)count);
795 res = viadev->lastpos; 800 res = viadev->lastpos;
796 } else { 801 } else {
@@ -807,9 +812,9 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
807 } 812 }
808 if (check_invalid_pos(viadev, res)) { 813 if (check_invalid_pos(viadev, res)) {
809#ifdef POINTER_DEBUG 814#ifdef POINTER_DEBUG
810 printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, " 815 dev_dbg(chip->card->dev,
811 "bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, " 816 "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n",
812 "count = 0x%x\n", idx, viadev->tbl_entries, 817 idx, viadev->tbl_entries,
813 viadev->lastpos, viadev->bufsize2, 818 viadev->lastpos, viadev->bufsize2,
814 viadev->idx_table[idx].offset, 819 viadev->idx_table[idx].offset,
815 viadev->idx_table[idx].size, count); 820 viadev->idx_table[idx].size, count);
@@ -817,8 +822,8 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
817 /* count register returns full size when end of buffer is reached */ 822 /* count register returns full size when end of buffer is reached */
818 res = base + size; 823 res = base + size;
819 if (check_invalid_pos(viadev, res)) { 824 if (check_invalid_pos(viadev, res)) {
820 snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), " 825 dev_dbg(chip->card->dev,
821 "using last valid pointer\n"); 826 "invalid via82xx_cur_ptr (2), using last valid pointer\n");
822 res = viadev->lastpos; 827 res = viadev->lastpos;
823 } 828 }
824 } 829 }
@@ -850,7 +855,7 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substr
850 idx = 0; 855 idx = 0;
851 else /* CURR_PTR holds the address + 8 */ 856 else /* CURR_PTR holds the address + 8 */
852 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; 857 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries;
853 res = calc_linear_pos(viadev, idx, count); 858 res = calc_linear_pos(chip, viadev, idx, count);
854 viadev->lastpos = res; /* remember the last position */ 859 viadev->lastpos = res; /* remember the last position */
855 spin_unlock(&chip->reg_lock); 860 spin_unlock(&chip->reg_lock);
856 861
@@ -889,13 +894,14 @@ static snd_pcm_uframes_t snd_via8233_pcm_pointer(struct snd_pcm_substream *subst
889 idx = count >> 24; 894 idx = count >> 24;
890 if (idx >= viadev->tbl_entries) { 895 if (idx >= viadev->tbl_entries) {
891#ifdef POINTER_DEBUG 896#ifdef POINTER_DEBUG
892 printk(KERN_DEBUG "fail: invalid idx = %i/%i\n", idx, 897 dev_dbg(chip->card->dev,
898 "fail: invalid idx = %i/%i\n", idx,
893 viadev->tbl_entries); 899 viadev->tbl_entries);
894#endif 900#endif
895 res = viadev->lastpos; 901 res = viadev->lastpos;
896 } else { 902 } else {
897 count &= 0xffffff; 903 count &= 0xffffff;
898 res = calc_linear_pos(viadev, idx, count); 904 res = calc_linear_pos(chip, viadev, idx, count);
899 } 905 }
900 } else { 906 } else {
901 res = viadev->hwptr_done; 907 res = viadev->hwptr_done;
@@ -1940,14 +1946,15 @@ static int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legac
1940 1946
1941 r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); 1947 r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport");
1942 if (!r) { 1948 if (!r) {
1943 printk(KERN_WARNING "via82xx: cannot reserve joystick port %#x\n", 1949 dev_warn(chip->card->dev, "cannot reserve joystick port %#x\n",
1944 JOYSTICK_ADDR); 1950 JOYSTICK_ADDR);
1945 return -EBUSY; 1951 return -EBUSY;
1946 } 1952 }
1947 1953
1948 chip->gameport = gp = gameport_allocate_port(); 1954 chip->gameport = gp = gameport_allocate_port();
1949 if (!gp) { 1955 if (!gp) {
1950 printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n"); 1956 dev_err(chip->card->dev,
1957 "cannot allocate memory for gameport\n");
1951 release_and_free_resource(r); 1958 release_and_free_resource(r);
1952 return -ENOMEM; 1959 return -ENOMEM;
1953 } 1960 }
@@ -2016,7 +2023,8 @@ static int snd_via8233_init_misc(struct via82xx *chip)
2016 strcpy(sid.name, "PCM Playback Volume"); 2023 strcpy(sid.name, "PCM Playback Volume");
2017 sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2024 sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
2018 if (! snd_ctl_find_id(chip->card, &sid)) { 2025 if (! snd_ctl_find_id(chip->card, &sid)) {
2019 snd_printd(KERN_INFO "Using DXS as PCM Playback\n"); 2026 dev_info(chip->card->dev,
2027 "Using DXS as PCM Playback\n");
2020 err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip)); 2028 err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip));
2021 if (err < 0) 2029 if (err < 0)
2022 return err; 2030 return err;
@@ -2102,8 +2110,9 @@ static int snd_via686_init_misc(struct via82xx *chip)
2102 mpu_port, MPU401_INFO_INTEGRATED | 2110 mpu_port, MPU401_INFO_INTEGRATED |
2103 MPU401_INFO_IRQ_HOOK, -1, 2111 MPU401_INFO_IRQ_HOOK, -1,
2104 &chip->rmidi) < 0) { 2112 &chip->rmidi) < 0) {
2105 printk(KERN_WARNING "unable to initialize MPU-401" 2113 dev_warn(chip->card->dev,
2106 " at 0x%lx, skipping\n", mpu_port); 2114 "unable to initialize MPU-401 at 0x%lx, skipping\n",
2115 mpu_port);
2107 legacy &= ~VIA_FUNC_ENABLE_MIDI; 2116 legacy &= ~VIA_FUNC_ENABLE_MIDI;
2108 } else { 2117 } else {
2109 legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */ 2118 legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */
@@ -2203,7 +2212,8 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
2203 } while (time_before(jiffies, end_time)); 2212 } while (time_before(jiffies, end_time));
2204 2213
2205 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 2214 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
2206 snd_printk(KERN_ERR "AC'97 codec is not ready [0x%x]\n", val); 2215 dev_err(chip->card->dev,
2216 "AC'97 codec is not ready [0x%x]\n", val);
2207 2217
2208#if 0 /* FIXME: we don't support the second codec yet so skip the detection now.. */ 2218#if 0 /* FIXME: we don't support the second codec yet so skip the detection now.. */
2209 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 2219 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
@@ -2303,8 +2313,7 @@ static int snd_via82xx_resume(struct device *dev)
2303 pci_set_power_state(pci, PCI_D0); 2313 pci_set_power_state(pci, PCI_D0);
2304 pci_restore_state(pci); 2314 pci_restore_state(pci);
2305 if (pci_enable_device(pci) < 0) { 2315 if (pci_enable_device(pci) < 0) {
2306 printk(KERN_ERR "via82xx: pci_enable_device failed, " 2316 dev_err(dev, "pci_enable_device failed, disabling device\n");
2307 "disabling device\n");
2308 snd_card_disconnect(card); 2317 snd_card_disconnect(card);
2309 return -EIO; 2318 return -EIO;
2310 } 2319 }
@@ -2417,7 +2426,7 @@ static int snd_via82xx_create(struct snd_card *card,
2417 snd_via8233_interrupt : snd_via686_interrupt, 2426 snd_via8233_interrupt : snd_via686_interrupt,
2418 IRQF_SHARED, 2427 IRQF_SHARED,
2419 KBUILD_MODNAME, chip)) { 2428 KBUILD_MODNAME, chip)) {
2420 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2429 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2421 snd_via82xx_free(chip); 2430 snd_via82xx_free(chip);
2422 return -EBUSY; 2431 return -EBUSY;
2423 } 2432 }
@@ -2514,7 +2523,7 @@ static int check_dxs_list(struct pci_dev *pci, int revision)
2514 2523
2515 w = snd_pci_quirk_lookup(pci, dxs_whitelist); 2524 w = snd_pci_quirk_lookup(pci, dxs_whitelist);
2516 if (w) { 2525 if (w) {
2517 snd_printdd(KERN_INFO "via82xx: DXS white list for %s found\n", 2526 dev_dbg(&pci->dev, "DXS white list for %s found\n",
2518 snd_pci_quirk_name(w)); 2527 snd_pci_quirk_name(w));
2519 return w->value; 2528 return w->value;
2520 } 2529 }
@@ -2526,10 +2535,10 @@ static int check_dxs_list(struct pci_dev *pci, int revision)
2526 /* 2535 /*
2527 * not detected, try 48k rate only to be sure. 2536 * not detected, try 48k rate only to be sure.
2528 */ 2537 */
2529 printk(KERN_INFO "via82xx: Assuming DXS channels with 48k fixed sample rate.\n"); 2538 dev_info(&pci->dev, "Assuming DXS channels with 48k fixed sample rate.\n");
2530 printk(KERN_INFO " Please try dxs_support=5 option\n"); 2539 dev_info(&pci->dev, " Please try dxs_support=5 option\n");
2531 printk(KERN_INFO " and report if it works on your machine.\n"); 2540 dev_info(&pci->dev, " and report if it works on your machine.\n");
2532 printk(KERN_INFO " For more details, read ALSA-Configuration.txt.\n"); 2541 dev_info(&pci->dev, " For more details, read ALSA-Configuration.txt.\n");
2533 return VIA_DXS_48K; 2542 return VIA_DXS_48K;
2534}; 2543};
2535 2544
@@ -2582,7 +2591,7 @@ static int snd_via82xx_probe(struct pci_dev *pci,
2582 strcpy(card->driver, "VIA8233"); 2591 strcpy(card->driver, "VIA8233");
2583 break; 2592 break;
2584 default: 2593 default:
2585 snd_printk(KERN_ERR "invalid card type %d\n", card_type); 2594 dev_err(card->dev, "invalid card type %d\n", card_type);
2586 err = -EINVAL; 2595 err = -EINVAL;
2587 goto __error; 2596 goto __error;
2588 } 2597 }
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 519740154824..46a0526b1d79 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -312,7 +312,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
312 unsigned int addr; 312 unsigned int addr;
313 313
314 if (idx >= VIA_TABLE_SIZE) { 314 if (idx >= VIA_TABLE_SIZE) {
315 snd_printk(KERN_ERR "via82xx: too much table size!\n"); 315 dev_err(&pci->dev, "too much table size!\n");
316 return -EINVAL; 316 return -EINVAL;
317 } 317 }
318 addr = snd_pcm_sgbuf_get_addr(substream, ofs); 318 addr = snd_pcm_sgbuf_get_addr(substream, ofs);
@@ -329,8 +329,9 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
329 } else 329 } else
330 flag = 0; /* period continues to the next */ 330 flag = 0; /* period continues to the next */
331 /* 331 /*
332 printk(KERN_DEBUG "via: tbl %d: at %d size %d " 332 dev_dbg(&pci->dev,
333 "(rest %d)\n", idx, ofs, r, rest); 333 "tbl %d: at %d size %d (rest %d)\n",
334 idx, ofs, r, rest);
334 */ 335 */
335 ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); 336 ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag);
336 dev->idx_table[idx].offset = ofs; 337 dev->idx_table[idx].offset = ofs;
@@ -382,7 +383,7 @@ static int snd_via82xx_codec_ready(struct via82xx_modem *chip, int secondary)
382 if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) 383 if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY))
383 return val & 0xffff; 384 return val & 0xffff;
384 } 385 }
385 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", 386 dev_err(chip->card->dev, "codec_ready: codec %i is not ready [0x%x]\n",
386 secondary, snd_via82xx_codec_xread(chip)); 387 secondary, snd_via82xx_codec_xread(chip));
387 return -EIO; 388 return -EIO;
388} 389}
@@ -443,7 +444,8 @@ static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned sho
443 xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; 444 xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT;
444 while (1) { 445 while (1) {
445 if (again++ > 3) { 446 if (again++ > 3) {
446 snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", 447 dev_err(chip->card->dev,
448 "codec_read: codec %i is not valid [0x%x]\n",
447 ac97->num, snd_via82xx_codec_xread(chip)); 449 ac97->num, snd_via82xx_codec_xread(chip));
448 return 0xffff; 450 return 0xffff;
449 } 451 }
@@ -560,7 +562,9 @@ static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
560 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\ 562 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\
561 viadev->lastpos < viadev->bufsize2)) 563 viadev->lastpos < viadev->bufsize2))
562 564
563static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx, 565static inline unsigned int calc_linear_pos(struct via82xx_modem *chip,
566 struct viadev *viadev,
567 unsigned int idx,
564 unsigned int count) 568 unsigned int count)
565{ 569{
566 unsigned int size, res; 570 unsigned int size, res;
@@ -570,20 +574,21 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
570 574
571 /* check the validity of the calculated position */ 575 /* check the validity of the calculated position */
572 if (size < count) { 576 if (size < count) {
573 snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", 577 dev_err(chip->card->dev,
578 "invalid via82xx_cur_ptr (size = %d, count = %d)\n",
574 (int)size, (int)count); 579 (int)size, (int)count);
575 res = viadev->lastpos; 580 res = viadev->lastpos;
576 } else if (check_invalid_pos(viadev, res)) { 581 } else if (check_invalid_pos(viadev, res)) {
577#ifdef POINTER_DEBUG 582#ifdef POINTER_DEBUG
578 printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, " 583 dev_dbg(chip->card->dev,
579 "bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, " 584 "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n",
580 "count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, 585 idx, viadev->tbl_entries, viadev->lastpos,
581 viadev->bufsize2, viadev->idx_table[idx].offset, 586 viadev->bufsize2, viadev->idx_table[idx].offset,
582 viadev->idx_table[idx].size, count); 587 viadev->idx_table[idx].size, count);
583#endif 588#endif
584 if (count && size < count) { 589 if (count && size < count) {
585 snd_printd(KERN_ERR "invalid via82xx_cur_ptr, " 590 dev_dbg(chip->card->dev,
586 "using last valid pointer\n"); 591 "invalid via82xx_cur_ptr, using last valid pointer\n");
587 res = viadev->lastpos; 592 res = viadev->lastpos;
588 } else { 593 } else {
589 if (! count) 594 if (! count)
@@ -595,8 +600,8 @@ static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int i
595 */ 600 */
596 res = viadev->idx_table[idx].offset + size; 601 res = viadev->idx_table[idx].offset + size;
597 if (check_invalid_pos(viadev, res)) { 602 if (check_invalid_pos(viadev, res)) {
598 snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), " 603 dev_dbg(chip->card->dev,
599 "using last valid pointer\n"); 604 "invalid via82xx_cur_ptr (2), using last valid pointer\n");
600 res = viadev->lastpos; 605 res = viadev->lastpos;
601 } 606 }
602 } 607 }
@@ -632,7 +637,7 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substr
632 else /* CURR_PTR holds the address + 8 */ 637 else /* CURR_PTR holds the address + 8 */
633 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % 638 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) %
634 viadev->tbl_entries; 639 viadev->tbl_entries;
635 res = calc_linear_pos(viadev, idx, count); 640 res = calc_linear_pos(chip, viadev, idx, count);
636 spin_unlock(&chip->reg_lock); 641 spin_unlock(&chip->reg_lock);
637 642
638 return bytes_to_frames(substream->runtime, res); 643 return bytes_to_frames(substream->runtime, res);
@@ -991,7 +996,8 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip)
991 } while (time_before(jiffies, end_time)); 996 } while (time_before(jiffies, end_time));
992 997
993 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 998 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
994 snd_printk(KERN_ERR "AC'97 codec is not ready [0x%x]\n", val); 999 dev_err(chip->card->dev,
1000 "AC'97 codec is not ready [0x%x]\n", val);
995 1001
996 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 1002 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
997 VIA_REG_AC97_SECONDARY_VALID | 1003 VIA_REG_AC97_SECONDARY_VALID |
@@ -1054,8 +1060,7 @@ static int snd_via82xx_resume(struct device *dev)
1054 pci_set_power_state(pci, PCI_D0); 1060 pci_set_power_state(pci, PCI_D0);
1055 pci_restore_state(pci); 1061 pci_restore_state(pci);
1056 if (pci_enable_device(pci) < 0) { 1062 if (pci_enable_device(pci) < 0) {
1057 printk(KERN_ERR "via82xx-modem: pci_enable_device failed, " 1063 dev_err(dev, "pci_enable_device failed, disabling device\n");
1058 "disabling device\n");
1059 snd_card_disconnect(card); 1064 snd_card_disconnect(card);
1060 return -EIO; 1065 return -EIO;
1061 } 1066 }
@@ -1137,7 +1142,7 @@ static int snd_via82xx_create(struct snd_card *card,
1137 chip->port = pci_resource_start(pci, 0); 1142 chip->port = pci_resource_start(pci, 0);
1138 if (request_irq(pci->irq, snd_via82xx_interrupt, IRQF_SHARED, 1143 if (request_irq(pci->irq, snd_via82xx_interrupt, IRQF_SHARED,
1139 KBUILD_MODNAME, chip)) { 1144 KBUILD_MODNAME, chip)) {
1140 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1145 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
1141 snd_via82xx_free(chip); 1146 snd_via82xx_free(chip);
1142 return -EBUSY; 1147 return -EBUSY;
1143 } 1148 }
@@ -1186,7 +1191,7 @@ static int snd_via82xx_probe(struct pci_dev *pci,
1186 sprintf(card->shortname, "VIA 82XX modem"); 1191 sprintf(card->shortname, "VIA 82XX modem");
1187 break; 1192 break;
1188 default: 1193 default:
1189 snd_printk(KERN_ERR "invalid card type %d\n", card_type); 1194 dev_err(card->dev, "invalid card type %d\n", card_type);
1190 err = -EINVAL; 1195 err = -EINVAL;
1191 goto __error; 1196 goto __error;
1192 } 1197 }
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index 4323556c13f8..ff9074d22607 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -170,7 +170,7 @@ static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
170 170
171 if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_SHARED, 171 if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_SHARED,
172 KBUILD_MODNAME, chip)) { 172 KBUILD_MODNAME, chip)) {
173 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 173 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
174 snd_vx222_free(chip); 174 snd_vx222_free(chip);
175 return -EBUSY; 175 return -EBUSY;
176 } 176 }
@@ -228,7 +228,7 @@ static int snd_vx222_probe(struct pci_dev *pci,
228 228
229 sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %i", 229 sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %i",
230 card->shortname, vx->port[0], vx->port[1], vx->core.irq); 230 card->shortname, vx->port[0], vx->port[1], vx->core.irq);
231 snd_printdd("%s at 0x%lx & 0x%lx, irq %i\n", 231 dev_dbg(card->dev, "%s at 0x%lx & 0x%lx, irq %i\n",
232 card->shortname, vx->port[0], vx->port[1], vx->core.irq); 232 card->shortname, vx->port[0], vx->port[1], vx->core.irq);
233 233
234#ifdef SND_VX_FW_LOADER 234#ifdef SND_VX_FW_LOADER
@@ -279,8 +279,7 @@ static int snd_vx222_resume(struct device *dev)
279 pci_set_power_state(pci, PCI_D0); 279 pci_set_power_state(pci, PCI_D0);
280 pci_restore_state(pci); 280 pci_restore_state(pci);
281 if (pci_enable_device(pci) < 0) { 281 if (pci_enable_device(pci) < 0) {
282 printk(KERN_ERR "vx222: pci_enable_device failed, " 282 dev_err(dev, "pci_enable_device failed, disabling device\n");
283 "disabling device\n");
284 snd_card_disconnect(card); 283 snd_card_disconnect(card);
285 return -EIO; 284 return -EIO;
286 } 285 }
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index a69e774d0b13..2d1570273e99 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -108,7 +108,7 @@ static void vx2_outb(struct vx_core *chip, int offset, unsigned char val)
108{ 108{
109 outb(val, vx2_reg_addr(chip, offset)); 109 outb(val, vx2_reg_addr(chip, offset));
110 /* 110 /*
111 printk(KERN_DEBUG "outb: %x -> %x\n", val, vx2_reg_addr(chip, offset)); 111 dev_dbg(chip->card->dev, "outb: %x -> %x\n", val, vx2_reg_addr(chip, offset));
112 */ 112 */
113} 113}
114 114
@@ -129,7 +129,7 @@ static unsigned int vx2_inl(struct vx_core *chip, int offset)
129static void vx2_outl(struct vx_core *chip, int offset, unsigned int val) 129static void vx2_outl(struct vx_core *chip, int offset, unsigned int val)
130{ 130{
131 /* 131 /*
132 printk(KERN_DEBUG "outl: %x -> %x\n", val, vx2_reg_addr(chip, offset)); 132 dev_dbg(chip->card->dev, "outl: %x -> %x\n", val, vx2_reg_addr(chip, offset));
133 */ 133 */
134 outl(val, vx2_reg_addr(chip, offset)); 134 outl(val, vx2_reg_addr(chip, offset));
135} 135}
@@ -173,7 +173,7 @@ static int vx2_test_xilinx(struct vx_core *_chip)
173 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 173 struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
174 unsigned int data; 174 unsigned int data;
175 175
176 snd_printdd("testing xilinx...\n"); 176 dev_dbg(_chip->card->dev, "testing xilinx...\n");
177 /* This test uses several write/read sequences on TEST0 and TEST1 bits 177 /* This test uses several write/read sequences on TEST0 and TEST1 bits
178 * to figure out whever or not the xilinx was correctly loaded 178 * to figure out whever or not the xilinx was correctly loaded
179 */ 179 */
@@ -183,7 +183,7 @@ static int vx2_test_xilinx(struct vx_core *_chip)
183 vx_inl(chip, ISR); 183 vx_inl(chip, ISR);
184 data = vx_inl(chip, STATUS); 184 data = vx_inl(chip, STATUS);
185 if ((data & VX_STATUS_VAL_TEST0_MASK) == VX_STATUS_VAL_TEST0_MASK) { 185 if ((data & VX_STATUS_VAL_TEST0_MASK) == VX_STATUS_VAL_TEST0_MASK) {
186 snd_printdd("bad!\n"); 186 dev_dbg(_chip->card->dev, "bad!\n");
187 return -ENODEV; 187 return -ENODEV;
188 } 188 }
189 189
@@ -192,7 +192,7 @@ static int vx2_test_xilinx(struct vx_core *_chip)
192 vx_inl(chip, ISR); 192 vx_inl(chip, ISR);
193 data = vx_inl(chip, STATUS); 193 data = vx_inl(chip, STATUS);
194 if (! (data & VX_STATUS_VAL_TEST0_MASK)) { 194 if (! (data & VX_STATUS_VAL_TEST0_MASK)) {
195 snd_printdd("bad! #2\n"); 195 dev_dbg(_chip->card->dev, "bad! #2\n");
196 return -ENODEV; 196 return -ENODEV;
197 } 197 }
198 198
@@ -203,7 +203,7 @@ static int vx2_test_xilinx(struct vx_core *_chip)
203 vx_inl(chip, ISR); 203 vx_inl(chip, ISR);
204 data = vx_inl(chip, STATUS); 204 data = vx_inl(chip, STATUS);
205 if ((data & VX_STATUS_VAL_TEST1_MASK) == VX_STATUS_VAL_TEST1_MASK) { 205 if ((data & VX_STATUS_VAL_TEST1_MASK) == VX_STATUS_VAL_TEST1_MASK) {
206 snd_printdd("bad! #3\n"); 206 dev_dbg(_chip->card->dev, "bad! #3\n");
207 return -ENODEV; 207 return -ENODEV;
208 } 208 }
209 209
@@ -212,11 +212,11 @@ static int vx2_test_xilinx(struct vx_core *_chip)
212 vx_inl(chip, ISR); 212 vx_inl(chip, ISR);
213 data = vx_inl(chip, STATUS); 213 data = vx_inl(chip, STATUS);
214 if (! (data & VX_STATUS_VAL_TEST1_MASK)) { 214 if (! (data & VX_STATUS_VAL_TEST1_MASK)) {
215 snd_printdd("bad! #4\n"); 215 dev_dbg(_chip->card->dev, "bad! #4\n");
216 return -ENODEV; 216 return -ENODEV;
217 } 217 }
218 } 218 }
219 snd_printdd("ok, xilinx fine.\n"); 219 dev_dbg(_chip->card->dev, "ok, xilinx fine.\n");
220 return 0; 220 return 0;
221} 221}
222 222
@@ -397,7 +397,8 @@ static int vx2_load_xilinx_binary(struct vx_core *chip, const struct firmware *x
397 i = vx_inl(chip, GPIOC); 397 i = vx_inl(chip, GPIOC);
398 if (i & 0x0100) 398 if (i & 0x0100)
399 return 0; 399 return 0;
400 snd_printk(KERN_ERR "vx222: xilinx test failed after load, GPIOC=0x%x\n", i); 400 dev_err(chip->card->dev,
401 "xilinx test failed after load, GPIOC=0x%x\n", i);
401 return -EINVAL; 402 return -EINVAL;
402 } 403 }
403 404
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 6ff4ea389b02..82eed164b275 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -106,7 +106,8 @@ static int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev,
106 break; 106 break;
107 } 107 }
108 if (!r) { 108 if (!r) {
109 printk(KERN_ERR "ymfpci: no gameport ports available\n"); 109 dev_err(chip->card->dev,
110 "no gameport ports available\n");
110 return -EBUSY; 111 return -EBUSY;
111 } 112 }
112 } 113 }
@@ -116,19 +117,22 @@ static int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev,
116 case 0x204: legacy_ctrl2 |= 2 << 6; break; 117 case 0x204: legacy_ctrl2 |= 2 << 6; break;
117 case 0x205: legacy_ctrl2 |= 3 << 6; break; 118 case 0x205: legacy_ctrl2 |= 3 << 6; break;
118 default: 119 default:
119 printk(KERN_ERR "ymfpci: invalid joystick port %#x", io_port); 120 dev_err(chip->card->dev,
121 "invalid joystick port %#x", io_port);
120 return -EINVAL; 122 return -EINVAL;
121 } 123 }
122 } 124 }
123 125
124 if (!r && !(r = request_region(io_port, 1, "YMFPCI gameport"))) { 126 if (!r && !(r = request_region(io_port, 1, "YMFPCI gameport"))) {
125 printk(KERN_ERR "ymfpci: joystick port %#x is in use.\n", io_port); 127 dev_err(chip->card->dev,
128 "joystick port %#x is in use.\n", io_port);
126 return -EBUSY; 129 return -EBUSY;
127 } 130 }
128 131
129 chip->gameport = gp = gameport_allocate_port(); 132 chip->gameport = gp = gameport_allocate_port();
130 if (!gp) { 133 if (!gp) {
131 printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n"); 134 dev_err(chip->card->dev,
135 "cannot allocate memory for gameport\n");
132 release_and_free_resource(r); 136 release_and_free_resource(r);
133 return -ENOMEM; 137 return -ENOMEM;
134 } 138 }
@@ -314,7 +318,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
314 MPU401_INFO_INTEGRATED | 318 MPU401_INFO_INTEGRATED |
315 MPU401_INFO_IRQ_HOOK, 319 MPU401_INFO_IRQ_HOOK,
316 -1, &chip->rawmidi)) < 0) { 320 -1, &chip->rawmidi)) < 0) {
317 printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]); 321 dev_warn(card->dev,
322 "cannot initialize MPU401 at 0x%lx, skipping...\n",
323 mpu_port[dev]);
318 legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */ 324 legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */
319 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); 325 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
320 } 326 }
@@ -324,12 +330,14 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
324 fm_port[dev], 330 fm_port[dev],
325 fm_port[dev] + 2, 331 fm_port[dev] + 2,
326 OPL3_HW_OPL3, 1, &opl3)) < 0) { 332 OPL3_HW_OPL3, 1, &opl3)) < 0) {
327 printk(KERN_WARNING "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", fm_port[dev]); 333 dev_warn(card->dev,
334 "cannot initialize FM OPL3 at 0x%lx, skipping...\n",
335 fm_port[dev]);
328 legacy_ctrl &= ~YMFPCI_LEGACY_FMEN; 336 legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
329 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); 337 pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
330 } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 338 } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
331 snd_card_free(card); 339 snd_card_free(card);
332 snd_printk(KERN_ERR "cannot create opl3 hwdep\n"); 340 dev_err(card->dev, "cannot create opl3 hwdep\n");
333 return err; 341 return err;
334 } 342 }
335 } 343 }
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index c7e98ff4f80f..81c916a5eb96 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -86,7 +86,9 @@ static int snd_ymfpci_codec_ready(struct snd_ymfpci *chip, int secondary)
86 return 0; 86 return 0;
87 schedule_timeout_uninterruptible(1); 87 schedule_timeout_uninterruptible(1);
88 } while (time_before(jiffies, end_time)); 88 } while (time_before(jiffies, end_time));
89 snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); 89 dev_err(chip->card->dev,
90 "codec_ready: codec %i is not ready [0x%x]\n",
91 secondary, snd_ymfpci_readw(chip, reg));
90 return -EBUSY; 92 return -EBUSY;
91} 93}
92 94
@@ -319,7 +321,7 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_
319 ypcm->last_pos = pos; 321 ypcm->last_pos = pos;
320 if (ypcm->period_pos >= ypcm->period_size) { 322 if (ypcm->period_pos >= ypcm->period_size) {
321 /* 323 /*
322 printk(KERN_DEBUG 324 dev_dbg(chip->card->dev,
323 "done - active_bank = 0x%x, start = 0x%x\n", 325 "done - active_bank = 0x%x, start = 0x%x\n",
324 chip->active_bank, 326 chip->active_bank,
325 voice->bank[chip->active_bank].start); 327 voice->bank[chip->active_bank].start);
@@ -372,7 +374,7 @@ static void snd_ymfpci_pcm_capture_interrupt(struct snd_pcm_substream *substream
372 if (ypcm->period_pos >= ypcm->period_size) { 374 if (ypcm->period_pos >= ypcm->period_size) {
373 ypcm->period_pos %= ypcm->period_size; 375 ypcm->period_pos %= ypcm->period_size;
374 /* 376 /*
375 printk(KERN_DEBUG 377 dev_dbg(chip->card->dev,
376 "done - active_bank = 0x%x, start = 0x%x\n", 378 "done - active_bank = 0x%x, start = 0x%x\n",
377 chip->active_bank, 379 chip->active_bank,
378 voice->bank[chip->active_bank].start); 380 voice->bank[chip->active_bank].start);
@@ -2067,7 +2069,8 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
2067 &chip->pci->dev); 2069 &chip->pci->dev);
2068 if (err >= 0) { 2070 if (err >= 0) {
2069 if (chip->dsp_microcode->size != YDSXG_DSPLENGTH) { 2071 if (chip->dsp_microcode->size != YDSXG_DSPLENGTH) {
2070 snd_printk(KERN_ERR "DSP microcode has wrong size\n"); 2072 dev_err(chip->card->dev,
2073 "DSP microcode has wrong size\n");
2071 err = -EINVAL; 2074 err = -EINVAL;
2072 } 2075 }
2073 } 2076 }
@@ -2082,8 +2085,8 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
2082 &chip->pci->dev); 2085 &chip->pci->dev);
2083 if (err >= 0) { 2086 if (err >= 0) {
2084 if (chip->controller_microcode->size != YDSXG_CTRLLENGTH) { 2087 if (chip->controller_microcode->size != YDSXG_CTRLLENGTH) {
2085 snd_printk(KERN_ERR "controller microcode" 2088 dev_err(chip->card->dev,
2086 " has wrong size\n"); 2089 "controller microcode has wrong size\n");
2087 err = -EINVAL; 2090 err = -EINVAL;
2088 } 2091 }
2089 } 2092 }
@@ -2360,8 +2363,7 @@ static int snd_ymfpci_resume(struct device *dev)
2360 pci_set_power_state(pci, PCI_D0); 2363 pci_set_power_state(pci, PCI_D0);
2361 pci_restore_state(pci); 2364 pci_restore_state(pci);
2362 if (pci_enable_device(pci) < 0) { 2365 if (pci_enable_device(pci) < 0) {
2363 printk(KERN_ERR "ymfpci: pci_enable_device failed, " 2366 dev_err(dev, "pci_enable_device failed, disabling device\n");
2364 "disabling device\n");
2365 snd_card_disconnect(card); 2367 snd_card_disconnect(card);
2366 return -EIO; 2368 return -EIO;
2367 } 2369 }
@@ -2433,13 +2435,15 @@ int snd_ymfpci_create(struct snd_card *card,
2433 chip->src441_used = -1; 2435 chip->src441_used = -1;
2434 2436
2435 if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) { 2437 if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) {
2436 snd_printk(KERN_ERR "unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); 2438 dev_err(chip->card->dev,
2439 "unable to grab memory region 0x%lx-0x%lx\n",
2440 chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
2437 snd_ymfpci_free(chip); 2441 snd_ymfpci_free(chip);
2438 return -EBUSY; 2442 return -EBUSY;
2439 } 2443 }
2440 if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED, 2444 if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
2441 KBUILD_MODNAME, chip)) { 2445 KBUILD_MODNAME, chip)) {
2442 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2446 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
2443 snd_ymfpci_free(chip); 2447 snd_ymfpci_free(chip);
2444 return -EBUSY; 2448 return -EBUSY;
2445 } 2449 }
@@ -2453,7 +2457,7 @@ int snd_ymfpci_create(struct snd_card *card,
2453 2457
2454 err = snd_ymfpci_request_firmware(chip); 2458 err = snd_ymfpci_request_firmware(chip);
2455 if (err < 0) { 2459 if (err < 0) {
2456 snd_printk(KERN_ERR "firmware request failed: %d\n", err); 2460 dev_err(chip->card->dev, "firmware request failed: %d\n", err);
2457 snd_ymfpci_free(chip); 2461 snd_ymfpci_free(chip);
2458 return err; 2462 return err;
2459 } 2463 }
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index e0fe0d92db8c..dcddfc354ba6 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -106,7 +106,7 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
106 } 106 }
107 if (regidx < 0) { 107 if (regidx < 0) {
108 mutex_unlock(&register_mutex); 108 mutex_unlock(&register_mutex);
109 snd_printk(KERN_ERR PREFIX "too many cards registered.\n"); 109 dev_err(&intf->dev, "too many cards registered.\n");
110 return -ENODEV; 110 return -ENODEV;
111 } 111 }
112 devices[regidx] = device; 112 devices[regidx] = device;
@@ -121,13 +121,13 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
121 121
122 /* if we are here, card can be registered in alsa. */ 122 /* if we are here, card can be registered in alsa. */
123 if (usb_set_interface(device, 0, 0) != 0) { 123 if (usb_set_interface(device, 0, 0) != 0) {
124 snd_printk(KERN_ERR PREFIX "can't set first interface.\n"); 124 dev_err(&intf->dev, "can't set first interface.\n");
125 return -EIO; 125 return -EIO;
126 } 126 }
127 ret = snd_card_new(&intf->dev, index[regidx], id[regidx], 127 ret = snd_card_new(&intf->dev, index[regidx], id[regidx],
128 THIS_MODULE, sizeof(struct sfire_chip), &card); 128 THIS_MODULE, sizeof(struct sfire_chip), &card);
129 if (ret < 0) { 129 if (ret < 0) {
130 snd_printk(KERN_ERR PREFIX "cannot create alsa card.\n"); 130 dev_err(&intf->dev, "cannot create alsa card.\n");
131 return ret; 131 return ret;
132 } 132 }
133 strcpy(card->driver, "6FireUSB"); 133 strcpy(card->driver, "6FireUSB");
@@ -168,7 +168,7 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
168 168
169 ret = snd_card_register(card); 169 ret = snd_card_register(card);
170 if (ret < 0) { 170 if (ret < 0) {
171 snd_printk(KERN_ERR PREFIX "cannot register card."); 171 dev_err(&intf->dev, "cannot register card.");
172 usb6fire_chip_destroy(chip); 172 usb6fire_chip_destroy(chip);
173 return ret; 173 return ret;
174 } 174 }
diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c
index 23452ee617e1..161215d78d95 100644
--- a/sound/usb/6fire/comm.c
+++ b/sound/usb/6fire/comm.c
@@ -51,7 +51,7 @@ static void usb6fire_comm_receiver_handler(struct urb *urb)
51 urb->status = 0; 51 urb->status = 0;
52 urb->actual_length = 0; 52 urb->actual_length = 0;
53 if (usb_submit_urb(urb, GFP_ATOMIC) < 0) 53 if (usb_submit_urb(urb, GFP_ATOMIC) < 0)
54 snd_printk(KERN_WARNING PREFIX 54 dev_warn(&urb->dev->dev,
55 "comm data receiver aborted.\n"); 55 "comm data receiver aborted.\n");
56 } 56 }
57} 57}
@@ -179,7 +179,7 @@ int usb6fire_comm_init(struct sfire_chip *chip)
179 if (ret < 0) { 179 if (ret < 0) {
180 kfree(rt->receiver_buffer); 180 kfree(rt->receiver_buffer);
181 kfree(rt); 181 kfree(rt);
182 snd_printk(KERN_ERR PREFIX "cannot create comm data receiver."); 182 dev_err(&chip->dev->dev, "cannot create comm data receiver.");
183 return ret; 183 return ret;
184 } 184 }
185 chip->comm = rt; 185 chip->comm = rt;
diff --git a/sound/usb/6fire/control.c b/sound/usb/6fire/control.c
index f6434c245720..184e3987ac24 100644
--- a/sound/usb/6fire/control.c
+++ b/sound/usb/6fire/control.c
@@ -194,7 +194,8 @@ static int usb6fire_control_output_vol_put(struct snd_kcontrol *kcontrol,
194 int changed = 0; 194 int changed = 0;
195 195
196 if (ch > 4) { 196 if (ch > 4) {
197 snd_printk(KERN_ERR PREFIX "Invalid channel in volume control."); 197 dev_err(&rt->chip->dev->dev,
198 "Invalid channel in volume control.");
198 return -EINVAL; 199 return -EINVAL;
199 } 200 }
200 201
@@ -222,7 +223,8 @@ static int usb6fire_control_output_vol_get(struct snd_kcontrol *kcontrol,
222 unsigned int ch = kcontrol->private_value; 223 unsigned int ch = kcontrol->private_value;
223 224
224 if (ch > 4) { 225 if (ch > 4) {
225 snd_printk(KERN_ERR PREFIX "Invalid channel in volume control."); 226 dev_err(&rt->chip->dev->dev,
227 "Invalid channel in volume control.");
226 return -EINVAL; 228 return -EINVAL;
227 } 229 }
228 230
@@ -240,7 +242,8 @@ static int usb6fire_control_output_mute_put(struct snd_kcontrol *kcontrol,
240 u8 value = 0; 242 u8 value = 0;
241 243
242 if (ch > 4) { 244 if (ch > 4) {
243 snd_printk(KERN_ERR PREFIX "Invalid channel in volume control."); 245 dev_err(&rt->chip->dev->dev,
246 "Invalid channel in volume control.");
244 return -EINVAL; 247 return -EINVAL;
245 } 248 }
246 249
@@ -265,7 +268,8 @@ static int usb6fire_control_output_mute_get(struct snd_kcontrol *kcontrol,
265 u8 value = rt->output_mute >> ch; 268 u8 value = rt->output_mute >> ch;
266 269
267 if (ch > 4) { 270 if (ch > 4) {
268 snd_printk(KERN_ERR PREFIX "Invalid channel in volume control."); 271 dev_err(&rt->chip->dev->dev,
272 "Invalid channel in volume control.");
269 return -EINVAL; 273 return -EINVAL;
270 } 274 }
271 275
@@ -594,14 +598,14 @@ int usb6fire_control_init(struct sfire_chip *chip)
594 ret = usb6fire_control_add_virtual(rt, chip->card, 598 ret = usb6fire_control_add_virtual(rt, chip->card,
595 "Master Playback Volume", vol_elements); 599 "Master Playback Volume", vol_elements);
596 if (ret) { 600 if (ret) {
597 snd_printk(KERN_ERR PREFIX "cannot add control.\n"); 601 dev_err(&chip->dev->dev, "cannot add control.\n");
598 kfree(rt); 602 kfree(rt);
599 return ret; 603 return ret;
600 } 604 }
601 ret = usb6fire_control_add_virtual(rt, chip->card, 605 ret = usb6fire_control_add_virtual(rt, chip->card,
602 "Master Playback Switch", mute_elements); 606 "Master Playback Switch", mute_elements);
603 if (ret) { 607 if (ret) {
604 snd_printk(KERN_ERR PREFIX "cannot add control.\n"); 608 dev_err(&chip->dev->dev, "cannot add control.\n");
605 kfree(rt); 609 kfree(rt);
606 return ret; 610 return ret;
607 } 611 }
@@ -611,7 +615,7 @@ int usb6fire_control_init(struct sfire_chip *chip)
611 ret = snd_ctl_add(chip->card, snd_ctl_new1(&elements[i], rt)); 615 ret = snd_ctl_add(chip->card, snd_ctl_new1(&elements[i], rt));
612 if (ret < 0) { 616 if (ret < 0) {
613 kfree(rt); 617 kfree(rt);
614 snd_printk(KERN_ERR PREFIX "cannot add control.\n"); 618 dev_err(&chip->dev->dev, "cannot add control.\n");
615 return ret; 619 return ret;
616 } 620 }
617 i++; 621 i++;
diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
index 780bf3f62d28..3b02e54b8f6d 100644
--- a/sound/usb/6fire/firmware.c
+++ b/sound/usb/6fire/firmware.c
@@ -219,16 +219,16 @@ static int usb6fire_fw_ezusb_upload(
219 ret = request_firmware(&fw, fwname, &device->dev); 219 ret = request_firmware(&fw, fwname, &device->dev);
220 if (ret < 0) { 220 if (ret < 0) {
221 kfree(rec); 221 kfree(rec);
222 snd_printk(KERN_ERR PREFIX "error requesting ezusb " 222 dev_err(&intf->dev,
223 "firmware %s.\n", fwname); 223 "error requesting ezusb firmware %s.\n", fwname);
224 return ret; 224 return ret;
225 } 225 }
226 ret = usb6fire_fw_ihex_init(fw, rec); 226 ret = usb6fire_fw_ihex_init(fw, rec);
227 if (ret < 0) { 227 if (ret < 0) {
228 kfree(rec); 228 kfree(rec);
229 release_firmware(fw); 229 release_firmware(fw);
230 snd_printk(KERN_ERR PREFIX "error validating ezusb " 230 dev_err(&intf->dev,
231 "firmware %s.\n", fwname); 231 "error validating ezusb firmware %s.\n", fwname);
232 return ret; 232 return ret;
233 } 233 }
234 /* upload firmware image */ 234 /* upload firmware image */
@@ -237,8 +237,9 @@ static int usb6fire_fw_ezusb_upload(
237 if (ret < 0) { 237 if (ret < 0) {
238 kfree(rec); 238 kfree(rec);
239 release_firmware(fw); 239 release_firmware(fw);
240 snd_printk(KERN_ERR PREFIX "unable to upload ezusb " 240 dev_err(&intf->dev,
241 "firmware %s: begin message.\n", fwname); 241 "unable to upload ezusb firmware %s: begin message.\n",
242 fwname);
242 return ret; 243 return ret;
243 } 244 }
244 245
@@ -248,8 +249,9 @@ static int usb6fire_fw_ezusb_upload(
248 if (ret < 0) { 249 if (ret < 0) {
249 kfree(rec); 250 kfree(rec);
250 release_firmware(fw); 251 release_firmware(fw);
251 snd_printk(KERN_ERR PREFIX "unable to upload ezusb " 252 dev_err(&intf->dev,
252 "firmware %s: data urb.\n", fwname); 253 "unable to upload ezusb firmware %s: data urb.\n",
254 fwname);
253 return ret; 255 return ret;
254 } 256 }
255 } 257 }
@@ -260,8 +262,9 @@ static int usb6fire_fw_ezusb_upload(
260 ret = usb6fire_fw_ezusb_write(device, 0xa0, postaddr, 262 ret = usb6fire_fw_ezusb_write(device, 0xa0, postaddr,
261 postdata, postlen); 263 postdata, postlen);
262 if (ret < 0) { 264 if (ret < 0) {
263 snd_printk(KERN_ERR PREFIX "unable to upload ezusb " 265 dev_err(&intf->dev,
264 "firmware %s: post urb.\n", fwname); 266 "unable to upload ezusb firmware %s: post urb.\n",
267 fwname);
265 return ret; 268 return ret;
266 } 269 }
267 } 270 }
@@ -269,8 +272,9 @@ static int usb6fire_fw_ezusb_upload(
269 data = 0x00; /* resume ezusb cpu */ 272 data = 0x00; /* resume ezusb cpu */
270 ret = usb6fire_fw_ezusb_write(device, 0xa0, 0xe600, &data, 1); 273 ret = usb6fire_fw_ezusb_write(device, 0xa0, 0xe600, &data, 1);
271 if (ret < 0) { 274 if (ret < 0) {
272 snd_printk(KERN_ERR PREFIX "unable to upload ezusb " 275 dev_err(&intf->dev,
273 "firmware %s: end message.\n", fwname); 276 "unable to upload ezusb firmware %s: end message.\n",
277 fwname);
274 return ret; 278 return ret;
275 } 279 }
276 return 0; 280 return 0;
@@ -292,7 +296,7 @@ static int usb6fire_fw_fpga_upload(
292 296
293 ret = request_firmware(&fw, fwname, &device->dev); 297 ret = request_firmware(&fw, fwname, &device->dev);
294 if (ret < 0) { 298 if (ret < 0) {
295 snd_printk(KERN_ERR PREFIX "unable to get fpga firmware %s.\n", 299 dev_err(&intf->dev, "unable to get fpga firmware %s.\n",
296 fwname); 300 fwname);
297 kfree(buffer); 301 kfree(buffer);
298 return -EIO; 302 return -EIO;
@@ -305,8 +309,8 @@ static int usb6fire_fw_fpga_upload(
305 if (ret < 0) { 309 if (ret < 0) {
306 kfree(buffer); 310 kfree(buffer);
307 release_firmware(fw); 311 release_firmware(fw);
308 snd_printk(KERN_ERR PREFIX "unable to upload fpga firmware: " 312 dev_err(&intf->dev,
309 "begin urb.\n"); 313 "unable to upload fpga firmware: begin urb.\n");
310 return ret; 314 return ret;
311 } 315 }
312 316
@@ -318,8 +322,8 @@ static int usb6fire_fw_fpga_upload(
318 if (ret < 0) { 322 if (ret < 0) {
319 release_firmware(fw); 323 release_firmware(fw);
320 kfree(buffer); 324 kfree(buffer);
321 snd_printk(KERN_ERR PREFIX "unable to upload fpga " 325 dev_err(&intf->dev,
322 "firmware: fw urb.\n"); 326 "unable to upload fpga firmware: fw urb.\n");
323 return ret; 327 return ret;
324 } 328 }
325 } 329 }
@@ -328,8 +332,8 @@ static int usb6fire_fw_fpga_upload(
328 332
329 ret = usb6fire_fw_ezusb_write(device, 9, 0, NULL, 0); 333 ret = usb6fire_fw_ezusb_write(device, 9, 0, NULL, 0);
330 if (ret < 0) { 334 if (ret < 0) {
331 snd_printk(KERN_ERR PREFIX "unable to upload fpga firmware: " 335 dev_err(&intf->dev,
332 "end urb.\n"); 336 "unable to upload fpga firmware: end urb.\n");
333 return ret; 337 return ret;
334 } 338 }
335 return 0; 339 return 0;
@@ -338,7 +342,7 @@ static int usb6fire_fw_fpga_upload(
338/* check, if the firmware version the devices has currently loaded 342/* check, if the firmware version the devices has currently loaded
339 * is known by this driver. 'version' needs to have 4 bytes version 343 * is known by this driver. 'version' needs to have 4 bytes version
340 * info data. */ 344 * info data. */
341static int usb6fire_fw_check(u8 *version) 345static int usb6fire_fw_check(struct usb_interface *intf, const u8 *version)
342{ 346{
343 int i; 347 int i;
344 348
@@ -346,7 +350,7 @@ static int usb6fire_fw_check(u8 *version)
346 if (!memcmp(version, known_fw_versions + i, 2)) 350 if (!memcmp(version, known_fw_versions + i, 2))
347 return 0; 351 return 0;
348 352
349 snd_printk(KERN_ERR PREFIX "invalid fimware version in device: %4ph. " 353 dev_err(&intf->dev, "invalid fimware version in device: %4ph. "
350 "please reconnect to power. if this failure " 354 "please reconnect to power. if this failure "
351 "still happens, check your firmware installation.", 355 "still happens, check your firmware installation.",
352 version); 356 version);
@@ -364,16 +368,16 @@ int usb6fire_fw_init(struct usb_interface *intf)
364 368
365 ret = usb6fire_fw_ezusb_read(device, 1, 0, buffer, 8); 369 ret = usb6fire_fw_ezusb_read(device, 1, 0, buffer, 8);
366 if (ret < 0) { 370 if (ret < 0) {
367 snd_printk(KERN_ERR PREFIX "unable to receive device " 371 dev_err(&intf->dev,
368 "firmware state.\n"); 372 "unable to receive device firmware state.\n");
369 return ret; 373 return ret;
370 } 374 }
371 if (buffer[0] != 0xeb || buffer[1] != 0xaa || buffer[2] != 0x55) { 375 if (buffer[0] != 0xeb || buffer[1] != 0xaa || buffer[2] != 0x55) {
372 snd_printk(KERN_ERR PREFIX "unknown device firmware state " 376 dev_err(&intf->dev,
373 "received from device: "); 377 "unknown device firmware state received from device:");
374 for (i = 0; i < 8; i++) 378 for (i = 0; i < 8; i++)
375 snd_printk("%02x ", buffer[i]); 379 printk(KERN_CONT "%02x ", buffer[i]);
376 snd_printk("\n"); 380 printk(KERN_CONT "\n");
377 return -EIO; 381 return -EIO;
378 } 382 }
379 /* do we need fpga loader ezusb firmware? */ 383 /* do we need fpga loader ezusb firmware? */
@@ -386,7 +390,7 @@ int usb6fire_fw_init(struct usb_interface *intf)
386 } 390 }
387 /* do we need fpga firmware and application ezusb firmware? */ 391 /* do we need fpga firmware and application ezusb firmware? */
388 else if (buffer[3] == 0x02) { 392 else if (buffer[3] == 0x02) {
389 ret = usb6fire_fw_check(buffer + 4); 393 ret = usb6fire_fw_check(intf, buffer + 4);
390 if (ret < 0) 394 if (ret < 0)
391 return ret; 395 return ret;
392 ret = usb6fire_fw_fpga_upload(intf, "6fire/dmx6firecf.bin"); 396 ret = usb6fire_fw_fpga_upload(intf, "6fire/dmx6firecf.bin");
@@ -402,14 +406,14 @@ int usb6fire_fw_init(struct usb_interface *intf)
402 } 406 }
403 /* all fw loaded? */ 407 /* all fw loaded? */
404 else if (buffer[3] == 0x03) 408 else if (buffer[3] == 0x03)
405 return usb6fire_fw_check(buffer + 4); 409 return usb6fire_fw_check(intf, buffer + 4);
406 /* unknown data? */ 410 /* unknown data? */
407 else { 411 else {
408 snd_printk(KERN_ERR PREFIX "unknown device firmware state " 412 dev_err(&intf->dev,
409 "received from device: "); 413 "unknown device firmware state received from device: ");
410 for (i = 0; i < 8; i++) 414 for (i = 0; i < 8; i++)
411 snd_printk("%02x ", buffer[i]); 415 printk(KERN_CONT "%02x ", buffer[i]);
412 snd_printk("\n"); 416 printk(KERN_CONT "\n");
413 return -EIO; 417 return -EIO;
414 } 418 }
415 return 0; 419 return 0;
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
index f3dd7266c391..3d410969553e 100644
--- a/sound/usb/6fire/midi.c
+++ b/sound/usb/6fire/midi.c
@@ -41,8 +41,9 @@ static void usb6fire_midi_out_handler(struct urb *urb)
41 41
42 ret = usb_submit_urb(urb, GFP_ATOMIC); 42 ret = usb_submit_urb(urb, GFP_ATOMIC);
43 if (ret < 0) 43 if (ret < 0)
44 snd_printk(KERN_ERR PREFIX "midi out urb " 44 dev_err(&urb->dev->dev,
45 "submit failed: %d\n", ret); 45 "midi out urb submit failed: %d\n",
46 ret);
46 } else /* no more data to transmit */ 47 } else /* no more data to transmit */
47 rt->out = NULL; 48 rt->out = NULL;
48 } 49 }
@@ -94,8 +95,9 @@ static void usb6fire_midi_out_trigger(
94 95
95 ret = usb_submit_urb(urb, GFP_ATOMIC); 96 ret = usb_submit_urb(urb, GFP_ATOMIC);
96 if (ret < 0) 97 if (ret < 0)
97 snd_printk(KERN_ERR PREFIX "midi out urb " 98 dev_err(&urb->dev->dev,
98 "submit failed: %d\n", ret); 99 "midi out urb submit failed: %d\n",
100 ret);
99 else 101 else
100 rt->out = alsa_sub; 102 rt->out = alsa_sub;
101 } 103 }
@@ -181,7 +183,7 @@ int usb6fire_midi_init(struct sfire_chip *chip)
181 if (ret < 0) { 183 if (ret < 0) {
182 kfree(rt->out_buffer); 184 kfree(rt->out_buffer);
183 kfree(rt); 185 kfree(rt);
184 snd_printk(KERN_ERR PREFIX "unable to create midi.\n"); 186 dev_err(&chip->dev->dev, "unable to create midi.\n");
185 return ret; 187 return ret;
186 } 188 }
187 rt->instance->private_data = rt; 189 rt->instance->private_data = rt;
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index b5eb97fdc842..ba40489b2de4 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -79,32 +79,35 @@ static int usb6fire_pcm_set_rate(struct pcm_runtime *rt)
79 ctrl_rt->usb_streaming = false; 79 ctrl_rt->usb_streaming = false;
80 ret = ctrl_rt->update_streaming(ctrl_rt); 80 ret = ctrl_rt->update_streaming(ctrl_rt);
81 if (ret < 0) { 81 if (ret < 0) {
82 snd_printk(KERN_ERR PREFIX "error stopping streaming while " 82 dev_err(&rt->chip->dev->dev,
83 "setting samplerate %d.\n", rates[rt->rate]); 83 "error stopping streaming while setting samplerate %d.\n",
84 rates[rt->rate]);
84 return ret; 85 return ret;
85 } 86 }
86 87
87 ret = ctrl_rt->set_rate(ctrl_rt, rt->rate); 88 ret = ctrl_rt->set_rate(ctrl_rt, rt->rate);
88 if (ret < 0) { 89 if (ret < 0) {
89 snd_printk(KERN_ERR PREFIX "error setting samplerate %d.\n", 90 dev_err(&rt->chip->dev->dev,
90 rates[rt->rate]); 91 "error setting samplerate %d.\n",
92 rates[rt->rate]);
91 return ret; 93 return ret;
92 } 94 }
93 95
94 ret = ctrl_rt->set_channels(ctrl_rt, OUT_N_CHANNELS, IN_N_CHANNELS, 96 ret = ctrl_rt->set_channels(ctrl_rt, OUT_N_CHANNELS, IN_N_CHANNELS,
95 false, false); 97 false, false);
96 if (ret < 0) { 98 if (ret < 0) {
97 snd_printk(KERN_ERR PREFIX "error initializing channels " 99 dev_err(&rt->chip->dev->dev,
98 "while setting samplerate %d.\n", 100 "error initializing channels while setting samplerate %d.\n",
99 rates[rt->rate]); 101 rates[rt->rate]);
100 return ret; 102 return ret;
101 } 103 }
102 104
103 ctrl_rt->usb_streaming = true; 105 ctrl_rt->usb_streaming = true;
104 ret = ctrl_rt->update_streaming(ctrl_rt); 106 ret = ctrl_rt->update_streaming(ctrl_rt);
105 if (ret < 0) { 107 if (ret < 0) {
106 snd_printk(KERN_ERR PREFIX "error starting streaming while " 108 dev_err(&rt->chip->dev->dev,
107 "setting samplerate %d.\n", rates[rt->rate]); 109 "error starting streaming while setting samplerate %d.\n",
110 rates[rt->rate]);
108 return ret; 111 return ret;
109 } 112 }
110 113
@@ -124,7 +127,7 @@ static struct pcm_substream *usb6fire_pcm_get_substream(
124 return &rt->playback; 127 return &rt->playback;
125 else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE) 128 else if (alsa_sub->stream == SNDRV_PCM_STREAM_CAPTURE)
126 return &rt->capture; 129 return &rt->capture;
127 snd_printk(KERN_ERR PREFIX "error getting pcm substream slot.\n"); 130 dev_err(&rt->chip->dev->dev, "error getting pcm substream slot.\n");
128 return NULL; 131 return NULL;
129} 132}
130 133
@@ -257,7 +260,7 @@ static void usb6fire_pcm_playback(struct pcm_substream *sub,
257 else if (alsa_rt->format == SNDRV_PCM_FORMAT_S24_LE) 260 else if (alsa_rt->format == SNDRV_PCM_FORMAT_S24_LE)
258 dest = (u32 *) (urb->buffer); 261 dest = (u32 *) (urb->buffer);
259 else { 262 else {
260 snd_printk(KERN_ERR PREFIX "Unknown sample format."); 263 dev_err(&rt->chip->dev->dev, "Unknown sample format.");
261 return; 264 return;
262 } 265 }
263 266
@@ -307,8 +310,8 @@ static void usb6fire_pcm_in_urb_handler(struct urb *usb_urb)
307 } 310 }
308 311
309 if (rt->stream_state == STREAM_DISABLED) { 312 if (rt->stream_state == STREAM_DISABLED) {
310 snd_printk(KERN_ERR PREFIX "internal error: " 313 dev_err(&rt->chip->dev->dev,
311 "stream disabled in in-urb handler.\n"); 314 "internal error: stream disabled in in-urb handler.\n");
312 return; 315 return;
313 } 316 }
314 317
@@ -410,7 +413,7 @@ static int usb6fire_pcm_open(struct snd_pcm_substream *alsa_sub)
410 413
411 if (!sub) { 414 if (!sub) {
412 mutex_unlock(&rt->stream_mutex); 415 mutex_unlock(&rt->stream_mutex);
413 snd_printk(KERN_ERR PREFIX "invalid stream type.\n"); 416 dev_err(&rt->chip->dev->dev, "invalid stream type.\n");
414 return -EINVAL; 417 return -EINVAL;
415 } 418 }
416 419
@@ -481,8 +484,9 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
481 break; 484 break;
482 if (rt->rate == ARRAY_SIZE(rates)) { 485 if (rt->rate == ARRAY_SIZE(rates)) {
483 mutex_unlock(&rt->stream_mutex); 486 mutex_unlock(&rt->stream_mutex);
484 snd_printk("invalid rate %d in prepare.\n", 487 dev_err(&rt->chip->dev->dev,
485 alsa_rt->rate); 488 "invalid rate %d in prepare.\n",
489 alsa_rt->rate);
486 return -EINVAL; 490 return -EINVAL;
487 } 491 }
488 492
@@ -494,8 +498,8 @@ static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub)
494 ret = usb6fire_pcm_stream_start(rt); 498 ret = usb6fire_pcm_stream_start(rt);
495 if (ret) { 499 if (ret) {
496 mutex_unlock(&rt->stream_mutex); 500 mutex_unlock(&rt->stream_mutex);
497 snd_printk(KERN_ERR PREFIX 501 dev_err(&rt->chip->dev->dev,
498 "could not start pcm stream.\n"); 502 "could not start pcm stream.\n");
499 return ret; 503 return ret;
500 } 504 }
501 } 505 }
@@ -650,7 +654,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
650 if (ret < 0) { 654 if (ret < 0) {
651 usb6fire_pcm_buffers_destroy(rt); 655 usb6fire_pcm_buffers_destroy(rt);
652 kfree(rt); 656 kfree(rt);
653 snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n"); 657 dev_err(&chip->dev->dev, "cannot create pcm instance.\n");
654 return ret; 658 return ret;
655 } 659 }
656 660
@@ -662,8 +666,8 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
662 if (ret) { 666 if (ret) {
663 usb6fire_pcm_buffers_destroy(rt); 667 usb6fire_pcm_buffers_destroy(rt);
664 kfree(rt); 668 kfree(rt);
665 snd_printk(KERN_ERR PREFIX 669 dev_err(&chip->dev->dev,
666 "error preallocating pcm buffers.\n"); 670 "error preallocating pcm buffers.\n");
667 return ret; 671 return ret;
668 } 672 }
669 rt->instance = pcm; 673 rt->instance = pcm;
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 0cfdc2d3b631..893d5a1afc3c 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -139,8 +139,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
139 struct usb_interface *iface = usb_ifnum_to_if(dev, interface); 139 struct usb_interface *iface = usb_ifnum_to_if(dev, interface);
140 140
141 if (!iface) { 141 if (!iface) {
142 snd_printk(KERN_ERR "%d:%u:%d : does not exist\n", 142 dev_err(&dev->dev, "%u:%d : does not exist\n",
143 dev->devnum, ctrlif, interface); 143 ctrlif, interface);
144 return -EINVAL; 144 return -EINVAL;
145 } 145 }
146 146
@@ -165,8 +165,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
165 } 165 }
166 166
167 if (usb_interface_claimed(iface)) { 167 if (usb_interface_claimed(iface)) {
168 snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", 168 dev_dbg(&dev->dev, "%d:%d: skipping, already claimed\n",
169 dev->devnum, ctrlif, interface); 169 ctrlif, interface);
170 return -EINVAL; 170 return -EINVAL;
171 } 171 }
172 172
@@ -176,8 +176,9 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
176 int err = snd_usbmidi_create(chip->card, iface, 176 int err = snd_usbmidi_create(chip->card, iface,
177 &chip->midi_list, NULL); 177 &chip->midi_list, NULL);
178 if (err < 0) { 178 if (err < 0) {
179 snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", 179 dev_err(&dev->dev,
180 dev->devnum, ctrlif, interface); 180 "%u:%d: cannot create sequencer device\n",
181 ctrlif, interface);
181 return -EINVAL; 182 return -EINVAL;
182 } 183 }
183 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); 184 usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
@@ -188,14 +189,15 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
188 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && 189 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO &&
189 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || 190 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
190 altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) { 191 altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) {
191 snd_printdd(KERN_ERR "%d:%u:%d: skipping non-supported interface %d\n", 192 dev_dbg(&dev->dev,
192 dev->devnum, ctrlif, interface, altsd->bInterfaceClass); 193 "%u:%d: skipping non-supported interface %d\n",
194 ctrlif, interface, altsd->bInterfaceClass);
193 /* skip non-supported classes */ 195 /* skip non-supported classes */
194 return -EINVAL; 196 return -EINVAL;
195 } 197 }
196 198
197 if (snd_usb_get_speed(dev) == USB_SPEED_LOW) { 199 if (snd_usb_get_speed(dev) == USB_SPEED_LOW) {
198 snd_printk(KERN_ERR "low speed audio streaming not supported\n"); 200 dev_err(&dev->dev, "low speed audio streaming not supported\n");
199 return -EINVAL; 201 return -EINVAL;
200 } 202 }
201 203
@@ -228,26 +230,27 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
228 protocol = altsd->bInterfaceProtocol; 230 protocol = altsd->bInterfaceProtocol;
229 231
230 if (!control_header) { 232 if (!control_header) {
231 snd_printk(KERN_ERR "cannot find UAC_HEADER\n"); 233 dev_err(&dev->dev, "cannot find UAC_HEADER\n");
232 return -EINVAL; 234 return -EINVAL;
233 } 235 }
234 236
235 switch (protocol) { 237 switch (protocol) {
236 default: 238 default:
237 snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n", 239 dev_warn(&dev->dev,
238 protocol); 240 "unknown interface protocol %#02x, assuming v1\n",
241 protocol);
239 /* fall through */ 242 /* fall through */
240 243
241 case UAC_VERSION_1: { 244 case UAC_VERSION_1: {
242 struct uac1_ac_header_descriptor *h1 = control_header; 245 struct uac1_ac_header_descriptor *h1 = control_header;
243 246
244 if (!h1->bInCollection) { 247 if (!h1->bInCollection) {
245 snd_printk(KERN_INFO "skipping empty audio interface (v1)\n"); 248 dev_info(&dev->dev, "skipping empty audio interface (v1)\n");
246 return -EINVAL; 249 return -EINVAL;
247 } 250 }
248 251
249 if (h1->bLength < sizeof(*h1) + h1->bInCollection) { 252 if (h1->bLength < sizeof(*h1) + h1->bInCollection) {
250 snd_printk(KERN_ERR "invalid UAC_HEADER (v1)\n"); 253 dev_err(&dev->dev, "invalid UAC_HEADER (v1)\n");
251 return -EINVAL; 254 return -EINVAL;
252 } 255 }
253 256
@@ -277,7 +280,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
277 } 280 }
278 281
279 if (!assoc) { 282 if (!assoc) {
280 snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); 283 dev_err(&dev->dev, "Audio class v2 interfaces need an interface association\n");
281 return -EINVAL; 284 return -EINVAL;
282 } 285 }
283 286
@@ -351,14 +354,14 @@ static int snd_usb_audio_create(struct usb_interface *intf,
351 case USB_SPEED_SUPER: 354 case USB_SPEED_SUPER:
352 break; 355 break;
353 default: 356 default:
354 snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev)); 357 dev_err(&dev->dev, "unknown device speed %d\n", snd_usb_get_speed(dev));
355 return -ENXIO; 358 return -ENXIO;
356 } 359 }
357 360
358 err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, 361 err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE,
359 0, &card); 362 0, &card);
360 if (err < 0) { 363 if (err < 0) {
361 snd_printk(KERN_ERR "cannot create card instance %d\n", idx); 364 dev_err(&dev->dev, "cannot create card instance %d\n", idx);
362 return err; 365 return err;
363 } 366 }
364 367
@@ -499,7 +502,7 @@ snd_usb_audio_probe(struct usb_device *dev,
499 for (i = 0; i < SNDRV_CARDS; i++) { 502 for (i = 0; i < SNDRV_CARDS; i++) {
500 if (usb_chip[i] && usb_chip[i]->dev == dev) { 503 if (usb_chip[i] && usb_chip[i]->dev == dev) {
501 if (usb_chip[i]->shutdown) { 504 if (usb_chip[i]->shutdown) {
502 snd_printk(KERN_ERR "USB device is in the shutdown state, cannot create a card instance\n"); 505 dev_err(&dev->dev, "USB device is in the shutdown state, cannot create a card instance\n");
503 goto __error; 506 goto __error;
504 } 507 }
505 chip = usb_chip[i]; 508 chip = usb_chip[i];
@@ -523,7 +526,7 @@ snd_usb_audio_probe(struct usb_device *dev,
523 break; 526 break;
524 } 527 }
525 if (!chip) { 528 if (!chip) {
526 printk(KERN_ERR "no available usb audio device\n"); 529 dev_err(&dev->dev, "no available usb audio device\n");
527 goto __error; 530 goto __error;
528 } 531 }
529 } 532 }
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 86f80c60b21f..03fed6611d9e 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -115,9 +115,9 @@ static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_i
115 return ret; 115 return ret;
116 116
117 if (ret != sizeof(pin)) { 117 if (ret != sizeof(pin)) {
118 snd_printk(KERN_ERR 118 usb_audio_err(chip,
119 "usb-audio:%d: setting selector (id %d) unexpected length %d\n", 119 "setting selector (id %d) unexpected length %d\n",
120 chip->dev->devnum, selector_id, ret); 120 selector_id, ret);
121 return -EINVAL; 121 return -EINVAL;
122 } 122 }
123 123
@@ -126,9 +126,9 @@ static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_i
126 return ret; 126 return ret;
127 127
128 if (ret != pin) { 128 if (ret != pin) {
129 snd_printk(KERN_ERR 129 usb_audio_err(chip,
130 "usb-audio:%d: setting selector (id %d) to %x failed (current: %d)\n", 130 "setting selector (id %d) to %x failed (current: %d)\n",
131 chip->dev->devnum, selector_id, pin, ret); 131 selector_id, pin, ret);
132 return -EINVAL; 132 return -EINVAL;
133 } 133 }
134 134
@@ -158,7 +158,8 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
158 &data, sizeof(data)); 158 &data, sizeof(data));
159 159
160 if (err < 0) { 160 if (err < 0) {
161 snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n", 161 dev_warn(&dev->dev,
162 "%s(): cannot get clock validity for id %d\n",
162 __func__, source_id); 163 __func__, source_id);
163 return 0; 164 return 0;
164 } 165 }
@@ -177,9 +178,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
177 entity_id &= 0xff; 178 entity_id &= 0xff;
178 179
179 if (test_and_set_bit(entity_id, visited)) { 180 if (test_and_set_bit(entity_id, visited)) {
180 snd_printk(KERN_WARNING 181 usb_audio_warn(chip,
181 "%s(): recursive clock topology detected, id %d.\n", 182 "%s(): recursive clock topology detected, id %d.\n",
182 __func__, entity_id); 183 __func__, entity_id);
183 return -EINVAL; 184 return -EINVAL;
184 } 185 }
185 186
@@ -188,8 +189,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
188 if (source) { 189 if (source) {
189 entity_id = source->bClockID; 190 entity_id = source->bClockID;
190 if (validate && !uac_clock_source_is_valid(chip, entity_id)) { 191 if (validate && !uac_clock_source_is_valid(chip, entity_id)) {
191 snd_printk(KERN_ERR "usb-audio:%d: clock source %d is not valid, cannot use\n", 192 usb_audio_err(chip,
192 chip->dev->devnum, entity_id); 193 "clock source %d is not valid, cannot use\n",
194 entity_id);
193 return -ENXIO; 195 return -ENXIO;
194 } 196 }
195 return entity_id; 197 return entity_id;
@@ -208,7 +210,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
208 /* Selector values are one-based */ 210 /* Selector values are one-based */
209 211
210 if (ret > selector->bNrInPins || ret < 1) { 212 if (ret > selector->bNrInPins || ret < 1) {
211 snd_printk(KERN_ERR 213 usb_audio_err(chip,
212 "%s(): selector reported illegal value, id %d, ret %d\n", 214 "%s(): selector reported illegal value, id %d, ret %d\n",
213 __func__, selector->bClockID, ret); 215 __func__, selector->bClockID, ret);
214 216
@@ -237,9 +239,9 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
237 if (err < 0) 239 if (err < 0)
238 continue; 240 continue;
239 241
240 snd_printk(KERN_INFO 242 usb_audio_info(chip,
241 "usb-audio:%d: found and selected valid clock source %d\n", 243 "found and selected valid clock source %d\n",
242 chip->dev->devnum, ret); 244 ret);
243 return ret; 245 return ret;
244 } 246 }
245 247
@@ -296,8 +298,8 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
296 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 298 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
297 UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, 299 UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
298 data, sizeof(data))) < 0) { 300 data, sizeof(data))) < 0) {
299 snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n", 301 dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n",
300 dev->devnum, iface, fmt->altsetting, rate, ep); 302 iface, fmt->altsetting, rate, ep);
301 return err; 303 return err;
302 } 304 }
303 305
@@ -305,14 +307,14 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
305 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, 307 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN,
306 UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, 308 UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
307 data, sizeof(data))) < 0) { 309 data, sizeof(data))) < 0) {
308 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n", 310 dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
309 dev->devnum, iface, fmt->altsetting, ep); 311 iface, fmt->altsetting, ep);
310 return 0; /* some devices don't support reading */ 312 return 0; /* some devices don't support reading */
311 } 313 }
312 314
313 crate = data[0] | (data[1] << 8) | (data[2] << 16); 315 crate = data[0] | (data[1] << 8) | (data[2] << 16);
314 if (crate != rate) { 316 if (crate != rate) {
315 snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); 317 dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate);
316 // runtime->rate = crate; 318 // runtime->rate = crate;
317 } 319 }
318 320
@@ -332,8 +334,8 @@ static int get_sample_rate_v2(struct snd_usb_audio *chip, int iface,
332 snd_usb_ctrl_intf(chip) | (clock << 8), 334 snd_usb_ctrl_intf(chip) | (clock << 8),
333 &data, sizeof(data)); 335 &data, sizeof(data));
334 if (err < 0) { 336 if (err < 0) {
335 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2): err %d\n", 337 dev_warn(&dev->dev, "%d:%d: cannot get freq (v2): err %d\n",
336 dev->devnum, iface, altsetting, err); 338 iface, altsetting, err);
337 return 0; 339 return 0;
338 } 340 }
339 341
@@ -369,8 +371,9 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
369 snd_usb_ctrl_intf(chip) | (clock << 8), 371 snd_usb_ctrl_intf(chip) | (clock << 8),
370 &data, sizeof(data)); 372 &data, sizeof(data));
371 if (err < 0) { 373 if (err < 0) {
372 snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2): err %d\n", 374 usb_audio_err(chip,
373 dev->devnum, iface, fmt->altsetting, rate, err); 375 "%d:%d: cannot set freq %d (v2): err %d\n",
376 iface, fmt->altsetting, rate, err);
374 return err; 377 return err;
375 } 378 }
376 379
@@ -381,14 +384,14 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
381 384
382 if (cur_rate != rate) { 385 if (cur_rate != rate) {
383 if (!writeable) { 386 if (!writeable) {
384 snd_printk(KERN_WARNING 387 usb_audio_warn(chip,
385 "%d:%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n", 388 "%d:%d: freq mismatch (RO clock): req %d, clock runs @%d\n",
386 dev->devnum, iface, fmt->altsetting, rate, cur_rate); 389 iface, fmt->altsetting, rate, cur_rate);
387 return -ENXIO; 390 return -ENXIO;
388 } 391 }
389 snd_printd(KERN_WARNING 392 usb_audio_dbg(chip,
390 "current rate %d is different from the runtime rate %d\n", 393 "current rate %d is different from the runtime rate %d\n",
391 cur_rate, rate); 394 cur_rate, rate);
392 } 395 }
393 396
394 /* Some devices doesn't respond to sample rate changes while the 397 /* Some devices doesn't respond to sample rate changes while the
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 83aabea259d7..e70a87e0d9fe 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -333,8 +333,9 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep)
333 333
334 err = usb_submit_urb(ctx->urb, GFP_ATOMIC); 334 err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
335 if (err < 0) 335 if (err < 0)
336 snd_printk(KERN_ERR "Unable to submit urb #%d: %d (urb %p)\n", 336 usb_audio_err(ep->chip,
337 ctx->index, err, ctx->urb); 337 "Unable to submit urb #%d: %d (urb %p)\n",
338 ctx->index, err, ctx->urb);
338 else 339 else
339 set_bit(ctx->index, &ep->active_mask); 340 set_bit(ctx->index, &ep->active_mask);
340 } 341 }
@@ -387,7 +388,7 @@ static void snd_complete_urb(struct urb *urb)
387 if (err == 0) 388 if (err == 0)
388 return; 389 return;
389 390
390 snd_printk(KERN_ERR "cannot submit urb (err = %d)\n", err); 391 usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
391 //snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 392 //snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
392 393
393exit_clear: 394exit_clear:
@@ -426,13 +427,14 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
426 if (ep->ep_num == ep_num && 427 if (ep->ep_num == ep_num &&
427 ep->iface == alts->desc.bInterfaceNumber && 428 ep->iface == alts->desc.bInterfaceNumber &&
428 ep->altsetting == alts->desc.bAlternateSetting) { 429 ep->altsetting == alts->desc.bAlternateSetting) {
429 snd_printdd(KERN_DEBUG "Re-using EP %x in iface %d,%d @%p\n", 430 usb_audio_dbg(ep->chip,
431 "Re-using EP %x in iface %d,%d @%p\n",
430 ep_num, ep->iface, ep->altsetting, ep); 432 ep_num, ep->iface, ep->altsetting, ep);
431 goto __exit_unlock; 433 goto __exit_unlock;
432 } 434 }
433 } 435 }
434 436
435 snd_printdd(KERN_DEBUG "Creating new %s %s endpoint #%x\n", 437 usb_audio_dbg(chip, "Creating new %s %s endpoint #%x\n",
436 is_playback ? "playback" : "capture", 438 is_playback ? "playback" : "capture",
437 type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync", 439 type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync",
438 ep_num); 440 ep_num);
@@ -496,8 +498,9 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
496 } while (time_before(jiffies, end_time)); 498 } while (time_before(jiffies, end_time));
497 499
498 if (alive) 500 if (alive)
499 snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", 501 usb_audio_err(ep->chip,
500 alive, ep->ep_num); 502 "timeout: still %d active urbs on EP #%x\n",
503 alive, ep->ep_num);
501 clear_bit(EP_FLAG_STOPPING, &ep->flags); 504 clear_bit(EP_FLAG_STOPPING, &ep->flags);
502 505
503 return 0; 506 return 0;
@@ -794,8 +797,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
794 int err; 797 int err;
795 798
796 if (ep->use_count != 0) { 799 if (ep->use_count != 0) {
797 snd_printk(KERN_WARNING "Unable to change format on ep #%x: already in use\n", 800 usb_audio_warn(ep->chip,
798 ep->ep_num); 801 "Unable to change format on ep #%x: already in use\n",
802 ep->ep_num);
799 return -EBUSY; 803 return -EBUSY;
800 } 804 }
801 805
@@ -830,8 +834,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
830 err = -EINVAL; 834 err = -EINVAL;
831 } 835 }
832 836
833 snd_printdd(KERN_DEBUG "Setting params for ep #%x (type %d, %d urbs), ret=%d\n", 837 usb_audio_dbg(ep->chip,
834 ep->ep_num, ep->type, ep->nurbs, err); 838 "Setting params for ep #%x (type %d, %d urbs), ret=%d\n",
839 ep->ep_num, ep->type, ep->nurbs, err);
835 840
836 return err; 841 return err;
837} 842}
@@ -906,8 +911,9 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
906 911
907 err = usb_submit_urb(urb, GFP_ATOMIC); 912 err = usb_submit_urb(urb, GFP_ATOMIC);
908 if (err < 0) { 913 if (err < 0) {
909 snd_printk(KERN_ERR "cannot submit urb %d, error %d: %s\n", 914 usb_audio_err(ep->chip,
910 i, err, usb_error_string(err)); 915 "cannot submit urb %d, error %d: %s\n",
916 i, err, usb_error_string(err));
911 goto __error; 917 goto __error;
912 } 918 }
913 set_bit(i, &ep->active_mask); 919 set_bit(i, &ep->active_mask);
diff --git a/sound/usb/format.c b/sound/usb/format.c
index d244fd3703d8..8bcc87cf5667 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -74,8 +74,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
74 if ((pcm_formats == 0) && 74 if ((pcm_formats == 0) &&
75 (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { 75 (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) {
76 /* some devices don't define this correctly... */ 76 /* some devices don't define this correctly... */
77 snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", 77 usb_audio_info(chip, "%u:%d : format type 0 is detected, processed as PCM\n",
78 chip->dev->devnum, fp->iface, fp->altsetting); 78 fp->iface, fp->altsetting);
79 format = 1 << UAC_FORMAT_TYPE_I_PCM; 79 format = 1 << UAC_FORMAT_TYPE_I_PCM;
80 } 80 }
81 if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) { 81 if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) {
@@ -83,9 +83,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
83 sample_width == 24 && sample_bytes == 2) 83 sample_width == 24 && sample_bytes == 2)
84 sample_bytes = 3; 84 sample_bytes = 3;
85 else if (sample_width > sample_bytes * 8) { 85 else if (sample_width > sample_bytes * 8) {
86 snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", 86 usb_audio_info(chip, "%u:%d : sample bitwidth %d in over sample bytes %d\n",
87 chip->dev->devnum, fp->iface, fp->altsetting, 87 fp->iface, fp->altsetting,
88 sample_width, sample_bytes); 88 sample_width, sample_bytes);
89 } 89 }
90 /* check the format byte size */ 90 /* check the format byte size */
91 switch (sample_bytes) { 91 switch (sample_bytes) {
@@ -108,9 +108,10 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
108 pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE; 108 pcm_formats |= SNDRV_PCM_FMTBIT_S32_LE;
109 break; 109 break;
110 default: 110 default:
111 snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n", 111 usb_audio_info(chip,
112 chip->dev->devnum, fp->iface, fp->altsetting, 112 "%u:%d : unsupported sample bitwidth %d in %d bytes\n",
113 sample_width, sample_bytes); 113 fp->iface, fp->altsetting,
114 sample_width, sample_bytes);
114 break; 115 break;
115 } 116 }
116 } 117 }
@@ -132,8 +133,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
132 pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW; 133 pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW;
133 } 134 }
134 if (format & ~0x3f) { 135 if (format & ~0x3f) {
135 snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n", 136 usb_audio_info(chip,
136 chip->dev->devnum, fp->iface, fp->altsetting, format); 137 "%u:%d : unsupported format bits %#x\n",
138 fp->iface, fp->altsetting, format);
137 } 139 }
138 140
139 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes); 141 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes);
@@ -158,8 +160,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
158 int nr_rates = fmt[offset]; 160 int nr_rates = fmt[offset];
159 161
160 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { 162 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) {
161 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 163 usb_audio_err(chip,
162 chip->dev->devnum, fp->iface, fp->altsetting); 164 "%u:%d : invalid UAC_FORMAT_TYPE desc\n",
165 fp->iface, fp->altsetting);
163 return -EINVAL; 166 return -EINVAL;
164 } 167 }
165 168
@@ -171,7 +174,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
171 174
172 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); 175 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
173 if (fp->rate_table == NULL) { 176 if (fp->rate_table == NULL) {
174 snd_printk(KERN_ERR "cannot malloc\n"); 177 usb_audio_err(chip, "cannot malloc\n");
175 return -ENOMEM; 178 return -ENOMEM;
176 } 179 }
177 180
@@ -222,7 +225,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
222 * get to know how many sample rates we have to expect. 225 * get to know how many sample rates we have to expect.
223 * Then fp->rate_table can be allocated and filled. 226 * Then fp->rate_table can be allocated and filled.
224 */ 227 */
225static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, 228static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip,
229 struct audioformat *fp, int nr_triplets,
226 const unsigned char *data) 230 const unsigned char *data)
227{ 231{
228 int i, nr_rates = 0; 232 int i, nr_rates = 0;
@@ -261,7 +265,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,
261 265
262 nr_rates++; 266 nr_rates++;
263 if (nr_rates >= MAX_NR_RATES) { 267 if (nr_rates >= MAX_NR_RATES) {
264 snd_printk(KERN_ERR "invalid uac2 rates\n"); 268 usb_audio_err(chip, "invalid uac2 rates\n");
265 break; 269 break;
266 } 270 }
267 271
@@ -287,7 +291,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
287 int clock = snd_usb_clock_find_source(chip, fp->clock, false); 291 int clock = snd_usb_clock_find_source(chip, fp->clock, false);
288 292
289 if (clock < 0) { 293 if (clock < 0) {
290 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n", 294 dev_err(&dev->dev,
295 "%s(): unable to find clock source (clock %d)\n",
291 __func__, clock); 296 __func__, clock);
292 goto err; 297 goto err;
293 } 298 }
@@ -300,7 +305,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
300 tmp, sizeof(tmp)); 305 tmp, sizeof(tmp));
301 306
302 if (ret < 0) { 307 if (ret < 0) {
303 snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n", 308 dev_err(&dev->dev,
309 "%s(): unable to retrieve number of sample rates (clock %d)\n",
304 __func__, clock); 310 __func__, clock);
305 goto err; 311 goto err;
306 } 312 }
@@ -321,7 +327,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
321 data, data_size); 327 data, data_size);
322 328
323 if (ret < 0) { 329 if (ret < 0) {
324 snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n", 330 dev_err(&dev->dev,
331 "%s(): unable to retrieve sample rate range (clock %d)\n",
325 __func__, clock); 332 __func__, clock);
326 ret = -EINVAL; 333 ret = -EINVAL;
327 goto err_free; 334 goto err_free;
@@ -332,7 +339,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
332 * will have to deal with. */ 339 * will have to deal with. */
333 kfree(fp->rate_table); 340 kfree(fp->rate_table);
334 fp->rate_table = NULL; 341 fp->rate_table = NULL;
335 fp->nr_rates = parse_uac2_sample_rate_range(fp, nr_triplets, data); 342 fp->nr_rates = parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
336 343
337 if (fp->nr_rates == 0) { 344 if (fp->nr_rates == 0) {
338 /* SNDRV_PCM_RATE_CONTINUOUS */ 345 /* SNDRV_PCM_RATE_CONTINUOUS */
@@ -348,7 +355,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
348 355
349 /* Call the triplet parser again, but this time, fp->rate_table is 356 /* Call the triplet parser again, but this time, fp->rate_table is
350 * allocated, so the rates will be stored */ 357 * allocated, so the rates will be stored */
351 parse_uac2_sample_rate_range(fp, nr_triplets, data); 358 parse_uac2_sample_rate_range(chip, fp, nr_triplets, data);
352 359
353err_free: 360err_free:
354 kfree(data); 361 kfree(data);
@@ -408,8 +415,9 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
408 } 415 }
409 416
410 if (fp->channels < 1) { 417 if (fp->channels < 1) {
411 snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", 418 usb_audio_err(chip,
412 chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); 419 "%u:%d : invalid channels %d\n",
420 fp->iface, fp->altsetting, fp->channels);
413 return -EINVAL; 421 return -EINVAL;
414 } 422 }
415 423
@@ -435,8 +443,9 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
435 fp->formats = SNDRV_PCM_FMTBIT_MPEG; 443 fp->formats = SNDRV_PCM_FMTBIT_MPEG;
436 break; 444 break;
437 default: 445 default:
438 snd_printd(KERN_INFO "%d:%u:%d : unknown format tag %#x is detected. processed as MPEG.\n", 446 usb_audio_info(chip,
439 chip->dev->devnum, fp->iface, fp->altsetting, format); 447 "%u:%d : unknown format tag %#x is detected. processed as MPEG.\n",
448 fp->iface, fp->altsetting, format);
440 fp->formats = SNDRV_PCM_FMTBIT_MPEG; 449 fp->formats = SNDRV_PCM_FMTBIT_MPEG;
441 break; 450 break;
442 } 451 }
@@ -449,7 +458,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
449 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; 458 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;
450 brate = le16_to_cpu(fmt->wMaxBitRate); 459 brate = le16_to_cpu(fmt->wMaxBitRate);
451 framesize = le16_to_cpu(fmt->wSamplesPerFrame); 460 framesize = le16_to_cpu(fmt->wSamplesPerFrame);
452 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 461 usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);
453 fp->frame_size = framesize; 462 fp->frame_size = framesize;
454 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */ 463 ret = parse_audio_format_rates_v1(chip, fp, _fmt, 8); /* fmt[8..] sample rates */
455 break; 464 break;
@@ -458,7 +467,7 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
458 struct uac_format_type_ii_ext_descriptor *fmt = _fmt; 467 struct uac_format_type_ii_ext_descriptor *fmt = _fmt;
459 brate = le16_to_cpu(fmt->wMaxBitRate); 468 brate = le16_to_cpu(fmt->wMaxBitRate);
460 framesize = le16_to_cpu(fmt->wSamplesPerFrame); 469 framesize = le16_to_cpu(fmt->wSamplesPerFrame);
461 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 470 usb_audio_info(chip, "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);
462 fp->frame_size = framesize; 471 fp->frame_size = framesize;
463 ret = parse_audio_format_rates_v2(chip, fp); 472 ret = parse_audio_format_rates_v2(chip, fp);
464 break; 473 break;
@@ -484,9 +493,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip,
484 err = parse_audio_format_ii(chip, fp, format, fmt); 493 err = parse_audio_format_ii(chip, fp, format, fmt);
485 break; 494 break;
486 default: 495 default:
487 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", 496 usb_audio_info(chip,
488 chip->dev->devnum, fp->iface, fp->altsetting, 497 "%u:%d : format type %d is not supported yet\n",
489 fmt->bFormatType); 498 fp->iface, fp->altsetting,
499 fmt->bFormatType);
490 return -ENOTSUPP; 500 return -ENOTSUPP;
491 } 501 }
492 fp->fmt_type = fmt->bFormatType; 502 fp->fmt_type = fmt->bFormatType;
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index b901f468b67a..9da74d2e8eee 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -191,16 +191,16 @@ static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags)
191{ 191{
192 int err = usb_submit_urb(urb, flags); 192 int err = usb_submit_urb(urb, flags);
193 if (err < 0 && err != -ENODEV) 193 if (err < 0 && err != -ENODEV)
194 snd_printk(KERN_ERR "usb_submit_urb: %d\n", err); 194 dev_err(&urb->dev->dev, "usb_submit_urb: %d\n", err);
195 return err; 195 return err;
196} 196}
197 197
198/* 198/*
199 * Error handling for URB completion functions. 199 * Error handling for URB completion functions.
200 */ 200 */
201static int snd_usbmidi_urb_error(int status) 201static int snd_usbmidi_urb_error(const struct urb *urb)
202{ 202{
203 switch (status) { 203 switch (urb->status) {
204 /* manually unlinked, or device gone */ 204 /* manually unlinked, or device gone */
205 case -ENOENT: 205 case -ENOENT:
206 case -ECONNRESET: 206 case -ECONNRESET:
@@ -213,7 +213,7 @@ static int snd_usbmidi_urb_error(int status)
213 case -EILSEQ: 213 case -EILSEQ:
214 return -EIO; 214 return -EIO;
215 default: 215 default:
216 snd_printk(KERN_ERR "urb status %d\n", status); 216 dev_err(&urb->dev->dev, "urb status %d\n", urb->status);
217 return 0; /* continue */ 217 return 0; /* continue */
218 } 218 }
219} 219}
@@ -227,7 +227,7 @@ static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int port
227 struct usbmidi_in_port* port = &ep->ports[portidx]; 227 struct usbmidi_in_port* port = &ep->ports[portidx];
228 228
229 if (!port->substream) { 229 if (!port->substream) {
230 snd_printd("unexpected port %d!\n", portidx); 230 dev_dbg(&ep->umidi->dev->dev, "unexpected port %d!\n", portidx);
231 return; 231 return;
232 } 232 }
233 if (!test_bit(port->substream->number, &ep->umidi->input_triggered)) 233 if (!test_bit(port->substream->number, &ep->umidi->input_triggered))
@@ -259,7 +259,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb)
259 ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer, 259 ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer,
260 urb->actual_length); 260 urb->actual_length);
261 } else { 261 } else {
262 int err = snd_usbmidi_urb_error(urb->status); 262 int err = snd_usbmidi_urb_error(urb);
263 if (err < 0) { 263 if (err < 0) {
264 if (err != -ENODEV) { 264 if (err != -ENODEV) {
265 ep->error_resubmit = 1; 265 ep->error_resubmit = 1;
@@ -289,7 +289,7 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb)
289 } 289 }
290 spin_unlock(&ep->buffer_lock); 290 spin_unlock(&ep->buffer_lock);
291 if (urb->status < 0) { 291 if (urb->status < 0) {
292 int err = snd_usbmidi_urb_error(urb->status); 292 int err = snd_usbmidi_urb_error(urb);
293 if (err < 0) { 293 if (err < 0) {
294 if (err != -ENODEV) 294 if (err != -ENODEV)
295 mod_timer(&ep->umidi->error_timer, 295 mod_timer(&ep->umidi->error_timer,
@@ -1668,7 +1668,7 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi,
1668 1668
1669 struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); 1669 struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number);
1670 if (!substream) { 1670 if (!substream) {
1671 snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number); 1671 dev_err(&umidi->dev->dev, "substream %d:%d not found\n", stream, number);
1672 return; 1672 return;
1673 } 1673 }
1674 1674
@@ -1717,7 +1717,7 @@ static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi,
1717 } 1717 }
1718 } 1718 }
1719 } 1719 }
1720 snd_printdd(KERN_INFO "created %d output and %d input ports\n", 1720 dev_dbg(&umidi->dev->dev, "created %d output and %d input ports\n",
1721 out_ports, in_ports); 1721 out_ports, in_ports);
1722 return 0; 1722 return 0;
1723} 1723}
@@ -1747,10 +1747,11 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1747 ms_header->bLength >= 7 && 1747 ms_header->bLength >= 7 &&
1748 ms_header->bDescriptorType == USB_DT_CS_INTERFACE && 1748 ms_header->bDescriptorType == USB_DT_CS_INTERFACE &&
1749 ms_header->bDescriptorSubtype == UAC_HEADER) 1749 ms_header->bDescriptorSubtype == UAC_HEADER)
1750 snd_printdd(KERN_INFO "MIDIStreaming version %02x.%02x\n", 1750 dev_dbg(&umidi->dev->dev, "MIDIStreaming version %02x.%02x\n",
1751 ms_header->bcdMSC[1], ms_header->bcdMSC[0]); 1751 ms_header->bcdMSC[1], ms_header->bcdMSC[0]);
1752 else 1752 else
1753 snd_printk(KERN_WARNING "MIDIStreaming interface descriptor not found\n"); 1753 dev_warn(&umidi->dev->dev,
1754 "MIDIStreaming interface descriptor not found\n");
1754 1755
1755 epidx = 0; 1756 epidx = 0;
1756 for (i = 0; i < intfd->bNumEndpoints; ++i) { 1757 for (i = 0; i < intfd->bNumEndpoints; ++i) {
@@ -1767,7 +1768,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1767 if (usb_endpoint_dir_out(ep)) { 1768 if (usb_endpoint_dir_out(ep)) {
1768 if (endpoints[epidx].out_ep) { 1769 if (endpoints[epidx].out_ep) {
1769 if (++epidx >= MIDI_MAX_ENDPOINTS) { 1770 if (++epidx >= MIDI_MAX_ENDPOINTS) {
1770 snd_printk(KERN_WARNING "too many endpoints\n"); 1771 dev_warn(&umidi->dev->dev,
1772 "too many endpoints\n");
1771 break; 1773 break;
1772 } 1774 }
1773 } 1775 }
@@ -1782,12 +1784,13 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1782 */ 1784 */
1783 endpoints[epidx].out_interval = 1; 1785 endpoints[epidx].out_interval = 1;
1784 endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; 1786 endpoints[epidx].out_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
1785 snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", 1787 dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n",
1786 ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); 1788 ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
1787 } else { 1789 } else {
1788 if (endpoints[epidx].in_ep) { 1790 if (endpoints[epidx].in_ep) {
1789 if (++epidx >= MIDI_MAX_ENDPOINTS) { 1791 if (++epidx >= MIDI_MAX_ENDPOINTS) {
1790 snd_printk(KERN_WARNING "too many endpoints\n"); 1792 dev_warn(&umidi->dev->dev,
1793 "too many endpoints\n");
1791 break; 1794 break;
1792 } 1795 }
1793 } 1796 }
@@ -1797,7 +1800,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1797 else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW) 1800 else if (snd_usb_get_speed(umidi->dev) == USB_SPEED_LOW)
1798 endpoints[epidx].in_interval = 1; 1801 endpoints[epidx].in_interval = 1;
1799 endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1; 1802 endpoints[epidx].in_cables = (1 << ms_ep->bNumEmbMIDIJack) - 1;
1800 snd_printdd(KERN_INFO "EP %02X: %d jack(s)\n", 1803 dev_dbg(&umidi->dev->dev, "EP %02X: %d jack(s)\n",
1801 ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack); 1804 ep->bEndpointAddress, ms_ep->bNumEmbMIDIJack);
1802 } 1805 }
1803 } 1806 }
@@ -1865,7 +1868,7 @@ static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi)
1865 (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) 1868 (get_endpoint(hostif, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
1866 return; 1869 return;
1867 1870
1868 snd_printdd(KERN_INFO "switching to altsetting %d with int ep\n", 1871 dev_dbg(&umidi->dev->dev, "switching to altsetting %d with int ep\n",
1869 intfd->bAlternateSetting); 1872 intfd->bAlternateSetting);
1870 usb_set_interface(umidi->dev, intfd->bInterfaceNumber, 1873 usb_set_interface(umidi->dev, intfd->bInterfaceNumber,
1871 intfd->bAlternateSetting); 1874 intfd->bAlternateSetting);
@@ -2047,25 +2050,25 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
2047 * input bulk endpoints (at indices 1 and 3) which aren't used. 2050 * input bulk endpoints (at indices 1 and 3) which aren't used.
2048 */ 2051 */
2049 if (intfd->bNumEndpoints < (endpoint->out_cables > 0x0001 ? 5 : 3)) { 2052 if (intfd->bNumEndpoints < (endpoint->out_cables > 0x0001 ? 5 : 3)) {
2050 snd_printdd(KERN_ERR "not enough endpoints\n"); 2053 dev_dbg(&umidi->dev->dev, "not enough endpoints\n");
2051 return -ENOENT; 2054 return -ENOENT;
2052 } 2055 }
2053 2056
2054 epd = get_endpoint(hostif, 0); 2057 epd = get_endpoint(hostif, 0);
2055 if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) { 2058 if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) {
2056 snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); 2059 dev_dbg(&umidi->dev->dev, "endpoint[0] isn't interrupt\n");
2057 return -ENXIO; 2060 return -ENXIO;
2058 } 2061 }
2059 epd = get_endpoint(hostif, 2); 2062 epd = get_endpoint(hostif, 2);
2060 if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) { 2063 if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) {
2061 snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); 2064 dev_dbg(&umidi->dev->dev, "endpoint[2] isn't bulk output\n");
2062 return -ENXIO; 2065 return -ENXIO;
2063 } 2066 }
2064 if (endpoint->out_cables > 0x0001) { 2067 if (endpoint->out_cables > 0x0001) {
2065 epd = get_endpoint(hostif, 4); 2068 epd = get_endpoint(hostif, 4);
2066 if (!usb_endpoint_dir_out(epd) || 2069 if (!usb_endpoint_dir_out(epd) ||
2067 !usb_endpoint_xfer_bulk(epd)) { 2070 !usb_endpoint_xfer_bulk(epd)) {
2068 snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); 2071 dev_dbg(&umidi->dev->dev, "endpoint[4] isn't bulk output\n");
2069 return -ENXIO; 2072 return -ENXIO;
2070 } 2073 }
2071 } 2074 }
@@ -2289,7 +2292,7 @@ int snd_usbmidi_create(struct snd_card *card,
2289 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 2292 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2290 break; 2293 break;
2291 default: 2294 default:
2292 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 2295 dev_err(&umidi->dev->dev, "invalid quirk type %d\n", quirk->type);
2293 err = -ENXIO; 2296 err = -ENXIO;
2294 break; 2297 break;
2295 } 2298 }
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 8c152b02da5a..fcd3ab9331d3 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -305,8 +305,9 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
305 goto out; 305 goto out;
306 } 306 }
307 } 307 }
308 snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 308 usb_audio_dbg(chip,
309 request, validx, idx, cval->val_type); 309 "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
310 request, validx, idx, cval->val_type);
310 err = -EINVAL; 311 err = -EINVAL;
311 312
312 out: 313 out:
@@ -351,8 +352,9 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
351 352
352 if (ret < 0) { 353 if (ret < 0) {
353error: 354error:
354 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 355 usb_audio_err(chip,
355 request, validx, idx, cval->val_type); 356 "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
357 request, validx, idx, cval->val_type);
356 return ret; 358 return ret;
357 } 359 }
358 360
@@ -413,7 +415,8 @@ static int get_cur_mix_value(struct usb_mixer_elem_info *cval,
413 err = get_cur_mix_raw(cval, channel, value); 415 err = get_cur_mix_raw(cval, channel, value);
414 if (err < 0) { 416 if (err < 0) {
415 if (!cval->mixer->ignore_ctl_error) 417 if (!cval->mixer->ignore_ctl_error)
416 snd_printd(KERN_ERR "cannot get current value for control %d ch %d: err = %d\n", 418 usb_audio_dbg(cval->mixer->chip,
419 "cannot get current value for control %d ch %d: err = %d\n",
417 cval->control, channel, err); 420 cval->control, channel, err);
418 return err; 421 return err;
419 } 422 }
@@ -444,7 +447,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
444 447
445 /* FIXME */ 448 /* FIXME */
446 if (request != UAC_SET_CUR) { 449 if (request != UAC_SET_CUR) {
447 snd_printdd(KERN_WARNING "RANGE setting not yet supported\n"); 450 usb_audio_dbg(chip, "RANGE setting not yet supported\n");
448 return -EINVAL; 451 return -EINVAL;
449 } 452 }
450 453
@@ -470,7 +473,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
470 goto out; 473 goto out;
471 } 474 }
472 } 475 }
473 snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", 476 usb_audio_dbg(chip, "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",
474 request, validx, idx, cval->val_type, buf[0], buf[1]); 477 request, validx, idx, cval->val_type, buf[0], buf[1]);
475 err = -EINVAL; 478 err = -EINVAL;
476 479
@@ -494,7 +497,8 @@ static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
494 cval->ch_readonly & (1 << (channel - 1)); 497 cval->ch_readonly & (1 << (channel - 1));
495 498
496 if (read_only) { 499 if (read_only) {
497 snd_printdd(KERN_INFO "%s(): channel %d of control %d is read_only\n", 500 usb_audio_dbg(cval->mixer->chip,
501 "%s(): channel %d of control %d is read_only\n",
498 __func__, channel, cval->control); 502 __func__, channel, cval->control);
499 return 0; 503 return 0;
500 } 504 }
@@ -560,7 +564,7 @@ int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
560 while (snd_ctl_find_id(mixer->chip->card, &kctl->id)) 564 while (snd_ctl_find_id(mixer->chip->card, &kctl->id))
561 kctl->id.index++; 565 kctl->id.index++;
562 if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) { 566 if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) {
563 snd_printd(KERN_ERR "cannot add control (err = %d)\n", err); 567 usb_audio_dbg(mixer->chip, "cannot add control (err = %d)\n", err);
564 return err; 568 return err;
565 } 569 }
566 cval->elem_id = &kctl->id; 570 cval->elem_id = &kctl->id;
@@ -807,7 +811,8 @@ static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
807static void volume_control_quirks(struct usb_mixer_elem_info *cval, 811static void volume_control_quirks(struct usb_mixer_elem_info *cval,
808 struct snd_kcontrol *kctl) 812 struct snd_kcontrol *kctl)
809{ 813{
810 switch (cval->mixer->chip->usb_id) { 814 struct snd_usb_audio *chip = cval->mixer->chip;
815 switch (chip->usb_id) {
811 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ 816 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
812 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ 817 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */
813 if (strcmp(kctl->id.name, "Effect Duration") == 0) { 818 if (strcmp(kctl->id.name, "Effect Duration") == 0) {
@@ -839,8 +844,8 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
839 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ 844 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
840 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ 845 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
841 if (strcmp(kctl->id.name, "Effect Duration") == 0) { 846 if (strcmp(kctl->id.name, "Effect Duration") == 0) {
842 snd_printk(KERN_INFO 847 usb_audio_info(chip,
843 "usb-audio: set quirk for FTU Effect Duration\n"); 848 "set quirk for FTU Effect Duration\n");
844 cval->min = 0x0000; 849 cval->min = 0x0000;
845 cval->max = 0x7f00; 850 cval->max = 0x7f00;
846 cval->res = 0x0100; 851 cval->res = 0x0100;
@@ -848,8 +853,8 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
848 } 853 }
849 if (strcmp(kctl->id.name, "Effect Volume") == 0 || 854 if (strcmp(kctl->id.name, "Effect Volume") == 0 ||
850 strcmp(kctl->id.name, "Effect Feedback Volume") == 0) { 855 strcmp(kctl->id.name, "Effect Feedback Volume") == 0) {
851 snd_printk(KERN_INFO 856 usb_audio_info(chip,
852 "usb-audio: set quirks for FTU Effect Feedback/Volume\n"); 857 "set quirks for FTU Effect Feedback/Volume\n");
853 cval->min = 0x00; 858 cval->min = 0x00;
854 cval->max = 0x7f; 859 cval->max = 0x7f;
855 break; 860 break;
@@ -867,7 +872,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
867 */ 872 */
868 if (!strcmp(kctl->id.name, "PCM Playback Volume") && 873 if (!strcmp(kctl->id.name, "PCM Playback Volume") &&
869 cval->min == -15616) { 874 cval->min == -15616) {
870 snd_printk(KERN_INFO 875 usb_audio_info(chip,
871 "set volume quirk for UDA1321/N101 chip\n"); 876 "set volume quirk for UDA1321/N101 chip\n");
872 cval->max = -256; 877 cval->max = -256;
873 } 878 }
@@ -875,7 +880,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
875 880
876 case USB_ID(0x046d, 0x09a4): 881 case USB_ID(0x046d, 0x09a4):
877 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 882 if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
878 snd_printk(KERN_INFO 883 usb_audio_info(chip,
879 "set volume quirk for QuickCam E3500\n"); 884 "set volume quirk for QuickCam E3500\n");
880 cval->min = 6080; 885 cval->min = 6080;
881 cval->max = 8768; 886 cval->max = 8768;
@@ -895,7 +900,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
895 * Proboly there is some logitech magic behind this number --fishor 900 * Proboly there is some logitech magic behind this number --fishor
896 */ 901 */
897 if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 902 if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
898 snd_printk(KERN_INFO 903 usb_audio_info(chip,
899 "set resolution quirk: cval->res = 384\n"); 904 "set resolution quirk: cval->res = 384\n");
900 cval->res = 384; 905 cval->res = 384;
901 } 906 }
@@ -931,7 +936,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
931 } 936 }
932 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || 937 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 ||
933 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { 938 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) {
934 snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n", 939 usb_audio_err(cval->mixer->chip,
940 "%d:%d: cannot get min/max values for control %d (id %d)\n",
935 cval->id, snd_usb_ctrl_intf(cval->mixer->chip), cval->control, cval->id); 941 cval->id, snd_usb_ctrl_intf(cval->mixer->chip), cval->control, cval->id);
936 return -EINVAL; 942 return -EINVAL;
937 } 943 }
@@ -1195,7 +1201,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1195 1201
1196 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1202 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
1197 if (! cval) { 1203 if (! cval) {
1198 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1204 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1199 return; 1205 return;
1200 } 1206 }
1201 cval->mixer = state->mixer; 1207 cval->mixer = state->mixer;
@@ -1224,7 +1230,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1224 kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval); 1230 kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
1225 1231
1226 if (! kctl) { 1232 if (! kctl) {
1227 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1233 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1228 kfree(cval); 1234 kfree(cval);
1229 return; 1235 return;
1230 } 1236 }
@@ -1298,16 +1304,16 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1298 * devices. It will definitively catch all buggy Logitech devices. 1304 * devices. It will definitively catch all buggy Logitech devices.
1299 */ 1305 */
1300 if (range > 384) { 1306 if (range > 384) {
1301 snd_printk(KERN_WARNING "usb_audio: Warning! Unlikely big " 1307 usb_audio_warn(state->chip, "Warning! Unlikely big "
1302 "volume range (=%u), cval->res is probably wrong.", 1308 "volume range (=%u), cval->res is probably wrong.",
1303 range); 1309 range);
1304 snd_printk(KERN_WARNING "usb_audio: [%d] FU [%s] ch = %d, " 1310 usb_audio_warn(state->chip, "[%d] FU [%s] ch = %d, "
1305 "val = %d/%d/%d", cval->id, 1311 "val = %d/%d/%d", cval->id,
1306 kctl->id.name, cval->channels, 1312 kctl->id.name, cval->channels,
1307 cval->min, cval->max, cval->res); 1313 cval->min, cval->max, cval->res);
1308 } 1314 }
1309 1315
1310 snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", 1316 usb_audio_dbg(state->chip, "[%d] FU [%s] ch = %d, val = %d/%d/%d\n",
1311 cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res); 1317 cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res);
1312 snd_usb_mixer_add_control(state->mixer, kctl); 1318 snd_usb_mixer_add_control(state->mixer, kctl);
1313} 1319}
@@ -1331,16 +1337,17 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1331 if (state->mixer->protocol == UAC_VERSION_1) { 1337 if (state->mixer->protocol == UAC_VERSION_1) {
1332 csize = hdr->bControlSize; 1338 csize = hdr->bControlSize;
1333 if (!csize) { 1339 if (!csize) {
1334 snd_printdd(KERN_ERR "usbaudio: unit %u: " 1340 usb_audio_dbg(state->chip,
1335 "invalid bControlSize == 0\n", unitid); 1341 "unit %u: invalid bControlSize == 0\n",
1342 unitid);
1336 return -EINVAL; 1343 return -EINVAL;
1337 } 1344 }
1338 channels = (hdr->bLength - 7) / csize - 1; 1345 channels = (hdr->bLength - 7) / csize - 1;
1339 bmaControls = hdr->bmaControls; 1346 bmaControls = hdr->bmaControls;
1340 if (hdr->bLength < 7 + csize) { 1347 if (hdr->bLength < 7 + csize) {
1341 snd_printk(KERN_ERR "usbaudio: unit %u: " 1348 usb_audio_err(state->chip,
1342 "invalid UAC_FEATURE_UNIT descriptor\n", 1349 "unit %u: invalid UAC_FEATURE_UNIT descriptor\n",
1343 unitid); 1350 unitid);
1344 return -EINVAL; 1351 return -EINVAL;
1345 } 1352 }
1346 } else { 1353 } else {
@@ -1349,9 +1356,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1349 channels = (hdr->bLength - 6) / 4 - 1; 1356 channels = (hdr->bLength - 6) / 4 - 1;
1350 bmaControls = ftr->bmaControls; 1357 bmaControls = ftr->bmaControls;
1351 if (hdr->bLength < 6 + csize) { 1358 if (hdr->bLength < 6 + csize) {
1352 snd_printk(KERN_ERR "usbaudio: unit %u: " 1359 usb_audio_err(state->chip,
1353 "invalid UAC_FEATURE_UNIT descriptor\n", 1360 "unit %u: invalid UAC_FEATURE_UNIT descriptor\n",
1354 unitid); 1361 unitid);
1355 return -EINVAL; 1362 return -EINVAL;
1356 } 1363 }
1357 } 1364 }
@@ -1369,14 +1376,14 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1369 /* master configuration quirks */ 1376 /* master configuration quirks */
1370 switch (state->chip->usb_id) { 1377 switch (state->chip->usb_id) {
1371 case USB_ID(0x08bb, 0x2702): 1378 case USB_ID(0x08bb, 0x2702):
1372 snd_printk(KERN_INFO 1379 usb_audio_info(state->chip,
1373 "usbmixer: master volume quirk for PCM2702 chip\n"); 1380 "usbmixer: master volume quirk for PCM2702 chip\n");
1374 /* disable non-functional volume control */ 1381 /* disable non-functional volume control */
1375 master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME); 1382 master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME);
1376 break; 1383 break;
1377 case USB_ID(0x1130, 0xf211): 1384 case USB_ID(0x1130, 0xf211):
1378 snd_printk(KERN_INFO 1385 usb_audio_info(state->chip,
1379 "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n"); 1386 "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n");
1380 /* disable non-functional volume control */ 1387 /* disable non-functional volume control */
1381 channels = 0; 1388 channels = 0;
1382 break; 1389 break;
@@ -1478,7 +1485,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
1478 1485
1479 kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval); 1486 kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
1480 if (! kctl) { 1487 if (! kctl) {
1481 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1488 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1482 kfree(cval); 1489 kfree(cval);
1483 return; 1490 return;
1484 } 1491 }
@@ -1491,7 +1498,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
1491 len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); 1498 len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1);
1492 append_ctl_name(kctl, " Volume"); 1499 append_ctl_name(kctl, " Volume");
1493 1500
1494 snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n", 1501 usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n",
1495 cval->id, kctl->id.name, cval->channels, cval->min, cval->max); 1502 cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
1496 snd_usb_mixer_add_control(state->mixer, kctl); 1503 snd_usb_mixer_add_control(state->mixer, kctl);
1497} 1504}
@@ -1508,12 +1515,12 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, void *r
1508 int pin, ich, err; 1515 int pin, ich, err;
1509 1516
1510 if (desc->bLength < 11 || ! (input_pins = desc->bNrInPins) || ! (num_outs = uac_mixer_unit_bNrChannels(desc))) { 1517 if (desc->bLength < 11 || ! (input_pins = desc->bNrInPins) || ! (num_outs = uac_mixer_unit_bNrChannels(desc))) {
1511 snd_printk(KERN_ERR "invalid MIXER UNIT descriptor %d\n", unitid); 1518 usb_audio_err(state->chip, "invalid MIXER UNIT descriptor %d\n", unitid);
1512 return -EINVAL; 1519 return -EINVAL;
1513 } 1520 }
1514 /* no bmControls field (e.g. Maya44) -> ignore */ 1521 /* no bmControls field (e.g. Maya44) -> ignore */
1515 if (desc->bLength <= 10 + input_pins) { 1522 if (desc->bLength <= 10 + input_pins) {
1516 snd_printdd(KERN_INFO "MU %d has no bmControls field\n", unitid); 1523 usb_audio_dbg(state->chip, "MU %d has no bmControls field\n", unitid);
1517 return 0; 1524 return 0;
1518 } 1525 }
1519 1526
@@ -1712,7 +1719,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
1712 1719
1713 if (desc->bLength < 13 || desc->bLength < 13 + num_ins || 1720 if (desc->bLength < 13 || desc->bLength < 13 + num_ins ||
1714 desc->bLength < num_ins + uac_processing_unit_bControlSize(desc, state->mixer->protocol)) { 1721 desc->bLength < num_ins + uac_processing_unit_bControlSize(desc, state->mixer->protocol)) {
1715 snd_printk(KERN_ERR "invalid %s descriptor (id %d)\n", name, unitid); 1722 usb_audio_err(state->chip, "invalid %s descriptor (id %d)\n", name, unitid);
1716 return -EINVAL; 1723 return -EINVAL;
1717 } 1724 }
1718 1725
@@ -1738,7 +1745,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
1738 continue; 1745 continue;
1739 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1746 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
1740 if (! cval) { 1747 if (! cval) {
1741 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1748 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1742 return -ENOMEM; 1749 return -ENOMEM;
1743 } 1750 }
1744 cval->mixer = state->mixer; 1751 cval->mixer = state->mixer;
@@ -1770,7 +1777,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
1770 1777
1771 kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); 1778 kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
1772 if (! kctl) { 1779 if (! kctl) {
1773 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1780 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1774 kfree(cval); 1781 kfree(cval);
1775 return -ENOMEM; 1782 return -ENOMEM;
1776 } 1783 }
@@ -1792,7 +1799,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
1792 append_ctl_name(kctl, " "); 1799 append_ctl_name(kctl, " ");
1793 append_ctl_name(kctl, valinfo->suffix); 1800 append_ctl_name(kctl, valinfo->suffix);
1794 1801
1795 snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n", 1802 usb_audio_dbg(state->chip,
1803 "[%d] PU [%s] ch = %d, val = %d/%d\n",
1796 cval->id, kctl->id.name, cval->channels, cval->min, cval->max); 1804 cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
1797 if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0) 1805 if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
1798 return err; 1806 return err;
@@ -1917,7 +1925,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
1917 char **namelist; 1925 char **namelist;
1918 1926
1919 if (!desc->bNrInPins || desc->bLength < 5 + desc->bNrInPins) { 1927 if (!desc->bNrInPins || desc->bLength < 5 + desc->bNrInPins) {
1920 snd_printk(KERN_ERR "invalid SELECTOR UNIT descriptor %d\n", unitid); 1928 usb_audio_err(state->chip,
1929 "invalid SELECTOR UNIT descriptor %d\n", unitid);
1921 return -EINVAL; 1930 return -EINVAL;
1922 } 1931 }
1923 1932
@@ -1935,7 +1944,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
1935 1944
1936 cval = kzalloc(sizeof(*cval), GFP_KERNEL); 1945 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
1937 if (! cval) { 1946 if (! cval) {
1938 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1947 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1939 return -ENOMEM; 1948 return -ENOMEM;
1940 } 1949 }
1941 cval->mixer = state->mixer; 1950 cval->mixer = state->mixer;
@@ -1954,7 +1963,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
1954 1963
1955 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); 1964 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL);
1956 if (! namelist) { 1965 if (! namelist) {
1957 snd_printk(KERN_ERR "cannot malloc\n"); 1966 usb_audio_err(state->chip, "cannot malloc\n");
1958 kfree(cval); 1967 kfree(cval);
1959 return -ENOMEM; 1968 return -ENOMEM;
1960 } 1969 }
@@ -1964,7 +1973,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
1964 len = 0; 1973 len = 0;
1965 namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL); 1974 namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL);
1966 if (! namelist[i]) { 1975 if (! namelist[i]) {
1967 snd_printk(KERN_ERR "cannot malloc\n"); 1976 usb_audio_err(state->chip, "cannot malloc\n");
1968 while (i--) 1977 while (i--)
1969 kfree(namelist[i]); 1978 kfree(namelist[i]);
1970 kfree(namelist); 1979 kfree(namelist);
@@ -1981,7 +1990,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
1981 1990
1982 kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval); 1991 kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval);
1983 if (! kctl) { 1992 if (! kctl) {
1984 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1993 usb_audio_err(state->chip, "cannot malloc kcontrol\n");
1985 kfree(namelist); 1994 kfree(namelist);
1986 kfree(cval); 1995 kfree(cval);
1987 return -ENOMEM; 1996 return -ENOMEM;
@@ -2009,7 +2018,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
2009 append_ctl_name(kctl, " Playback Source"); 2018 append_ctl_name(kctl, " Playback Source");
2010 } 2019 }
2011 2020
2012 snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n", 2021 usb_audio_dbg(state->chip, "[%d] SU [%s] items = %d\n",
2013 cval->id, kctl->id.name, desc->bNrInPins); 2022 cval->id, kctl->id.name, desc->bNrInPins);
2014 if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0) 2023 if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
2015 return err; 2024 return err;
@@ -2031,7 +2040,7 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
2031 2040
2032 p1 = find_audio_control_unit(state, unitid); 2041 p1 = find_audio_control_unit(state, unitid);
2033 if (!p1) { 2042 if (!p1) {
2034 snd_printk(KERN_ERR "usbaudio: unit %d not found!\n", unitid); 2043 usb_audio_err(state->chip, "unit %d not found!\n", unitid);
2035 return -EINVAL; 2044 return -EINVAL;
2036 } 2045 }
2037 2046
@@ -2061,7 +2070,8 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
2061 case UAC2_EXTENSION_UNIT_V2: 2070 case UAC2_EXTENSION_UNIT_V2:
2062 return parse_audio_extension_unit(state, unitid, p1); 2071 return parse_audio_extension_unit(state, unitid, p1);
2063 default: 2072 default:
2064 snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); 2073 usb_audio_err(state->chip,
2074 "unit %u: unexpected type 0x%02x\n", unitid, p1[2]);
2065 return -EINVAL; 2075 return -EINVAL;
2066 } 2076 }
2067} 2077}
@@ -2209,8 +2219,9 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
2209 __u8 channel = value & 0xff; 2219 __u8 channel = value & 0xff;
2210 2220
2211 if (channel >= MAX_CHANNELS) { 2221 if (channel >= MAX_CHANNELS) {
2212 snd_printk(KERN_DEBUG "%s(): bogus channel number %d\n", 2222 usb_audio_dbg(mixer->chip,
2213 __func__, channel); 2223 "%s(): bogus channel number %d\n",
2224 __func__, channel);
2214 return; 2225 return;
2215 } 2226 }
2216 2227
@@ -2239,8 +2250,9 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
2239 break; 2250 break;
2240 2251
2241 default: 2252 default:
2242 snd_printk(KERN_DEBUG "unknown attribute %d in interrupt\n", 2253 usb_audio_dbg(mixer->chip,
2243 attribute); 2254 "unknown attribute %d in interrupt\n",
2255 attribute);
2244 break; 2256 break;
2245 } /* switch */ 2257 } /* switch */
2246 } 2258 }
@@ -2261,7 +2273,7 @@ static void snd_usb_mixer_interrupt(struct urb *urb)
2261 for (status = urb->transfer_buffer; 2273 for (status = urb->transfer_buffer;
2262 len >= sizeof(*status); 2274 len >= sizeof(*status);
2263 len -= sizeof(*status), status++) { 2275 len -= sizeof(*status), status++) {
2264 snd_printd(KERN_DEBUG "status interrupt: %02x %02x\n", 2276 dev_dbg(&urb->dev->dev, "status interrupt: %02x %02x\n",
2265 status->bStatusType, 2277 status->bStatusType,
2266 status->bOriginator); 2278 status->bOriginator);
2267 2279
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index f4b12c216f1c..f119a41ed9a9 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -600,8 +600,8 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
600 up_read(&mixer->chip->shutdown_rwsem); 600 up_read(&mixer->chip->shutdown_rwsem);
601 601
602 if (ret < 0) { 602 if (ret < 0) {
603 snd_printk(KERN_ERR 603 dev_err(&dev->dev,
604 "unable to issue vendor read request (ret = %d)", ret); 604 "unable to issue vendor read request (ret = %d)", ret);
605 return ret; 605 return ret;
606 } 606 }
607 607
@@ -631,8 +631,8 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
631 up_read(&mixer->chip->shutdown_rwsem); 631 up_read(&mixer->chip->shutdown_rwsem);
632 632
633 if (ret < 0) { 633 if (ret < 0) {
634 snd_printk(KERN_ERR 634 dev_err(&dev->dev,
635 "unable to issue vendor write request (ret = %d)", ret); 635 "unable to issue vendor write request (ret = %d)", ret);
636 return ret; 636 return ret;
637 } 637 }
638 638
@@ -1699,7 +1699,7 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer,
1699 snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id); 1699 snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id);
1700 break; 1700 break;
1701 default: 1701 default:
1702 snd_printd(KERN_DEBUG "memory change in unknown unit %d\n", unitid); 1702 usb_audio_dbg(mixer->chip, "memory change in unknown unit %d\n", unitid);
1703 break; 1703 break;
1704 } 1704 }
1705} 1705}
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index ca3256d6fde3..49de5c1284f6 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -166,8 +166,8 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface,
166 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 166 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
167 UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, 167 UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep,
168 data, sizeof(data))) < 0) { 168 data, sizeof(data))) < 0) {
169 snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n", 169 usb_audio_err(chip, "%d:%d: cannot set enable PITCH\n",
170 dev->devnum, iface, ep); 170 iface, ep);
171 return err; 171 return err;
172 } 172 }
173 173
@@ -187,8 +187,8 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface,
187 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 187 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
188 UAC2_EP_CS_PITCH << 8, 0, 188 UAC2_EP_CS_PITCH << 8, 0,
189 data, sizeof(data))) < 0) { 189 data, sizeof(data))) < 0) {
190 snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n", 190 usb_audio_err(chip, "%d:%d: cannot set enable PITCH (v2)\n",
191 dev->devnum, iface, fmt->altsetting); 191 iface, fmt->altsetting);
192 return err; 192 return err;
193 } 193 }
194 194
@@ -226,7 +226,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
226 if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) { 226 if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) {
227 struct snd_usb_endpoint *ep = subs->data_endpoint; 227 struct snd_usb_endpoint *ep = subs->data_endpoint;
228 228
229 snd_printdd(KERN_DEBUG "Starting data EP @%p\n", ep); 229 dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep);
230 230
231 ep->data_subs = subs; 231 ep->data_subs = subs;
232 err = snd_usb_endpoint_start(ep, can_sleep); 232 err = snd_usb_endpoint_start(ep, can_sleep);
@@ -247,16 +247,15 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
247 subs->sync_endpoint->altsetting); 247 subs->sync_endpoint->altsetting);
248 if (err < 0) { 248 if (err < 0) {
249 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); 249 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags);
250 snd_printk(KERN_ERR 250 dev_err(&subs->dev->dev,
251 "%d:%d:%d: cannot set interface (%d)\n", 251 "%d:%d: cannot set interface (%d)\n",
252 subs->dev->devnum,
253 subs->sync_endpoint->iface, 252 subs->sync_endpoint->iface,
254 subs->sync_endpoint->altsetting, err); 253 subs->sync_endpoint->altsetting, err);
255 return -EIO; 254 return -EIO;
256 } 255 }
257 } 256 }
258 257
259 snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); 258 dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep);
260 259
261 ep->sync_slave = subs->data_endpoint; 260 ep->sync_slave = subs->data_endpoint;
262 err = snd_usb_endpoint_start(ep, can_sleep); 261 err = snd_usb_endpoint_start(ep, can_sleep);
@@ -410,8 +409,9 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
410 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC || 409 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC ||
411 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 410 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
412 get_endpoint(alts, 1)->bSynchAddress != 0)) { 411 get_endpoint(alts, 1)->bSynchAddress != 0)) {
413 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n", 412 dev_err(&dev->dev,
414 dev->devnum, fmt->iface, fmt->altsetting, 413 "%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n",
414 fmt->iface, fmt->altsetting,
415 get_endpoint(alts, 1)->bmAttributes, 415 get_endpoint(alts, 1)->bmAttributes,
416 get_endpoint(alts, 1)->bLength, 416 get_endpoint(alts, 1)->bLength,
417 get_endpoint(alts, 1)->bSynchAddress); 417 get_endpoint(alts, 1)->bSynchAddress);
@@ -421,8 +421,9 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
421 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 421 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
422 ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || 422 ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
423 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) { 423 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
424 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", 424 dev_err(&dev->dev,
425 dev->devnum, fmt->iface, fmt->altsetting, 425 "%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n",
426 fmt->iface, fmt->altsetting,
426 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress); 427 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress);
427 return -EINVAL; 428 return -EINVAL;
428 } 429 }
@@ -469,8 +470,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
469 if (subs->interface >= 0 && subs->interface != fmt->iface) { 470 if (subs->interface >= 0 && subs->interface != fmt->iface) {
470 err = usb_set_interface(subs->dev, subs->interface, 0); 471 err = usb_set_interface(subs->dev, subs->interface, 0);
471 if (err < 0) { 472 if (err < 0) {
472 snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n", 473 dev_err(&dev->dev,
473 dev->devnum, fmt->iface, fmt->altsetting, err); 474 "%d:%d: return to setting 0 failed (%d)\n",
475 fmt->iface, fmt->altsetting, err);
474 return -EIO; 476 return -EIO;
475 } 477 }
476 subs->interface = -1; 478 subs->interface = -1;
@@ -482,12 +484,13 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
482 subs->altset_idx != fmt->altset_idx) { 484 subs->altset_idx != fmt->altset_idx) {
483 err = usb_set_interface(dev, fmt->iface, fmt->altsetting); 485 err = usb_set_interface(dev, fmt->iface, fmt->altsetting);
484 if (err < 0) { 486 if (err < 0) {
485 snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n", 487 dev_err(&dev->dev,
486 dev->devnum, fmt->iface, fmt->altsetting, err); 488 "%d:%d: usb_set_interface failed (%d)\n",
489 fmt->iface, fmt->altsetting, err);
487 return -EIO; 490 return -EIO;
488 } 491 }
489 snd_printdd(KERN_INFO "setting usb interface %d:%d\n", 492 dev_dbg(&dev->dev, "setting usb interface %d:%d\n",
490 fmt->iface, fmt->altsetting); 493 fmt->iface, fmt->altsetting);
491 subs->interface = fmt->iface; 494 subs->interface = fmt->iface;
492 subs->altset_idx = fmt->altset_idx; 495 subs->altset_idx = fmt->altset_idx;
493 496
@@ -523,20 +526,23 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
523 * - Requested PCM format is not supported. 526 * - Requested PCM format is not supported.
524 * - Requested sample rate is not supported. 527 * - Requested sample rate is not supported.
525 */ 528 */
526static int match_endpoint_audioformats(struct audioformat *fp, 529static int match_endpoint_audioformats(struct snd_usb_substream *subs,
527 struct audioformat *match, int rate, 530 struct audioformat *fp,
528 snd_pcm_format_t pcm_format) 531 struct audioformat *match, int rate,
532 snd_pcm_format_t pcm_format)
529{ 533{
530 int i; 534 int i;
531 int score = 0; 535 int score = 0;
532 536
533 if (fp->channels < 1) { 537 if (fp->channels < 1) {
534 snd_printdd("%s: (fmt @%p) no channels\n", __func__, fp); 538 dev_dbg(&subs->dev->dev,
539 "%s: (fmt @%p) no channels\n", __func__, fp);
535 return 0; 540 return 0;
536 } 541 }
537 542
538 if (!(fp->formats & pcm_format_to_bits(pcm_format))) { 543 if (!(fp->formats & pcm_format_to_bits(pcm_format))) {
539 snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__, 544 dev_dbg(&subs->dev->dev,
545 "%s: (fmt @%p) no match for format %d\n", __func__,
540 fp, pcm_format); 546 fp, pcm_format);
541 return 0; 547 return 0;
542 } 548 }
@@ -548,7 +554,8 @@ static int match_endpoint_audioformats(struct audioformat *fp,
548 } 554 }
549 } 555 }
550 if (!score) { 556 if (!score) {
551 snd_printdd("%s: (fmt @%p) no match for rate %d\n", __func__, 557 dev_dbg(&subs->dev->dev,
558 "%s: (fmt @%p) no match for rate %d\n", __func__,
552 fp, rate); 559 fp, rate);
553 return 0; 560 return 0;
554 } 561 }
@@ -556,7 +563,8 @@ static int match_endpoint_audioformats(struct audioformat *fp,
556 if (fp->channels == match->channels) 563 if (fp->channels == match->channels)
557 score++; 564 score++;
558 565
559 snd_printdd("%s: (fmt @%p) score %d\n", __func__, fp, score); 566 dev_dbg(&subs->dev->dev,
567 "%s: (fmt @%p) score %d\n", __func__, fp, score);
560 568
561 return score; 569 return score;
562} 570}
@@ -587,7 +595,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
587 595
588 /* Try to find the best matching audioformat. */ 596 /* Try to find the best matching audioformat. */
589 list_for_each_entry(fp, &sync_subs->fmt_list, list) { 597 list_for_each_entry(fp, &sync_subs->fmt_list, list) {
590 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, 598 int score = match_endpoint_audioformats(subs,
599 fp, subs->cur_audiofmt,
591 subs->cur_rate, subs->pcm_format); 600 subs->cur_rate, subs->pcm_format);
592 601
593 if (score > cur_score) { 602 if (score > cur_score) {
@@ -597,7 +606,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
597 } 606 }
598 607
599 if (unlikely(sync_fp == NULL)) { 608 if (unlikely(sync_fp == NULL)) {
600 snd_printk(KERN_ERR "%s: no valid audioformat for sync ep %x found\n", 609 dev_err(&subs->dev->dev,
610 "%s: no valid audioformat for sync ep %x found\n",
601 __func__, sync_subs->ep_num); 611 __func__, sync_subs->ep_num);
602 return -EINVAL; 612 return -EINVAL;
603 } 613 }
@@ -609,7 +619,8 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
609 if (sync_fp->channels != subs->channels) { 619 if (sync_fp->channels != subs->channels) {
610 sync_period_bytes = (subs->period_bytes / subs->channels) * 620 sync_period_bytes = (subs->period_bytes / subs->channels) *
611 sync_fp->channels; 621 sync_fp->channels;
612 snd_printdd("%s: adjusted sync ep period bytes (%d -> %d)\n", 622 dev_dbg(&subs->dev->dev,
623 "%s: adjusted sync ep period bytes (%d -> %d)\n",
613 __func__, subs->period_bytes, sync_period_bytes); 624 __func__, subs->period_bytes, sync_period_bytes);
614 } 625 }
615 626
@@ -685,7 +696,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
685 696
686 fmt = find_format(subs); 697 fmt = find_format(subs);
687 if (!fmt) { 698 if (!fmt) {
688 snd_printd(KERN_DEBUG "cannot set format: format = %#x, rate = %d, channels = %d\n", 699 dev_dbg(&subs->dev->dev,
700 "cannot set format: format = %#x, rate = %d, channels = %d\n",
689 subs->pcm_format, subs->cur_rate, subs->channels); 701 subs->pcm_format, subs->cur_rate, subs->channels);
690 return -EINVAL; 702 return -EINVAL;
691 } 703 }
@@ -742,7 +754,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
742 int ret; 754 int ret;
743 755
744 if (! subs->cur_audiofmt) { 756 if (! subs->cur_audiofmt) {
745 snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); 757 dev_err(&subs->dev->dev, "no format is specified!\n");
746 return -ENXIO; 758 return -ENXIO;
747 } 759 }
748 760
@@ -1235,7 +1247,8 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
1235 for (i = 0; i < urb->number_of_packets; i++) { 1247 for (i = 0; i < urb->number_of_packets; i++) {
1236 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj; 1248 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj;
1237 if (urb->iso_frame_desc[i].status && printk_ratelimit()) { 1249 if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
1238 snd_printdd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); 1250 dev_dbg(&subs->dev->dev, "frame %d active: %d\n",
1251 i, urb->iso_frame_desc[i].status);
1239 // continue; 1252 // continue;
1240 } 1253 }
1241 bytes = urb->iso_frame_desc[i].actual_length; 1254 bytes = urb->iso_frame_desc[i].actual_length;
@@ -1245,7 +1258,8 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
1245 if (bytes % (runtime->sample_bits >> 3) != 0) { 1258 if (bytes % (runtime->sample_bits >> 3) != 0) {
1246 int oldbytes = bytes; 1259 int oldbytes = bytes;
1247 bytes = frames * stride; 1260 bytes = frames * stride;
1248 snd_printdd(KERN_ERR "Corrected urb data len. %d->%d\n", 1261 dev_warn(&subs->dev->dev,
1262 "Corrected urb data len. %d->%d\n",
1249 oldbytes, bytes); 1263 oldbytes, bytes);
1250 } 1264 }
1251 /* update the current pointer */ 1265 /* update the current pointer */
@@ -1488,7 +1502,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
1488 * on two reads of a counter updated every ms. 1502 * on two reads of a counter updated every ms.
1489 */ 1503 */
1490 if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) 1504 if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
1491 snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n", 1505 dev_dbg(&subs->dev->dev,
1506 "delay: estimated %d, actual %d\n",
1492 est_delay, subs->last_delay); 1507 est_delay, subs->last_delay);
1493 1508
1494 if (!subs->running) { 1509 if (!subs->running) {
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 89730707614c..7c57f2268dd7 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -110,7 +110,7 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip,
110 altsd = get_iface_desc(alts); 110 altsd = get_iface_desc(alts);
111 err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber); 111 err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber);
112 if (err < 0) { 112 if (err < 0) {
113 snd_printk(KERN_ERR "cannot setup if %d: error %d\n", 113 usb_audio_err(chip, "cannot setup if %d: error %d\n",
114 altsd->bInterfaceNumber, err); 114 altsd->bInterfaceNumber, err);
115 return err; 115 return err;
116 } 116 }
@@ -135,7 +135,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
135 135
136 fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); 136 fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL);
137 if (!fp) { 137 if (!fp) {
138 snd_printk(KERN_ERR "cannot memdup\n"); 138 usb_audio_err(chip, "cannot memdup\n");
139 return -ENOMEM; 139 return -ENOMEM;
140 } 140 }
141 if (fp->nr_rates > MAX_NR_RATES) { 141 if (fp->nr_rates > MAX_NR_RATES) {
@@ -464,7 +464,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
464 fp->rate_max = fp->rate_min = 96000; 464 fp->rate_max = fp->rate_min = 96000;
465 break; 465 break;
466 default: 466 default:
467 snd_printk(KERN_ERR "unknown sample rate\n"); 467 usb_audio_err(chip, "unknown sample rate\n");
468 kfree(fp); 468 kfree(fp);
469 return -ENXIO; 469 return -ENXIO;
470 } 470 }
@@ -536,7 +536,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
536 if (quirk->type < QUIRK_TYPE_COUNT) { 536 if (quirk->type < QUIRK_TYPE_COUNT) {
537 return quirk_funcs[quirk->type](chip, iface, driver, quirk); 537 return quirk_funcs[quirk->type](chip, iface, driver, quirk);
538 } else { 538 } else {
539 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 539 usb_audio_err(chip, "invalid quirk type %d\n", quirk->type);
540 return -ENXIO; 540 return -ENXIO;
541 } 541 }
542} 542}
@@ -555,18 +555,21 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac
555 555
556 if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || 556 if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD ||
557 le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) { 557 le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) {
558 snd_printdd("sending Extigy boot sequence...\n"); 558 dev_dbg(&dev->dev, "sending Extigy boot sequence...\n");
559 /* Send message to force it to reconnect with full interface. */ 559 /* Send message to force it to reconnect with full interface. */
560 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0), 560 err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0),
561 0x10, 0x43, 0x0001, 0x000a, NULL, 0); 561 0x10, 0x43, 0x0001, 0x000a, NULL, 0);
562 if (err < 0) snd_printdd("error sending boot message: %d\n", err); 562 if (err < 0)
563 dev_dbg(&dev->dev, "error sending boot message: %d\n", err);
563 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 564 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
564 &dev->descriptor, sizeof(dev->descriptor)); 565 &dev->descriptor, sizeof(dev->descriptor));
565 config = dev->actconfig; 566 config = dev->actconfig;
566 if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err); 567 if (err < 0)
568 dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err);
567 err = usb_reset_configuration(dev); 569 err = usb_reset_configuration(dev);
568 if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); 570 if (err < 0)
569 snd_printdd("extigy_boot: new boot length = %d\n", 571 dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err);
572 dev_dbg(&dev->dev, "extigy_boot: new boot length = %d\n",
570 le16_to_cpu(get_cfg_desc(config)->wTotalLength)); 573 le16_to_cpu(get_cfg_desc(config)->wTotalLength));
571 return -ENODEV; /* quit this anyway */ 574 return -ENODEV; /* quit this anyway */
572 } 575 }
@@ -594,7 +597,7 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
594 int err; 597 int err;
595 598
596 if (dev->actconfig->desc.bConfigurationValue == 1) { 599 if (dev->actconfig->desc.bConfigurationValue == 1) {
597 snd_printk(KERN_INFO "usb-audio: " 600 dev_info(&dev->dev,
598 "Fast Track Pro switching to config #2\n"); 601 "Fast Track Pro switching to config #2\n");
599 /* This function has to be available by the usb core module. 602 /* This function has to be available by the usb core module.
600 * if it is not avialable the boot quirk has to be left out 603 * if it is not avialable the boot quirk has to be left out
@@ -603,14 +606,15 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
603 */ 606 */
604 err = usb_driver_set_configuration(dev, 2); 607 err = usb_driver_set_configuration(dev, 2);
605 if (err < 0) 608 if (err < 0)
606 snd_printdd("error usb_driver_set_configuration: %d\n", 609 dev_dbg(&dev->dev,
607 err); 610 "error usb_driver_set_configuration: %d\n",
611 err);
608 /* Always return an error, so that we stop creating a device 612 /* Always return an error, so that we stop creating a device
609 that will just be destroyed and recreated with a new 613 that will just be destroyed and recreated with a new
610 configuration */ 614 configuration */
611 return -ENODEV; 615 return -ENODEV;
612 } else 616 } else
613 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); 617 dev_info(&dev->dev, "Fast Track Pro config OK\n");
614 618
615 return 0; 619 return 0;
616} 620}
@@ -779,11 +783,11 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
779 fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength); 783 fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength);
780 784
781 if (fwsize != MBOX2_FIRMWARE_SIZE) { 785 if (fwsize != MBOX2_FIRMWARE_SIZE) {
782 snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize); 786 dev_err(&dev->dev, "Invalid firmware size=%d.\n", fwsize);
783 return -ENODEV; 787 return -ENODEV;
784 } 788 }
785 789
786 snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); 790 dev_dbg(&dev->dev, "Sending Digidesign Mbox 2 boot sequence...\n");
787 791
788 count = 0; 792 count = 0;
789 bootresponse[0] = MBOX2_BOOT_LOADING; 793 bootresponse[0] = MBOX2_BOOT_LOADING;
@@ -794,32 +798,32 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
794 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); 798 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012);
795 if (bootresponse[0] == MBOX2_BOOT_READY) 799 if (bootresponse[0] == MBOX2_BOOT_READY)
796 break; 800 break;
797 snd_printd("usb-audio: device not ready, resending boot sequence...\n"); 801 dev_dbg(&dev->dev, "device not ready, resending boot sequence...\n");
798 count++; 802 count++;
799 } 803 }
800 804
801 if (bootresponse[0] != MBOX2_BOOT_READY) { 805 if (bootresponse[0] != MBOX2_BOOT_READY) {
802 snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); 806 dev_err(&dev->dev, "Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]);
803 return -ENODEV; 807 return -ENODEV;
804 } 808 }
805 809
806 snd_printdd("usb-audio: device initialised!\n"); 810 dev_dbg(&dev->dev, "device initialised!\n");
807 811
808 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 812 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
809 &dev->descriptor, sizeof(dev->descriptor)); 813 &dev->descriptor, sizeof(dev->descriptor));
810 config = dev->actconfig; 814 config = dev->actconfig;
811 if (err < 0) 815 if (err < 0)
812 snd_printd("error usb_get_descriptor: %d\n", err); 816 dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err);
813 817
814 err = usb_reset_configuration(dev); 818 err = usb_reset_configuration(dev);
815 if (err < 0) 819 if (err < 0)
816 snd_printd("error usb_reset_configuration: %d\n", err); 820 dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err);
817 snd_printdd("mbox2_boot: new boot length = %d\n", 821 dev_dbg(&dev->dev, "mbox2_boot: new boot length = %d\n",
818 le16_to_cpu(get_cfg_desc(config)->wTotalLength)); 822 le16_to_cpu(get_cfg_desc(config)->wTotalLength));
819 823
820 mbox2_setup_48_24_magic(dev); 824 mbox2_setup_48_24_magic(dev);
821 825
822 snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz"); 826 dev_info(&dev->dev, "Digidesign Mbox 2: 24bit 48kHz");
823 827
824 return 0; /* Successful boot */ 828 return 0; /* Successful boot */
825} 829}
@@ -865,7 +869,7 @@ static int quattro_skip_setting_quirk(struct snd_usb_audio *chip,
865 return 1; /* skip this altsetting */ 869 return 1; /* skip this altsetting */
866 } 870 }
867 } 871 }
868 snd_printdd(KERN_INFO 872 usb_audio_dbg(chip,
869 "using altsetting %d for interface %d config %d\n", 873 "using altsetting %d for interface %d config %d\n",
870 altno, iface, chip->setup); 874 altno, iface, chip->setup);
871 return 0; /* keep this altsetting */ 875 return 0; /* keep this altsetting */
@@ -932,7 +936,7 @@ static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip,
932 return 1; 936 return 1;
933 } 937 }
934 938
935 snd_printdd(KERN_INFO 939 usb_audio_dbg(chip,
936 "using altsetting %d for interface %d config %d\n", 940 "using altsetting %d for interface %d config %d\n",
937 altno, iface, chip->setup); 941 altno, iface, chip->setup);
938 return 0; /* keep this altsetting */ 942 return 0; /* keep this altsetting */
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 2fb71be5e100..310a3822d2b7 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -411,10 +411,9 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
411 411
412 if (!csep || csep->bLength < 7 || 412 if (!csep || csep->bLength < 7 ||
413 csep->bDescriptorSubtype != UAC_EP_GENERAL) { 413 csep->bDescriptorSubtype != UAC_EP_GENERAL) {
414 snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" 414 usb_audio_warn(chip,
415 " class specific endpoint descriptor\n", 415 "%u:%d : no or invalid class specific endpoint descriptor\n",
416 chip->dev->devnum, iface_no, 416 iface_no, altsd->bAlternateSetting);
417 altsd->bAlternateSetting);
418 return 0; 417 return 0;
419 } 418 }
420 419
@@ -533,8 +532,8 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
533 /* get audio formats */ 532 /* get audio formats */
534 switch (protocol) { 533 switch (protocol) {
535 default: 534 default:
536 snd_printdd(KERN_WARNING "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n", 535 dev_dbg(&dev->dev, "%u:%d: unknown interface protocol %#02x, assuming v1\n",
537 dev->devnum, iface_no, altno, protocol); 536 iface_no, altno, protocol);
538 protocol = UAC_VERSION_1; 537 protocol = UAC_VERSION_1;
539 /* fall through */ 538 /* fall through */
540 539
@@ -544,14 +543,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
544 struct uac_input_terminal_descriptor *iterm; 543 struct uac_input_terminal_descriptor *iterm;
545 544
546 if (!as) { 545 if (!as) {
547 snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", 546 dev_err(&dev->dev,
548 dev->devnum, iface_no, altno); 547 "%u:%d : UAC_AS_GENERAL descriptor not found\n",
548 iface_no, altno);
549 continue; 549 continue;
550 } 550 }
551 551
552 if (as->bLength < sizeof(*as)) { 552 if (as->bLength < sizeof(*as)) {
553 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", 553 dev_err(&dev->dev,
554 dev->devnum, iface_no, altno); 554 "%u:%d : invalid UAC_AS_GENERAL desc\n",
555 iface_no, altno);
555 continue; 556 continue;
556 } 557 }
557 558
@@ -574,14 +575,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
574 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 575 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
575 576
576 if (!as) { 577 if (!as) {
577 snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", 578 dev_err(&dev->dev,
578 dev->devnum, iface_no, altno); 579 "%u:%d : UAC_AS_GENERAL descriptor not found\n",
580 iface_no, altno);
579 continue; 581 continue;
580 } 582 }
581 583
582 if (as->bLength < sizeof(*as)) { 584 if (as->bLength < sizeof(*as)) {
583 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_AS_GENERAL desc\n", 585 dev_err(&dev->dev,
584 dev->devnum, iface_no, altno); 586 "%u:%d : invalid UAC_AS_GENERAL desc\n",
587 iface_no, altno);
585 continue; 588 continue;
586 } 589 }
587 590
@@ -607,8 +610,9 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
607 break; 610 break;
608 } 611 }
609 612
610 snd_printk(KERN_ERR "%d:%u:%d : bogus bTerminalLink %d\n", 613 dev_err(&dev->dev,
611 dev->devnum, iface_no, altno, as->bTerminalLink); 614 "%u:%d : bogus bTerminalLink %d\n",
615 iface_no, altno, as->bTerminalLink);
612 continue; 616 continue;
613 } 617 }
614 } 618 }
@@ -616,14 +620,16 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
616 /* get format type */ 620 /* get format type */
617 fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE); 621 fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE);
618 if (!fmt) { 622 if (!fmt) {
619 snd_printk(KERN_ERR "%d:%u:%d : no UAC_FORMAT_TYPE desc\n", 623 dev_err(&dev->dev,
620 dev->devnum, iface_no, altno); 624 "%u:%d : no UAC_FORMAT_TYPE desc\n",
625 iface_no, altno);
621 continue; 626 continue;
622 } 627 }
623 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || 628 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) ||
624 ((protocol == UAC_VERSION_2) && (fmt->bLength < 6))) { 629 ((protocol == UAC_VERSION_2) && (fmt->bLength < 6))) {
625 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 630 dev_err(&dev->dev,
626 dev->devnum, iface_no, altno); 631 "%u:%d : invalid UAC_FORMAT_TYPE desc\n",
632 iface_no, altno);
627 continue; 633 continue;
628 } 634 }
629 635
@@ -644,7 +650,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
644 650
645 fp = kzalloc(sizeof(*fp), GFP_KERNEL); 651 fp = kzalloc(sizeof(*fp), GFP_KERNEL);
646 if (! fp) { 652 if (! fp) {
647 snd_printk(KERN_ERR "cannot malloc\n"); 653 dev_err(&dev->dev, "cannot malloc\n");
648 return -ENOMEM; 654 return -ENOMEM;
649 } 655 }
650 656
@@ -707,7 +713,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
707 chconfig = 0; 713 chconfig = 0;
708 fp->chmap = convert_chmap(fp->channels, chconfig, protocol); 714 fp->chmap = convert_chmap(fp->channels, chconfig, protocol);
709 715
710 snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint %#x\n", dev->devnum, iface_no, altno, fp->endpoint); 716 dev_dbg(&dev->dev, "%u:%d: add audio endpoint %#x\n", iface_no, altno, fp->endpoint);
711 err = snd_usb_add_audio_stream(chip, stream, fp); 717 err = snd_usb_add_audio_stream(chip, stream, fp);
712 if (err < 0) { 718 if (err < 0) {
713 kfree(fp->rate_table); 719 kfree(fp->rate_table);
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 5d2fe0530745..25c4c7e217de 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -60,6 +60,15 @@ struct snd_usb_audio {
60 struct usb_host_interface *ctrl_intf; /* the audio control interface */ 60 struct usb_host_interface *ctrl_intf; /* the audio control interface */
61}; 61};
62 62
63#define usb_audio_err(chip, fmt, args...) \
64 dev_err(&(chip)->dev->dev, fmt, ##args)
65#define usb_audio_warn(chip, fmt, args...) \
66 dev_warn(&(chip)->dev->dev, fmt, ##args)
67#define usb_audio_info(chip, fmt, args...) \
68 dev_info(&(chip)->dev->dev, fmt, ##args)
69#define usb_audio_dbg(chip, fmt, args...) \
70 dev_dbg(&(chip)->dev->dev, fmt, ##args)
71
63/* 72/*
64 * Information about devices with broken descriptors 73 * Information about devices with broken descriptors
65 */ 74 */