diff mbox series

[v3] usb: typec: tcpci: mask event interrupts when remove driver

Message ID 1579502333-4145-1-git-send-email-jun.li@nxp.com (mailing list archive)
State Mainlined
Commit 3ba76256fc4e2a0d7fb26cc95459041ea0e88972
Headers show
Series [v3] usb: typec: tcpci: mask event interrupts when remove driver | expand

Commit Message

Jun Li Jan. 20, 2020, 6:43 a.m. UTC
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(+)

Comments

Guenter Roeck Jan. 20, 2020, 7:18 a.m. UTC | #1
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);
>   
>
Heikki Krogerus Jan. 20, 2020, 9:27 a.m. UTC | #2
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
diff mbox series

Patch

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