Skip to content

Commit dc18836

Browse files
Sibi Sankarandersson
authored andcommitted
soc: qcom: icc-bwmon: Allow for interrupts to be shared across instances
The multiple BWMONv4 instances available on the X1E80100 SoC use the same interrupt number. Mark them are shared to allow for re-use across instances. Using IRQF_SHARED coupled with devm_request_threaded_irq implies that the irq can still trigger during/after bwmon_remove due to other active bwmon instances. Handle this race by relying on bwmon_disable to disable the interrupt and coupled with explicit request/free irqs. Signed-off-by: Sibi Sankar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 530c661 commit dc18836

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/soc/qcom/icc-bwmon.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,14 @@ static int bwmon_probe(struct platform_device *pdev)
783783
bwmon->dev = dev;
784784

785785
bwmon_disable(bwmon);
786-
ret = devm_request_threaded_irq(dev, bwmon->irq, bwmon_intr,
787-
bwmon_intr_thread,
788-
IRQF_ONESHOT, dev_name(dev), bwmon);
786+
787+
/*
788+
* SoCs with multiple cpu-bwmon instances can end up using a shared interrupt
789+
* line. Using the devm_ variant might result in the IRQ handler being executed
790+
* after bwmon_disable in bwmon_remove()
791+
*/
792+
ret = request_threaded_irq(bwmon->irq, bwmon_intr, bwmon_intr_thread,
793+
IRQF_ONESHOT | IRQF_SHARED, dev_name(dev), bwmon);
789794
if (ret)
790795
return dev_err_probe(dev, ret, "failed to request IRQ\n");
791796

@@ -800,6 +805,7 @@ static void bwmon_remove(struct platform_device *pdev)
800805
struct icc_bwmon *bwmon = platform_get_drvdata(pdev);
801806

802807
bwmon_disable(bwmon);
808+
free_irq(bwmon->irq, bwmon);
803809
}
804810

805811
static const struct icc_bwmon_data msm8998_bwmon_data = {

0 commit comments

Comments
 (0)