* [v6,09/15] staging: typec: tcpci: register port before request irq
@ 2018-05-28 2:52 Jun Li
0 siblings, 0 replies; 2+ messages in thread
From: Jun Li @ 2018-05-28 2:52 UTC (permalink / raw)
To: robh+dt, gregkh, heikki.krogerus, linux
Cc: cw00.choi, a.hajda, shufan_lee, peter.chen, garsilva, gsomlo,
jun.li, linux-usb, devicetree, linux-imx
From: Peter Chen <peter.chen@nxp.com>
With that we can clear any pending events and the port is registered
so driver can be ready to handle typec events once we request irq.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
---
drivers/staging/typec/tcpci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index b63f147..3b35fce 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -537,24 +537,27 @@ static int tcpci_probe(struct i2c_client *client,
if (IS_ERR(chip->data.regmap))
return PTR_ERR(chip->data.regmap);
+ i2c_set_clientdata(client, chip);
+
/* Disable chip interrupts before requesting irq */
err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val,
sizeof(u16));
if (err < 0)
return err;
+ chip->tcpci = tcpci_register_port(&client->dev, &chip->data);
+ if (IS_ERR(chip->tcpci))
+ return PTR_ERR(chip->tcpci);
+
err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
_tcpci_irq,
IRQF_ONESHOT | IRQF_TRIGGER_LOW,
dev_name(&client->dev), chip);
- if (err < 0)
+ if (err < 0) {
+ tcpci_unregister_port(chip->tcpci);
return err;
+ }
- chip->tcpci = tcpci_register_port(&client->dev, &chip->data);
- if (IS_ERR(chip->tcpci))
- return PTR_ERR(chip->tcpci);
-
- i2c_set_clientdata(client, chip);
return 0;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [v6,09/15] staging: typec: tcpci: register port before request irq
@ 2018-06-11 12:35 Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2018-06-11 12:35 UTC (permalink / raw)
To: Li Jun
Cc: robh+dt, gregkh, linux, cw00.choi, a.hajda, shufan_lee,
peter.chen, garsilva, gsomlo, linux-usb, devicetree, linux-imx
On Mon, May 28, 2018 at 10:52:41AM +0800, Li Jun wrote:
> From: Peter Chen <peter.chen@nxp.com>
>
> With that we can clear any pending events and the port is registered
> so driver can be ready to handle typec events once we request irq.
>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> Signed-off-by: Li Jun <jun.li@nxp.com>
FWIW:
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/staging/typec/tcpci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
> index b63f147..3b35fce 100644
> --- a/drivers/staging/typec/tcpci.c
> +++ b/drivers/staging/typec/tcpci.c
> @@ -537,24 +537,27 @@ static int tcpci_probe(struct i2c_client *client,
> if (IS_ERR(chip->data.regmap))
> return PTR_ERR(chip->data.regmap);
>
> + i2c_set_clientdata(client, chip);
> +
> /* Disable chip interrupts before requesting irq */
> err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val,
> sizeof(u16));
> if (err < 0)
> return err;
>
> + chip->tcpci = tcpci_register_port(&client->dev, &chip->data);
> + if (IS_ERR(chip->tcpci))
> + return PTR_ERR(chip->tcpci);
> +
> err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> _tcpci_irq,
> IRQF_ONESHOT | IRQF_TRIGGER_LOW,
> dev_name(&client->dev), chip);
> - if (err < 0)
> + if (err < 0) {
> + tcpci_unregister_port(chip->tcpci);
> return err;
> + }
>
> - chip->tcpci = tcpci_register_port(&client->dev, &chip->data);
> - if (IS_ERR(chip->tcpci))
> - return PTR_ERR(chip->tcpci);
> -
> - i2c_set_clientdata(client, chip);
> return 0;
> }
Thanks,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-11 12:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 2:52 [v6,09/15] staging: typec: tcpci: register port before request irq Jun Li
-- strict thread matches above, loose matches on Subject: below --
2018-06-11 12:35 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).