Skip to contentSkip to conversation

regulator: da9121: add IRQ free to release function

PATCH In review Adam Ward 2 participants 4 messages Dec 2, 2020

Subsystems (2)
lore
Share & tools
lore

Adam Ward

author
#0 lore raw

v2 cover regulator: da9121: add IRQ free to release function

This patch fixes the DA9121 driver to disable the IRQ before cancelling the work, to be sure the IRQ doesn't restart it before all IRQs are masked

V2:

- Fix to release IRQ if regmap error fails probe

Adam Ward (1):
regulator: da9121: Request IRQ directly and free in release function
to avoid masking race

 drivers/regulator/da9121-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v2 1/1 regulator: da9121: Request IRQ directly and free in release function to avoid masking race

---
 drivers/regulator/da9121-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/regulator/da9121-regulator.c +6 -3
index d9a8a4b..3ead6a1 100644
@@ -945,8 +945,7 @@ static int da9121_config_irq(struct i2c_client *i2c,
 
 		chip->passive_delay = p_delay;
 
-		ret = devm_request_threaded_irq(chip->dev,
-					chip->chip_irq, NULL,
+		ret = request_threaded_irq(chip->chip_irq, NULL,
 					da9121_irq_handler,
 					IRQF_TRIGGER_LOW|IRQF_ONESHOT,
 					"da9121", chip);
@@ -960,7 +959,7 @@ static int da9121_config_irq(struct i2c_client *i2c,
 		if (ret != 0) {
 			dev_err(chip->dev, "Failed to set IRQ masks: %d\n",
 				ret);
-			goto error;
+			goto regmap_error;
 		}
 
 		INIT_DELAYED_WORK(&chip->work, da9121_status_poll_on);
@@ -969,6 +968,9 @@ static int da9121_config_irq(struct i2c_client *i2c,
 	}
 error:
 	return ret;
+regmap_error:
+	free_irq(chip->chip_irq, chip);
+	return ret;
 }
 
 static const struct of_device_id da9121_dt_ids[] = {
@@ -1036,6 +1038,7 @@ static int da9121_i2c_remove(struct i2c_client *i2c)
 	const int mask_all[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
 	int ret = 0;
 
+	free_irq(chip->chip_irq, chip);
 	cancel_delayed_work_sync(&chip->work);
 
 	ret = regmap_bulk_write(chip->regmap, DA9121_REG_SYS_MASK_0, mask_all, 4);
Signature · 1 line
1.9.1
maintainer
#2 lore raw
In reply to Adam Ward
Quoted 3 lines · Adam Ward

This patch fixes the DA9121 driver to disable the IRQ before cancelling the work, to be sure the IRQ doesn't restart it before all IRQs are masked

Please don't send cover letters for single patches, if there is anything that needs saying put it in the changelog of the patch or after the --- if it's administrative stuff. This reduces mail volume and ensures that any important information is recorded in the changelog rather than being lost.

maintainer
#3 lore raw
In reply to Adam Ward
Quoted 9 lines · Adam Ward

This patch fixes the DA9121 driver to disable the IRQ before cancelling the work, to be sure the IRQ doesn't restart it before all IRQs are masked

V2:

- Fix to release IRQ if regmap error fails probe

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: da9121: Request IRQ directly and free in release function to avoid masking race

      commit: 5e191d2e05a4fe098632006bb3afa5e21c8789db

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark