linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] usb: typec: tcpci: mask event interrupts when remove driver
@ 2020-01-20  6:43 Jun Li
  2020-01-20  7:18 ` Guenter Roeck
  2020-01-20  9:27 ` Heikki Krogerus
  0 siblings, 2 replies; 3+ messages in thread
From: Jun Li @ 2020-01-20  6:43 UTC (permalink / raw)
  To: linux, heikki.krogerus; +Cc: gregkh, linux-usb, dl-linux-imx

This is to prevent any possible events generated while unregister
tpcm port.

Fixes: 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/typec/tcpm/tcpci.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index c1f7073..dfae41f 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -581,6 +581,12 @@ static int tcpci_probe(struct i2c_client *client,
 static int tcpci_remove(struct i2c_client *client)
 {
 	struct tcpci_chip *chip = i2c_get_clientdata(client);
+	int err;
+
+	/* Disable chip interrupts before unregistering port */
+	err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0);
+	if (err < 0)
+		return err;
 
 	tcpci_unregister_port(chip->tcpci);
 
-- 
2.7.4


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

* Re: [PATCH v3] usb: typec: tcpci: mask event interrupts when remove driver
  2020-01-20  6:43 [PATCH v3] usb: typec: tcpci: mask event interrupts when remove driver Jun Li
@ 2020-01-20  7:18 ` Guenter Roeck
  2020-01-20  9:27 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2020-01-20  7:18 UTC (permalink / raw)
  To: Jun Li, heikki.krogerus; +Cc: gregkh, linux-usb, dl-linux-imx

On 1/19/20 10:43 PM, Jun Li wrote:
> This is to prevent any possible events generated while unregister
> tpcm port.
> 
> Fixes: 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
> Signed-off-by: Li Jun <jun.li@nxp.com>

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

> ---
>   drivers/usb/typec/tcpm/tcpci.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index c1f7073..dfae41f 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -581,6 +581,12 @@ static int tcpci_probe(struct i2c_client *client,
>   static int tcpci_remove(struct i2c_client *client)
>   {
>   	struct tcpci_chip *chip = i2c_get_clientdata(client);
> +	int err;
> +
> +	/* Disable chip interrupts before unregistering port */
> +	err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0);
> +	if (err < 0)
> +		return err;
>   
>   	tcpci_unregister_port(chip->tcpci);
>   
> 


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

* Re: [PATCH v3] usb: typec: tcpci: mask event interrupts when remove driver
  2020-01-20  6:43 [PATCH v3] usb: typec: tcpci: mask event interrupts when remove driver Jun Li
  2020-01-20  7:18 ` Guenter Roeck
@ 2020-01-20  9:27 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2020-01-20  9:27 UTC (permalink / raw)
  To: Jun Li; +Cc: linux, gregkh, linux-usb, dl-linux-imx

On Mon, Jan 20, 2020 at 06:43:19AM +0000, Jun Li wrote:
> This is to prevent any possible events generated while unregister
> tpcm port.
> 
> Fixes: 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
> Signed-off-by: Li Jun <jun.li@nxp.com>

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

> ---
>  drivers/usb/typec/tcpm/tcpci.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index c1f7073..dfae41f 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -581,6 +581,12 @@ static int tcpci_probe(struct i2c_client *client,
>  static int tcpci_remove(struct i2c_client *client)
>  {
>  	struct tcpci_chip *chip = i2c_get_clientdata(client);
> +	int err;
> +
> +	/* Disable chip interrupts before unregistering port */
> +	err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0);
> +	if (err < 0)
> +		return err;
>  
>  	tcpci_unregister_port(chip->tcpci);
>  
> -- 
> 2.7.4

-- 
heikki

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

end of thread, other threads:[~2020-01-20  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20  6:43 [PATCH v3] usb: typec: tcpci: mask event interrupts when remove driver Jun Li
2020-01-20  7:18 ` Guenter Roeck
2020-01-20  9:27 ` 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).