linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs
@ 2020-06-02  7:12 jun.li
  2020-06-02  9:03 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jun.li @ 2020-06-02  7:12 UTC (permalink / raw)
  To: linux, heikki.krogerus; +Cc: john.stultz, gregkh, linux-usb

From: Li Jun <jun.li@nxp.com>

John reported screaming irq caused by rt1711h when system boot[1],
this is because irq request is done before tcpci_register_port(),
so the chip->tcpci has not been setup, irq handler is entered but
can't do anything, this patch is to address this by moving the irq
request after tcpci_register_port().

[1] https://lkml.org/lkml/2020/5/30/1

Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/typec/tcpm/tcpci_rt1711h.c | 31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
index 0173890..b56a088 100644
--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
+++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
@@ -179,26 +179,6 @@ static irqreturn_t rt1711h_irq(int irq, void *dev_id)
 	return tcpci_irq(chip->tcpci);
 }
 
-static int rt1711h_init_alert(struct rt1711h_chip *chip,
-			      struct i2c_client *client)
-{
-	int ret;
-
-	/* Disable chip interrupts before requesting irq */
-	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
-	if (ret < 0)
-		return ret;
-
-	ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
-					rt1711h_irq,
-					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
-					dev_name(chip->dev), chip);
-	if (ret < 0)
-		return ret;
-	enable_irq_wake(client->irq);
-	return 0;
-}
-
 static int rt1711h_sw_reset(struct rt1711h_chip *chip)
 {
 	int ret;
@@ -260,7 +240,8 @@ static int rt1711h_probe(struct i2c_client *client,
 	if (ret < 0)
 		return ret;
 
-	ret = rt1711h_init_alert(chip, client);
+	/* Disable chip interrupts before requesting irq */
+	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
 	if (ret < 0)
 		return ret;
 
@@ -271,6 +252,14 @@ static int rt1711h_probe(struct i2c_client *client,
 	if (IS_ERR_OR_NULL(chip->tcpci))
 		return PTR_ERR(chip->tcpci);
 
+	ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
+					rt1711h_irq,
+					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
+					dev_name(chip->dev), chip);
+	if (ret < 0)
+		return ret;
+	enable_irq_wake(client->irq);
+
 	return 0;
 }
 
-- 
2.7.4


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

* Re: [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs
  2020-06-02  7:12 [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs jun.li
@ 2020-06-02  9:03 ` Greg KH
  2020-06-02 13:32 ` Guenter Roeck
  2020-06-02 13:43 ` Heikki Krogerus
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-06-02  9:03 UTC (permalink / raw)
  To: jun.li; +Cc: linux, heikki.krogerus, john.stultz, linux-usb

On Tue, Jun 02, 2020 at 03:12:08PM +0800, jun.li@nxp.com wrote:
> From: Li Jun <jun.li@nxp.com>
> 
> John reported screaming irq caused by rt1711h when system boot[1],
> this is because irq request is done before tcpci_register_port(),
> so the chip->tcpci has not been setup, irq handler is entered but
> can't do anything, this patch is to address this by moving the irq
> request after tcpci_register_port().
> 
> [1] https://lkml.org/lkml/2020/5/30/1

Please use lore.kernel.org links instead of lkml.org as we have no
control over that random site at all.

thanks,

greg k-h

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

* Re: [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs
  2020-06-02  7:12 [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs jun.li
  2020-06-02  9:03 ` Greg KH
@ 2020-06-02 13:32 ` Guenter Roeck
  2020-06-02 13:43 ` Heikki Krogerus
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-06-02 13:32 UTC (permalink / raw)
  To: jun.li, heikki.krogerus; +Cc: john.stultz, gregkh, linux-usb

On 6/2/20 12:12 AM, jun.li@nxp.com wrote:
> From: Li Jun <jun.li@nxp.com>
> 
> John reported screaming irq caused by rt1711h when system boot[1],
> this is because irq request is done before tcpci_register_port(),
> so the chip->tcpci has not been setup, irq handler is entered but
> can't do anything, this patch is to address this by moving the irq
> request after tcpci_register_port().
> 
> [1] https://lkml.org/lkml/2020/5/30/1
> 
> Cc: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Li Jun <jun.li@nxp.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 31 ++++++++++---------------------
>  1 file changed, 10 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index 0173890..b56a088 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -179,26 +179,6 @@ static irqreturn_t rt1711h_irq(int irq, void *dev_id)
>  	return tcpci_irq(chip->tcpci);
>  }
>  
> -static int rt1711h_init_alert(struct rt1711h_chip *chip,
> -			      struct i2c_client *client)
> -{
> -	int ret;
> -
> -	/* Disable chip interrupts before requesting irq */
> -	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
> -	if (ret < 0)
> -		return ret;
> -
> -	ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
> -					rt1711h_irq,
> -					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
> -					dev_name(chip->dev), chip);
> -	if (ret < 0)
> -		return ret;
> -	enable_irq_wake(client->irq);
> -	return 0;
> -}
> -
>  static int rt1711h_sw_reset(struct rt1711h_chip *chip)
>  {
>  	int ret;
> @@ -260,7 +240,8 @@ static int rt1711h_probe(struct i2c_client *client,
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = rt1711h_init_alert(chip, client);
> +	/* Disable chip interrupts before requesting irq */
> +	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -271,6 +252,14 @@ static int rt1711h_probe(struct i2c_client *client,
>  	if (IS_ERR_OR_NULL(chip->tcpci))
>  		return PTR_ERR(chip->tcpci);
>  
> +	ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
> +					rt1711h_irq,
> +					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
> +					dev_name(chip->dev), chip);
> +	if (ret < 0)
> +		return ret;
> +	enable_irq_wake(client->irq);
> +
>  	return 0;
>  }
>  
> 


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

* Re: [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs
  2020-06-02  7:12 [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs jun.li
  2020-06-02  9:03 ` Greg KH
  2020-06-02 13:32 ` Guenter Roeck
@ 2020-06-02 13:43 ` Heikki Krogerus
  2 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2020-06-02 13:43 UTC (permalink / raw)
  To: jun.li; +Cc: linux, john.stultz, gregkh, linux-usb

On Tue, Jun 02, 2020 at 03:12:08PM +0800, jun.li@nxp.com wrote:
> From: Li Jun <jun.li@nxp.com>
> 
> John reported screaming irq caused by rt1711h when system boot[1],
> this is because irq request is done before tcpci_register_port(),
> so the chip->tcpci has not been setup, irq handler is entered but
> can't do anything, this patch is to address this by moving the irq
> request after tcpci_register_port().
> 
> [1] https://lkml.org/lkml/2020/5/30/1
> 
> Cc: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Li Jun <jun.li@nxp.com>

Shouldn't this be marked as a fix?

> ---
>  drivers/usb/typec/tcpm/tcpci_rt1711h.c | 31 ++++++++++---------------------
>  1 file changed, 10 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index 0173890..b56a088 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -179,26 +179,6 @@ static irqreturn_t rt1711h_irq(int irq, void *dev_id)
>  	return tcpci_irq(chip->tcpci);
>  }
>  
> -static int rt1711h_init_alert(struct rt1711h_chip *chip,
> -			      struct i2c_client *client)
> -{
> -	int ret;
> -
> -	/* Disable chip interrupts before requesting irq */
> -	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
> -	if (ret < 0)
> -		return ret;
> -
> -	ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
> -					rt1711h_irq,
> -					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
> -					dev_name(chip->dev), chip);
> -	if (ret < 0)
> -		return ret;
> -	enable_irq_wake(client->irq);
> -	return 0;
> -}
> -
>  static int rt1711h_sw_reset(struct rt1711h_chip *chip)
>  {
>  	int ret;
> @@ -260,7 +240,8 @@ static int rt1711h_probe(struct i2c_client *client,
>  	if (ret < 0)
>  		return ret;
>  
> -	ret = rt1711h_init_alert(chip, client);
> +	/* Disable chip interrupts before requesting irq */
> +	ret = rt1711h_write16(chip, TCPC_ALERT_MASK, 0);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -271,6 +252,14 @@ static int rt1711h_probe(struct i2c_client *client,
>  	if (IS_ERR_OR_NULL(chip->tcpci))
>  		return PTR_ERR(chip->tcpci);
>  
> +	ret = devm_request_threaded_irq(chip->dev, client->irq, NULL,
> +					rt1711h_irq,
> +					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
> +					dev_name(chip->dev), chip);
> +	if (ret < 0)
> +		return ret;
> +	enable_irq_wake(client->irq);
> +
>  	return 0;
>  }

thanks,

-- 
heikki

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

end of thread, other threads:[~2020-06-02 13:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-02  7:12 [PATCH] usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs jun.li
2020-06-02  9:03 ` Greg KH
2020-06-02 13:32 ` Guenter Roeck
2020-06-02 13:43 ` Heikki Krogerus

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