Ignore:
Timestamp:
Sep 26, 2021, 6:18:40 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/rme9652/hdsp.c

    r695 r703  
    290290        return 110100480000000 / rate; // 105 MHz
    291291*/
    292 #define DDS_NUMERATOR 104857600000000ULL;  /*  =  2^20 * 10^8 */
     292#define DDS_NUMERATOR 104857600000000ULL  /*  =  2^20 * 10^8 */
    293293
    294294#define hdsp_encode_latency(x)       (((x)<<1) & HDSP_LatencyMask)
     
    13191319        if (hmidi->output) {
    13201320                if (!snd_rawmidi_transmit_empty (hmidi->output)) {
    1321                         if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) {
     1321                        n_pending = snd_hdsp_midi_output_possible(hmidi->hdsp, hmidi->id);
     1322                        if (n_pending > 0) {
    13221323                                if (n_pending > (int)sizeof (buf))
    13231324                                        n_pending = sizeof (buf);
    13241325
    1325                                 if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) {
     1326                                to_write = snd_rawmidi_transmit(hmidi->output, buf, n_pending);
     1327                                if (to_write > 0) {
    13261328                                        for (i = 0; i < to_write; ++i)
    13271329                                                snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]);
     
    13421344
    13431345        spin_lock_irqsave (&hmidi->lock, flags);
    1344         if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) {
     1346        n_pending = snd_hdsp_midi_input_available(hmidi->hdsp, hmidi->id);
     1347        if (n_pending > 0) {
    13451348                if (hmidi->input) {
    13461349                        if (n_pending > (int)sizeof (buf))
     
    33233326
    33243327        for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_controls); idx++) {
    3325                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0)
     3328                kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp);
     3329                err = snd_ctl_add(card, kctl);
     3330                if (err < 0)
    33263331                        return err;
    33273332                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
     
    33323337        snd_hdsp_adat_sync_check.name = "ADAT Lock Status";
    33333338        snd_hdsp_adat_sync_check.index = 1;
    3334         if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp))))
     3339        kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp);
     3340        err = snd_ctl_add(card, kctl);
     3341        if (err < 0)
    33353342                return err;
    33363343        if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
    33373344                for (idx = 1; idx < 3; ++idx) {
    33383345                        snd_hdsp_adat_sync_check.index = idx+1;
    3339                         if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp))))
     3346                        kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp);
     3347                        err = snd_ctl_add(card, kctl);
     3348                        if (err < 0)
    33403349                                return err;
    33413350                }
     
    33453354        if (hdsp->io_type == H9632) {
    33463355                for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) {
    3347                         if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp))) < 0)
     3356                        kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp);
     3357                        err = snd_ctl_add(card, kctl);
     3358                        if (err < 0)
    33483359                                return err;
    33493360                }
     
    33633374        /* AEB control for H96xx card */
    33643375        if (hdsp->io_type == H9632 || hdsp->io_type == H9652) {
    3365                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp))) < 0)
    3366                                 return err;
     3376                kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp);
     3377                err = snd_ctl_add(card, kctl);
     3378                if (err < 0)
     3379                        return err;
    33673380        }
    33683381
     
    39433956                return NULL;
    39443957
    3945         if ((mapped_channel = hdsp->channel_map[channel]) < 0)
     3958        mapped_channel = hdsp->channel_map[channel];
     3959        if (mapped_channel < 0)
    39463960                return NULL;
    39473961
     
    41154129        spin_lock_irq(&hdsp->lock);
    41164130        if (! hdsp->clock_source_locked) {
    4117                 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) {
     4131                err = hdsp_set_rate(hdsp, params_rate(params), 0);
     4132                if (err < 0) {
    41184133                        spin_unlock_irq(&hdsp->lock);
    41194134                        _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
     
    41234138        spin_unlock_irq(&hdsp->lock);
    41244139
    4125         if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) {
     4140        err = hdsp_set_interrupt_interval(hdsp, params_period_size(params));
     4141        if (err < 0) {
    41264142                _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
    41274143                return err;
     
    48554871                if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL;
    48564872                if (hdsp->io_type == Undefined) {
    4857                         if ((err = hdsp_get_iobox_version(hdsp)) < 0)
     4873                        err = hdsp_get_iobox_version(hdsp);
     4874                        if (err < 0)
    48584875                                return err;
    48594876                }
     
    48614878                hdsp_version.io_type = hdsp->io_type;
    48624879                hdsp_version.firmware_rev = hdsp->firmware_rev;
    4863                 if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version))))
    4864                         return -EFAULT;
     4880                if (copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))
     4881                        return -EFAULT;
    48654882                break;
    48664883        }
     
    49014918                hdsp->state |= HDSP_FirmwareCached;
    49024919
    4903                 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0)
     4920                err = snd_hdsp_load_firmware_from_cache(hdsp);
     4921                if (err < 0)
    49044922                        return err;
    49054923
    49064924                if (!(hdsp->state & HDSP_InitializationComplete)) {
    4907                         if ((err = snd_hdsp_enable_io(hdsp)) < 0)
     4925                        err = snd_hdsp_enable_io(hdsp);
     4926                        if (err < 0)
    49084927                                return err;
    49094928
     
    49114930                        snd_hdsp_initialize_midi_flush(hdsp);
    49124931
    4913                         if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
     4932                        err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp);
     4933                        if (err < 0) {
    49144934                                dev_err(hdsp->card->dev,
    49154935                                        "error creating alsa devices\n");
     
    49614981        int err;
    49624982
    4963         if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0)
     4983        err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw);
     4984        if (err < 0)
    49644985                return err;
    49654986
     
    49795000        int err;
    49805001
    4981         if ((err = snd_pcm_new(card, hdsp->card_name, 0, 1, 1, &pcm)) < 0)
     5002        err = snd_pcm_new(card, hdsp->card_name, 0, 1, 1, &pcm);
     5003        if (err < 0)
    49825004                return err;
    49835005
     
    50855107        int err;
    50865108
    5087         if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) {
     5109        err = snd_hdsp_create_pcm(card, hdsp);
     5110        if (err < 0) {
    50885111                dev_err(card->dev,
    50895112                        "Error creating pcm interface\n");
     
    50925115
    50935116
    5094         if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) {
     5117        err = snd_hdsp_create_midi(card, hdsp, 0);
     5118        if (err < 0) {
    50955119                dev_err(card->dev,
    50965120                        "Error creating first midi interface\n");
     
    50995123
    51005124        if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
    5101                 if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) {
     5125                err = snd_hdsp_create_midi(card, hdsp, 1);
     5126                if (err < 0) {
    51025127                        dev_err(card->dev,
    51035128                                "Error creating second midi interface\n");
     
    51065131        }
    51075132
    5108         if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) {
     5133        err = snd_hdsp_create_controls(card, hdsp);
     5134        if (err < 0) {
    51095135                dev_err(card->dev,
    51105136                        "Error creating ctl interface\n");
     
    51205146        hdsp->playback_substream = NULL;
    51215147
    5122         if ((err = snd_hdsp_set_defaults(hdsp)) < 0) {
     5148        err = snd_hdsp_set_defaults(hdsp);
     5149        if (err < 0) {
    51235150                dev_err(card->dev,
    51245151                        "Error setting default values\n");
     
    51315158                        hdsp->port, hdsp->irq);
    51325159
    5133                 if ((err = snd_card_register(card)) < 0) {
     5160                err = snd_card_register(card);
     5161                if (err < 0) {
    51345162                        dev_err(card->dev,
    51355163                                "error registering card\n");
     
    51525180                return 0;
    51535181        if (hdsp->io_type == Undefined) {
    5154                 if ((err = hdsp_get_iobox_version(hdsp)) < 0)
     5182                err = hdsp_get_iobox_version(hdsp);
     5183                if (err < 0)
    51555184                        return err;
    51565185                if (hdsp->io_type == H9652 || hdsp->io_type == H9632)
     
    51985227        hdsp->state |= HDSP_FirmwareCached;
    51995228
    5200         if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0)
     5229        err = snd_hdsp_load_firmware_from_cache(hdsp);
     5230        if (err < 0)
    52015231                return err;
    52025232
    52035233        if (!(hdsp->state & HDSP_InitializationComplete)) {
    5204                 if ((err = snd_hdsp_enable_io(hdsp)) < 0)
     5234                err = snd_hdsp_enable_io(hdsp);
     5235                if (err < 0)
    52055236                        return err;
    52065237
    5207                 if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) {
     5238                err = snd_hdsp_create_hwdep(hdsp->card, hdsp);
     5239                if (err < 0) {
    52085240                        dev_err(hdsp->card->dev,
    52095241                                "error creating hwdep device\n");
     
    52125244                snd_hdsp_initialize_channels(hdsp);
    52135245                snd_hdsp_initialize_midi_flush(hdsp);
    5214                 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
     5246                err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp);
     5247                if (err < 0) {
    52155248                        dev_err(hdsp->card->dev,
    52165249                                "error creating alsa devices\n");
     
    52815314        }
    52825315
    5283         if ((err = pci_enable_device(pci)) < 0)
     5316        err = pci_enable_device(pci);
     5317        if (err < 0)
    52845318                return err;
    52855319
    52865320        pci_set_master(hdsp->pci);
    52875321
    5288         if ((err = pci_request_regions(pci, "hdsp")) < 0)
     5322        err = pci_request_regions(pci, "hdsp");
     5323        if (err < 0)
    52895324                return err;
    52905325        hdsp->port = pci_resource_start(pci, 0);
    5291         if ((hdsp->iobase = ioremap(hdsp->port, HDSP_IO_EXTENT)) == NULL) {
     5326        hdsp->iobase = ioremap(hdsp->port, HDSP_IO_EXTENT);
     5327        if (!hdsp->iobase) {
    52925328                dev_err(hdsp->card->dev, "unable to remap region 0x%lx-0x%lx\n",
    52935329                        hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1);
     
    53075343        hdsp->dds_value = 0;
    53085344
    5309         if ((err = snd_hdsp_initialize_memory(hdsp)) < 0)
     5345        err = snd_hdsp_initialize_memory(hdsp);
     5346        if (err < 0)
    53105347                return err;
    53115348
     
    53195356
    53205357                if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    5321                         if ((err = hdsp_request_fw_loader(hdsp)) < 0)
     5358                        err = hdsp_request_fw_loader(hdsp);
     5359                        if (err < 0)
    53225360                                /* we don't fail as this can happen
    53235361                                   if userspace is not ready for
     
    53325370                        dev_info(hdsp->card->dev,
    53335371                                 "card initialization pending : waiting for firmware\n");
    5334                         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
     5372                        err = snd_hdsp_create_hwdep(card, hdsp);
     5373                        if (err < 0)
    53355374                                return err;
    53365375                        return 0;
     
    53475386        }
    53485387
    5349         if ((err = snd_hdsp_enable_io(hdsp)) != 0)
     5388        err = snd_hdsp_enable_io(hdsp);
     5389        if (err)
    53505390                return err;
    53515391
     
    53565396                hdsp->io_type = H9632;
    53575397
    5358         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
     5398        err = snd_hdsp_create_hwdep(card, hdsp);
     5399        if (err < 0)
    53595400                return err;
    53605401
     
    53645405        hdsp->state |= HDSP_FirmwareLoaded;
    53655406
    5366         if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0)
     5407        err = snd_hdsp_create_alsa_devices(card, hdsp);
     5408        if (err < 0)
    53675409                return err;
    53685410
Note: See TracChangeset for help on using the changeset viewer.