usb: typec: stusb160x: register role switch before interrupt registration
authorAmelie Delaunay <amelie.delaunay@foss.st.com>
Fri, 16 Jul 2021 12:07:17 +0000 (14:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jul 2021 07:16:26 +0000 (09:16 +0200)
commit86762ad4abcc549deb7a155c8e5e961b9755bcf0
tree71245fd3dce19c2e6ef17f76754bc20b74aa704f
parent6abf2fe6b4bf6e5256b80c5817908151d2d33e9f
usb: typec: stusb160x: register role switch before interrupt registration

During interrupt registration, attach state is checked. If attached,
then the Type-C state is updated with typec_set_xxx functions and role
switch is set with usb_role_switch_set_role().

If the usb_role_switch parameter is error or null, the function simply
returns 0.

So, to update usb_role_switch role if a device is attached before the
irq is registered, usb_role_switch must be registered before irq
registration.

Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20210716120718.20398-2-amelie.delaunay@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/stusb160x.c