ALSA: usb-audio: Return meaningful error codes instead of -1 in format.c

Also, silences the following smatch warning:
sound/usb/format.c:170 parse_audio_format_rates_v1() warn:
returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: Deprecate async_unlink option

The async unlink behavior has been working over years.  The option was
provided only as a workaround for 2.4.x kernel.  Let's get rid of it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: simplify snd_usb_endpoint_start/stop arguments

Reduce the redundant arguments for snd_usb_endpoint_start() and
snd_usb_endpoint_stop().  Also replaced from int to bool.

No functional changes by this commit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: simplify endpoint deactivation code

For further code simplification, drop the conditional call for
usb_kill_urb() with can_wait argument in deactivate_urbs(), and use
only usb_unlink_urb() and wait_clear_urbs() pairs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: stop both data and sync endpoints asynchronously

As we are stopping the endpoints asynchronously now, it's better to
trigger the stop of both data and sync endpoints and wait for pending
stopping operations, instead of the sequential trigger-and-wait
procedure.

So the wait argument in snd_usb_endpoint_stop() is dropped, and it's
expected that the caller synchronizes explicitly by calling
snd_usb_endpoint_sync_pending_stop().  (Actually there is only one
place calling this, so it was safe to change.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: process pending stop at PCM hw_free and close

PCM hw_free and close should wait until all the pending stop
operations have been finished.  Basically only PCM trigger callback
should use non-wait calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Use standard helper functions in patch_hdmi.c

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Remove shutup calls in free callbacks

The free callback is called at the state where no extra verbs are
executed, thus calling *_shutup() is useless, as it's checking the
shutdown flag.  Remove such superfluous calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Don't overwrite the pin default configs

Since we keep the pin default config values anyway internally, we
don't have to set the values in the codec.  This patch removes the
code writing the pincfg values.

As a gratis bonus, we can remove also the code restoring the original
pincfg values at PM resume or module free.  This will give us more
benefit, as it can reduce the unnecessary power-up of codecs.

This won't change the driver functionality.  The only difference would
be that the codec proc file will show the original pincfg values
instead of the actually referred values.  The actually referred values
can be determined from sysfs *_pin_configs files.
(Also hda-emu was updated to follow this change.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: mixart: hard dependency on the standard fw loader

It makes no longer sense to keep the old hwdep user-space firmware
loading, which has been deprecated since ages ago.

Just add a hard dependency on CONFIG_FW_LOADER and drop the useless
code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: pcxhr: hard dependency on the standard fw loader

Like the previous commit for mixart, drop the home-baked fw loader
code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: vx: hard dependency on the standard fw loader

Yet again like previous two commits, drop the old hwdep user-space
firmware code from vx driver (snd-vxpocket and snd-vx222).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Don't release firmware when CONFIG_PM is set

The new firmware code tries to re-read the formerly read firmware
files before suspend.  Thus it's wiser to keep the "patch" firmware in
the driver for avoiding this unnecessary re-reading.

Of course, this will consume a bit of memory for unused stuff, but
the patch fw is supposed to be fairly small, so it's more benefit in
the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ymfpci: Use kmalloc for register buffer for PM

Th buffer to save registers for PM is enough small for kmalloc(), not
necessary to use vmalloc().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hdsp: improve firmware caching

As the recent firmware code tries to reread and cache the firmware by
itself, it's even better to keep the struct firmware data instead of
keeping a local copy.  Also, it makes little sense to disable the fw
loader for this driver, so added the explicit dependency, too.

Last, but not least, allocate the firmware data loaded via ioctl in
vmalloc'ed buffer instead, as the firmware size isn't that small.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: emu10k1: cache emu1010 firmware

Instead of calling request_firmware() at each time, keep the obtained
firmware internally and reuse it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: emu10k1: don't update firmware during suspend/resume

Add a flag to suppress the update in emu1010_firmware_thread() during
suspend/resume.

Signed-off-by: Takashi Iwai <tiwai@suse.de>