diff mbox series

[v3,4/6] usb: chipidea: Fix otg event handler

Message ID 1536074340-14840-4-git-send-email-loic.poulain@linaro.org (mailing list archive)
State New, archived
Headers show
Series [v3,1/6] usb: chipidea: Add dynamic pinctrl selection | expand

Commit Message

Loic Poulain Sept. 4, 2018, 3:18 p.m. UTC
At OTG work running time, it's possible that several events need to be
addressed (e.g. ID and VBUS events). The current implementation handles
only one event at a time which leads to ignoring the other one. Fix it.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 v2: v3: no change

 drivers/usb/chipidea/otg.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Peter Chen Sept. 5, 2018, 3:25 a.m. UTC | #1
>  v2: v3: no change
> 
>  drivers/usb/chipidea/otg.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index
> db4ceff..f25d482 100644
> --- a/drivers/usb/chipidea/otg.c
> +++ b/drivers/usb/chipidea/otg.c
> @@ -203,14 +203,17 @@ static void ci_otg_work(struct work_struct *work)
>  	}
> 
>  	pm_runtime_get_sync(ci->dev);
> +
>  	if (ci->id_event) {
>  		ci->id_event = false;
>  		ci_handle_id_switch(ci);
> -	} else if (ci->b_sess_valid_event) {
> +	}
> +
> +	if (ci->b_sess_valid_event) {
>  		ci->b_sess_valid_event = false;
>  		ci_handle_vbus_change(ci);
> -	} else
> -		dev_err(ci->dev, "unexpected event occurs at %s\n", __func__);
> +	}
> +
>  	pm_runtime_put_sync(ci->dev);
> 
>  	enable_irq(ci->irq);
> --

For chipidea changes, I will apply them. Thanks.

Peter
diff mbox series

Patch

diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
index db4ceff..f25d482 100644
--- a/drivers/usb/chipidea/otg.c
+++ b/drivers/usb/chipidea/otg.c
@@ -203,14 +203,17 @@  static void ci_otg_work(struct work_struct *work)
 	}
 
 	pm_runtime_get_sync(ci->dev);
+
 	if (ci->id_event) {
 		ci->id_event = false;
 		ci_handle_id_switch(ci);
-	} else if (ci->b_sess_valid_event) {
+	}
+
+	if (ci->b_sess_valid_event) {
 		ci->b_sess_valid_event = false;
 		ci_handle_vbus_change(ci);
-	} else
-		dev_err(ci->dev, "unexpected event occurs at %s\n", __func__);
+	}
+
 	pm_runtime_put_sync(ci->dev);
 
 	enable_irq(ci->irq);