--- zzzz-none-000/linux-3.10.107/sound/pci/emu10k1/p16v.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/pci/emu10k1/p16v.c 2021-02-04 17:41:59.000000000 +0000 @@ -166,11 +166,8 @@ static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) { struct snd_emu10k1_pcm *epcm = runtime->private_data; - - if (epcm) { - /* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */ - kfree(epcm); - } + + kfree(epcm); } /* open_playback callback */ @@ -183,14 +180,14 @@ int err; epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); - /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ + /* dev_dbg(emu->card->dev, "epcm kcalloc: %p\n", epcm); */ if (epcm == NULL) return -ENOMEM; epcm->emu = emu; epcm->substream = substream; /* - snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", + dev_dbg(emu->card->dev, "epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); */ runtime->private_data = epcm; @@ -203,10 +200,10 @@ channel->use=1; #if 0 /* debug */ - snd_printk(KERN_DEBUG + dev_dbg(emu->card->dev, "p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); - printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + dev_dbg(emu->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n", channel_id, chip, channel); #endif /* debug */ /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ @@ -231,14 +228,14 @@ int err; epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); - /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ + /* dev_dbg(emu->card->dev, "epcm kcalloc: %p\n", epcm); */ if (epcm == NULL) return -ENOMEM; epcm->emu = emu; epcm->substream = substream; /* - snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", + dev_dbg(emu->card->dev, "epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); */ runtime->private_data = epcm; @@ -251,10 +248,10 @@ channel->use=1; #if 0 /* debug */ - snd_printk(KERN_DEBUG + dev_dbg(emu->card->dev, "p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); - printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", + dev_dbg(emu->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n", channel_id, chip, channel); #endif /* debug */ /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ @@ -349,15 +346,18 @@ u32 tmp; #if 0 /* debug */ - snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, " + dev_dbg(emu->card->dev, + "prepare:channel_number=%d, rate=%d, " "format=0x%x, channels=%d, buffer_size=%ld, " "period_size=%ld, periods=%u, frames_to_bytes=%d\n", channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); - snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", + dev_dbg(emu->card->dev, + "dma_addr=%x, dma_area=%p, table_base=%p\n", runtime->dma_addr, runtime->dma_area, table_base); - snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", + dev_dbg(emu->card->dev, + "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", emu->p16v_buffer.addr, emu->p16v_buffer.area, emu->p16v_buffer.bytes); #endif /* debug */ @@ -405,7 +405,7 @@ u32 tmp; /* - printk(KERN_DEBUG "prepare capture:channel_number=%d, rate=%d, " + dev_dbg(emu->card->dev, "prepare capture:channel_number=%d, rate=%d, " "format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, " "frames_to_bytes=%d\n", channel, runtime->rate, runtime->format, runtime->channels, @@ -491,13 +491,13 @@ runtime = s->runtime; epcm = runtime->private_data; channel = substream->pcm->device-emu->p16v_device_offset; - /* snd_printk(KERN_DEBUG "p16v channel=%d\n", channel); */ + /* dev_dbg(emu->card->dev, "p16v channel=%d\n", channel); */ epcm->running = running; basic |= (0x1<card->dev, "basic=0x%x, inte=0x%x\n", basic, inte); */ switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -588,10 +588,10 @@ ptr=ptr2; if (ptr >= runtime->buffer_size) { ptr -= runtime->buffer_size; - printk(KERN_WARNING "buffer capture limited!\n"); + dev_warn(emu->card->dev, "buffer capture limited!\n"); } /* - printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " + dev_dbg(emu->card->dev, "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, @@ -630,24 +630,22 @@ if (chip->p16v_buffer.area) { snd_dma_free_pages(&chip->p16v_buffer); /* - snd_printk(KERN_DEBUG "period lables free: %p\n", + dev_dbg(chip->card->dev, "period lables free: %p\n", &chip->p16v_buffer); */ } return 0; } -int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) +int snd_p16v_pcm(struct snd_emu10k1 *emu, int device) { struct snd_pcm *pcm; struct snd_pcm_substream *substream; int err; int capture=1; - /* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d\n", device); */ + /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */ emu->p16v_device_offset = device; - if (rpcm) - *rpcm = NULL; if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0) return err; @@ -672,7 +670,7 @@ ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) return err; /* - snd_printk(KERN_DEBUG + dev_dbg(emu->card->dev, "preallocate playback substream: err=%d\n", err); */ } @@ -686,14 +684,11 @@ 65536 - 64, 65536 - 64)) < 0) return err; /* - snd_printk(KERN_DEBUG + dev_dbg(emu->card->dev, "preallocate capture substream: err=%d\n", err); */ } - if (rpcm) - *rpcm = pcm; - return 0; } @@ -754,18 +749,12 @@ static int snd_p16v_capture_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[8] = { + static const char * const texts[8] = { "SPDIF", "I2S", "SRC48", "SRCMulti_SPDIF", "SRCMulti_I2S", "CDIF", "FX", "AC97" }; - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = 1; - uinfo->value.enumerated.items = 8; - if (uinfo->value.enumerated.item > 7) - uinfo->value.enumerated.item = 7; - strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); - return 0; + return snd_ctl_enum_info(uinfo, 1, 8, texts); } static int snd_p16v_capture_source_get(struct snd_kcontrol *kcontrol, @@ -802,15 +791,9 @@ static int snd_p16v_capture_channel_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[4] = { "0", "1", "2", "3", }; + static const char * const texts[4] = { "0", "1", "2", "3", }; - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = 1; - uinfo->value.enumerated.items = 4; - if (uinfo->value.enumerated.item > 3) - uinfo->value.enumerated.item = 3; - strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); - return 0; + return snd_ctl_enum_info(uinfo, 1, 4, texts); } static int snd_p16v_capture_channel_get(struct snd_kcontrol *kcontrol,