All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind
@ 2025-04-06 19:50 Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 1/8] mfd: 88pm886: " Krzysztof Kozlowski
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.  Use devm for driver already having devm interface and manually
disable wakeup for drivers still having remove() callback to keep
consistent ordering of cleanups.

I did not update the drivers with suppress_bind_attrs and no error paths
after device_init_wakeup() because it would not bring any benefits.

Best regards,
Krzysztof

---
Krzysztof Kozlowski (8):
      mfd: 88pm886: Fix wakeup source leaks on device unbind
      mfd: as3722: Fix wakeup source leaks on device unbind
      mfd: max14577: Fix wakeup source leaks on device unbind
      mfd: max77541: Fix wakeup source leaks on device unbind
      mfd: max77705: Fix wakeup source leaks on device unbind
      mfd: max8925: Fix wakeup source leaks on device unbind
      mfd: rt5033: Fix wakeup source leaks on device unbind
      mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind

 drivers/mfd/88pm886.c         | 6 +++++-
 drivers/mfd/as3722.c          | 4 +++-
 drivers/mfd/max14577.c        | 1 +
 drivers/mfd/max77541.c        | 2 +-
 drivers/mfd/max77705.c        | 4 +++-
 drivers/mfd/max8925-i2c.c     | 1 +
 drivers/mfd/rt5033.c          | 6 +++++-
 drivers/mfd/sprd-sc27xx-spi.c | 5 ++++-
 8 files changed, 23 insertions(+), 6 deletions(-)
---
base-commit: a4cda136f021ad44b8b52286aafd613030a6db5f
change-id: 20250406-mfd-device-wakekup-leak-a98a99acb1fa

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


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

* [PATCH 1/8] mfd: 88pm886: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-08 13:45   ` Karel Balej
  2025-04-06 19:50 ` [PATCH 2/8] mfd: as3722: " Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/88pm886.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/88pm886.c b/drivers/mfd/88pm886.c
index 891fdce5d8c12474e5e01152ca5fec8c88470b63..177878aa32f86eb59705ba6a1205eea43142d920 100644
--- a/drivers/mfd/88pm886.c
+++ b/drivers/mfd/88pm886.c
@@ -124,7 +124,11 @@ static int pm886_probe(struct i2c_client *client)
 	if (err)
 		return dev_err_probe(dev, err, "Failed to register power off handler\n");
 
-	device_init_wakeup(dev, device_property_read_bool(dev, "wakeup-source"));
+	if (device_property_read_bool(dev, "wakeup-source")) {
+		err = devm_device_init_wakeup(dev);
+		if (err)
+			return dev_err_probe(dev, err, "Failed to init wakeup\n");
+	}
 
 	return 0;
 }

-- 
2.45.2


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

* [PATCH 2/8] mfd: as3722: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 1/8] mfd: 88pm886: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 3/8] mfd: max14577: " Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/as3722.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c
index 6c0d89b0c7e3faa2f82a265df245c6abc6617e48..7ab6fcc9c27c8f8284d5e2a7bf4291d582b9ca22 100644
--- a/drivers/mfd/as3722.c
+++ b/drivers/mfd/as3722.c
@@ -394,7 +394,9 @@ static int as3722_i2c_probe(struct i2c_client *i2c)
 		return ret;
 	}
 
-	device_init_wakeup(as3722->dev, true);
+	ret = devm_device_init_wakeup(as3722->dev);
+	if (ret)
+		return dev_err_probe(as3722->dev, ret, "Failed to init wakeup\n");
 
 	dev_dbg(as3722->dev, "AS3722 core driver initialized successfully\n");
 	return 0;

-- 
2.45.2


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

* [PATCH 3/8] mfd: max14577: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 1/8] mfd: 88pm886: " Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 2/8] mfd: as3722: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-15 15:49   ` Lee Jones
  2025-04-06 19:50 ` [PATCH 4/8] mfd: max77541: " Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/max14577.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 6fce79ec2dc64682ef4d85f22d762ec8e2ce1adb..7e7e8af9af224660557e76c2b80d92b05c86d202 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -456,6 +456,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
 {
 	struct max14577 *max14577 = i2c_get_clientdata(i2c);
 
+	device_init_wakeup(max14577->dev, false);
 	mfd_remove_devices(max14577->dev);
 	regmap_del_irq_chip(max14577->irq, max14577->irq_data);
 	if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)

-- 
2.45.2


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

* [PATCH 4/8] mfd: max77541: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2025-04-06 19:50 ` [PATCH 3/8] mfd: max14577: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 5/8] mfd: max77705: " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/max77541.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/max77541.c b/drivers/mfd/max77541.c
index d77c31c86e4356f5c19eb0e1d958d1e2f360f4cb..f91b4f5373ce938ccdab2d473039540aeb408b1d 100644
--- a/drivers/mfd/max77541.c
+++ b/drivers/mfd/max77541.c
@@ -152,7 +152,7 @@ static int max77541_pmic_setup(struct device *dev)
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to initialize IRQ\n");
 
-	ret = device_init_wakeup(dev, true);
+	ret = devm_device_init_wakeup(dev);
 	if (ret)
 		return dev_err_probe(dev, ret, "Unable to init wakeup\n");
 

-- 
2.45.2


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

* [PATCH 5/8] mfd: max77705: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2025-04-06 19:50 ` [PATCH 4/8] mfd: max77541: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 6/8] mfd: max8925: " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/max77705.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/max77705.c b/drivers/mfd/max77705.c
index 60c457c21d952c2ad485f29619e014f5b85a2087..6b263bacb8c28d980e890777452db58be84d7338 100644
--- a/drivers/mfd/max77705.c
+++ b/drivers/mfd/max77705.c
@@ -131,7 +131,9 @@ static int max77705_i2c_probe(struct i2c_client *i2c)
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to register child devices\n");
 
-	device_init_wakeup(dev, true);
+	ret = devm_device_init_wakeup(dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to init wakeup\n");
 
 	return 0;
 }

-- 
2.45.2


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

* [PATCH 6/8] mfd: max8925: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2025-04-06 19:50 ` [PATCH 5/8] mfd: max77705: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-15 15:48   ` Lee Jones
  2025-04-06 19:50 ` [PATCH 7/8] mfd: rt5033: " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/max8925-i2c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index 556aea7ec0a0473edc9291cae0c82fe9b4ecb346..ab19ff0c786732be53e58a0162d2658650d88f47 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -201,6 +201,7 @@ static void max8925_remove(struct i2c_client *client)
 	struct max8925_chip *chip = i2c_get_clientdata(client);
 
 	max8925_device_exit(chip);
+	device_init_wakeup(&client->dev, false);
 	i2c_unregister_device(chip->adc);
 	i2c_unregister_device(chip->rtc);
 }

-- 
2.45.2


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

* [PATCH 7/8] mfd: rt5033: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2025-04-06 19:50 ` [PATCH 6/8] mfd: max8925: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-06 19:50 ` [PATCH 8/8] mfd: sprd-sc27xx: " Krzysztof Kozlowski
  2025-05-08 14:14 ` [PATCH 0/8] mfd: " Lee Jones
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/rt5033.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/rt5033.c b/drivers/mfd/rt5033.c
index 84ebc96f58e48d3b55abab75d64efde2fdb02f66..2204bf1c5a51a864b1ca2cb1be45272d65630d15 100644
--- a/drivers/mfd/rt5033.c
+++ b/drivers/mfd/rt5033.c
@@ -98,7 +98,11 @@ static int rt5033_i2c_probe(struct i2c_client *i2c)
 		return ret;
 	}
 
-	device_init_wakeup(rt5033->dev, rt5033->wakeup);
+	if (rt5033->wakeup) {
+		ret = devm_device_init_wakeup(rt5033->dev);
+		if (ret)
+			return dev_err_probe(rt5033->dev, ret, "Failed to init wakeup\n");
+	}
 
 	return 0;
 }

-- 
2.45.2


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

* [PATCH 8/8] mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2025-04-06 19:50 ` [PATCH 7/8] mfd: rt5033: " Krzysztof Kozlowski
@ 2025-04-06 19:50 ` Krzysztof Kozlowski
  2025-04-07  1:56   ` Baolin Wang
  2025-05-08 14:14 ` [PATCH 0/8] mfd: " Lee Jones
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 19:50 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-kernel, Krzysztof Kozlowski

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/mfd/sprd-sc27xx-spi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index 7186e2108108f0d779bfe72d476fa333194c23ca..d6b4350779e6aecfa19d9fa21b9174447d589e33 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -210,7 +210,10 @@ static int sprd_pmic_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	device_init_wakeup(&spi->dev, true);
+	ret = devm_device_init_wakeup(&spi->dev);
+	if (ret)
+		return dev_err_probe(&spi->dev, ret, "Failed to init wakeup\n");
+
 	return 0;
 }
 

-- 
2.45.2


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

* Re: [PATCH 8/8] mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 ` [PATCH 8/8] mfd: sprd-sc27xx: " Krzysztof Kozlowski
@ 2025-04-07  1:56   ` Baolin Wang
  0 siblings, 0 replies; 15+ messages in thread
From: Baolin Wang @ 2025-04-07  1:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Karel Balej, Lee Jones, Chanwoo Choi,
	Krzysztof Kozlowski, Orson Zhai, Chunyan Zhang
  Cc: linux-kernel



On 2025/4/7 03:50, Krzysztof Kozlowski wrote:
> Device can be unbound, so driver must also release memory for the wakeup
> source.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Thanks. LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/mfd/sprd-sc27xx-spi.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
> index 7186e2108108f0d779bfe72d476fa333194c23ca..d6b4350779e6aecfa19d9fa21b9174447d589e33 100644
> --- a/drivers/mfd/sprd-sc27xx-spi.c
> +++ b/drivers/mfd/sprd-sc27xx-spi.c
> @@ -210,7 +210,10 @@ static int sprd_pmic_probe(struct spi_device *spi)
>   		return ret;
>   	}
>   
> -	device_init_wakeup(&spi->dev, true);
> +	ret = devm_device_init_wakeup(&spi->dev);
> +	if (ret)
> +		return dev_err_probe(&spi->dev, ret, "Failed to init wakeup\n");
> +
>   	return 0;
>   }
>   
> 

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

* Re: [PATCH 1/8] mfd: 88pm886: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 ` [PATCH 1/8] mfd: 88pm886: " Krzysztof Kozlowski
@ 2025-04-08 13:45   ` Karel Balej
  0 siblings, 0 replies; 15+ messages in thread
From: Karel Balej @ 2025-04-08 13:45 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang

Krzysztof Kozlowski, 2025-04-06T21:50:09+02:00:
> Device can be unbound, so driver must also release memory for the wakeup
> source.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/mfd/88pm886.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Karel Balej <balejk@matfyz.cz>

Thanks!
K. B.

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

* Re: [PATCH 6/8] mfd: max8925: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 ` [PATCH 6/8] mfd: max8925: " Krzysztof Kozlowski
@ 2025-04-15 15:48   ` Lee Jones
  2025-05-01 15:17     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 15+ messages in thread
From: Lee Jones @ 2025-04-15 15:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Karel Balej, Chanwoo Choi, Krzysztof Kozlowski, Orson Zhai,
	Baolin Wang, Chunyan Zhang, linux-kernel

On Sun, 06 Apr 2025, Krzysztof Kozlowski wrote:

> Device can be unbound, so driver must also release memory for the wakeup
> source.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/mfd/max8925-i2c.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
> index 556aea7ec0a0473edc9291cae0c82fe9b4ecb346..ab19ff0c786732be53e58a0162d2658650d88f47 100644
> --- a/drivers/mfd/max8925-i2c.c
> +++ b/drivers/mfd/max8925-i2c.c
> @@ -201,6 +201,7 @@ static void max8925_remove(struct i2c_client *client)
>  	struct max8925_chip *chip = i2c_get_clientdata(client);
>  
>  	max8925_device_exit(chip);
> +	device_init_wakeup(&client->dev, false);

Why not devm_* instead?

>  	i2c_unregister_device(chip->adc);
>  	i2c_unregister_device(chip->rtc);
>  }
> 
> -- 
> 2.45.2
> 

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH 3/8] mfd: max14577: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 ` [PATCH 3/8] mfd: max14577: " Krzysztof Kozlowski
@ 2025-04-15 15:49   ` Lee Jones
  0 siblings, 0 replies; 15+ messages in thread
From: Lee Jones @ 2025-04-15 15:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Karel Balej, Chanwoo Choi, Krzysztof Kozlowski, Orson Zhai,
	Baolin Wang, Chunyan Zhang, linux-kernel

On Sun, 06 Apr 2025, Krzysztof Kozlowski wrote:

> Device can be unbound, so driver must also release memory for the wakeup
> source.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/mfd/max14577.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
> index 6fce79ec2dc64682ef4d85f22d762ec8e2ce1adb..7e7e8af9af224660557e76c2b80d92b05c86d202 100644
> --- a/drivers/mfd/max14577.c
> +++ b/drivers/mfd/max14577.c
> @@ -456,6 +456,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c)
>  {
>  	struct max14577 *max14577 = i2c_get_clientdata(i2c);
>  
> +	device_init_wakeup(max14577->dev, false);

devm_* again?

>  	mfd_remove_devices(max14577->dev);
>  	regmap_del_irq_chip(max14577->irq, max14577->irq_data);
>  	if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
> 
> -- 
> 2.45.2
> 

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH 6/8] mfd: max8925: Fix wakeup source leaks on device unbind
  2025-04-15 15:48   ` Lee Jones
@ 2025-05-01 15:17     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-01 15:17 UTC (permalink / raw)
  To: Lee Jones
  Cc: Karel Balej, Chanwoo Choi, Krzysztof Kozlowski, Orson Zhai,
	Baolin Wang, Chunyan Zhang, linux-kernel

On 15/04/2025 17:48, Lee Jones wrote:
> On Sun, 06 Apr 2025, Krzysztof Kozlowski wrote:
> 
>> Device can be unbound, so driver must also release memory for the wakeup
>> source.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>  drivers/mfd/max8925-i2c.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
>> index 556aea7ec0a0473edc9291cae0c82fe9b4ecb346..ab19ff0c786732be53e58a0162d2658650d88f47 100644
>> --- a/drivers/mfd/max8925-i2c.c
>> +++ b/drivers/mfd/max8925-i2c.c
>> @@ -201,6 +201,7 @@ static void max8925_remove(struct i2c_client *client)
>>  	struct max8925_chip *chip = i2c_get_clientdata(client);
>>  
>>  	max8925_device_exit(chip);
>> +	device_init_wakeup(&client->dev, false);
> 
> Why not devm_* instead?


Hi Lee,

I am sorry I reply so late - I totally missed your comment/email.

I am not using devm intentionally, because there is cleanup path and
devm() would change the order of things are released.

The rule of thumb is: use devm or manual, don't mix, otherwise you ask
for trouble in weird cases.

Same for the other comment.

Best regards,
Krzysztof

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

* Re: [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind
  2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2025-04-06 19:50 ` [PATCH 8/8] mfd: sprd-sc27xx: " Krzysztof Kozlowski
@ 2025-05-08 14:14 ` Lee Jones
  8 siblings, 0 replies; 15+ messages in thread
From: Lee Jones @ 2025-05-08 14:14 UTC (permalink / raw)
  To: Karel Balej, Lee Jones, Chanwoo Choi, Krzysztof Kozlowski,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Krzysztof Kozlowski
  Cc: linux-kernel

On Sun, 06 Apr 2025 21:50:08 +0200, Krzysztof Kozlowski wrote:
> Device can be unbound, so driver must also release memory for the wakeup
> source.  Use devm for driver already having devm interface and manually
> disable wakeup for drivers still having remove() callback to keep
> consistent ordering of cleanups.
> 
> I did not update the drivers with suppress_bind_attrs and no error paths
> after device_init_wakeup() because it would not bring any benefits.
> 
> [...]

Applied, thanks!

[1/8] mfd: 88pm886: Fix wakeup source leaks on device unbind
      commit: 0fcb3bee6f9e004b1d52ad6e090bcd0ff2cc7add
[2/8] mfd: as3722: Fix wakeup source leaks on device unbind
      commit: 16e0c58e342867fec5198fbd0af7f93f49d12f42
[3/8] mfd: max14577: Fix wakeup source leaks on device unbind
      commit: add4c382ae0185ebdde685b5992efcc3052e487f
[4/8] mfd: max77541: Fix wakeup source leaks on device unbind
      commit: e1b513336240d05e43fb4f0165e2ff242cc5c5aa
[5/8] mfd: max77705: Fix wakeup source leaks on device unbind
      commit: ae3311e911012dc433ba79ef9d5cb6d3eb144223
[6/8] mfd: max8925: Fix wakeup source leaks on device unbind
      commit: a58fa75ee660144620e42abeffd517c6dab40ce7
[7/8] mfd: rt5033: Fix wakeup source leaks on device unbind
      commit: c85164efc5486eb711b376a15aecfd37c292c09f
[8/8] mfd: sprd-sc27xx: Fix wakeup source leaks on device unbind
      commit: 7f8bb8ef012ee27b601b778b3ef33223f242604f

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2025-05-08 14:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-06 19:50 [PATCH 0/8] mfd: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
2025-04-06 19:50 ` [PATCH 1/8] mfd: 88pm886: " Krzysztof Kozlowski
2025-04-08 13:45   ` Karel Balej
2025-04-06 19:50 ` [PATCH 2/8] mfd: as3722: " Krzysztof Kozlowski
2025-04-06 19:50 ` [PATCH 3/8] mfd: max14577: " Krzysztof Kozlowski
2025-04-15 15:49   ` Lee Jones
2025-04-06 19:50 ` [PATCH 4/8] mfd: max77541: " Krzysztof Kozlowski
2025-04-06 19:50 ` [PATCH 5/8] mfd: max77705: " Krzysztof Kozlowski
2025-04-06 19:50 ` [PATCH 6/8] mfd: max8925: " Krzysztof Kozlowski
2025-04-15 15:48   ` Lee Jones
2025-05-01 15:17     ` Krzysztof Kozlowski
2025-04-06 19:50 ` [PATCH 7/8] mfd: rt5033: " Krzysztof Kozlowski
2025-04-06 19:50 ` [PATCH 8/8] mfd: sprd-sc27xx: " Krzysztof Kozlowski
2025-04-07  1:56   ` Baolin Wang
2025-05-08 14:14 ` [PATCH 0/8] mfd: " Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.