linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/1] regulator: da9121: add IRQ free to release function
@ 2020-12-02 11:32 Adam Ward
  2020-12-02 11:32 ` [PATCH V2 1/1] regulator: da9121: Request IRQ directly and free in release function to avoid masking race Adam Ward
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Adam Ward @ 2020-12-02 11:32 UTC (permalink / raw)
  To: Mark Brown, Rob Herring
  Cc: Liam Girdwood, Vincent Whitchurch, linux-kernel, devicetree,
	Support Opensource

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(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2 1/1] regulator: da9121: Request IRQ directly and free in release function to avoid masking race
  2020-12-02 11:32 [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Adam Ward
@ 2020-12-02 11:32 ` Adam Ward
  2020-12-02 13:26 ` [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Mark Brown
  2020-12-02 17:19 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Adam Ward @ 2020-12-02 11:32 UTC (permalink / raw)
  To: Mark Brown, Rob Herring
  Cc: Liam Girdwood, Vincent Whitchurch, linux-kernel, devicetree,
	Support Opensource

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
---
 drivers/regulator/da9121-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index d9a8a4b..3ead6a1 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2 0/1] regulator: da9121: add IRQ free to release function
  2020-12-02 11:32 [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Adam Ward
  2020-12-02 11:32 ` [PATCH V2 1/1] regulator: da9121: Request IRQ directly and free in release function to avoid masking race Adam Ward
@ 2020-12-02 13:26 ` Mark Brown
  2020-12-02 17:19 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-12-02 13:26 UTC (permalink / raw)
  To: Adam Ward
  Cc: Rob Herring, Liam Girdwood, Vincent Whitchurch, linux-kernel,
	devicetree, Support Opensource

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

On Wed, Dec 02, 2020 at 11:32:46AM +0000, Adam Ward wrote:
> 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. 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2 0/1] regulator: da9121: add IRQ free to release function
  2020-12-02 11:32 [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Adam Ward
  2020-12-02 11:32 ` [PATCH V2 1/1] regulator: da9121: Request IRQ directly and free in release function to avoid masking race Adam Ward
  2020-12-02 13:26 ` [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Mark Brown
@ 2020-12-02 17:19 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-12-02 17:19 UTC (permalink / raw)
  To: Rob Herring, Adam Ward
  Cc: Liam Girdwood, linux-kernel, Support Opensource,
	Vincent Whitchurch, devicetree

On Wed, 2 Dec 2020 11:32:46 +0000, Adam Ward wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-02 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 11:32 [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Adam Ward
2020-12-02 11:32 ` [PATCH V2 1/1] regulator: da9121: Request IRQ directly and free in release function to avoid masking race Adam Ward
2020-12-02 13:26 ` [PATCH V2 0/1] regulator: da9121: add IRQ free to release function Mark Brown
2020-12-02 17:19 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).