Skip to content

Commit 0b8757b

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: SDCA: Unregister IRQ handlers on module remove
Ensure that all interrupt handlers are unregistered before the parent regmap_irq is unregistered. sdca_irq_cleanup() was only called from the component_remove(). If the module was loaded and removed without ever being component probed the FDL interrupts would not be unregistered and this would hit a WARN when devm called regmap_del_irq_chip() during the removal of the parent IRQ. Fixes: 4e53116 ("ASoC: SDCA: Fix errors in IRQ cleanup") Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20260408093835.2881486-5-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 58dec4f commit 0b8757b

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

include/sound/sdca_interrupts.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *function_regmap,
8383
int sdca_irq_populate(struct sdca_function_data *function,
8484
struct snd_soc_component *component,
8585
struct sdca_interrupt_info *info);
86-
void sdca_irq_cleanup(struct sdca_function_data *function,
87-
struct snd_soc_component *component,
86+
void sdca_irq_cleanup(struct device *dev,
87+
struct sdca_function_data *function,
8888
struct sdca_interrupt_info *info);
8989
struct sdca_interrupt_info *sdca_irq_allocate(struct device *dev,
9090
struct regmap *regmap, int irq);

sound/soc/sdca/sdca_class_function.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static void class_function_component_remove(struct snd_soc_component *component)
203203
struct class_function_drv *drv = snd_soc_component_get_drvdata(component);
204204
struct sdca_class_drv *core = drv->core;
205205

206-
sdca_irq_cleanup(drv->function, component, core->irq_info);
206+
sdca_irq_cleanup(component->dev, drv->function, core->irq_info);
207207
}
208208

209209
static int class_function_set_jack(struct snd_soc_component *component,
@@ -411,6 +411,13 @@ static int class_function_probe(struct auxiliary_device *auxdev,
411411
return 0;
412412
}
413413

414+
static void class_function_remove(struct auxiliary_device *auxdev)
415+
{
416+
struct class_function_drv *drv = auxiliary_get_drvdata(auxdev);
417+
418+
sdca_irq_cleanup(drv->dev, drv->function, drv->core->irq_info);
419+
}
420+
414421
static int class_function_runtime_suspend(struct device *dev)
415422
{
416423
struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
@@ -559,6 +566,7 @@ static struct auxiliary_driver class_function_drv = {
559566
},
560567

561568
.probe = class_function_probe,
569+
.remove = class_function_remove,
562570
.id_table = class_function_id_table
563571
};
564572
module_auxiliary_driver(class_function_drv);

sound/soc/sdca/sdca_interrupts.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,17 +555,16 @@ EXPORT_SYMBOL_NS_GPL(sdca_irq_populate, "SND_SOC_SDCA");
555555

556556
/**
557557
* sdca_irq_cleanup - Free all the individual IRQs for an SDCA Function
558+
* @sdev: Device pointer against which the sdca_interrupt_info was allocated.
558559
* @function: Pointer to the SDCA Function.
559-
* @component: Pointer to the ASoC component for the Function.
560560
* @info: Pointer to the SDCA interrupt info for this device.
561561
*
562562
* Typically this would be called from the driver for a single SDCA Function.
563563
*/
564-
void sdca_irq_cleanup(struct sdca_function_data *function,
565-
struct snd_soc_component *component,
564+
void sdca_irq_cleanup(struct device *dev,
565+
struct sdca_function_data *function,
566566
struct sdca_interrupt_info *info)
567567
{
568-
struct device *dev = component->dev;
569568
int i;
570569

571570
guard(mutex)(&info->irq_lock);

0 commit comments

Comments
 (0)