diff mbox series

soundwire: bus: Fix race on the creation of the IRQ domain

Message ID 20250409122239.1396489-1-ckeepax@opensource.cirrus.com (mailing list archive)
State New
Headers show
Series soundwire: bus: Fix race on the creation of the IRQ domain | expand

Commit Message

Charles Keepax April 9, 2025, 12:22 p.m. UTC
The SoundWire IRQ domain needs to be created before any slaves are added
to the bus, such that the domain is always available when needed. Move
the call to sdw_irq_create() before the calls to sdw_acpi_find_slaves()
and sdw_of_find_slaves().

Fixes: 12a95123bfe1 ("soundwire: bus: Allow SoundWire peripherals to register IRQ handlers")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/soundwire/bus.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Vinod Koul April 10, 2025, 6:29 a.m. UTC | #1
On Wed, 09 Apr 2025 13:22:39 +0100, Charles Keepax wrote:
> The SoundWire IRQ domain needs to be created before any slaves are added
> to the bus, such that the domain is always available when needed. Move
> the call to sdw_irq_create() before the calls to sdw_acpi_find_slaves()
> and sdw_of_find_slaves().
> 
> 

Applied, thanks!

[1/1] soundwire: bus: Fix race on the creation of the IRQ domain
      commit: fd15594ba7d559d9da741504c322b9f57c4981e5

Best regards,
diff mbox series

Patch

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 6f8a20014e76d..39aecd34c6414 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -122,6 +122,10 @@  int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
 	set_bit(SDW_GROUP13_DEV_NUM, bus->assigned);
 	set_bit(SDW_MASTER_DEV_NUM, bus->assigned);
 
+	ret = sdw_irq_create(bus, fwnode);
+	if (ret)
+		return ret;
+
 	/*
 	 * SDW is an enumerable bus, but devices can be powered off. So,
 	 * they won't be able to report as present.
@@ -138,6 +142,7 @@  int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
 
 	if (ret < 0) {
 		dev_err(bus->dev, "Finding slaves failed:%d\n", ret);
+		sdw_irq_delete(bus);
 		return ret;
 	}
 
@@ -156,10 +161,6 @@  int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
 	bus->params.curr_bank = SDW_BANK0;
 	bus->params.next_bank = SDW_BANK1;
 
-	ret = sdw_irq_create(bus, fwnode);
-	if (ret)
-		return ret;
-
 	return 0;
 }
 EXPORT_SYMBOL(sdw_bus_master_add);