UPSTREAM: thunderbolt: Check for NVM authentication status after the operation started

If the NVM authentication fails immediately, like if the firmware
detects that the image is not valid for some reason, better to read the
status once and if set to non-zero fail the operation accordingly.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 25335b30daf66f4cc03715c2ac9cdc3258fb5531)

BUG=b:180449562
TEST=No TBT/USB4 regressions
TEST=Check that the offline and rescan sysfs entries work:
localhost # ls /sys/bus/thunderbolt/devices/0-0/usb4_port1
firmware_node  link  offline  power  rescan  uevent
localhost # echo 1 > /sys/bus/thunderbolt/devices/0-0/usb4_port1/offline
localhost # echo 1 > /sys/bus/thunderbolt/devices/0-0/usb4_port1/rescan
localhost # ls /sys/bus/thunderbolt/devices/0-0/usb4_port1
0-0:1.1  firmware_node  link  offline  power  rescan  uevent

Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>
Change-Id: I1b54307967bff394f61e83c9c45f513f413522cc
Signed-off-by: Chintan Patel <chintan.m.patel@intel.corp-partner.google.com>
Signed-off-by: Daniel Campello <campello@chromium.org>
1 file changed