* [PATCH 1/3] iio: accel: fxls8962af: Fix wakeup source leaks on device unbind
2025-04-06 20:01 [PATCH 0/3] iio: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
@ 2025-04-06 20:01 ` Krzysztof Kozlowski
2025-04-06 20:01 ` [PATCH 2/3] iio: adc: qcom-spmi-iadc: " Krzysztof Kozlowski
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 20:01 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-iio, linux-kernel, linux-arm-msm, 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/iio/accel/fxls8962af-core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index 48e4282964a0698d422df49739365648e19bdef6..bf1d3923a181798a1c884ee08b62d86ab5aed26f 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -1226,8 +1226,11 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq)
if (ret)
return ret;
- if (device_property_read_bool(dev, "wakeup-source"))
- device_init_wakeup(dev, true);
+ if (device_property_read_bool(dev, "wakeup-source")) {
+ ret = devm_device_init_wakeup(dev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to init wakeup\n");
+ }
return devm_iio_device_register(dev, indio_dev);
}
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] iio: adc: qcom-spmi-iadc: Fix wakeup source leaks on device unbind
2025-04-06 20:01 [PATCH 0/3] iio: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
2025-04-06 20:01 ` [PATCH 1/3] iio: accel: fxls8962af: " Krzysztof Kozlowski
@ 2025-04-06 20:01 ` Krzysztof Kozlowski
2025-04-06 20:01 ` [PATCH 3/3] iio: imu: st_lsm6dsx: " Krzysztof Kozlowski
2025-04-12 11:24 ` [PATCH 0/3] iio: " Jonathan Cameron
3 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 20:01 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-iio, linux-kernel, linux-arm-msm, 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/iio/adc/qcom-spmi-iadc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-iadc.c
index 7fb8b2499a1d00e4a020da893181e693650726bd..b64a8a407168bbc109e6ea9a63b8c4e492ac5bf4 100644
--- a/drivers/iio/adc/qcom-spmi-iadc.c
+++ b/drivers/iio/adc/qcom-spmi-iadc.c
@@ -543,7 +543,9 @@ static int iadc_probe(struct platform_device *pdev)
else
return ret;
} else {
- device_init_wakeup(iadc->dev, 1);
+ ret = devm_device_init_wakeup(iadc->dev);
+ if (ret)
+ return dev_err_probe(iadc->dev, ret, "Failed to init wakeup\n");
}
ret = iadc_update_offset(iadc);
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] iio: imu: st_lsm6dsx: Fix wakeup source leaks on device unbind
2025-04-06 20:01 [PATCH 0/3] iio: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
2025-04-06 20:01 ` [PATCH 1/3] iio: accel: fxls8962af: " Krzysztof Kozlowski
2025-04-06 20:01 ` [PATCH 2/3] iio: adc: qcom-spmi-iadc: " Krzysztof Kozlowski
@ 2025-04-06 20:01 ` Krzysztof Kozlowski
2025-04-08 7:05 ` Lorenzo Bianconi
2025-04-12 11:24 ` [PATCH 0/3] iio: " Jonathan Cameron
3 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 20:01 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-iio, linux-kernel, linux-arm-msm, 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/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 4fdcc2acc94ed0f594116b9141ce85f7c4449a58..96c6106b95eef60b43eb41fef67889d44d5836db 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2719,8 +2719,11 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
}
if (device_property_read_bool(dev, "wakeup-source") ||
- (pdata && pdata->wakeup_source))
- device_init_wakeup(dev, true);
+ (pdata && pdata->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] 6+ messages in thread* Re: [PATCH 3/3] iio: imu: st_lsm6dsx: Fix wakeup source leaks on device unbind
2025-04-06 20:01 ` [PATCH 3/3] iio: imu: st_lsm6dsx: " Krzysztof Kozlowski
@ 2025-04-08 7:05 ` Lorenzo Bianconi
0 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2025-04-08 7:05 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel,
linux-arm-msm
[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]
> Device can be unbound, so driver must also release memory for the wakeup
> source.
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 4fdcc2acc94ed0f594116b9141ce85f7c4449a58..96c6106b95eef60b43eb41fef67889d44d5836db 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2719,8 +2719,11 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
> }
>
> if (device_property_read_bool(dev, "wakeup-source") ||
> - (pdata && pdata->wakeup_source))
> - device_init_wakeup(dev, true);
> + (pdata && pdata->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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] iio: Fix wakeup source leaks on device unbind
2025-04-06 20:01 [PATCH 0/3] iio: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
` (2 preceding siblings ...)
2025-04-06 20:01 ` [PATCH 3/3] iio: imu: st_lsm6dsx: " Krzysztof Kozlowski
@ 2025-04-12 11:24 ` Jonathan Cameron
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-04-12 11:24 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Lars-Peter Clausen, Lorenzo Bianconi, linux-iio, linux-kernel,
linux-arm-msm
On Sun, 06 Apr 2025 22:01:41 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> Device can be unbound, so driver must also release memory for the wakeup
> source.
Applied to the fixes-togreg branch of iio.git.
I haven't marked them for stable as seems the resource leak is fairly
harmless.
Jonathan
>
> Best regards,
> Krzysztof
>
> ---
> Krzysztof Kozlowski (3):
> iio: accel: fxls8962af: Fix wakeup source leaks on device unbind
> iio: adc: qcom-spmi-iadc: Fix wakeup source leaks on device unbind
> iio: imu: st_lsm6dsx: Fix wakeup source leaks on device unbind
>
> drivers/iio/accel/fxls8962af-core.c | 7 +++++--
> drivers/iio/adc/qcom-spmi-iadc.c | 4 +++-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 7 +++++--
> 3 files changed, 13 insertions(+), 5 deletions(-)
> ---
> base-commit: a4cda136f021ad44b8b52286aafd613030a6db5f
> change-id: 20250406-b4-device-wakeup-leak-iio-4457b99b6a91
>
> Best regards,
^ permalink raw reply [flat|nested] 6+ messages in thread