--- zzzz-none-000/linux-3.10.107/sound/pci/echoaudio/echoaudio.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/pci/echoaudio/echoaudio.c 2021-02-04 17:41:59.000000000 +0000 @@ -48,17 +48,21 @@ #ifdef CONFIG_PM_SLEEP if (chip->fw_cache[fw_index]) { - DE_ACT(("firmware requested: %s is cached\n", card_fw[fw_index].data)); + dev_dbg(chip->card->dev, + "firmware requested: %s is cached\n", + card_fw[fw_index].data); *fw_entry = chip->fw_cache[fw_index]; return 0; } #endif - DE_ACT(("firmware requested: %s\n", card_fw[fw_index].data)); + dev_dbg(chip->card->dev, + "firmware requested: %s\n", card_fw[fw_index].data); snprintf(name, sizeof(name), "ea/%s", card_fw[fw_index].data); err = request_firmware(fw_entry, name, pci_device(chip)); if (err < 0) - snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); + dev_err(chip->card->dev, + "get_firmware(): Firmware not available (%d)\n", err); #ifdef CONFIG_PM_SLEEP else chip->fw_cache[fw_index] = *fw_entry; @@ -68,13 +72,13 @@ -static void free_firmware(const struct firmware *fw_entry) +static void free_firmware(const struct firmware *fw_entry, + struct echoaudio *chip) { #ifdef CONFIG_PM_SLEEP - DE_ACT(("firmware not released (kept in cache)\n")); + dev_dbg(chip->card->dev, "firmware not released (kept in cache)\n"); #else release_firmware(fw_entry); - DE_ACT(("firmware released\n")); #endif } @@ -88,10 +92,9 @@ for (i = 0; i < 8 ; i++) if (chip->fw_cache[i]) { release_firmware(chip->fw_cache[i]); - DE_ACT(("release_firmware(%d)\n", i)); + dev_dbg(chip->card->dev, "release_firmware(%d)\n", i); } - DE_ACT(("firmware_cache released\n")); #endif } @@ -285,7 +288,7 @@ /* Set up hw capabilities and contraints */ memcpy(&pipe->hw, &pcm_hardware_skel, sizeof(struct snd_pcm_hardware)); - DE_HWP(("max_channels=%d\n", max_channels)); + dev_dbg(chip->card->dev, "max_channels=%d\n", max_channels); pipe->constr.list = channels_list; pipe->constr.mask = 0; for (i = 0; channels_list[i] <= max_channels; i++); @@ -335,7 +338,7 @@ if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), PAGE_SIZE, &pipe->sgpage)) < 0) { - DE_HWP(("s-g list allocation failed\n")); + dev_err(chip->card->dev, "s-g list allocation failed\n"); return err; } @@ -349,7 +352,6 @@ struct echoaudio *chip = snd_pcm_substream_chip(substream); int err; - DE_ACT(("pcm_analog_in_open\n")); if ((err = pcm_open(substream, num_analog_busses_in(chip) - substream->number)) < 0) return err; @@ -366,9 +368,9 @@ atomic_inc(&chip->opencount); if (atomic_read(&chip->opencount) > 1 && chip->rate_set) chip->can_set_rate=0; - DE_HWP(("pcm_analog_in_open cs=%d oc=%d r=%d\n", + dev_dbg(chip->card->dev, "pcm_analog_in_open cs=%d oc=%d r=%d\n", chip->can_set_rate, atomic_read(&chip->opencount), - chip->sample_rate)); + chip->sample_rate); return 0; } @@ -384,7 +386,6 @@ #else max_channels = num_analog_busses_out(chip); #endif - DE_ACT(("pcm_analog_out_open\n")); if ((err = pcm_open(substream, max_channels - substream->number)) < 0) return err; if ((err = snd_pcm_hw_rule_add(substream->runtime, 0, @@ -402,9 +403,9 @@ atomic_inc(&chip->opencount); if (atomic_read(&chip->opencount) > 1 && chip->rate_set) chip->can_set_rate=0; - DE_HWP(("pcm_analog_out_open cs=%d oc=%d r=%d\n", + dev_dbg(chip->card->dev, "pcm_analog_out_open cs=%d oc=%d r=%d\n", chip->can_set_rate, atomic_read(&chip->opencount), - chip->sample_rate)); + chip->sample_rate); return 0; } @@ -417,7 +418,6 @@ struct echoaudio *chip = snd_pcm_substream_chip(substream); int err, max_channels; - DE_ACT(("pcm_digital_in_open\n")); max_channels = num_digital_busses_in(chip) - substream->number; mutex_lock(&chip->mode_mutex); if (chip->digital_mode == DIGITAL_MODE_ADAT) @@ -459,7 +459,6 @@ struct echoaudio *chip = snd_pcm_substream_chip(substream); int err, max_channels; - DE_ACT(("pcm_digital_out_open\n")); max_channels = num_digital_busses_out(chip) - substream->number; mutex_lock(&chip->mode_mutex); if (chip->digital_mode == DIGITAL_MODE_ADAT) @@ -506,18 +505,17 @@ /* Nothing to do here. Audio is already off and pipe will be * freed by its callback */ - DE_ACT(("pcm_close\n")); atomic_dec(&chip->opencount); oc = atomic_read(&chip->opencount); - DE_ACT(("pcm_close oc=%d cs=%d rs=%d\n", oc, - chip->can_set_rate, chip->rate_set)); + dev_dbg(chip->card->dev, "pcm_close oc=%d cs=%d rs=%d\n", oc, + chip->can_set_rate, chip->rate_set); if (oc < 2) chip->can_set_rate = 1; if (oc == 0) chip->rate_set = 0; - DE_ACT(("pcm_close2 oc=%d cs=%d rs=%d\n", oc, - chip->can_set_rate,chip->rate_set)); + dev_dbg(chip->card->dev, "pcm_close2 oc=%d cs=%d rs=%d\n", oc, + chip->can_set_rate, chip->rate_set); return 0; } @@ -541,7 +539,7 @@ */ spin_lock_irq(&chip->lock); if (pipe->index >= 0) { - DE_HWP(("hwp_ie free(%d)\n", pipe->index)); + dev_dbg(chip->card->dev, "hwp_ie free(%d)\n", pipe->index); err = free_pipes(chip, pipe); snd_BUG_ON(err); chip->substream[pipe->index] = NULL; @@ -550,20 +548,21 @@ err = allocate_pipes(chip, pipe, pipe_index, interleave); if (err < 0) { spin_unlock_irq(&chip->lock); - DE_ACT((KERN_NOTICE "allocate_pipes(%d) err=%d\n", - pipe_index, err)); + dev_err(chip->card->dev, "allocate_pipes(%d) err=%d\n", + pipe_index, err); return err; } spin_unlock_irq(&chip->lock); - DE_ACT((KERN_NOTICE "allocate_pipes()=%d\n", pipe_index)); + dev_dbg(chip->card->dev, "allocate_pipes()=%d\n", pipe_index); - DE_HWP(("pcm_hw_params (bufsize=%dB periods=%d persize=%dB)\n", + dev_dbg(chip->card->dev, + "pcm_hw_params (bufsize=%dB periods=%d persize=%dB)\n", params_buffer_bytes(hw_params), params_periods(hw_params), - params_period_bytes(hw_params))); + params_period_bytes(hw_params)); err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); if (err < 0) { - snd_printk(KERN_ERR "malloc_pages err=%d\n", err); + dev_err(chip->card->dev, "malloc_pages err=%d\n", err); spin_lock_irq(&chip->lock); free_pipes(chip, pipe); spin_unlock_irq(&chip->lock); @@ -614,7 +613,6 @@ spin_lock_irq(&chip->lock); set_sample_rate(chip, hw_params->rate_num / hw_params->rate_den); spin_unlock_irq(&chip->lock); - DE_HWP(("pcm_hw_params ok\n")); return 0; } @@ -678,14 +676,13 @@ spin_lock_irq(&chip->lock); if (pipe->index >= 0) { - DE_HWP(("pcm_hw_free(%d)\n", pipe->index)); + dev_dbg(chip->card->dev, "pcm_hw_free(%d)\n", pipe->index); free_pipes(chip, pipe); chip->substream[pipe->index] = NULL; pipe->index = -1; } spin_unlock_irq(&chip->lock); - DE_HWP(("pcm_hw_freed\n")); snd_pcm_lib_free_pages(substream); return 0; } @@ -699,8 +696,8 @@ struct audioformat format; int pipe_index = ((struct audiopipe *)runtime->private_data)->index; - DE_HWP(("Prepare rate=%d format=%d channels=%d\n", - runtime->rate, runtime->format, runtime->channels)); + dev_dbg(chip->card->dev, "Prepare rate=%d format=%d channels=%d\n", + runtime->rate, runtime->format, runtime->channels); format.interleave = runtime->channels; format.data_are_bigendian = 0; format.mono_to_stereo = 0; @@ -720,8 +717,9 @@ format.bits_per_sample = 32; break; default: - DE_HWP(("Prepare error: unsupported format %d\n", - runtime->format)); + dev_err(chip->card->dev, + "Prepare error: unsupported format %d\n", + runtime->format); return -EINVAL; } @@ -756,10 +754,8 @@ spin_lock(&chip->lock); switch (cmd) { case SNDRV_PCM_TRIGGER_RESUME: - DE_ACT(("pcm_trigger resume\n")); case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - DE_ACT(("pcm_trigger start\n")); for (i = 0; i < DSP_MAXPIPES; i++) { if (channelmask & (1 << i)) { pipe = chip->substream[i]->runtime->private_data; @@ -781,9 +777,7 @@ chip->pipe_cyclic_mask); break; case SNDRV_PCM_TRIGGER_SUSPEND: - DE_ACT(("pcm_trigger suspend\n")); case SNDRV_PCM_TRIGGER_STOP: - DE_ACT(("pcm_trigger stop\n")); for (i = 0; i < DSP_MAXPIPES; i++) { if (channelmask & (1 << i)) { pipe = chip->substream[i]->runtime->private_data; @@ -793,7 +787,6 @@ err = stop_transport(chip, channelmask); break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - DE_ACT(("pcm_trigger pause\n")); for (i = 0; i < DSP_MAXPIPES; i++) { if (channelmask & (1 << i)) { pipe = chip->substream[i]->runtime->private_data; @@ -930,7 +923,6 @@ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &analog_capture_ops); if ((err = snd_echo_preallocate_pages(pcm, snd_dma_pci_data(chip->pci))) < 0) return err; - DE_INIT(("Analog PCM ok\n")); #ifdef ECHOCARD_HAS_DIGITAL_IO /* PCM#1 Digital inputs, no outputs */ @@ -943,7 +935,6 @@ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &digital_capture_ops); if ((err = snd_echo_preallocate_pages(pcm, snd_dma_pci_data(chip->pci))) < 0) return err; - DE_INIT(("Digital PCM ok\n")); #endif /* ECHOCARD_HAS_DIGITAL_IO */ #else /* ECHOCARD_HAS_VMIXER */ @@ -965,7 +956,6 @@ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &analog_capture_ops); if ((err = snd_echo_preallocate_pages(pcm, snd_dma_pci_data(chip->pci))) < 0) return err; - DE_INIT(("Analog PCM ok\n")); #ifdef ECHOCARD_HAS_DIGITAL_IO /* PCM#1 Digital i/o */ @@ -980,7 +970,6 @@ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &digital_capture_ops); if ((err = snd_echo_preallocate_pages(pcm, snd_dma_pci_data(chip->pci))) < 0) return err; - DE_INIT(("Digital PCM ok\n")); #endif /* ECHOCARD_HAS_DIGITAL_IO */ #endif /* ECHOCARD_HAS_VMIXER */ @@ -1294,12 +1283,14 @@ static int snd_echo_mixer_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct echoaudio *chip; + struct echoaudio *chip = snd_kcontrol_chip(kcontrol); + unsigned int out = ucontrol->id.index / num_busses_in(chip); + unsigned int in = ucontrol->id.index % num_busses_in(chip); - chip = snd_kcontrol_chip(kcontrol); - ucontrol->value.integer.value[0] = - chip->monitor_gain[ucontrol->id.index / num_busses_in(chip)] - [ucontrol->id.index % num_busses_in(chip)]; + if (out >= ECHO_MAXAUDIOOUTPUTS || in >= ECHO_MAXAUDIOINPUTS) + return -EINVAL; + + ucontrol->value.integer.value[0] = chip->monitor_gain[out][in]; return 0; } @@ -1308,12 +1299,14 @@ { struct echoaudio *chip; int changed, gain; - short out, in; + unsigned int out, in; changed = 0; chip = snd_kcontrol_chip(kcontrol); out = ucontrol->id.index / num_busses_in(chip); in = ucontrol->id.index % num_busses_in(chip); + if (out >= ECHO_MAXAUDIOOUTPUTS || in >= ECHO_MAXAUDIOINPUTS) + return -EINVAL; gain = ucontrol->value.integer.value[0]; if (gain < ECHOGAIN_MINOUT || gain > ECHOGAIN_MAXOUT) return -EINVAL; @@ -1415,21 +1408,14 @@ static int snd_echo_digital_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *names[4] = { + static const char * const names[4] = { "S/PDIF Coaxial", "S/PDIF Optical", "ADAT Optical", "S/PDIF Cdrom" }; struct echoaudio *chip; chip = snd_kcontrol_chip(kcontrol); - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->value.enumerated.items = chip->num_digital_modes; - uinfo->count = 1; - if (uinfo->value.enumerated.item >= chip->num_digital_modes) - uinfo->value.enumerated.item = chip->num_digital_modes - 1; - strcpy(uinfo->value.enumerated.name, names[ - chip->digital_mode_list[uinfo->value.enumerated.item]]); - return 0; + return snd_ctl_enum_info(uinfo, 1, chip->num_digital_modes, names); } static int snd_echo_digital_mode_get(struct snd_kcontrol *kcontrol, @@ -1480,7 +1466,8 @@ snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->clock_src_ctl->id); - DE_ACT(("SDM() =%d\n", changed)); + dev_dbg(chip->card->dev, + "SDM() =%d\n", changed); } if (changed >= 0) changed = 1; /* No errors */ @@ -1508,16 +1495,9 @@ static int snd_echo_spdif_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *names[2] = {"Consumer", "Professional"}; + static const char * const names[2] = {"Consumer", "Professional"}; - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->value.enumerated.items = 2; - uinfo->count = 1; - if (uinfo->value.enumerated.item) - uinfo->value.enumerated.item = 1; - strcpy(uinfo->value.enumerated.name, - names[uinfo->value.enumerated.item]); - return 0; + return snd_ctl_enum_info(uinfo, 1, 2, names); } static int snd_echo_spdif_mode_get(struct snd_kcontrol *kcontrol, @@ -1565,21 +1545,14 @@ static int snd_echo_clock_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *names[8] = { + static const char * const names[8] = { "Internal", "Word", "Super", "S/PDIF", "ADAT", "ESync", "ESync96", "MTC" }; struct echoaudio *chip; chip = snd_kcontrol_chip(kcontrol); - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->value.enumerated.items = chip->num_clock_sources; - uinfo->count = 1; - if (uinfo->value.enumerated.item >= chip->num_clock_sources) - uinfo->value.enumerated.item = chip->num_clock_sources - 1; - strcpy(uinfo->value.enumerated.name, names[ - chip->clock_source_list[uinfo->value.enumerated.item]]); - return 0; + return snd_ctl_enum_info(uinfo, 1, chip->num_clock_sources, names); } static int snd_echo_clock_source_get(struct snd_kcontrol *kcontrol, @@ -1621,7 +1594,8 @@ } if (changed < 0) - DE_ACT(("seticlk val%d err 0x%x\n", dclock, changed)); + dev_dbg(chip->card->dev, + "seticlk val%d err 0x%x\n", dclock, changed); return changed; } @@ -1753,9 +1727,6 @@ static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct echoaudio *chip; - - chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 96; uinfo->value.integer.min = ECHOGAIN_MINOUT; @@ -1797,9 +1768,6 @@ static int snd_echo_channels_info_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct echoaudio *chip; - - chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 6; uinfo->value.integer.min = 0; @@ -1884,7 +1852,7 @@ #ifdef ECHOCARD_HAS_MIDI if (st > 0 && chip->midi_in) { snd_rawmidi_receive(chip->midi_in, chip->midi_buffer, st); - DE_MID(("rawmidi_iread=%d\n", st)); + dev_dbg(chip->card->dev, "rawmidi_iread=%d\n", st); } #endif return IRQ_HANDLED; @@ -1899,10 +1867,8 @@ static int snd_echo_free(struct echoaudio *chip) { - DE_INIT(("Stop DSP...\n")); if (chip->comm_page) rest_in_peace(chip); - DE_INIT(("Stopped.\n")); if (chip->irq >= 0) free_irq(chip->irq, chip); @@ -1910,20 +1876,13 @@ if (chip->comm_page) snd_dma_free_pages(&chip->commpage_dma_buf); - if (chip->dsp_registers) - iounmap(chip->dsp_registers); - - if (chip->iores) - release_and_free_resource(chip->iores); - - DE_INIT(("MMIO freed.\n")); - + iounmap(chip->dsp_registers); + release_and_free_resource(chip->iores); pci_disable_device(chip->pci); /* release chip data */ free_firmware_cache(chip); kfree(chip); - DE_INIT(("Chip freed.\n")); return 0; } @@ -1933,7 +1892,6 @@ { struct echoaudio *chip = device->device_data; - DE_INIT(("snd_echo_dev_free()...\n")); return snd_echo_free(chip); } @@ -1966,7 +1924,7 @@ pci_disable_device(pci); return -ENOMEM; } - DE_INIT(("chip=%p\n", chip)); + dev_dbg(card->dev, "chip=%p\n", chip); spin_lock_init(&chip->lock); chip->card = card; chip->pci = pci; @@ -1989,8 +1947,8 @@ if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz, ECHOCARD_NAME)) == NULL) { + dev_err(chip->card->dev, "cannot get memory region\n"); snd_echo_free(chip); - snd_printk(KERN_ERR "cannot get memory region\n"); return -EBUSY; } chip->dsp_registers = (volatile u32 __iomem *) @@ -1998,21 +1956,21 @@ if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, KBUILD_MODNAME, chip)) { + dev_err(chip->card->dev, "cannot grab irq\n"); snd_echo_free(chip); - snd_printk(KERN_ERR "cannot grab irq\n"); return -EBUSY; } chip->irq = pci->irq; - DE_INIT(("pci=%p irq=%d subdev=%04x Init hardware...\n", - chip->pci, chip->irq, chip->pci->subsystem_device)); + dev_dbg(card->dev, "pci=%p irq=%d subdev=%04x Init hardware...\n", + chip->pci, chip->irq, chip->pci->subsystem_device); /* Create the DSP comm page - this is the area of memory used for most of the communication with the DSP, which accesses it via bus mastering */ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), sizeof(struct comm_page), &chip->commpage_dma_buf) < 0) { + dev_err(chip->card->dev, "cannot allocate the comm page\n"); snd_echo_free(chip); - snd_printk(KERN_ERR "cannot allocate the comm page\n"); return -ENOMEM; } chip->comm_page_phys = chip->commpage_dma_buf.addr; @@ -2022,11 +1980,10 @@ if (err >= 0) err = set_mixer_defaults(chip); if (err < 0) { - DE_INIT(("init_hw err=%d\n", err)); + dev_err(card->dev, "init_hw err=%d\n", err); snd_echo_free(chip); return err; } - DE_INIT(("Card init OK\n")); if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { snd_echo_free(chip); @@ -2056,14 +2013,12 @@ return -ENOENT; } - DE_INIT(("Echoaudio driver starting...\n")); i = 0; - err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); + err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, + 0, &card); if (err < 0) return err; - snd_card_set_dev(card, &pci->dev); - chip = NULL; /* Tells snd_echo_create to allocate chip */ if ((err = snd_echo_create(card, pci, &chip)) < 0) { snd_card_free(card); @@ -2082,7 +2037,7 @@ chip->dsp_registers_phys, chip->irq); if ((err = snd_echo_new_pcm(chip)) < 0) { - snd_printk(KERN_ERR "new pcm error %d\n", err); + dev_err(chip->card->dev, "new pcm error %d\n", err); snd_card_free(card); return err; } @@ -2090,7 +2045,7 @@ #ifdef ECHOCARD_HAS_MIDI if (chip->has_midi) { /* Some Mia's do not have midi */ if ((err = snd_echo_midi_create(card, chip)) < 0) { - snd_printk(KERN_ERR "new midi error %d\n", err); + dev_err(chip->card->dev, "new midi error %d\n", err); snd_card_free(card); return err; } @@ -2189,14 +2144,14 @@ err = snd_card_register(card); if (err < 0) goto ctl_error; - snd_printk(KERN_INFO "Card registered: %s\n", card->longname); + dev_info(card->dev, "Card registered: %s\n", card->longname); pci_set_drvdata(pci, chip); dev++; return 0; ctl_error: - snd_printk(KERN_ERR "new control error %d\n", err); + dev_err(card->dev, "new control error %d\n", err); snd_card_free(card); return err; } @@ -2207,10 +2162,8 @@ static int snd_echo_suspend(struct device *dev) { - struct pci_dev *pci = to_pci_dev(dev); struct echoaudio *chip = dev_get_drvdata(dev); - DE_INIT(("suspend start\n")); snd_pcm_suspend_all(chip->analog_pcm); snd_pcm_suspend_all(chip->digital_pcm); @@ -2234,10 +2187,6 @@ chip->dsp_code = NULL; free_irq(chip->irq, chip); chip->irq = -1; - pci_save_state(pci); - pci_disable_device(pci); - - DE_INIT(("suspend done\n")); return 0; } @@ -2251,22 +2200,19 @@ u32 pipe_alloc_mask; int err; - DE_INIT(("resume start\n")); - pci_restore_state(pci); - commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); + commpage_bak = kmalloc(sizeof(*commpage), GFP_KERNEL); if (commpage_bak == NULL) return -ENOMEM; commpage = chip->comm_page; - memcpy(commpage_bak, commpage, sizeof(struct comm_page)); + memcpy(commpage_bak, commpage, sizeof(*commpage)); err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device); if (err < 0) { kfree(commpage_bak); - DE_INIT(("resume init_hw err=%d\n", err)); + dev_err(dev, "resume init_hw err=%d\n", err); snd_echo_free(chip); return err; } - DE_INIT(("resume init OK\n")); /* Temporarily set chip->pipe_alloc_mask=0 otherwise * restore_dsp_settings() fails. @@ -2279,7 +2225,6 @@ kfree(commpage_bak); return err; } - DE_INIT(("resume restore OK\n")); memcpy(&commpage->audio_format, &commpage_bak->audio_format, sizeof(commpage->audio_format)); @@ -2291,21 +2236,20 @@ if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, KBUILD_MODNAME, chip)) { + dev_err(chip->card->dev, "cannot grab irq\n"); snd_echo_free(chip); - snd_printk(KERN_ERR "cannot grab irq\n"); return -EBUSY; } chip->irq = pci->irq; - DE_INIT(("resume irq=%d\n", chip->irq)); + dev_dbg(dev, "resume irq=%d\n", chip->irq); #ifdef ECHOCARD_HAS_MIDI if (chip->midi_input_enabled) - enable_midi_input(chip, TRUE); + enable_midi_input(chip, true); if (chip->midi_out) snd_echo_midi_output_trigger(chip->midi_out, 1); #endif - DE_INIT(("resume done\n")); return 0; } @@ -2323,7 +2267,6 @@ chip = pci_get_drvdata(pci); if (chip) snd_card_free(chip->card); - pci_set_drvdata(pci, NULL); }