summaryrefslogtreecommitdiff
path: root/drivers/usb/typec/tcpm
diff options
context:
space:
mode:
authorJun Li <jun.li@nxp.com>2020-01-20 06:43:19 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 10:11:28 +0100
commit3ba76256fc4e2a0d7fb26cc95459041ea0e88972 (patch)
treec847c6150f1647169820a076ada8c2cd8fd0e405 /drivers/usb/typec/tcpm
parente1f236efd9c579a29d7df75aa052127d0d975267 (diff)
usb: typec: tcpci: mask event interrupts when remove driver
This is to prevent any possible events generated while unregister tpcm port. Fixes: 74e656d6b055 ("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> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/1579502333-4145-1-git-send-email-jun.li@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/tcpm')
-rw-r--r--drivers/usb/typec/tcpm/tcpci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index 8b4ff9fff340..753645bb2527 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -591,6 +591,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);