All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpci: mask event interrupts when remove driver
@ 2020-01-19 10:59 Jun Li
  2020-01-19 12:54 ` gregkh
  2020-01-19 15:03 ` Guenter Roeck
  0 siblings, 2 replies; 4+ messages in thread
From: Jun Li @ 2020-01-19 10:59 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.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/typec/tcpm/tcpci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index c1f7073..3b42ef8 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -581,6 +581,14 @@ static int tcpci_probe(struct i2c_client *client,
 static int tcpci_remove(struct i2c_client *client)
 {
 	struct tcpci_chip *chip = i2c_get_clientdata(client);
+	u16 val = 0;
+	int err;
+
+	/* Disable chip interrupts before unregistger port */
+	err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val,
+			       sizeof(u16));
+	if (err < 0)
+		return err;
 
 	tcpci_unregister_port(chip->tcpci);
 
-- 
2.7.4


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

* Re: [PATCH] usb: typec: tcpci: mask event interrupts when remove driver
  2020-01-19 10:59 [PATCH] usb: typec: tcpci: mask event interrupts when remove driver Jun Li
@ 2020-01-19 12:54 ` gregkh
  2020-01-19 15:03 ` Guenter Roeck
  1 sibling, 0 replies; 4+ messages in thread
From: gregkh @ 2020-01-19 12:54 UTC (permalink / raw)
  To: Jun Li; +Cc: linux, heikki.krogerus, linux-usb, dl-linux-imx

On Sun, Jan 19, 2020 at 10:59:37AM +0000, Jun Li wrote:
> This is to prevent any possible events generated while unregister
> tpcm port.
> 
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
>  drivers/usb/typec/tcpm/tcpci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Does this need to be backported to older kernels?  If so, how far back?
Any idea what commit caused this issue?

thanks,

greg k-h

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

* Re: [PATCH] usb: typec: tcpci: mask event interrupts when remove driver
  2020-01-19 10:59 [PATCH] usb: typec: tcpci: mask event interrupts when remove driver Jun Li
  2020-01-19 12:54 ` gregkh
@ 2020-01-19 15:03 ` Guenter Roeck
  2020-01-20  3:04   ` Jun Li
  1 sibling, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2020-01-19 15:03 UTC (permalink / raw)
  To: Jun Li, heikki.krogerus; +Cc: gregkh, linux-usb, dl-linux-imx

On 1/19/20 2:59 AM, Jun Li wrote:
> This is to prevent any possible events generated while unregister
> tpcm port.
> 
> Signed-off-by: Li Jun <jun.li@nxp.com>

Fixes: 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")

> ---
>   drivers/usb/typec/tcpm/tcpci.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index c1f7073..3b42ef8 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -581,6 +581,14 @@ static int tcpci_probe(struct i2c_client *client,
>   static int tcpci_remove(struct i2c_client *client)
>   {
>   	struct tcpci_chip *chip = i2c_get_clientdata(client);
> +	u16 val = 0;
> +	int err;
> +
> +	/* Disable chip interrupts before unregistger port */
> +	err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val,
> +			       sizeof(u16));

I would suggest

	err = tcpci_write16(chip, TCPC_ALERT_MASK, 0);

Guenter

> +	if (err < 0)
> +		return err;
>   
>   	tcpci_unregister_port(chip->tcpci);
>   
> 


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

* RE: [PATCH] usb: typec: tcpci: mask event interrupts when remove driver
  2020-01-19 15:03 ` Guenter Roeck
@ 2020-01-20  3:04   ` Jun Li
  0 siblings, 0 replies; 4+ messages in thread
From: Jun Li @ 2020-01-20  3:04 UTC (permalink / raw)
  To: Guenter Roeck, heikki.krogerus; +Cc: gregkh, linux-usb, dl-linux-imx

Hi Guenter,

> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: 2020年1月19日 23:03
> To: Jun Li <jun.li@nxp.com>; heikki.krogerus@linux.intel.com
> Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [PATCH] usb: typec: tcpci: mask event interrupts when remove
> driver
> 
> On 1/19/20 2:59 AM, Jun Li wrote:
> > This is to prevent any possible events generated while unregister tpcm
> > port.
> >
> > Signed-off-by: Li Jun <jun.li@nxp.com>
> 
> Fixes: 74e656d6b0551 ("staging: typec: Type-C Port Controller Interface
> driver (tcpci)")

Thanks, I will add the stable tag.
> 
> > ---
> >   drivers/usb/typec/tcpm/tcpci.c | 8 ++++++++
> >   1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/usb/typec/tcpm/tcpci.c
> > b/drivers/usb/typec/tcpm/tcpci.c index c1f7073..3b42ef8 100644
> > --- a/drivers/usb/typec/tcpm/tcpci.c
> > +++ b/drivers/usb/typec/tcpm/tcpci.c
> > @@ -581,6 +581,14 @@ static int tcpci_probe(struct i2c_client *client,
> >   static int tcpci_remove(struct i2c_client *client)
> >   {
> >   	struct tcpci_chip *chip = i2c_get_clientdata(client);
> > +	u16 val = 0;
> > +	int err;
> > +
> > +	/* Disable chip interrupts before unregistger port */
> > +	err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val,
> > +			       sizeof(u16));
> 
> I would suggest
> 
> 	err = tcpci_write16(chip, TCPC_ALERT_MASK, 0);

OK, this is simpler, will send out V2.

Li Jun
> 
> Guenter
> 
> > +	if (err < 0)
> > +		return err;
> >
> >   	tcpci_unregister_port(chip->tcpci);
> >
> >


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 10:59 [PATCH] usb: typec: tcpci: mask event interrupts when remove driver Jun Li
2020-01-19 12:54 ` gregkh
2020-01-19 15:03 ` Guenter Roeck
2020-01-20  3:04   ` Jun Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.