mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: typec: tcpci: Fix wakeup source leaks on device unbind
@ 2025-04-06 20:40 Krzysztof Kozlowski
  2025-04-06 20:40 ` [PATCH 2/2] usb: typec: tipd: " Krzysztof Kozlowski
  2025-04-07 13:56 ` [PATCH 1/2] usb: typec: tcpci: " Heikki Krogerus
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 20:40 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: 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/usb/typec/tcpm/tcpci_maxim_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c
index fd1b80593367..29a4aa89d1a1 100644
--- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c
+++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c
@@ -536,7 +536,10 @@ static int max_tcpci_probe(struct i2c_client *client)
 		return dev_err_probe(&client->dev, ret,
 				     "IRQ initialization failed\n");
 
-	device_init_wakeup(chip->dev, true);
+	ret = devm_device_init_wakeup(chip->dev);
+	if (ret)
+		return dev_err_probe(chip->dev, ret, "Failed to init wakeup\n");
+
 	return 0;
 }
 
-- 
2.45.2


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

* [PATCH 2/2] usb: typec: tipd: Fix wakeup source leaks on device unbind
  2025-04-06 20:40 [PATCH 1/2] usb: typec: tcpci: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
@ 2025-04-06 20:40 ` Krzysztof Kozlowski
  2025-04-07 13:58   ` Heikki Krogerus
  2025-04-07 13:56 ` [PATCH 1/2] usb: typec: tcpci: " Heikki Krogerus
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-06 20:40 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: 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/usb/typec/tipd/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index 7ee721a877c1..dcf141ada078 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -1431,7 +1431,7 @@ static int tps6598x_probe(struct i2c_client *client)
 
 	tps->wakeup = device_property_read_bool(tps->dev, "wakeup-source");
 	if (tps->wakeup && client->irq) {
-		device_init_wakeup(&client->dev, true);
+		devm_device_init_wakeup(&client->dev);
 		enable_irq_wake(client->irq);
 	}
 
-- 
2.45.2


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

* Re: [PATCH 1/2] usb: typec: tcpci: Fix wakeup source leaks on device unbind
  2025-04-06 20:40 [PATCH 1/2] usb: typec: tcpci: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
  2025-04-06 20:40 ` [PATCH 2/2] usb: typec: tipd: " Krzysztof Kozlowski
@ 2025-04-07 13:56 ` Heikki Krogerus
  1 sibling, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2025-04-07 13:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Sun, Apr 06, 2025 at 10:40:50PM +0200, 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>

I this should be marked as a fix. In any case, FWIW:

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpci_maxim_core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c
> index fd1b80593367..29a4aa89d1a1 100644
> --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c
> +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c
> @@ -536,7 +536,10 @@ static int max_tcpci_probe(struct i2c_client *client)
>  		return dev_err_probe(&client->dev, ret,
>  				     "IRQ initialization failed\n");
>  
> -	device_init_wakeup(chip->dev, true);
> +	ret = devm_device_init_wakeup(chip->dev);
> +	if (ret)
> +		return dev_err_probe(chip->dev, ret, "Failed to init wakeup\n");
> +
>  	return 0;
>  }
>  
> -- 
> 2.45.2

-- 
heikki

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

* Re: [PATCH 2/2] usb: typec: tipd: Fix wakeup source leaks on device unbind
  2025-04-06 20:40 ` [PATCH 2/2] usb: typec: tipd: " Krzysztof Kozlowski
@ 2025-04-07 13:58   ` Heikki Krogerus
  0 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2025-04-07 13:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Sun, Apr 06, 2025 at 10:40:51PM +0200, 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>

The same comment here - this should be tagged as a fix.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tipd/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 7ee721a877c1..dcf141ada078 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -1431,7 +1431,7 @@ static int tps6598x_probe(struct i2c_client *client)
>  
>  	tps->wakeup = device_property_read_bool(tps->dev, "wakeup-source");
>  	if (tps->wakeup && client->irq) {
> -		device_init_wakeup(&client->dev, true);
> +		devm_device_init_wakeup(&client->dev);
>  		enable_irq_wake(client->irq);
>  	}
>  
> -- 
> 2.45.2

-- 
heikki

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

end of thread, other threads:[~2025-04-07 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-06 20:40 [PATCH 1/2] usb: typec: tcpci: Fix wakeup source leaks on device unbind Krzysztof Kozlowski
2025-04-06 20:40 ` [PATCH 2/2] usb: typec: tipd: " Krzysztof Kozlowski
2025-04-07 13:58   ` Heikki Krogerus
2025-04-07 13:56 ` [PATCH 1/2] usb: typec: tcpci: " Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®