Skip to contentSkip to conversation

usb: typec: tcpci: mask event interrupts when remove driver

PATCH Superseded Jun Li 2 participants 3 messages Jan 20, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jun Li

author
#0 lore raw

PATCH v2 1/1 usb: typec: tcpci: mask event interrupts when remove driver

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

Fixes 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
---
 drivers/usb/typec/tcpm/tcpci.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/usb/typec/tcpm/tcpci.c +6 -0
index c1f7073..fb9f2c1 100644
@@ -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 unregistger port */
+	err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0);
+	if (err < 0)
+		return err;
 
 	tcpci_unregister_port(chip->tcpci);
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 14 lines · Jun Li

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

Fixes 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
---
  drivers/usb/typec/tcpm/tcpci.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/usb/typec/tcpm/tcpci.c +0 -0
index c1f7073..fb9f2c1 100644

drivers/usb/typec/tcpm/tcpci.c static int tcpci_probe(struct i2c_client *client, · line 586

Quoted 6 lines
drivers/usb/typec/tcpm/tcpci.c +3 -0
@@ -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 unregistger port */

s/unregistger/unregistering/

Sorry, I should have noticed before.

Quoted 7 lines
drivers/usb/typec/tcpm/tcpci.c +3 -0
+	err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0);
+	if (err < 0)
+		return err;
 
  	tcpci_unregister_port(chip->tcpci);
 
author
#2 lore raw

Hi Guenter

Quoted 34 lines

-----Original Message-----
From: Guenter Roeck <[email protected]> On Behalf Of Guenter Roeck
Sent: 2020年1月20日 14:06
To: Jun Li <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v2] usb: typec: tcpci: mask event interrupts when remove driver

Quoted 15 lines · Jun Li

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

Fixes 74e656d6b0551 ("staging: typec: Type-C Port Controller

Interface driver (tcpci)")

---
  drivers/usb/typec/tcpm/tcpci.c | 6 ++++++
  1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/drivers/usb/typec/tcpm/tcpci.c index c1f7073..fb9f2c1 100644

drivers/usb/typec/tcpm/tcpci.c static int tcpci_probe(struct i2c_client *client, · line 586

Quoted 6 lines
drivers/usb/typec/tcpm/tcpci.c +3 -0
@@ -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 unregistger port */

s/unregistger/unregistering/

Quoted 1 line

Sorry, I should have noticed before.

thanks, I will send v3, I thought checkpatch.pl will check spell errors in patch but seems it only covers commit log.

Li Jun

Quoted 8 lines
Quoted 8 lines
drivers/usb/typec/tcpm/tcpci.c +3 -0
+	err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, 0);
+	if (err < 0)
+		return err;
 
  	tcpci_unregister_port(chip->tcpci);