File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,16 @@ static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci)
302
302
return USB_ROLE_NONE ;
303
303
}
304
304
305
+ static inline enum ci_role usb_role_to_ci_role (enum usb_role role )
306
+ {
307
+ if (role == USB_ROLE_HOST )
308
+ return CI_ROLE_HOST ;
309
+ else if (role == USB_ROLE_DEVICE )
310
+ return CI_ROLE_GADGET ;
311
+ else
312
+ return CI_ROLE_END ;
313
+ }
314
+
305
315
/**
306
316
* hw_read_id_reg: reads from a identification register
307
317
* @ci: the controller
Original file line number Diff line number Diff line change @@ -618,9 +618,11 @@ static int ci_usb_role_switch_set(struct device *dev, enum usb_role role)
618
618
struct ci_hdrc * ci = dev_get_drvdata (dev );
619
619
struct ci_hdrc_cable * cable = NULL ;
620
620
enum usb_role current_role = ci_role_to_usb_role (ci );
621
+ enum ci_role ci_role = usb_role_to_ci_role (role );
621
622
unsigned long flags ;
622
623
623
- if (current_role == role )
624
+ if ((ci_role != CI_ROLE_END && !ci -> roles [ci_role ]) ||
625
+ (current_role == role ))
624
626
return 0 ;
625
627
626
628
pm_runtime_get_sync (ci -> dev );
You can’t perform that action at this time.
0 commit comments