Gustavo A. R. Silva [Fri, 3 Aug 2018 20:53:54 +0000 (15:53 -0500)]
ALSA: seq_oss: Mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Warning level 2 was used: -Wimplicit-fallthrough=2
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Fri, 3 Aug 2018 20:52:33 +0000 (15:52 -0500)]
ALSA: seq: Mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Notice that in this particular case, I replaced the code comment with
a proper "fall through" annotation, which is what GCC is expecting
to find.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 3 Aug 2018 13:48:54 +0000 (15:48 +0200)]
ALSA: synth: Remove empty init and exit
For a sake of code simplification, remove the init and the exit
entries that do nothing.
Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry. By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 3 Aug 2018 13:48:41 +0000 (15:48 +0200)]
ALSA: pci: Remove empty init and exit
For a sake of code simplification, remove the init and the exit
entries that do nothing.
Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry. By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 3 Aug 2018 13:48:26 +0000 (15:48 +0200)]
ALSA: i2c: Remove empty init and exit
For a sake of code simplification, remove the init and the exit
entries that do nothing.
Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry. By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 3 Aug 2018 13:44:15 +0000 (15:44 +0200)]
ALSA: isa: Remove empty init and exit
For a sake of code simplification, remove the init and the exit
entries that do nothing.
Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry. By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 3 Aug 2018 13:42:46 +0000 (15:42 +0200)]
ALSA: drivers: Remove empty init and exit
For a sake of code simplification, remove the init and the exit
entries that do nothing.
Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry. By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 3 Aug 2018 13:40:25 +0000 (15:40 +0200)]
ALSA: compress: Remove empty init and exit
For a sake of code simplification, remove the init and the exit
entries that do nothing.
Notes for readers: actually it's OK to remove *both* init and exit,
but not OK to remove the exit entry. By removing only the exit while
keeping init, the module becomes permanently loaded; i.e. you cannot
unload it any longer!
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Fri, 3 Aug 2018 13:47:56 +0000 (14:47 +0100)]
ALSA: gus: fix spelling mistake "acumulator" -> "accumulator"
Trivial spelling mistake fix in debug message
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:42:39 +0000 (15:42 -0500)]
ALSA: es18xx: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 115075 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:41:55 +0000 (15:41 -0500)]
ALSA: opti9xx: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 402016 ("Missing break in switch")
Addresses-Coverity-ID: 1056542 ("Missing break in switch")
Addresses-Coverity-ID: 1339579 ("Missing break in switch")
Addresses-Coverity-ID: 1369526 ("Missing break in switch")
Addresses-Coverity-ID: 1369529 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:41:21 +0000 (15:41 -0500)]
ALSA: opti92x: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 1165394 ("Missing break in switch")
Addresses-Coverity-ID: 1167851 ("Missing break in switch")
Addresses-Coverity-ID: 402015 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Thu, 2 Aug 2018 20:40:37 +0000 (15:40 -0500)]
ALSA: galaxy: Mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 1468367 ("Missing break in switch")
Addresses-Coverity-ID: 115037 ("Missing break in switch")
Addresses-Coverity-ID: 115038 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 2 Aug 2018 05:40:19 +0000 (07:40 +0200)]
ALSA: sb: Fix a typo
There was a typo of COPY_USER in the dead code (that is disabled
as default).
Fixes:
4b83eff81c81 ("ALSA: sb: Convert to the new PCM ops")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Wei Yongjun [Thu, 2 Aug 2018 04:31:02 +0000 (04:31 +0000)]
ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.
Fixes:
7edf3b5e6a45 ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 1 Aug 2018 14:43:56 +0000 (16:43 +0200)]
ALSA: seq: Drop unused 64bit division macros
The old ugly macros remained in the code without usage.
Rip them off.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 1 Aug 2018 14:42:29 +0000 (16:42 +0200)]
ALSA: seq: Use no intrruptible mutex_lock
All usages of mutex in ALSA sequencer core would take too long, hence
we don't have to care about the user interruption that makes things
complicated. Let's replace them with simpler mutex_lock().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 1 Aug 2018 14:37:02 +0000 (16:37 +0200)]
ALSA: seq: Fix leftovers at probe error path
The sequencer core module doesn't call some destructors in the error
path of the init code, which may leave some resources.
This patch mainly fix these leaks by calling the destructors
appropriately at alsa_seq_init(). Also the patch brings a few
cleanups along with it, namely:
- Expand the old "if ((err = xxx) < 0)" coding style
- Get rid of empty seq_queue_init() and its caller
- Change snd_seq_info_done() to void
Last but not least, a couple of functions lose __exit annotation since
they are called also in alsa_seq_init().
No functional changes but minor code cleanups.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 1 Aug 2018 12:59:07 +0000 (14:59 +0200)]
ALSA: seq: Remove dead codes
There are a few functions that have been commented out for ages.
And also there are functions that do nothing but placeholders.
Let's kill them.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 1 Aug 2018 12:38:18 +0000 (14:38 +0200)]
ALSA: seq: Minor cleanup of MIDI event parser helpers
snd_midi_event_encode_byte() can never fail, and it can return rather
true/false. Change the return type to bool, adjust the argument to
receive a MIDI byte as unsigned char, and adjust the comment
accordingly. This allows callers to drop error checks, which
simplifies the code.
Meanwhile, snd_midi_event_encode() helper is used only in seq_midi.c,
and it can be better folded into it. This will reduce the total
amount of lines in the end.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Wed, 1 Aug 2018 16:14:16 +0000 (11:14 -0500)]
ALSA: usb: Mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 115084 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo A. R. Silva [Wed, 1 Aug 2018 15:58:25 +0000 (10:58 -0500)]
ALSA: pcm: Mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 1357375 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 1 Aug 2018 10:47:41 +0000 (11:47 +0100)]
ALSA: usb-audio: remove redundant pointer 'urb'
Pointer 'urb' is being assigned but is never used hence it is
redundant and can be removed.
Cleans up clang warning:
warning: variable 'urb' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 1 Aug 2018 10:47:38 +0000 (11:47 +0100)]
ALSA: sonicvibes: remove redundant pointer 'dir'
Pointer 'dir' is being assigned but is never used hence it is
redundant and can be removed.
Cleans up clang warning:
warning: variable 'dir' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 1 Aug 2018 10:47:37 +0000 (11:47 +0100)]
ALSA: ens137x: remove redundant array pcm_devs
The array pcm_devs is being assigned but is never used hence it is
redundant and can be removed.
Cleans up clang warning:
warning: variable 'pcm_devs' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 1 Aug 2018 10:47:36 +0000 (11:47 +0100)]
ALSA: emu10k1: remove redundant variable attn
Variable attn is being assigned but is never used hence it is
redundant and can be removed.
Cleans up clang warning:
warning: variable 'attn' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 1 Aug 2018 10:47:35 +0000 (11:47 +0100)]
ALSA: cs5535audio: remove redundant pointer 'dma'
Pointer 'dma' is being assigned but is never used hence it is
redundant and can be removed.
Cleans up two clang warnings:
warning: variable 'dma' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 1 Aug 2018 10:47:34 +0000 (11:47 +0100)]
ALSA: asihpi: remove redundant variable max_streams
Variable max_streams is being assigned but is never used hence it is
redundant and can be removed.
Cleans up clang warning:
warning: variable 'max_streams' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:45 +0000 (13:28 +0100)]
ALSA: usb-audio: Operate UAC3 Power Domains in PCM callbacks
Make use of UAC3 Power Domains associated to an Audio Streaming
path within the PCM's logic. This means, when there is no audio
being transferred (pcm is closed), the host will set the Power Domain
associated to that substream to state D1. When audio is being transferred
(from hw_params onwards), the Power Domain will be set to D0 state.
This is the way the host lets the device know which Terminal
is going to be actively used and it is for the device to
manage its own internal resources on that UAC3 Power Domain.
Note the resume method now sets the Power Domain to D1 state as
resuming the device doesn't mean audio streaming will occur.
Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:44 +0000 (13:28 +0100)]
ALSA: usb-audio: Add UAC3 Power Domains to suspend/resume
Set the UAC3 Power Domain state for an Audio Streaming interface
to D2 state before suspending the device (usb_driver callback).
This lets the device know there is no intention to use any of the
Units in the Audio Function and that the host is not going to
even listen for wake-up events (interrupts) on the units.
When the usb_driver gets resumed, the state D0 (fully powered) will
be set. This ties up the UAC3 Power Domains to the runtime PM.
Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:43 +0000 (13:28 +0100)]
ALSA: usb-audio: AudioStreaming Power Domain parsing
Power Domains in the UAC3 spec are mainly intended to be
associated to an Input or Output Terminal so the host
changes the power state of the entire capture or playback
path within the topology.
This patch adds support for finding Power Domains associated
to an Audio Streaming Interface (bTerminalLink) and adds a
reference to them in the usb audio substreams (snd_usb_substream).
Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jorge Sanjuan [Tue, 31 Jul 2018 12:28:42 +0000 (13:28 +0100)]
ALSA: usb-audio: Initial Power Domain support
Thee USB Audio Class 3 (UAC3) introduces Power Domains as a new
feature to let a host turn individual parts of an audio function
to different power states via USB requests. This lets the device
get to know a bit amore about what the host is up to in order to
optimize power consumption efficiently.
The Power Domains are optional for UAC3 configuration but all
UAC3 devices shall include at least one BADD configuration where
the support for Power Domains is compulsory.
This patch adds a set of features/helpers to parse these power
domains and change their status.
Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 30 Jul 2018 12:48:29 +0000 (14:48 +0200)]
ALSA: seq: virmidi: Use READ_ONCE/WRITE_ONCE() macros
The trigger flag in vmidi object can be referred in different contexts
concurrently, hence it's better to be put with READ_ONCE() and
WRITE_ONCE() macros to assure the accesses.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 29 Jul 2018 21:03:05 +0000 (23:03 +0200)]
ALSA: seq: virmidi: Offload the output event processing
The virmidi sequencer stuff tries to translate the rawmidi bytes to
sequencer events and deliver the packets at trigger callback. The
amount of the whole process of these translations and deliveries
depends on the incoming rawmidi bytes, and we have no limit for that;
this was the cause of a CPU soft lockup that had been reported and
fixed recently.
Although we've fixed the soft lockup by putting the temporary unlock
and cond_resched(), it's rather a quick band aid. In this patch,
meanwhile, the event parsing and delivery process is offloaded to a
dedicated work, and the trigger callback just kicks it off. It has
three merits, at least:
- The processing is always done in a sleepable context, which can
assure the event delivery with non-atomic flag without hackish
is_atomic() usage.
- Other relevant codes can be simplified, reducing the lines
- It makes me happier
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 29 Jul 2018 20:38:54 +0000 (22:38 +0200)]
Merge branch 'for-linus' into topic/virmidi
Pull the latest ALSA sequencer fixes for the further development of
virmidi.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 12 Jul 2018 21:06:51 +0000 (23:06 +0200)]
ALSA: hda/hdmi: Use single mutex unlock in error paths
Instead of calling mutex_unlock() at each error path multiple times,
take the standard goto-and-a-single-unlock approach. This will
simplify the code and make easier to find the unbalanced mutex locks.
No functional changes, but only the code readability improvement as a
preliminary work for further changes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Park Ju Hyung [Fri, 27 Jul 2018 18:16:42 +0000 (03:16 +0900)]
ALSA: hda - Sleep for 10ms after entering D3 on Conexant codecs
On rare occasions, we are still noticing that the internal speaker
spitting out spurious noises even after adding the problematic codec
to the list.
Adding a 10ms artificial delay before rebooting fixes the issue entirely.
Patch for Realtek codecs also adds the same amount of delay after
entering D3.
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Park Ju Hyung [Fri, 27 Jul 2018 18:16:21 +0000 (03:16 +0900)]
ALSA: hda - Turn CX8200 into D3 as well upon reboot
As an equivalent codec with CX20724,
CX8200 is also subject to the reboot bug.
Late 2017 and 2018 LG Gram and some HP Spectre laptops are known victims
to this issue, causing extremely loud noises upon reboot.
Now that we know that this bug is subject to multiple codecs,
fix the comment as well.
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jia-Ju Bai [Fri, 27 Jul 2018 09:01:43 +0000 (17:01 +0800)]
ALSA: ctxfi: cthw20k2: Replace mdelay() with msleep() and usleep_range()
hw_pll_init(), hw_dac_stop(), hw_dac_start() and hw_adc_init()
are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jia-Ju Bai [Fri, 27 Jul 2018 08:57:56 +0000 (16:57 +0800)]
ALSA:: ctxfi: cthw20k1: Replace mdelay() with msleep()
hw_pll_init(), hw_reset_dac() and hw_card_init() are never
called in atomic context.
They calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jia-Ju Bai [Fri, 27 Jul 2018 08:55:28 +0000 (16:55 +0800)]
ALSA: usb-audio: quirks: Replace mdelay() with msleep() and usleep_range()
snd_usb_select_mode_quirk(), snd_usb_set_interface_quirk() and
snd_usb_ctl_msg_quirk() are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().
This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:14 +0000 (23:24 +0200)]
ALSA: sb: Proper endian notations
The data types defined in SB CSP driver code are all in little-endian,
hence the proper type like __le32 should be used.
Spotted by sparse, a warning like:
sound/isa/sb/sb16_csp.c:330:14: warning: cast to restricted __le32
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:13 +0000 (23:24 +0200)]
ALSA: atiixp_modem: Proper endian notations
The DMA address table in atiixp modem driver is in little-endian,
hence we should define it with __le32 properly.
Spotted by sparse, a warning like:
sound/pci/atiixp_modem.c:360:28: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:12 +0000 (23:24 +0200)]
ALSA: atiixp: Proper endian notations
The DMA address table in atiixp driver is in little-endian, hence we should define it with __le32 properly.
Spotted by sparse, a warning like:
sound/pci/atiixp.c:393:28: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:11 +0000 (23:24 +0200)]
ALSA: bt87x: Proper endian notations
The RISC data in bt87x is in little-endian, hence we should define it
with __le32 properly.
Spotted by sparse, a warning like:
sound/pci/bt87x.c:240:17: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:10 +0000 (23:24 +0200)]
ALSA: echoaudio: Proper endian notations
Many data fields defined in echoaudio drivers are in little-endian,
hence they should be defined with __le16 or __le32. This makes it
easier to catch the forgotten conversions.
Spotted by sparse, a warning like:
sound/pci/echoaudio/echoaudio_dsp.c:990:36: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:09 +0000 (23:24 +0200)]
ALSA: maestro3: Proper endian notations
The ASSP data passed to maestro3 driver is in little-endian format,
hence the data pointer should be with __le16.
Spotted by sparse, warnings like:
sound/pci/maestro3.c:2128:35: warning: cast to restricted __le16
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:08 +0000 (23:24 +0200)]
ALSA: intel8x0m: Proper endian notations
The BD address tables in intel8x0m driver are in little-endian, hence
they should be represented as __le32 instead u32.
Spotted by sparse, warnings like:
sound/pci/intel8x0m.c:406:40: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:07 +0000 (23:24 +0200)]
ALSA: intel8x0: Proper endian notations
The BD address tables in intel8x0 driver are in little-endian, hence
they should be represented as __le32 instead u32.
Spotted by sparse, warnings like:
sound/pci/intel8x0.c:688:40: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:06 +0000 (23:24 +0200)]
ALSA: lola: Proper endian notations
The BDL entries in lola driver are little-endian while we code them as
u32. This leads to sparse warnings like:
sound/pci/lola/lola.c:105:40: warning: incorrect type in assignment (different base types)
sound/pci/lola/lola.c:105:40: expected unsigned int [unsigned] [usertype] <noident>
sound/pci/lola/lola.c:105:40: got restricted __le32 [usertype] <noident>
This patch fixes the declarations to the proper __le32 type.
Also, there was a typo in the original code, where __user was used
that was intended as __iomem. This was caused also by sparse:
sound/pci/lola/lola_mixer.c:132:27: warning: incorrect type in assignment (different address spaces)
Fixed in this patch as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:05 +0000 (23:24 +0200)]
ALSA: mixart: Proper endian notations
The miXart driver deals with big-endian values as raw data, while it
declares most of variables as u32. This leads to sparse warnings like
sound/pci/mixart/mixart.c:1203:23: warning: cast to restricted __be32
Fix them by properly defining the structs and add the explicit cast to
macros.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:04 +0000 (23:24 +0200)]
ALSA: riptide: Properly endian notations
The SG descriptor of Riptide contains the little-endian values, hence
we need to define with __le32 properly. This fixes sparse warnings
like:
sound/pci/riptide/riptide.c:1112:40: warning: cast to restricted __le32
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:03 +0000 (23:24 +0200)]
ALSA: hda: Proper endian notations for BDL pointers
The BDL pointer used in snd_hdac_dsp_prepare() should be declared as
__le32, as warned by sparse:
sound/hda/hdac_stream.c:655:47: warning: incorrect type in argument 4 (different base types)
sound/hda/hdac_stream.c:655:47: expected restricted __le32 [usertype] **bdlp
sound/hda/hdac_stream.c:655:47: got unsigned int [usertype] **<noident>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:02 +0000 (23:24 +0200)]
ALSA: trident: Proper endian notations
The TLB entries in Trident driver are represented in little-endian,
hence they should be declared as __le32.
This patch fixes the sparse warnings like:
sound/pci/trident/trident_memory.c:226:17: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:24:01 +0000 (23:24 +0200)]
ALSA: ymfpci: Proper endian notations
The bank values are all little-endians, so they should be defined with
__le32. This fixes lots of sparse warnings like:
sound/pci/ymfpci/ymfpci_main.c:315:23: warning: cast to restricted __le32
sound/pci/ymfpci/ymfpci_main.c:342:32: warning: incorrect type in assignment (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:45 +0000 (23:19 +0200)]
ALSA: xen: Use standard pcm_format_to_bits() for ALSA format bits
The open codes with the bit shift in xen_snd_front_alsa.c give sparse
warnings as the PCM format type is with __bitwise.
There is already a standard macro to get the format bits, so let's use
it instead.
This fixes sparse warnings like:
sound/xen/xen_snd_front_alsa.c:191:47: warning: restricted snd_pcm_format_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:44 +0000 (23:19 +0200)]
ALSA: sb: Fix sparse warning wrt PCM format type
The PCM format type is with __bitwise, and it can't be converted from
integer implicitly. Instead of an ugly cast, declare the function
argument of snd_sb_csp_autoload() with the proper snd_pcm_format_t
type.
This fixes the sparse warnings like:
sound/isa/sb/sb16_csp.c:743:22: warning: restricted snd_pcm_format_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:43 +0000 (23:19 +0200)]
ALSA: sb: Fix PCM format bit calculation
The PCM format type in snd_pcm_format_t can't be treated as integer
implicitly since it's with __bitwise. We have already a helper
function to get the bit index of the given type, and use it in each
place instead.
This fixes sparse warnings like:
sound/isa/sb/sb16_main.c:61:44: warning: restricted snd_pcm_format_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:42 +0000 (23:19 +0200)]
ALSA: wss: Fix sparse warning wrt PCM format type
The PCM format type is with __bitwise, and it can't be converted from
integer implicitly. Instead of an ugly cast, declare the function
argument of snd_wss_get_format() with the proper snd_pcm_format_t
type.
This fixes the sparse warnings like:
sound/isa/wss/wss_lib.c:551:14: warning: restricted snd_pcm_format_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:41 +0000 (23:19 +0200)]
ALSA: asihpi: Fix PCM format notations
asihpi driver treats -1 as an own invalid PCM format, but this needs
a proper cast with __force prefix since PCM format type is __bitwise.
Define a constant with the proper type and use it allover.
This fixes sparse warnings like:
sound/pci/asihpi/asihpi.c:315:9: warning: incorrect type in initializer (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:40 +0000 (23:19 +0200)]
ALSA: au88x0: Fix sparse warning wrt PCM format type
The PCM format type is with __bitwise, and it can't be converted from
integer implicitly. Instead of an ugly cast, declare the function
argument of vortex_alsafmt_aspfmt() with the proper snd_pcm_format_t
type.
This fixes the sparse warning like:
sound/pci/au88x0/au88x0_core.c:2778:14: warning: restricted snd_pcm_format_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:39 +0000 (23:19 +0200)]
ALSA: ad1816a: Fix sparse warning wrt PCM format type
The PCM format type is with __bitwise, and it can't be converted from
integer implicitly. Instead of an ugly cast, declare the function
argument of snd_ad1816a_get_format() with the proper snd_pcm_format_t
type.
This fixes the sparse warning like:
sound/isa/ad1816a/ad1816a_lib.c:93:14: warning: restricted snd_pcm_format_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:38 +0000 (23:19 +0200)]
ALSA: pcm: Fix sparse warning wrt PCM format type
The PCM format type is with __bitwise, hence it needs the explicit
cast with __force. It's ugly, but there is a reason for that cost...
This fixes the sparse warning:
sound/core/oss/pcm_oss.c:1854:55: warning: incorrect type in argument 1 (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:37 +0000 (23:19 +0200)]
ALSA: riptide: Fix PCM format type conversion
The PCM format type is with __bitwise, hence it needs to be explicitly
declared as snd_pcm_format_t, as warned by sparse:
sound/pci/riptide/riptide.c:1028:34: warning: incorrect type in argument 1 (different base types)
sound/pci/riptide/riptide.c:1028:34: expected restricted snd_pcm_format_t [usertype] format
sound/pci/riptide/riptide.c:1028:34: got unsigned char [unsigned] format
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:19:36 +0000 (23:19 +0200)]
ALSA: hda: Fix implicit PCM format type conversion
The PCM format type is defined with __bitwise, hence it can't be
passed as integer but needs an explicit cast. In this patch, instead
of the messy cast flood, define the format argument of
snd_hdac_calc_stream_format() to be the proper snd_pcm_format_t type.
This fixes sparse warnings like:
sound/hda/hdac_device.c:760:38: warning: incorrect type in argument 1 (different base types)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 26 Jul 2018 12:27:59 +0000 (14:27 +0200)]
ALSA: virmidi: Fix too long output trigger loop
The virmidi output trigger tries to parse the all available bytes and
process sequencer events as much as possible. In a normal situation,
this is supposed to be relatively short, but a program may give a huge
buffer and it'll take a long time in a single spin lock, which may
eventually lead to a soft lockup.
This patch simply adds a workaround, a cond_resched() call in the loop
if applicable. A better solution would be to move the event processor
into a work, but let's put a duct-tape quickly at first.
Reported-and-tested-by: Dae R. Jeong <threeearcat@gmail.com>
Reported-by: syzbot+619d9f40141d826b097e@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 26 Jul 2018 12:58:03 +0000 (14:58 +0200)]
ALSA: trident: Suppress gcc string warning
The meddlesome gcc warns about the possible shortname string in
trident driver code:
sound/pci/trident/trident.c: In function ‘snd_trident_probe’:
sound/pci/trident/trident.c:126:2: warning: ‘strcat’ accessing 17 or more bytes at offsets 36 and 20 may overlap 1 byte at offset 36 [-Wrestrict]
strcat(card->shortname, card->driver);
It happens since gcc calculates the possible string size from
card->driver, but this can't be true since we did set the string just
before that, and they are much shorter.
For shutting it up, use the exactly same string set to card->driver
for strcat() to card->shortname, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:57 +0000 (23:00 +0200)]
ALSA: emu10k1: Fix missing __force annotation for user/kernel pointer cast
The cast between user-space and kernel-space needs an explicit __force
prefix, but it's missing in many places in emu10k1 driver code.
Spotted by sparse as a warning like:
sound/pci/emu10k1/emufx.c:529:33: warning: cast removes address space of expression
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:56 +0000 (23:00 +0200)]
ALSA: korg1212: Add __force annotation to cast in user-copy callbacks
The user-copy callbacks in korg1212 driver contain the explicit cast
from a user pointer to a kernel pointer, but they missed __force
prefix. It's mandatory for converting between them.
Spotted by sparse, a warning like:
sound/pci/korg1212/korg1212.c:1329:33: warning: cast removes address space of expression
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:55 +0000 (23:00 +0200)]
ALSA: pcm: Use standard lower_32_bits() and upper_32_bits()
Instead of open codes, use the standard macros for obtaining the lower
and upper 32bit values.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:54 +0000 (23:00 +0200)]
ALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()
The snd_pcm_lib_read() and snd_pcm_lib_write() inline functions have
the explicit cast from a user pointer to a kernel pointer, but they
lacks of __force prefix.
This fixes sparse warnings like:
./include/sound/pcm.h:1093:47: warning: cast removes address space of expression
Fixes:
68541213720d ("ALSA: pcm: Direct in-kernel read/write support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:53 +0000 (23:00 +0200)]
ALSA: usb-audio: Declare the common variable in header file
Declare snd_usb_feature_unit_ctl properly in mixer.h. Otherwise it's
error-prone.
This fixes the sparse warning:
sound/usb/mixer.c:1464:25: warning: symbol 'snd_usb_feature_unit_ctl' was not declared. Should it be static?
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:52 +0000 (23:00 +0200)]
ALSA: opl3: Declare common variables properly
Move the declarations of common variables into opl3_voice.h instead of
declaring at each file multiple times, which was error-prone.
This fixes sparse warnings like:
sound/drivers/opl3/opl3_synth.c:51:6: warning: symbol 'snd_opl3_regmap' was not declared. Should it be static?
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:51 +0000 (23:00 +0200)]
ALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t
The knew->iface field is in snd_ctl_elem_iface_t, which is with
__bitwise, hence it can't be converted implicitly from integer.
Give an explicit cast for the invalid type.
Spotted by sparse:
sound/pci/hda/hda_codec.c:3280:25: warning: restricted snd_ctl_elem_iface_t degrades to integer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:50 +0000 (23:00 +0200)]
ALSA: msnd: Use NULL instead of 0
Fix a sparse warning:
sound/isa/msnd/msnd_pinnacle.c:813:1: warning: Using plain integer as NULL pointer
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:49 +0000 (23:00 +0200)]
ALSA: hda/ca0132 - Use NULL instead of 0
Use NULL for initializing the snd_kcontrol_new.tlv field, instead of
0, as warned by sparse:
sound/pci/hda/patch_ca0132.c:5519:22: warning: Using plain integer as NULL pointer
Also, the driver does the same initialization twice, once for
knew.tlv.c and another for knew.tlv.p while both point to the same
address (these are union). Drop the latter superfluous one.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:48 +0000 (23:00 +0200)]
ALSA: msnd: Fix the default sample sizes
The default sample sizes set by msnd driver are bogus; it sets ALSA
PCM format, not the actual bit width.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:47 +0000 (23:00 +0200)]
ALSA: msnd: Add missing __iomem annotations
The io-mapped buffers used in msnd drivers need __iomem annotations.
This fixes sparse warnings like:
sound/isa/msnd/msnd_pinnacle.c:172:45: warning: incorrect type in initializer (different address spaces)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 21:00:46 +0000 (23:00 +0200)]
ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC()
for expanding idVendor and idProduct fields. However, the latter
macro adds also match_flags and bInterfaceClass, which are different
from the values AU0828_DEVICE() macro sets after that.
For fixing them, just expand idVendor and idProduct fields manually in
AU0828_DEVICE().
This fixes sparse warnings like:
sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeff Crukley [Wed, 25 Jul 2018 19:05:01 +0000 (15:05 -0400)]
ALSA: usb-audio: Add support for Encore mDSD USB DAC
This patch adds native DSD playback support for the Encore mDSD USB DAC by
specifying the vendor and product ID's
Signed-off-by: Jeff Crukley <jcrukley@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 15:59:26 +0000 (17:59 +0200)]
ALSA: cs5535audio: Fix invalid endian conversion
One place in cs5535audio_build_dma_packets() does an extra conversion
via cpu_to_le32(); namely jmpprd_addr is passed to setup_prd() ops,
which writes the value via cs_writel(). That is, the callback does
the conversion by itself, and we don't need to convert beforehand.
This patch fixes that bogus conversion.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 15:11:38 +0000 (17:11 +0200)]
ALSA: vxpocket: Fix invalid endian conversions
The endian conversions used in vxp_dma_read() and vxp_dma_write() are
superfluous and even wrong on big-endian machines, as inw() and outw()
already do conversions. Kill them.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 15:10:11 +0000 (17:10 +0200)]
ALSA: vx222: Fix invalid endian conversions
The endian conversions used in vx2_dma_read() and vx2_dma_write() are
superfluous and even wrong on big-endian machines, as inl() and outl()
already do conversions. Kill them.
Spotted by sparse, a warning like:
sound/pci/vx222/vx222_ops.c:278:30: warning: incorrect type in argument 1 (different base types)
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 25 Jul 2018 14:34:12 +0000 (16:34 +0200)]
ALSA: seq: Fix poll() error return
The sanity checks in ALSA sequencer and OSS sequencer emulation codes
return falsely -ENXIO from poll callback. They should be EPOLLERR
instead.
This was caught thanks to the recent change to the return value.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 11 Jul 2018 13:05:06 +0000 (15:05 +0200)]
ALSA: hda/i915: Allow delayed i915 audio component binding
Currently HD-audio i915 audio binding doesn't support any delayed
binding, and supposes that the i915 driver registers the component
immediately. This has been OK, so far, but the work-in-progress
change in i915 may introduce the asynchronous binding, which
effectively delays the component registration.
For addressing it, implement a completion to be synced with the master
binding. The timeout is set to 10 seconds which should be long enough
and hopefully be not too annoying if anyone boots up a debugging
session with i915 KMS turned off.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Yue Wang [Mon, 23 Jul 2018 08:56:46 +0000 (01:56 -0700)]
ALSA: usb-audio: Generic DSD detection for Thesycon-based implementations
Thesycon provides solutions to XMOS chips, and has its own device
vendor id.
In this patch, we use generic method to detect DSD capability of
Thesycon-based UAC2 implementations in order to support a wide range
of current and future devices.
The patch will enable the SNDRV_PCM_FMTBIT_DSD_U32_BE bit for the DAC
hence enable native DSD playback up to DSD512 format.
Signed-off-by: Yue Wang <yuleopen@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 19 Jul 2018 09:01:04 +0000 (11:01 +0200)]
ALSA: memalloc: Don't exceed over the requested size
snd_dma_alloc_pages_fallback() tries to allocate pages again when the
allocation fails with reduced size. But the first try actually
*increases* the size to power-of-two, which may give back a larger
chunk than the requested size. This confuses the callers, e.g. sgbuf
assumes that the size is equal or less, and it may result in a bad
loop due to the underflow and eventually lead to Oops.
The code of this function seems incorrectly assuming the usage of
get_order(). We need to decrease at first, then align to
power-of-two.
Reported-and-tested-by: he, bo <bo.he@intel.com>
Reported-by: zhang jun <jun.zhang@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Srikanth K H [Fri, 20 Jul 2018 05:43:51 +0000 (11:13 +0530)]
ALSA: timer: catch invalid timer object creation
A timer object for the classes SNDRV_TIMER_CLASS_CARD and
SNDRV_TIMER_CLASS_PCM has to be associated with a card object, but we
have no check at creation time. Such a timer object with NULL card
causes various unexpected problems, e.g. NULL dereference at reading
the sound timer proc file.
So as preventive measure while the creating the sound timer object is
created the card information availability is checked for the mentioned
entries and returned error if its NULL.
Signed-off-by: Srikanth K H <srikanth.h@samsung.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 19 Jul 2018 18:48:06 +0000 (20:48 +0200)]
Merge branch 'topic/drm_audio_component' into for-next
Pull the generic drm_audio_component support, which will be used later
for AMD/ATI and other HD-audio HDMI codec drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adam Goode [Wed, 18 Jul 2018 20:41:05 +0000 (16:41 -0400)]
ALSA: usb-audio: Allow changing from a bad sample rate
If the audio device is externally clocked and set to a rate that does
not match the external clock, the clock will never be valid and we cannot
set the rate successfully. To fix this, allow a rate change even if
the clock is initially invalid, and validate again after the rate is
changed.
This fixes problems with MOTU UltraLite AVB hardware over USB.
Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 18 Jul 2018 15:42:34 +0000 (17:42 +0200)]
Merge branch 'topic/vga_switcheroo' into for-next
Pull the vga_switcheroo audio client fix.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 17 Jul 2018 15:08:32 +0000 (17:08 +0200)]
ALSA: hda/realtek - Yet another Clevo P950 quirk entry
The PCI SSID 1558:95e1 needs the same quirk for other Clevo P950
models, too. Otherwise no sound comes out of speakers.
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1101143
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 18 Jul 2018 05:40:53 +0000 (07:40 +0200)]
ALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc()
snd_pcm_lib_mmap_vmalloc() was supposed to be implemented with
somewhat special for vmalloc handling, but in the end, this turned to
just the default handler, i.e. NULL. As the situation has never
changed over decades, let's rip it off.
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 17 Jul 2018 21:12:33 +0000 (23:12 +0200)]
ALSA: rawmidi: Use kvmalloc() for buffers
The size of in-kernel rawmidi buffers may be big up to 1MB, and it can
be specified freely by user-space; which implies that user-space may
trigger kmalloc() errors frequently.
This patch replaces the buffer allocation via kvmalloc() for dealing
with bigger buffers gracefully.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 17 Jul 2018 21:07:29 +0000 (23:07 +0200)]
ALSA: rawmidi: Minor code refactoring
Unify a few open codes with helper functions to improve the
readability. Minor behavior changes (rather fixes) are:
- runtime->drain clearance is done within lock
- active_sensing is updated before resizing buffer in
SNDRV_RAWMIDI_IOCTL_PARAMS ioctl.
Other than that, simply code cleanups.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 17 Jul 2018 20:45:50 +0000 (22:45 +0200)]
ALSA: rawmidi: Simplify error paths
Apply the standard idiom: rewrite the multiple unlocks in error paths
in the goto-error-and-single-unlock way.
Just a code refactoring, and no functional changes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 17 Jul 2018 20:32:52 +0000 (22:32 +0200)]
ALSA: rawmidi: Tidy up coding styles
Just minor coding style fixes like removal of superfluous white space,
adding missing blank lines, etc. No actual code changes at all.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 17 Jul 2018 20:26:54 +0000 (22:26 +0200)]
Merge branch 'for-linus' into for-next
Back-merge for further cleanup / improvements on rawmidi and HD-audio
stuff.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 11 Jul 2018 14:23:16 +0000 (16:23 +0200)]
ALSA: hda: Make audio component support more generic
This is the final step for more generic support of DRM audio
component. The generic audio component code is now moved to its own
file, and the symbols are renamed from snd_hac_i915_* to
snd_hdac_acomp_*, respectively. The generic code is enabled via the
new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
kept as the super-class.
Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and
the widget id, and master_bind/master_unbin are called at binding /
unbinding the master component, respectively. All these are optional,
but used in i915 implementation and also other later implementations.
A note about the new snd_hdac_acomp_init() function: there is a slight
difference between this and the old snd_hdac_i915_init(). The latter
(still) synchronizes with the master component binding, i.e. it
assures that the relevant DRM component gets bound when it returns, or
gives a negative error. Meanwhile the new function doesn't
synchronize but just leaves as is. It's the responsibility by the
caller's side to synchronize, or the caller may accept the
asynchronous binding on the fly.
v1->v2: Fix missing NULL check in master_bind/unbind
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 11 Jul 2018 13:48:18 +0000 (15:48 +0200)]
ALSA: hda/i915: Associate audio component with devres
The HD-audio i915 binding code contains a single pointer, hdac_acomp,
for allowing the access to audio component from the master bind/unbind
callbacks. This was needed because the callbacks pass only the device
pointer and we can't guarantee the object type assigned to the drvdata
(which is free for each controller driver implementation).
And this implementation will be a problem if we support multiple
components for different DRM drivers, not only i915.
As a solution, allocate the audio component object via devres and
associate it with the given device, so that the component callbacks
can refer to it via devres_find().
The removal of the object is still done half-manually via
devres_destroy() to make the code consistent (although it may work
without the explicit call).
Also, the snd_hda_i915_register_notifier() had the reference to
hdac_acomp as well. In this patch, the corresponding code is removed
by passing hdac_bus object to the function, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>