linux/drivers/soundwire
Charles Keepax f8a9411ef1 soundwire: Move handle_nested_irq outside of sdw_dev_lock
[ Upstream commit ccb7bb13c0 ]

The sdw_dev_lock protects the SoundWire driver callbacks against
the probed flag, which is used to skip the callbacks if the
driver gets removed. For more information see commit bd29c00edd
("soundwire: revisit driver bind/unbind and callbacks").

However, this lock is a frequent source of mutex inversions.
Many audio operations eventually hit the hardware resulting in a
SoundWire callback, this means that typically the driver has the
locking order ALSA/ASoC locks -> sdw_dev_lock. Conversely, the IRQ
comes in directly from the SoundWire hardware, but then will often
want to access ALSA/ASoC, such as updating something in DAPM or
an ALSA control. This gives the other lock order sdw_dev_lock ->
ALSA/ASoC locks.

When the IRQ handling was initially added to SoundWire this was
through a callback mechanism. As such it required being covered by
the lock because the callbacks are part of the sdw_driver structure
and are thus present regardless of if the driver is currently
probed.

Since then a newer mechanism using the IRQ framework has been
added, which is currently covered by the same lock but this isn't
actually required. Handlers for the IRQ framework are registered in
probe and should by released during remove, thus the IRQ framework
will have already unbound the IRQ before the slave driver is
removed. Avoid the aforementioned mutex inversion by moving the
handle_nested_irq call outside of the sdw_dev_lock.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20250609143041.495049-3-ckeepax@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-08-20 18:30:46 +02:00
..
amd_init.c soundwire: amd_init: simplify with cleanup.h 2024-07-09 19:12:49 +05:30
amd_init.h soundwire: amd: use inline function for register update 2024-03-28 23:39:50 +05:30
amd_manager.c soundwire: amd: cancel pending slave status handling workqueue during remove sequence 2025-08-20 18:30:45 +02:00
amd_manager.h soundwire: amd: fix for wake interrupt handling for clockstop mode 2024-03-28 23:40:33 +05:30
bus.c soundwire: Move handle_nested_irq outside of sdw_dev_lock 2025-08-20 18:30:46 +02:00
bus.h soundwire: export sdw_compute_slave_ports() function 2023-04-12 15:30:35 +05:30
bus_type.c soundwire: bus: clean up probe warnings 2024-07-31 12:27:45 +05:30
cadence_master.c soundwire: cadence_master: set frame shape and divider based on actual clk freq 2025-05-29 11:02:51 +02:00
cadence_master.h soundwire: cadence: re-check Peripheral status with delayed_work 2024-08-18 12:14:24 +05:30
debugfs.c soundwire: debugfs: simplify with cleanup.h 2024-07-09 19:12:49 +05:30
dmi-quirks.c ASoC: Intel: common: DMI remap for rebranded Intel NUC M15 (LAPRC710) laptops 2024-02-08 21:23:19 +00:00
generic_bandwidth_allocation.c soundwire: generic_bandwidth_allocation: change port_bo parameter to pointer 2024-06-21 15:26:26 +05:30
intel.c soundwire: intel: simplify with cleanup.h 2024-07-09 19:12:49 +05:30
intel.h soundwire updates for 6.12 2024-09-23 14:00:46 -07:00
intel_ace2x.c soundwire: intel_ace2x: Send PDI stream number during prepare 2024-10-17 12:11:19 +01:00
intel_ace2x_debugfs.c soundwire: Intel: clarify Copyright information 2024-06-21 15:26:02 +05:30
intel_auxdevice.c soundwire updates for 6.12 2024-09-23 14:00:46 -07:00
intel_auxdevice.h soundwire: intel: export intel_resume_child_device 2024-04-11 22:52:51 +05:30
intel_bus_common.c soundwire: intel_bus_common: enable interrupts before exiting reset 2024-08-18 12:14:53 +05:30
intel_init.c soundwire: intel_init: resume all devices on exit. 2024-04-11 22:52:51 +05:30
irq.c soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
irq.h soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
Kconfig soundwire: intel_ace2x: fix SND_SOC_SOF_HDA_MLINK dependency 2023-06-21 16:19:44 +05:30
Makefile soundwire: amd: refactor amd soundwire manager device node creation 2024-01-30 16:06:34 +00:00
master.c soundwire: constify the struct device_type usage 2024-03-03 19:28:06 +05:30
mipi_disco.c soundwire: fix usages of device_get_named_child_node() 2024-06-03 17:35:24 +05:30
qcom.c drivers:soundwire: qcom: cleanup port maask calculations 2024-07-02 16:49:56 +05:30
slave.c soundwire: slave: fix an OF node reference leak in soundwire slave device 2025-04-10 14:39:22 +02:00
stream.c soundwire: stream: restore params when prepare ports fail 2025-08-15 12:13:55 +02:00
sysfs_local.h soundwire: sysfs: remove sdw_slave_sysfs_init() 2024-03-28 23:38:47 +05:30
sysfs_slave.c soundwire: sysfs: remove unneeded ATTRIBUTE_GROUPS() comments 2024-03-28 23:38:47 +05:30
sysfs_slave_dpn.c soundwire: sysfs: remove sdw_slave_sysfs_init() 2024-03-28 23:38:47 +05:30