|
@@ -854,7 +854,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|
|
params = kmalloc(sizeof(*params), GFP_KERNEL);
|
|
|
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
|
|
|
if (!sw_params || !params || !sparams) {
|
|
|
- snd_printd("No memory\n");
|
|
|
+ pcm_dbg(substream->pcm, "No memory\n");
|
|
|
err = -ENOMEM;
|
|
|
goto failure;
|
|
|
}
|
|
@@ -877,7 +877,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|
|
}
|
|
|
err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask);
|
|
|
if (err < 0) {
|
|
|
- snd_printd("No usable accesses\n");
|
|
|
+ pcm_dbg(substream->pcm, "No usable accesses\n");
|
|
|
err = -EINVAL;
|
|
|
goto failure;
|
|
|
}
|
|
@@ -902,7 +902,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|
|
break;
|
|
|
}
|
|
|
if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) {
|
|
|
- snd_printd("Cannot find a format!!!\n");
|
|
|
+ pcm_dbg(substream->pcm, "Cannot find a format!!!\n");
|
|
|
err = -EINVAL;
|
|
|
goto failure;
|
|
|
}
|
|
@@ -942,14 +942,16 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|
|
if ((err = snd_pcm_plug_format_plugins(substream,
|
|
|
params,
|
|
|
sparams)) < 0) {
|
|
|
- snd_printd("snd_pcm_plug_format_plugins failed: %i\n", err);
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "snd_pcm_plug_format_plugins failed: %i\n", err);
|
|
|
snd_pcm_oss_plugin_clear(substream);
|
|
|
goto failure;
|
|
|
}
|
|
|
if (runtime->oss.plugin_first) {
|
|
|
struct snd_pcm_plugin *plugin;
|
|
|
if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) {
|
|
|
- snd_printd("snd_pcm_plugin_build_io failed: %i\n", err);
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "snd_pcm_plugin_build_io failed: %i\n", err);
|
|
|
snd_pcm_oss_plugin_clear(substream);
|
|
|
goto failure;
|
|
|
}
|
|
@@ -983,7 +985,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|
|
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
|
|
|
|
|
|
if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) {
|
|
|
- snd_printd("HW_PARAMS failed: %i\n", err);
|
|
|
+ pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err);
|
|
|
goto failure;
|
|
|
}
|
|
|
|
|
@@ -1016,7 +1018,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|
|
}
|
|
|
|
|
|
if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) {
|
|
|
- snd_printd("SW_PARAMS failed: %i\n", err);
|
|
|
+ pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err);
|
|
|
goto failure;
|
|
|
}
|
|
|
|
|
@@ -1110,7 +1112,8 @@ static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream)
|
|
|
|
|
|
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL);
|
|
|
if (err < 0) {
|
|
|
- snd_printd("snd_pcm_oss_prepare: SNDRV_PCM_IOCTL_PREPARE failed\n");
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "snd_pcm_oss_prepare: SNDRV_PCM_IOCTL_PREPARE failed\n");
|
|
|
return err;
|
|
|
}
|
|
|
runtime->oss.prepare = 0;
|
|
@@ -1175,12 +1178,10 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const
|
|
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
|
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
|
|
#ifdef OSS_DEBUG
|
|
|
- if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
|
|
- printk(KERN_DEBUG "pcm_oss: write: "
|
|
|
- "recovering from XRUN\n");
|
|
|
- else
|
|
|
- printk(KERN_DEBUG "pcm_oss: write: "
|
|
|
- "recovering from SUSPEND\n");
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "pcm_oss: write: recovering from %s\n",
|
|
|
+ runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
|
|
+ "XRUN" : "SUSPEND");
|
|
|
#endif
|
|
|
ret = snd_pcm_oss_prepare(substream);
|
|
|
if (ret < 0)
|
|
@@ -1213,12 +1214,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p
|
|
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
|
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
|
|
#ifdef OSS_DEBUG
|
|
|
- if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
|
|
- printk(KERN_DEBUG "pcm_oss: read: "
|
|
|
- "recovering from XRUN\n");
|
|
|
- else
|
|
|
- printk(KERN_DEBUG "pcm_oss: read: "
|
|
|
- "recovering from SUSPEND\n");
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "pcm_oss: read: recovering from %s\n",
|
|
|
+ runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
|
|
+ "XRUN" : "SUSPEND");
|
|
|
#endif
|
|
|
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
|
|
if (ret < 0)
|
|
@@ -1261,12 +1260,10 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void
|
|
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
|
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
|
|
#ifdef OSS_DEBUG
|
|
|
- if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
|
|
- printk(KERN_DEBUG "pcm_oss: writev: "
|
|
|
- "recovering from XRUN\n");
|
|
|
- else
|
|
|
- printk(KERN_DEBUG "pcm_oss: writev: "
|
|
|
- "recovering from SUSPEND\n");
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "pcm_oss: writev: recovering from %s\n",
|
|
|
+ runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
|
|
+ "XRUN" : "SUSPEND");
|
|
|
#endif
|
|
|
ret = snd_pcm_oss_prepare(substream);
|
|
|
if (ret < 0)
|
|
@@ -1299,12 +1296,10 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void *
|
|
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
|
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
|
|
#ifdef OSS_DEBUG
|
|
|
- if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
|
|
- printk(KERN_DEBUG "pcm_oss: readv: "
|
|
|
- "recovering from XRUN\n");
|
|
|
- else
|
|
|
- printk(KERN_DEBUG "pcm_oss: readv: "
|
|
|
- "recovering from SUSPEND\n");
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "pcm_oss: readv: recovering from %s\n",
|
|
|
+ runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
|
|
+ "XRUN" : "SUSPEND");
|
|
|
#endif
|
|
|
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
|
|
if (ret < 0)
|
|
@@ -1561,7 +1556,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
|
|
|
init_waitqueue_entry(&wait, current);
|
|
|
add_wait_queue(&runtime->sleep, &wait);
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "sync1: size = %li\n", size);
|
|
|
+ pcm_dbg(substream->pcm, "sync1: size = %li\n", size);
|
|
|
#endif
|
|
|
while (1) {
|
|
|
result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1);
|
|
@@ -1587,7 +1582,8 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
|
|
|
break;
|
|
|
}
|
|
|
if (res == 0) {
|
|
|
- snd_printk(KERN_ERR "OSS sync error - DMA timeout\n");
|
|
|
+ pcm_err(substream->pcm,
|
|
|
+ "OSS sync error - DMA timeout\n");
|
|
|
result = -EIO;
|
|
|
break;
|
|
|
}
|
|
@@ -1618,7 +1614,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
|
|
|
mutex_lock(&runtime->oss.params_lock);
|
|
|
if (runtime->oss.buffer_used > 0) {
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "sync: buffer_used\n");
|
|
|
+ pcm_dbg(substream->pcm, "sync: buffer_used\n");
|
|
|
#endif
|
|
|
size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width;
|
|
|
snd_pcm_format_set_silence(format,
|
|
@@ -1631,7 +1627,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
|
|
|
}
|
|
|
} else if (runtime->oss.period_ptr > 0) {
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "sync: period_ptr\n");
|
|
|
+ pcm_dbg(substream->pcm, "sync: period_ptr\n");
|
|
|
#endif
|
|
|
size = runtime->oss.period_bytes - runtime->oss.period_ptr;
|
|
|
snd_pcm_format_set_silence(format,
|
|
@@ -1983,7 +1979,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
|
|
|
int err, cmd;
|
|
|
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "pcm_oss: trigger = 0x%x\n", trigger);
|
|
|
+ pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger);
|
|
|
#endif
|
|
|
|
|
|
psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
|
|
@@ -2203,9 +2199,9 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
|
|
|
}
|
|
|
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "pcm_oss: space: bytes = %i, fragments = %i, "
|
|
|
- "fragstotal = %i, fragsize = %i\n",
|
|
|
- info.bytes, info.fragments, info.fragstotal, info.fragsize);
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize = %i\n",
|
|
|
+ info.bytes, info.fragments, info.fragstotal, info.fragsize);
|
|
|
#endif
|
|
|
if (copy_to_user(_info, &info, sizeof(info)))
|
|
|
return -EFAULT;
|
|
@@ -2215,7 +2211,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
|
|
|
static int snd_pcm_oss_get_mapbuf(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct buffmem_desc __user * _info)
|
|
|
{
|
|
|
// it won't be probably implemented
|
|
|
- // snd_printd("TODO: snd_pcm_oss_get_mapbuf\n");
|
|
|
+ // pr_debug("TODO: snd_pcm_oss_get_mapbuf\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
@@ -2519,7 +2515,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
|
|
|
if (((cmd >> 8) & 0xff) != 'P')
|
|
|
return -EINVAL;
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "pcm_oss: ioctl = 0x%x\n", cmd);
|
|
|
+ pr_debug("pcm_oss: ioctl = 0x%x\n", cmd);
|
|
|
#endif
|
|
|
switch (cmd) {
|
|
|
case SNDCTL_DSP_RESET:
|
|
@@ -2646,7 +2642,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
|
|
|
case SNDCTL_DSP_PROFILE:
|
|
|
return 0; /* silently ignore */
|
|
|
default:
|
|
|
- snd_printd("pcm_oss: unknown command = 0x%x\n", cmd);
|
|
|
+ pr_debug("pcm_oss: unknown command = 0x%x\n", cmd);
|
|
|
}
|
|
|
return -EINVAL;
|
|
|
}
|
|
@@ -2673,8 +2669,9 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun
|
|
|
#else
|
|
|
{
|
|
|
ssize_t res = snd_pcm_oss_read1(substream, buf, count);
|
|
|
- printk(KERN_DEBUG "pcm_oss: read %li bytes "
|
|
|
- "(returned %li bytes)\n", (long)count, (long)res);
|
|
|
+ pcm_dbg(substream->pcm,
|
|
|
+ "pcm_oss: read %li bytes (returned %li bytes)\n",
|
|
|
+ (long)count, (long)res);
|
|
|
return res;
|
|
|
}
|
|
|
#endif
|
|
@@ -2693,7 +2690,7 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size
|
|
|
substream->f_flags = file->f_flags & O_NONBLOCK;
|
|
|
result = snd_pcm_oss_write1(substream, buf, count);
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "pcm_oss: write %li bytes (wrote %li bytes)\n",
|
|
|
+ pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n",
|
|
|
(long)count, (long)result);
|
|
|
#endif
|
|
|
return result;
|
|
@@ -2772,7 +2769,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
|
|
|
int err;
|
|
|
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "pcm_oss: mmap begin\n");
|
|
|
+ pr_debug("pcm_oss: mmap begin\n");
|
|
|
#endif
|
|
|
pcm_oss_file = file->private_data;
|
|
|
switch ((area->vm_flags & (VM_READ | VM_WRITE))) {
|
|
@@ -2822,7 +2819,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
|
|
|
runtime->silence_threshold = 0;
|
|
|
runtime->silence_size = 0;
|
|
|
#ifdef OSS_DEBUG
|
|
|
- printk(KERN_DEBUG "pcm_oss: mmap ok, bytes = 0x%x\n",
|
|
|
+ pr_debug("pcm_oss: mmap ok, bytes = 0x%x\n",
|
|
|
runtime->oss.mmap_bytes);
|
|
|
#endif
|
|
|
/* In mmap mode we never stop */
|
|
@@ -3010,7 +3007,7 @@ static void register_oss_dsp(struct snd_pcm *pcm, int index)
|
|
|
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
|
|
|
pcm->card, index, &snd_pcm_oss_f_reg,
|
|
|
pcm) < 0) {
|
|
|
- snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n",
|
|
|
+ pcm_err(pcm, "unable to register OSS PCM device %i:%i\n",
|
|
|
pcm->card->number, pcm->device);
|
|
|
}
|
|
|
}
|
|
@@ -3091,12 +3088,12 @@ static int __init alsa_pcm_oss_init(void)
|
|
|
/* check device map table */
|
|
|
for (i = 0; i < SNDRV_CARDS; i++) {
|
|
|
if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) {
|
|
|
- snd_printk(KERN_ERR "invalid dsp_map[%d] = %d\n",
|
|
|
+ pr_err("ALSA: pcm_oss: invalid dsp_map[%d] = %d\n",
|
|
|
i, dsp_map[i]);
|
|
|
dsp_map[i] = 0;
|
|
|
}
|
|
|
if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) {
|
|
|
- snd_printk(KERN_ERR "invalid adsp_map[%d] = %d\n",
|
|
|
+ pr_err("ALSA: pcm_oss: invalid adsp_map[%d] = %d\n",
|
|
|
i, adsp_map[i]);
|
|
|
adsp_map[i] = 1;
|
|
|
}
|