diff mbox series

[v3,05/11] staging: typec: fusb302: Use client->irq as irq if set

Message ID 20170830094814.17758-6-hdegoede@redhat.com
State Superseded
Headers show
Series Hookup typec power-negotation to the PMIC and charger | expand

Commit Message

Hans de Goede Aug. 30, 2017, 9:48 a.m. UTC
The fusb302 is also used on x86 systems where the platform code sets
the irq in client->irq and there is no gpio named fcs,int_n.

Cc: "Yueyao (Nathan) Zhu" <yueyao@google.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/staging/typec/fusb302/fusb302.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Guenter Roeck Aug. 30, 2017, 1:56 p.m. UTC | #1
On 08/30/2017 02:48 AM, Hans de Goede wrote:
> The fusb302 is also used on x86 systems where the platform code sets
> the irq in client->irq and there is no gpio named fcs,int_n.
> 
> Cc: "Yueyao (Nathan) Zhu" <yueyao@google.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/staging/typec/fusb302/fusb302.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
> index 1c1751c994db..675161cf4f3a 100644
> --- a/drivers/staging/typec/fusb302/fusb302.c
> +++ b/drivers/staging/typec/fusb302/fusb302.c
> @@ -1735,9 +1735,13 @@ static int fusb302_probe(struct i2c_client *client,
>   		goto destroy_workqueue;
>   	}
>   
> -	ret = init_gpio(chip);
> -	if (ret < 0)
> -		goto destroy_workqueue;
> +	if (client->irq) {
> +		chip->gpio_int_n_irq = client->irq;
> +	} else {
> +		ret = init_gpio(chip);
> +		if (ret < 0)
> +			goto destroy_workqueue;
> +	}
>   
>   	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
>   	if (IS_ERR(chip->tcpm_port)) {
>
diff mbox series

Patch

diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
index 1c1751c994db..675161cf4f3a 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1735,9 +1735,13 @@  static int fusb302_probe(struct i2c_client *client,
 		goto destroy_workqueue;
 	}
 
-	ret = init_gpio(chip);
-	if (ret < 0)
-		goto destroy_workqueue;
+	if (client->irq) {
+		chip->gpio_int_n_irq = client->irq;
+	} else {
+		ret = init_gpio(chip);
+		if (ret < 0)
+			goto destroy_workqueue;
+	}
 
 	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
 	if (IS_ERR(chip->tcpm_port)) {