Ignore:
Timestamp:
Jan 4, 2021, 10:15:17 AM (5 years ago)
Author:
Paul Smedley
Message:

Update source to linux 5.10.4 level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/alsa-kernel/drivers/dummy.c

    r615 r629  
    118118struct snd_dummy {
    119119        struct snd_card *card;
    120         struct dummy_model *model;
     120        const struct dummy_model *model;
    121121        struct snd_pcm *pcm;
    122122        struct snd_pcm_hardware pcm_hw;
     
    145145}
    146146
    147 static struct dummy_model model_emu10k1 = {
     147static const struct dummy_model model_emu10k1 = {
    148148        .name = "emu10k1",
    149149        .playback_constraints = emu10k1_playback_constraints,
     
    151151};
    152152
    153 static struct dummy_model model_rme9652 = {
     153static const struct dummy_model model_rme9652 = {
    154154        .name = "rme9652",
    155155        .buffer_bytes_max = 26 * 64 * 1024,
     
    161161};
    162162
    163 static struct dummy_model model_ice1712 = {
     163static const struct dummy_model model_ice1712 = {
    164164        .name = "ice1712",
    165165        .buffer_bytes_max = 256 * 1024,
     
    171171};
    172172
    173 static struct dummy_model model_uda1341 = {
     173static const struct dummy_model model_uda1341 = {
    174174        .name = "uda1341",
    175175        .buffer_bytes_max = 16380,
     
    181181};
    182182
    183 static struct dummy_model model_ac97 = {
     183static const struct dummy_model model_ac97 = {
    184184        .name = "ac97",
    185185        .formats = SNDRV_PCM_FMTBIT_S16_LE,
     
    191191};
    192192
    193 static struct dummy_model model_ca0106 = {
     193static const struct dummy_model model_ca0106 = {
    194194        .name = "ca0106",
    195195        .formats = SNDRV_PCM_FMTBIT_S16_LE,
     
    205205};
    206206
    207 static struct dummy_model *dummy_models[] = {
     207static const struct dummy_model *dummy_models[] = {
    208208        &model_emu10k1,
    209209        &model_rme9652,
     
    530530                return 0;
    531531        }
    532         return snd_pcm_lib_malloc_pages(substream,
    533                                         params_buffer_bytes(hw_params));
    534 }
    535 
    536 static int dummy_pcm_hw_free(struct snd_pcm_substream *substream)
    537 {
    538         if (fake_buffer)
    539                 return 0;
    540         return snd_pcm_lib_free_pages(substream);
     532        return 0;
    541533}
    542534
     
    544536{
    545537        struct snd_dummy *dummy = snd_pcm_substream_chip(substream);
    546         struct dummy_model *model = dummy->model;
     538        const struct dummy_model *model = dummy->model;
    547539        struct snd_pcm_runtime *runtime = substream->runtime;
    548540        const struct dummy_timer_ops *ops;
     
    653645}
    654646
    655 static struct snd_pcm_ops dummy_pcm_ops = {
     647static const struct snd_pcm_ops dummy_pcm_ops = {
    656648        .open =         dummy_pcm_open,
    657649        .close =        dummy_pcm_close,
    658         .ioctl =        snd_pcm_lib_ioctl,
    659650        .hw_params =    dummy_pcm_hw_params,
    660         .hw_free =      dummy_pcm_hw_free,
    661651        .prepare =      dummy_pcm_prepare,
    662652        .trigger =      dummy_pcm_trigger,
     
    664654};
    665655
    666 static struct snd_pcm_ops dummy_pcm_ops_no_buf = {
     656static const struct snd_pcm_ops dummy_pcm_ops_no_buf = {
    667657        .open =         dummy_pcm_open,
    668658        .close =        dummy_pcm_close,
    669         .ioctl =        snd_pcm_lib_ioctl,
    670659        .hw_params =    dummy_pcm_hw_params,
    671         .hw_free =      dummy_pcm_hw_free,
    672660        .prepare =      dummy_pcm_prepare,
    673661        .trigger =      dummy_pcm_trigger,
     
    683671{
    684672        struct snd_pcm *pcm;
    685         struct snd_pcm_ops *ops;
     673        const struct snd_pcm_ops *ops;
    686674        int err;
    687675
     
    701689        strcpy(pcm->name, "Dummy PCM");
    702690        if (!fake_buffer) {
    703                 snd_pcm_lib_preallocate_pages_for_all(pcm,
     691                snd_pcm_set_managed_buffer_all(pcm,
    704692                        SNDRV_DMA_TYPE_CONTINUOUS,
    705                         snd_dma_continuous_data(GFP_KERNEL),
     693                        NULL,
    706694                        0, 64*1024);
    707695        }
     
    862850}
    863851
    864 static struct snd_kcontrol_new snd_dummy_controls[] = {
     852static const struct snd_kcontrol_new snd_dummy_controls[] = {
    865853DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
    866854DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
     
    914902                          struct snd_info_buffer *buffer)
    915903{
    916         int i;
    917 
    918         for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
    919                 if (dummy->pcm_hw.formats & (1ULL << i))
     904        snd_pcm_format_t i;
     905
     906        pcm_for_each_format(i) {
     907                if (dummy->pcm_hw.formats & pcm_format_to_bits(i))
    920908                        snd_iprintf(buffer, " %s", snd_pcm_format_name(i));
    921909        }
     
    925913                        struct snd_info_buffer *buffer)
    926914{
    927         static int rates[] = {
     915        static const int rates[] = {
    928916                5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000,
    929917                64000, 88200, 96000, 176400, 192000,
     
    957945        .size = sizeof(dummy_pcm_hardware.item) }
    958946
    959 static struct dummy_hw_field fields[] = {
     947static const struct dummy_hw_field fields[] = {
    960948        FIELD_ENTRY(formats, "%#llx"),
    961949        FIELD_ENTRY(rates, "%#x"),
     
    10351023        struct snd_card *card;
    10361024        struct snd_dummy *dummy;
    1037         struct dummy_model *m = NULL, **mdl;
     1025        const struct dummy_model *m = NULL, **mdl;
    10381026        int idx, err;
    10391027        int dev = devptr->id;
Note: See TracChangeset for help on using the changeset viewer.