]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitc78a40deb2cbf2776bef6bdf9c04d70c5762e6d4
tree71245fd3dce19c2e6ef17f76754bc20b74aa704f
parent9fef8eaf7addd495a412de6b2cfe19c002a3e4f2
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: 8831c084ffa5 ("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