Re: [PATCH] soundwire: intel_auxdevice: Don't disable IRQs before removing children

From: Pierre-Louis Bossart
Date: Wed Dec 18 2024 - 16:42:06 EST



Or do you object to
the way I have solved that problem? I am certainly open to other
solutions, if you have any suggestions?

Having looked at the code in more details, I think there are other issues, see e.g. this part of the code called from snd_bus_master_delete().

static int sdw_delete_slave(struct device *dev, void *data)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct sdw_bus *bus = slave->bus;

pm_runtime_disable(dev);

sdw_slave_debugfs_exit(slave);

mutex_lock(&bus->bus_lock);

if (slave->dev_num) { /* clear dev_num if assigned */
clear_bit(slave->dev_num, bus->assigned);
if (bus->ops && bus->ops->put_device_num)
bus->ops->put_device_num(bus, slave);
}

So at this point an interaction with the device is not longer possible, even if the Cadence interrupts are kept active, since there's no valid device number to use...

list_del_init(&slave->node);
mutex_unlock(&bus->bus_lock);

... but this is where the .remove() will take place.

device_unregister(dev);
return 0;
}

What am I missing?